Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Re: java.lang.ArrayIndexOutOfBoundsException Error

Hi, Ramnivas,
 
I think you get my point. But in what situation aspectJ will not give Args and throws the ArrayIndexOutOfBoundsException? Thanks!!
 
Terry
 
 
On 3/1/08, aspectj-users-request@xxxxxxxxxxx <aspectj-users-request@xxxxxxxxxxx> wrote:
Send aspectj-users mailing list submissions to
       aspectj-users@xxxxxxxxxxx

To subscribe or unsubscribe via the World Wide Web, visit
       https://dev.eclipse.org/mailman/listinfo/aspectj-users
or, via email, send a message with subject or body 'help' to
       aspectj-users-request@xxxxxxxxxxx

You can reach the person managing the list at
       aspectj-users-owner@xxxxxxxxxxx

When replying, please edit your Subject line so it is more specific
than "Re: Contents of aspectj-users digest..."


Today's Topics:

  1. Re: aspectj-users Digest, Vol 36, Issue 39 (Heping Zhang)
  2. Re: Re: java.lang.ArrayIndexOutOfBoundsException Error
     (Ramnivas Laddad)


----------------------------------------------------------------------

Message: 1
Date: Sat, 1 Mar 2008 19:19:29 +0800
From: "Heping Zhang" <phoenix.zhp@xxxxxxxxx>
Subject: [aspectj-users] Re: aspectj-users Digest, Vol 36, Issue 39
To: aspectj-users@xxxxxxxxxxx
Message-ID:
       <e17fb0540803010319q42cc27ebrad2b5f411ccb34e9@xxxxxxxxxxxxxx>
Content-Type: text/plain; charset="iso-8859-1"

Thank you both! I think your solutions are the same per se. One is elegant
and the other is compact. I've resolved my problem. Thank you!
By the way, my god, it's you Ramnivas replied my email! I read your book two
years ago, but didn't practice much at that time, so have forgotten most ot
them. Your reply is a big encouragement to me!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://dev.eclipse.org/mailman/private/aspectj-users/attachments/20080301/b1128f33/attachment.html

------------------------------

Message: 2
Date: Sat, 1 Mar 2008 10:20:37 -0500
From: "Ramnivas Laddad" <ramnivas@xxxxxxxxxxxxxxx>
Subject: Re: [aspectj-users] Re:
       java.lang.ArrayIndexOutOfBoundsException Error
To: aspectj-users@xxxxxxxxxxx
Message-ID:
       <ef9c6b3b0803010720p4e7508e2l2fe28a4282b7a3ab@xxxxxxxxxxxxxx>
Content-Type: text/plain; charset="iso-8859-1"

Terry,

I am quite sure if I understand the question. However, you shouldn't have to
do anything special to have arguments available to the ProceedingJoinPoint
object in an around advice; its getArgs() method will give you an array of
objects at the advised join point.

-Ramnivas

On Sat, Mar 1, 2008 at 1:19 AM, Lau Man Kwong <kinthecastle@xxxxxxxxx>
wrote:

