Wrong exception catched

Michael Koch <[email protected]>
Newsgroups gmane.comp.java.classpath.extensions.xml
Message-ID <[email protected]>
Hi list,


I think I found a bug in GNU jaxp. I use the GNU jaxp copy included in 
classpath CVS but I looked into GNU jaxp CVS to make sure the bug is still 
there.

I get this warning from jikes:

Issued 1 semantic warning compiling 
"/home/mkoch/src/classpath/external/jaxp/source/org/xml/sax/helpers/XMLReaderFactory.java":

   112.         catch (Exception e) { /* normally fails for applets */ }
                       <--------->
*** Caution: This try block cannot throw a "checked exception" (JLS section 
14.7) that can be caught here. You may have intended to catch a 
RuntimeException instead of an Exception.

I applied this patch to fix it:

Index: org/xml/sax/helpers/XMLReaderFactory.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/external/jaxp/source/org/xml/sax/helpers/XMLReaderFactory.java,v
retrieving revision 1.1.1.1
diff -u -b -B -r1.1.1.1 XMLReaderFactory.java
--- org/xml/sax/helpers/XMLReaderFactory.java	1 Feb 2003 02:10:48 -0000	
1.1.1.1
+++ org/xml/sax/helpers/XMLReaderFactory.java	23 Oct 2003 12:03:41 -0000
@@ -109,7 +109,7 @@
 	
 	// 1. try the JVM-instance-wide system property
 	try { className = System.getProperty (property); }
-	catch (Exception e) { /* normally fails for applets */ }
+	catch (RuntimeException e) { /* normally fails for applets */ }
 
 	// 2. if that fails, try META-INF/services/
 	if (className == null) {



Greetings,
Michael
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.