harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Soeren Strassfeld <nc-stras...@netcologne.de>
Subject Re: Version Conflict with bcel?
Date Sun, 09 Apr 2006 10:47:59 GMT
Hi Stepan,

first, I did a simple xsl Transformation:

TransformerFactory f = TransformerFactory.newInstance();
Transformer t = f.newTransformer(new StreamSource(new 
FileInputStream("foo.xsl")));
t.transform(new StreamSource(new FileInputStream("foo.xml")),new 
StreamResult(System.out));

(foo.xml and foo.xsl are really simple, actually taken from the Xalan 
Examples)

This works fine on both, Sun jdk1.5 and Harmony.
When running with -verbose, I noticed that harmony uses
org.apache.xalan.processor.TransformerFactoryImpl
while Sun uses
com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl
as default javax.xml.transform.TransformerFactory

Actually all Apache classes within the Sun JDK seem
to be repackaged to com.sun.org.apache.<project>.internal.*

After that test, I forced harmony to use the compiling
TransformerFactory with
System.setProperty("javax.xml.transform.TransformerFactory",
               "org.apache.xalan.xsltc.trax.TransformerFactoryImpl");

(Does not work on sun jdk1.5 because of the repackaging)

Now the bcel classes are loaded as shown in the harmony -verbose
output. XSL Transformation still works fine on harmony.

When I now run the test with
-Xbootclasspath/p:bcel-5.2rc1.jar
I get a
java.lang.NullPointerException
       at 
org.apache.bcel.util.InstructionFinder.search(InstructionFinder.java:226)
       at 
org.apache.bcel.util.InstructionFinder.search(InstructionFinder.java:250)
       at 
org.apache.xalan.xsltc.compiler.Mode.peepHoleOptimization(Mode.java:1442)
       at 
org.apache.xalan.xsltc.compiler.Mode.compileApplyTemplates(Mode.java:1056)
       at 
org.apache.xalan.xsltc.compiler.Stylesheet.compileModes(Stylesheet.java:580)
       at 
org.apache.xalan.xsltc.compiler.Stylesheet.translate(Stylesheet.java:695)
       at org.apache.xalan.xsltc.compiler.XSLTC.compile(XSLTC.java:335)
       at org.apache.xalan.xsltc.compiler.XSLTC.compile(XSLTC.java:410)
       at 
org.apache.xalan.xsltc.trax.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:720)
       at 
org.apache.xalan.xsltc.trax.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:548)
       at Main.main(Main.java:14)

The harmony-bcel InstructionFinder class uses jakarta.regexp, while
the 5.2rc1 InstructionFinder uses java.util.regexp, which could be
the Reason for the NullPointerException.
Anyway, I think the interesting part of this test is, that sun repackages
external packages to com.sun. packages to avoid Version conflicts.
Although I don´t like this Idea, as this is some kind of "fork" to me,
I don´t see any better solution for this kind of Problem!?

Thanks,
Soeren


Stepan Mishura schrieb:
> On 4/8/06, Soeren Strassfeld wrote:
>   
>> Hi List,
>>
>> the latest Harmony snapshot ships a version of xalan.jar, which seems to
>> contains
>> an old version of Jakarta bcel.
>> When I try to run my bcel based App, I get a NoSuchMethodError:
>>
>> org/apache/bcel/Repository.lookupClass(Ljava/lang/Class;)Lorg/apache/bcel/classfile/JavaClass;
>>
>> I checked Repository.class within xalan.jar, and it doesen´t have this
>> Method
>> (I use bcel5.2rc1, but this Method is already present in 5.1).
>>
>> How can I tell Harmony to use my Version (-classpath bcel5.2rc1 does not
>> work)
>> of bcel?
>>     
>
>
> Try option:  -Xbootclasspath/p:<specify your path here>
>
> Thanks,
> Stepan.
>
> Regards,
>   
>> Soeren
>>
>> --
>>
>> Soeren Strassfeld (nc-straszso at netcologne dot de)
>>
>>
>>
>> ---------------------------------------------------------------------
>> Terms of use : http://incubator.apache.org/harmony/mailing.html
>> To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
>> For additional commands, e-mail: harmony-dev-help@incubator.apache.org
>>
>>
>>     
>
>
> -----------------------------------------------------------------------
> Terms of use : http://incubator.apache.org/harmony/mailing.html
> To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> For additional commands, e-mail: harmony-dev-help@incubator.apache.org
>
> Thanks,
> Stepan Mishura
> Intel Middleware Products Division
>
>   


---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Mime
View raw message