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 Mon, 10 Apr 2006 15:50:47 GMT
On 4/10/06 Stepan Mishura wrote:
> On 4/9/06, Soeren Strassfeld wrote:
> >
> > 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.
>
>
> Right. The current implementation of java.util.regexp package contains
> stubs. I think the problem will be resolved when stub implementation will be
> replaced with implementation from HARMONY-39 contribution.
>   
Hi,
you´re right, it might work with harmony-39, but the result is more or 
less random, as all xalan
tests ran against another bcel version (The pattern is actually passed 
from xalan to bcel, so
jakarta.regexp and java.util.regexp would have to be compatible in their 
pattern syntax).
And imagine, bcel decides to change it´s api, you would get a 
NoSuchMethodError with or without
regexp package.
Anyway, let´s don´t stay with this specific example, I guess similar 
cases could be created with other
external libraries:
The more I think about it, I think that harmony (like sun) should change 
packages for all external classes,
so only API classes + org.apache.harmony classes are on the bootclasspath.
There are Applications, which depend on exactly Version x.y.z of Library 
whatever (think of all those
jdk1.3 Apps, which ship their own Version of xalan/xerces), and you 
can´t force
them to upgrade/downgrade to run on harmony, because harmony uses 
another Version internally.

Thanks,
Soeren

> Thanks,
> Stepan.
>
> 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
> >
> >
>
>
> --
> ---------------------------------------------------------------------
> 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