Bryan, I feel somewhat guilty as I am somehow related to this new piece of
code... :)

I agree with Gary that using class loaders might be programmed better, but I
still do not feel I understand it entirely...

I have tried to investigate your issue, but unfortunately I could not
reproduce it. That is, I use Tomcat 4.0.4b2 and JDK 1.4.0 on Windows, and
have all my encoding issues resolved, and do not get any NPEs... But I agree
that if it throws an exception for you then it definitely has a bug that
should be fixed.

Could you describe your configuration that results in NPE? OS, Tomcat
version, JDK/JRE version, placement of Xalan, environment settings, etc... ?

Regards,
Sergey


----- Original Message -----
From: "Bryan Kearney" <[EMAIL PROTECTED]>
To: "'Gary L Peskin'" <[EMAIL PROTECTED]>; "Bryan Kearney"
<[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Friday, May 31, 2002 7:02 PM
Subject: RE: New Xalan not playing well with Tomcat 4.0?


> I threw away my output, but I modified the file as shown. What I saw as
> output was (See the System.outs)
>
> "ST" was blank
> "BK" showed a tomcat WebAppClass loader which pointed to the
WEB-INF\classes
> directory as it should. It delegeted up several layers as is typical for
> tomcat.
> "B" was null
> "C" was null
>
> by moving the location of the file, it was found. TO be fair.. I do not
> recall if it ws "B" or "C" that found it however.
>
> -- bk
>
>
>   private static EncodingInfo[] loadEncodingInfo()
>   {
>     URL url = null;
>     try {
>       String urlString =
>         System.getProperty("org.apache.xalan.serialize.encodings", "");
>       System.out.println("ST" + urlString) ;
>       if (urlString == null || urlString.length() == 0) {
>         ClassLoader cl = Encodings.class.getClassLoader();
>         System.out.println("org/apache/xalan/serialize/" +
>                                               ENCODINGS_FILE) ;
>         System.out.println("BK" + cl) ;
>
>         if (cl == null) {
>           url =
ClassLoader.getSystemResource("org/apache/xalan/serialize/"
> +
>                                               ENCODINGS_FILE);
>           System.out.println("A" + url) ;
>
>         } else {
>           url = cl.getResource(ENCODINGS_FILE);
>           System.out.println("B" + url) ;
>           if (url == null)
>             url =
> ClassLoader.getSystemResource("org/apache/xalan/serialize/" +
>                                               ENCODINGS_FILE);
>           System.out.println("C" + url) ;
>
>         }
>       } else {
>         url = new URL (urlString);
>         System.out.println("D" + url) ;
>
>       }
>
>       // ? consider whether we should allow an exception here if resource
>       // is not found or should we return an empty array ?
>       InputStream is = url.openStream();
>
> >> -----Original Message-----
> >> From: Gary L Peskin [mailto:[EMAIL PROTECTED]
> >> Sent: Friday, May 31, 2002 8:56 AM
> >> To: 'Bryan Kearney'; [EMAIL PROTECTED]
> >> Subject: RE: New Xalan not playing well with Tomcat 4.0?
> >>
> >>
> >> This looks like a bug in Encodings.  It seems to be using the
> >> classloader that loaded the Encodings class rather than the Context
> >> classloader.  Also, if a classloader is found, only the
> >> Encodings.properties name is searched rather than the full path name.
> >> There are several problems with this code.  Could you please open a
> >> Bugzilla entry on this problem?
> >>
> >> Thanks,
> >> Gary
> >>
> >> > -----Original Message-----
> >> > From: Bryan Kearney [mailto:[EMAIL PROTECTED]
> >> > Sent: Friday, May 31, 2002 7:47 AM
> >> > To: 'Gary L Peskin'; Bryan Kearney
> >> > Subject: RE: New Xalan not playing well with Tomcat 4.0?
> >> >
> >> >
> >> > It was a Null Pointer exception. The url on line 357 was
> >> > null. The ClassLoader was unable to find the
> >> > Encodings.properties file if it existed in an un-jarred xalan
> >> > installation. I moved it to tomcat/classes (just the
> >> > Encodings.properties) and the class loader can find it now. I
> >> > did not dig to far into the why of it was not found as the
> >> > webapps stuff is already pretty ugly for me.
> >> >
> >> > -- bk
> >> >
> >> >
> >> > >> -----Original Message-----
> >> > >> From: Gary L Peskin [mailto:[EMAIL PROTECTED]
> >> > >> Sent: Friday, May 31, 2002 8:43 AM
> >> > >> To: 'Bryan Kearney'
> >> > >> Subject: RE: New Xalan not playing well with Tomcat 4.0?
> >> > >>
> >> > >>
> >> > >> Bryan --
> >> > >>
> >> > >> What is the exception that you're getting at the top of the
> >> > >> stack trace?
> >> > >>
> >> > >> Gary
> >> > >>
> >> > >> > -----Original Message-----
> >> > >> > From: Bryan Kearney [mailto:[EMAIL PROTECTED]
> >> > >> > Sent: Friday, May 31, 2002 6:13 AM
> >> > >> > To: '[EMAIL PROTECTED]'
> >> > >> > Subject: New Xalan not playing well with Tomcat 4.0?
> >> > >> >
> >> > >> >
> >> > >> > Has anyone seen this? I have started to get the following
> >> > >> > exception when loading up the encodings:
> >> > >> >
> >> > >> > at
> >> > >> > org.apache.xalan.serialize.Encodings.loadEncodingInfo(Encoding
> >> > >> > s.java:357)
> >> > >> > at
> >> > >>
> >> org.apache.xalan.serialize.Encodings.<clinit>(Encodings.java:396)
> >> > >> > at
> >> org.apache.xalan.serialize.SerializerToXML.<init>(SerializerTo
> >> > >> > XML.java:313)
> >> > >> > at
> >> > >> > org.apache.xalan.serialize.SerializerToHTML.<init>(SerializerT
> >> > >> > oHTML.java:523
> >> > >> > )
> >> > >> >
> >> > >> > I am running a pretty new xalan in the latest tomcat. I do
> >> > >> > not get this from the command line. Could this be an issue
> >> > >> > with tomcats layered clss loades?
> >> > >> >
> >> > >> >
> >> > >> > -- bk
> >> > >> >
> >> > >>
> >> >
> >>
>

Reply via email to