You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by bu...@apache.org on 2003/10/15 19:04:16 UTC

DO NOT REPLY [Bug 23846] New: - Minor Exception try block error

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23846>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23846

Minor Exception try block error

           Summary: Minor Exception try block error
           Product: XalanJ2
           Version: 2.5
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Minor
          Priority: Other
         Component: org.apache.xalan
        AssignedTo: xalan-dev@xml.apache.org
        ReportedBy: lzap@seznam.cz


Dears
 
sorry to trouble you on your official mail but I`m not in the list and I do not 
want to subscribe enything 
incl. bugzilla or any other compicated forms (why all open source projects 
doesn`t have any anonymous email 
address allowing us to report bugs and recomendations without strained subscribe 
forms -- IMHO lots of users 
give it up at the beginning).
 
Ok. I found a small mistake in the Xalan-J source org.apache.xalan.xslt.Process.
 
There are some try-catch blocks in the code that parses URIRESOLVER and 
ENTITYRESOLVER parameters. The 
exceptions should be ClassNotFoundException cnfe but somebody changed this to 
Exception cnfe. Well this is not 
bad author just needed to handle more exceptions but I found a problem.
 
I spent 4 hours of fining why my Xalan reports an error about not finding my 
resolver class. I solved it only 
by debugging the code. My JRE 1.4.2 was always loading RT.JAR with old xalan and 
in this situation my new 
resovler was not compatible with this old Xalan. BUT! The Xalan always reported 
the resolver class could not 
be found.... It made harder to locate the problem for me and it will make it 
harder for any other user with 1.4
 JRE.
 
You should split the exception into two ones. One should report 
ClassNotFoundException and one could report 
ClassCastException. This can make a life much easyier for users with Java 1.4 or 
higher...
 
Here`s the problem part code (ASF license, visit www.apache.org for more 
information about the license):
 
package org.apache.xalan.xslt;
 
public class Process
{
......
 
                        if("-URIRESOLVER".equalsIgnoreCase(argv[i]))
                        {
                            if(i + 1 < argv.length)
                            {
                                try
                                {
                                    uriResolver = (URIResolver)Class.
forName(argv[++i], true, 
ClassLoader.getSystemClassLoader()).newInstance();
                                    tfactory.setURIResolver(uriResolver);
                                }
                                catch(Exception cnfe) // HERE! YOU CAN SEE 
ANYBODY CHANGED IT
                                {
                                    
System.err.println(XSLMessages.createMessage("ER_CLASS_NOT_FOUND_FOR_OPTION", 
new Object[] {
                                        "-URIResolver"
                                    }));
                                    doExit(-1);
                                }
                            } else
                            {
                                System.err.println(XSLMessages.
createMessage("ER_MISSING_ARG_FOR_OPTION", new 
Object[] {
                                    "-URIResolver"
                                }));
                                doExit(-1);
                            }
                        } else
 
......
}