> Hi Eric,
>
> Thanks for your hints.
>
> From the stacktrace, I got the "com.at.aspect.LoggingAspect.log(Unknown
> Source)". That's related to the method of LoggingAspect class "public Object
> log(ProceedingJoinPoint call)". As you mentioned, the proceedingJoinPoint
> may has no value so it shows java.lang.ArrayIndexOutOfBoundsExceptionError.
>
> My question is that does aspectJ provide the argument to the
> ProceedingJoinPoint according to the spring configuration file? If yes, what
> setting that I have set incorrectly in the spring configuration file?
>
> Thanks!!!
>
> Regards,
> Terry
>
>
>
> On 3/1/08, aspectj-users-request@xxxxxxxxxxx <
> aspectj-users-request@xxxxxxxxxxx> wrote:
> >
> > Send aspectj-users mailing list submissions to
> >        aspectj-users@xxxxxxxxxxx
> >
> > To subscribe or unsubscribe via the World Wide Web, visit
> >        https://dev.eclipse.org/mailman/listinfo/aspectj-users
> > or, via email, send a message with subject or body 'help' to
> >        aspectj-users-request@xxxxxxxxxxx
> >
> > You can reach the person managing the list at
> >        aspectj-users-owner@xxxxxxxxxxx
> >
> > When replying, please edit your Subject line so it is more specific
> > than "Re: Contents of aspectj-users digest..."
> >
> >
> > Today's Topics:
> >
> >   1. aspect on a java API class (ldelaforge@xxxxxxx)
> >   2. java.lang.ArrayIndexOutOfBoundsException Error (Lau Man Kwong)
> >   3. Re: java.lang.ArrayIndexOutOfBoundsException Error (Eric Bodden)
> >
> >
> > ----------------------------------------------------------------------
> >
> > Message: 1
> > Date: Fri, 29 Feb 2008 17:59:18 +0100
> > From: ldelaforge@xxxxxxx
> > Subject: [aspectj-users] aspect on a java API class
> > To: aspectj-users@xxxxxxxxxxx
> > Message-ID:
> >        <
> > OF445806EF.93D9E0D7-ONC12573FE.005CFC0C-C12573FE.005D5206@xxxxxxx>
> > Content-Type: text/plain; charset="us-ascii"
> >
> > Hi all,
> >
> > I am (still) trying to put a joinpoint on a java API class :
> > java.math.BigDecimal
> > I try to do it with load time weaving LTW (with a JavaAgent)
> >
> > My aspect is like this :
> > @Aspect
> > public class AppAspect {
> >    @After("execution(* java.math.BigDecimal.valueOf(..))")
> >                        public void afterBigDecimal(JoinPoint jp) {
> >                                System.out.println("grouik BigDecimal");
> >    }
> > }
> >
> > And, because I know it is normally not authorized to do it,
> > I bypass the loading of the BigDecimal of the rt.jar, by bootloading an
> > extracted java.math.BigDecimal.
> > I do it by adding in the JVM parameters
> > -Xbootclasspath/p:"D:\...\target\test-classes\temp"
> > where ...\temp\ contains java\math\BigDecimal.class
> >
> > But when I execute this, the advise is not executed...
> >
> > Is the bypass a good solution ? If yes, why does it not working ? If no,
> > is there another way ?
> >
> > Thanks in advance.
> >
> > Laurent Delaforge
> >
> >
> >
> > ___________________________________________________________________________
> >
> > L'integrite de ce message n'etant pas assuree sur Internet, les societes
> > du groupe Oddo ne peuvent ?tre tenues responsables de son contenu. Ce
> > message et  les eventuels fichiers attaches contiennent des informations
> > confidentielles. Au cas o? il ne vous serait pas destine, nous vous
> > remercions de bien vouloir le supprimer et en aviser l'expediteur.
> >
> > This message and the files that may be attached to it contain
> > confidential information. The Oddo group may not be held responsible for
> > their contents, whose accuracy and completeness cannot be guaranteed over
> > the internet. If the message is not addressed to you, kindly delete it and
> > notify the sender.
> >
> >
> > ___________________________________________________________________________
> > -------------- next part --------------
> > An HTML attachment was scrubbed...
> > URL:
> > https://dev.eclipse.org/mailman/private/aspectj-users/attachments/20080229/1bdf3ab4/attachment.html
> >
> > ------------------------------
> >
> > Message: 2
> > Date: Sat, 1 Mar 2008 01:40:38 +0800
> > From: "Lau Man Kwong" <kinthecastle@xxxxxxxxx>
> > Subject: [aspectj-users] java.lang.ArrayIndexOutOfBoundsException
> >        Error
> > To: aspectj <aspectj-users@xxxxxxxxxxx>
> > Message-ID:
> >        <53981a8a0802290940v6c736b82gef0b99bc3a59a16c@xxxxxxxxxxxxxx>
> > Content-Type: text/plain; charset="iso-8859-1"
> >
> >
> > Hi,
> >
> > I'm new to aspectj. When I do some practice on aspectj, an error "
> > java.lang.ArrayIndexOutOfBoundsException: 0 at
> > com.at.aspect.LoggingAspect.log(Unknown Source)" was encountered. I have
> > searched on internet but get no answer. Can you give me some hints for
> > this
> > error?
> >
> > I am using AspectJ 1.5.4, Spring 2.0 and JDK 5.0 on this project.
> >
> > I have attached some codes and stacktrace. Thanks!!!
> >
> > Regards,
> > Terry
> >
> > *LoggingAspect.java*
> >
> > package com.at.aspect;
> >
> > import org.aspectj.lang.ProceedingJoinPoint;
> >
> > public class LoggingAspect {
> > public Object log(ProceedingJoinPoint call) throws Throwable
> >    {
> >        System.out.println("from logging aspect: entering method [" +
> > call.toShortString()
> >                            +"] with param:"+call.getArgs()[0] );
> >
> >        Object point =  call.proceed();
> >
> >        System.out.println("from logging aspect: exiting method [" +
> > call.toShortString()
> >                            + "with return as:" +point);
> >
> >        return point;
> >    }
> >
> > }
> > *Spring Configuration File*
> >
> > <bean id="myLoggingAspect" class="com.at.aspect.LoggingAspect"/>
> > <bean id="printReportBean" class="com.at.services.PrintReportManagerImpl
> > ">
> >       <property name="hibernateDAO" ref="HibernateDAO"/>
> > </bean>
> > <aop:config>
> >     <aop:aspect ref="myLoggingAspect">
> >        <aop:pointcut id="myCutLogging"
> >                   _expression_="execution(*
> > com.at.services.PrintReportManagerImpl*.*(..))"/>
> >        <aop:around pointcut-ref="myCutLogging" method="log"/>
> >     </aop:aspect>
> > </aop:config>
> >
> > *Error*
> >
> > 2008-03-01 01:25:03,984 [org.apache.struts.action.RequestProcessor
> > ]-[WARN]
> > Unhandled Exception thrown: class
> > java.lang.ArrayIndexOutOfBoundsException
> > 2008-03-01 01:25:03,984
> > [org.apache.catalina.core.ContainerBase
> > .[Catalina].[localhost].[/AssetApp].[action]]-[ERROR]
> > Servlet.service() for servlet action threw exception
> > java.lang.ArrayIndexOutOfBoundsException: 0
> > at com.at.aspect.LoggingAspect.log(Unknown Source)
> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > at sun.reflect.NativeMethodAccessorImpl.invoke(
> > NativeMethodAccessorImpl.java:39)
> > at sun.reflect.DelegatingMethodAccessorImpl.invoke(
> > DelegatingMethodAccessorImpl.java:25)
> > at java.lang.reflect.Method.invoke(Method.java:585)
> > at
> >
> > org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs
> > (AbstractAspectJAdvice.java:597)
> > at
> > org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod
> > (AbstractAspectJAdvice.java:583)
> > at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(
> > AspectJAroundAdvice.java:60)
> > at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
> > ReflectiveMethodInvocation.java:171)
> > at
> > org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(
> > ExposeInvocationInterceptor.java:89)
> > at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
> > ReflectiveMethodInvocation.java:171)
> > at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(
> > JdkDynamicAopProxy.java:204)
> > at $Proxy1.getConn(Unknown Source)
> > at com.at.web.PrintReportAction.printAssetList(Unknown Source)
> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > at sun.reflect.NativeMethodAccessorImpl.invoke(
> > NativeMethodAccessorImpl.java:39)
> > at sun.reflect.DelegatingMethodAccessorImpl.invoke(
> > DelegatingMethodAccessorImpl.java:25)
> > at java.lang.reflect.Method.invoke(Method.java:585)
> > at org.apache.struts.actions.DispatchAction.dispatchMethod(
> > DispatchAction.java:270)
> > at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java
> > :187)
> > at org.apache.struts.action.RequestProcessor.processActionPerform(
> > RequestProcessor.java:431)
> > at org.apache.struts.action.RequestProcessor.process(
> > RequestProcessor.java
> > :236)
> > at org.apache.struts.action.ActionServlet.process(ActionServlet.java
> > :1196)
> > at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
> > at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
> > at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> > at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
> > ApplicationFilterChain.java:252)
> > at org.apache.catalina.core.ApplicationFilterChain.doFilter(
> > ApplicationFilterChain.java:173)
> > at org.apache.catalina.core.StandardWrapperValve.invoke(
> > StandardWrapperValve.java:213)
> > at org.apache.catalina.core.StandardContextValve.invoke(
> > StandardContextValve.java:178)
> > at org.apache.catalina.authenticator.AuthenticatorBase.invoke(
> > AuthenticatorBase.java:432)
> > at org.apache.catalina.core.StandardHostValve.invoke(
> > StandardHostValve.java
> > :126)
> > at org.apache.catalina.valves.ErrorReportValve.invoke(
> > ErrorReportValve.java
> > :105)
> > at org.apache.catalina.core.StandardEngineValve.invoke(
> > StandardEngineValve.java:107)
> > at org.apache.catalina.connector.CoyoteAdapter.service(
> > CoyoteAdapter.java
> > :148)
> > at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
> > :869)
> > at
> >
> > org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection
> > (Http11BaseProtocol.java:664)
> > at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(
> > PoolTcpEndpoint.java:527)
> > at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(
> > LeaderFollowerWorkerThread.java:80)
> > at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(
> > ThreadPool.java:684)
> > at java.lang.Thread.run(Thread.java:595)
> > -------------- next part --------------
> > An HTML attachment was scrubbed...
> > URL:
> > https://dev.eclipse.org/mailman/private/aspectj-users/attachments/20080229/564e61aa/attachment.html
> >
> > ------------------------------
> >
> > Message: 3
> > Date: Fri, 29 Feb 2008 13:14:45 -0500
> > From: "Eric Bodden" <eric.bodden@xxxxxxxxxxxxxx>
> > Subject: Re: [aspectj-users] java.lang.ArrayIndexOutOfBoundsException
> >        Error
> > To: aspectj-users@xxxxxxxxxxx
> > Message-ID:
> >        <804e3c660802291014o16d7130bx8573778b8a33cfd9@xxxxxxxxxxxxxx>
> > Content-Type: text/plain; charset=ISO-8859-1
> >
> >
> > Maybe there are calls that have no arguments?
> >
> > Eric
> >
> > On 29/02/2008, Lau Man Kwong <kinthecastle@xxxxxxxxx> wrote:
> > > Hi,
> > >
> > > I'm new to aspectj. When I do some practice on aspectj, an error
> > > "java.lang.ArrayIndexOutOfBoundsException: 0 at
> > > com.at.aspect.LoggingAspect.log(Unknown Source)" was encountered. I
> > have
> > > searched on internet but get no answer. Can you give me some hints for
> > this
> > > error?
> > >
> > > I am using AspectJ 1.5.4, Spring 2.0 and JDK 5.0 on this project.
> > >
> > > I have attached some codes and stacktrace. Thanks!!!
> > >
> > > Regards,
> > > Terry
> > >
> > > LoggingAspect.java
> > >
> > >
> > > package com.at.aspect;
> > >
> > > import org.aspectj.lang.ProceedingJoinPoint;
> > >
> > > public class LoggingAspect {
> > >  public Object log(ProceedingJoinPoint call) throws Throwable
> > >     {
> > >         System.out.println("from logging aspect: entering method [" +
> > > call.toShortString()
> > >                             +"] with param:"+call.getArgs()[0] );
> > >
> > >         Object point =  call.proceed();
> > >
> > >         System.out.println("from logging aspect: exiting method [" +
> > > call.toShortString()
> > >                             + "with return as:" +point);
> > >
> > >         return point;
> > >     }
> > >
> > > }
> > >
> > > Spring Configuration File
> > >
> > > <bean id="myLoggingAspect" class="com.at.aspect.LoggingAspect"/>
> > > <bean id="printReportBean"
> > > class="com.at.services.PrintReportManagerImpl">
> > >        <property name="hibernateDAO" ref="HibernateDAO"/>
> > >  </bean>
> > > <aop:config>
> > >      <aop:aspect ref="myLoggingAspect">
> > >         <aop:pointcut id="myCutLogging"
> > >                    _expression_="execution(*
> > > com.at.services.PrintReportManagerImpl*.*(..))"/>
> > >          <aop:around pointcut-ref="myCutLogging" method="log"/>
> > >      </aop:aspect>
> > >   </aop:config>
> > >
> > > Error
> > >
> > > 2008-03-01 01:25:03,984
> > > [org.apache.struts.action.RequestProcessor]-[WARN]
> > > Unhandled Exception thrown: class
> > > java.lang.ArrayIndexOutOfBoundsException
> > > 2008-03-01 01:25:03,984
> > > [org.apache.catalina.core.ContainerBase
> > .[Catalina].[localhost].[/AssetApp].[action]]-[ERROR]
> > > Servlet.service() for servlet action threw exception
> > >  java.lang.ArrayIndexOutOfBoundsException: 0
> > >  at com.at.aspect.LoggingAspect.log(Unknown Source)
> > >  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> > > Method)
> > >  at
> > > sun.reflect.NativeMethodAccessorImpl.invoke(
> > NativeMethodAccessorImpl.java:39)
> > >   at
> > > sun.reflect.DelegatingMethodAccessorImpl.invoke(
> > DelegatingMethodAccessorImpl.java:25)
> > >  at java.lang.reflect.Method.invoke(Method.java:585)
> > >  at
> > >
> > org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs
> > (AbstractAspectJAdvice.java:597)
> > >   at
> > >
> > org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod
> > (AbstractAspectJAdvice.java:583)
> > >  at
> > > org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(
> > AspectJAroundAdvice.java:60)
> > >  at
> > > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
> > ReflectiveMethodInvocation.java:171)
> > >   at
> > > org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke
> > (ExposeInvocationInterceptor.java:89)
> > >  at
> > > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
> > ReflectiveMethodInvocation.java:171)
> > >   at
> > > org.springframework.aop.framework.JdkDynamicAopProxy.invoke(
> > JdkDynamicAopProxy.java:204)
> > >  at $Proxy1.getConn(Unknown Source)
> > >  at com.at.web.PrintReportAction.printAssetList(Unknown
> > > Source)
> > >  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> > > Method)
> > >   at
> > > sun.reflect.NativeMethodAccessorImpl.invoke(
> > NativeMethodAccessorImpl.java:39)
> > >  at
> > > sun.reflect.DelegatingMethodAccessorImpl.invoke(
> > DelegatingMethodAccessorImpl.java:25)
> > >  at java.lang.reflect.Method.invoke(Method.java:585)
> > >   at
> > > org.apache.struts.actions.DispatchAction.dispatchMethod(
> > DispatchAction.java:270)
> > >  at
> > > org.apache.struts.actions.DispatchAction.execute(DispatchAction.java
> > :187)
> > >  at
> > > org.apache.struts.action.RequestProcessor.processActionPerform(
> > RequestProcessor.java:431)
> > >   at
> > > org.apache.struts.action.RequestProcessor.process(
> > RequestProcessor.java:236)
> > >  at
> > > org.apache.struts.action.ActionServlet.process(ActionServlet.java
> > :1196)
> > >  at
> > > org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
> > >   at
> > > javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
> > >  at
> > > javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> > >  at
> > > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
> > ApplicationFilterChain.java:252)
> > >   at
> > > org.apache.catalina.core.ApplicationFilterChain.doFilter(
> > ApplicationFilterChain.java:173)
> > >  at
> > > org.apache.catalina.core.StandardWrapperValve.invoke(
> > StandardWrapperValve.java:213)
> > >  at
> > > org.apache.catalina.core.StandardContextValve.invoke(
> > StandardContextValve.java:178)
> > >   at
> > > org.apache.catalina.authenticator.AuthenticatorBase.invoke(
> > AuthenticatorBase.java:432)
> > >  at
> > > org.apache.catalina.core.StandardHostValve.invoke(
> > StandardHostValve.java:126)
> > >  at
> > > org.apache.catalina.valves.ErrorReportValve.invoke(
> > ErrorReportValve.java:105)
> > >   at
> > > org.apache.catalina.core.StandardEngineValve.invoke(
> > StandardEngineValve.java:107)
> > >  at
> > > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java
> > :148)
> > >  at
> > > org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
> > :869)
> > >   at
> > >
> > org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection
> > (Http11BaseProtocol.java:664)
> > >  at
> > > org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(
> > PoolTcpEndpoint.java:527)
> > >  at
> > > org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(
> > LeaderFollowerWorkerThread.java:80)
> > >   at
> > > org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(
> > ThreadPool.java:684)
> > >  at java.lang.Thread.run(Thread.java:595)
> > > _______________________________________________
> > >  aspectj-users mailing list
> > >  aspectj-users@xxxxxxxxxxx
> > > https://dev.eclipse.org/mailman/listinfo/aspectj-users
> > >
> > >
> >
> >
> > --
> > Eric Bodden
> > Sable Research Group
> > McGill University, Montréal, Canada
> >
> >
> > ------------------------------
> >
> > _______________________________________________
> > aspectj-users mailing list
> > aspectj-users@xxxxxxxxxxx
> > https://dev.eclipse.org/mailman/listinfo/aspectj-users
> >
> >
> > End of aspectj-users Digest, Vol 36, Issue 40
> > *********************************************
> >
>
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://dev.eclipse.org/mailman/private/aspectj-users/attachments/20080301/15213cc3/attachment.html

------------------------------

_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users


End of aspectj-users Digest, Vol 37, Issue 2
********************************************


Back to the top