Re: [aspectwerkz-dev] Sort of a bug in AspectWerkzPreProcessor.java

Niklas Therning <[email protected]> Mon, 07 Feb 2005 15:54:01 +0100
Newsgroups gmane.comp.java.aspectwerkz.devel
Message-ID <[email protected]>
Hi,

I noticed that this has not yet been fixed in RC3. At the moment I'm 
using my own patched version of AW. But I would rather be able to use 
the current release without having to patch anything. Any chances this 
will be fixed before 2.0? My particular problem seems to be with Xalan 
which I guess compiles XSLT-files into Java byte code on the fly.

/Niklas

Alexandre Vasseur wrote:

>Hi
>
>I will fix it in RC2. Just be aware that this means that someone is
>trying to define a on the fly generated class (f.e. a proxy) with a
>"null" name.
>This has been deprecated (see javadoc for ClassLoader . defineClass)
>but was used perhaps 6 month ago in some (old) cglib verrsion f.e.
>
>I ll let you know when fixed (though I won't have a good test case for it)
>
>Alex
>
>
>On Tue, 07 Dec 2004 13:31:50 +0100, Niklas Therning <[email protected]> wrote:
>  
>
>>Hi,
>>
>>I've just started using AspectWerkz and I find it very useful! I'm using
>>it in a cocoon-based webapp. My problem is that on each http request I
>>get the following (several times) on the console:
>>
>>AspectWerkz - WARN - Error pre-processing class null in
>>Thread[Thread-15,5,main]
>>java.lang.NullPointerException
>>        at
>>org.codehaus.aspectwerkz.transform.AspectWerkzPreProcessor.preProcess(AspectWerkzPreProcessor.java:131)
>>        at
>>org.codehaus.aspectwerkz.hook.impl.ClassPreProcessorHelper.defineClass0Pre(ClassPreProcessorHelper.java:107)
>>        at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
>>        at java.lang.ClassLoader.defineClass(ClassLoader.java:448)
>>        at
>>org.apache.xalan.xsltc.trax.TemplatesImpl$TransletClassLoader.defineClass(TemplatesImpl.java:125)
>>        at
>>org.apache.xalan.xsltc.trax.TemplatesImpl.defineTransletClasses(TemplatesImpl.java:296)
>>        at
>>org.apache.xalan.xsltc.trax.TemplatesImpl.getTransletInstance(TemplatesImpl.java:333)
>>        at
>>org.apache.xalan.xsltc.trax.TemplatesImpl.newTransformer(TemplatesImpl.java:366)
>>...
>>
>>The NPE is thrown on this line:
>>
>>final String className = name.replace('/', '.');
>>
>>I think it should rather be
>>
>>final String className = name != null ? name.replace('/', '.') : null;
>>
>>As I understand it the filter() method, which is called right after the
>>line above, will filter out classes with a null name anyway.
>>
>>I guess it's not really a bug since
>>ClassPreProcessorHelper.defineClass0Pre() uses the original byte-array
>>if an exception is thrown within AspectWerkzPreProcessor.preProcess().
>>The problem is that since this gets written directly to stderr there's
>>no way for me to suppress these error messages and it's rely annoying
>>and could even introduce a performance penalty in my application.
>>
>>Regards,
>>Niklas Therning
>>
>>
>>    
>>
>
>  
>