xml-commons-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mrgla...@apache.org
Subject svn commit: r670432 - in /xml/commons/trunk/java/external/src/javax/xml: datatype/FactoryFinder.java validation/SchemaFactoryFinder.java xpath/XPathFactoryFinder.java
Date Mon, 23 Jun 2008 02:02:08 GMT
Author: mrglavas
Date: Sun Jun 22 19:02:08 2008
New Revision: 670432

URL: http://svn.apache.org/viewvc?rev=670432&view=rev
Log:
ThreadDeath should always be re-thrown so that the dying thread can terminate normally.
Also we shouldn't be catching and ignoring OutOfMemoryErrors, StackOverflowErrors or
any other serious VM error. Re-throw them.

Modified:
    xml/commons/trunk/java/external/src/javax/xml/datatype/FactoryFinder.java
    xml/commons/trunk/java/external/src/javax/xml/validation/SchemaFactoryFinder.java
    xml/commons/trunk/java/external/src/javax/xml/xpath/XPathFactoryFinder.java

Modified: xml/commons/trunk/java/external/src/javax/xml/datatype/FactoryFinder.java
URL: http://svn.apache.org/viewvc/xml/commons/trunk/java/external/src/javax/xml/datatype/FactoryFinder.java?rev=670432&r1=670431&r2=670432&view=diff
==============================================================================
--- xml/commons/trunk/java/external/src/javax/xml/datatype/FactoryFinder.java (original)
+++ xml/commons/trunk/java/external/src/javax/xml/datatype/FactoryFinder.java Sun Jun 22 19:02:08
2008
@@ -376,7 +376,16 @@
             if (it != null) {
             	return it.toString();
             } 
-        } catch (Throwable t) {
+        }
+        // The VM ran out of memory or there was some other serious problem. Re-throw.
+        catch (VirtualMachineError vme) {
+            throw vme;
+        }
+        // ThreadDeath should always be re-thrown
+        catch (ThreadDeath td) {
+            throw td;
+        }
+        catch (Throwable t) {
             // work defensively.
             if (debug) {
             	t.printStackTrace();

Modified: xml/commons/trunk/java/external/src/javax/xml/validation/SchemaFactoryFinder.java
URL: http://svn.apache.org/viewvc/xml/commons/trunk/java/external/src/javax/xml/validation/SchemaFactoryFinder.java?rev=670432&r1=670431&r2=670432&view=diff
==============================================================================
--- xml/commons/trunk/java/external/src/javax/xml/validation/SchemaFactoryFinder.java (original)
+++ xml/commons/trunk/java/external/src/javax/xml/validation/SchemaFactoryFinder.java Sun
Jun 22 19:02:08 2008
@@ -108,7 +108,16 @@
                 debugPrintln("using thread context class loader ("+classLoader+") for search");
                 return;
             }
-        } catch( Throwable _ ) {
+        }
+        // The VM ran out of memory or there was some other serious problem. Re-throw.
+        catch (VirtualMachineError vme) {
+            throw vme;
+        }
+        // ThreadDeath should always be re-thrown
+        catch (ThreadDeath td) {
+            throw td;
+        }
+        catch (Throwable _) {
             ; // getContextClassLoader() undefined in JDK1.1 
         }
         
@@ -169,7 +178,16 @@
             else if (debug) {
                 debugPrintln("The property is undefined.");
             }
-        } catch( Throwable t ) {
+        }
+        // The VM ran out of memory or there was some other serious problem. Re-throw.
+        catch (VirtualMachineError vme) {
+            throw vme;
+        }
+        // ThreadDeath should always be re-thrown
+        catch (ThreadDeath td) {
+            throw td;
+        }
+        catch (Throwable t) {
             if( debug ) {
                 debugPrintln("failed to look up system property '"+propertyName+"'" );
                 t.printStackTrace();
@@ -283,7 +301,16 @@
                 return (SchemaFactory)o;
             
             if (debug) debugPrintln(className+" is not assignable to "+SERVICE_CLASS.getName());
-        } catch( Throwable t ) {
+        }
+        // The VM ran out of memory or there was some other serious problem. Re-throw.
+        catch (VirtualMachineError vme) {
+            throw vme;
+        }
+        // ThreadDeath should always be re-thrown
+        catch (ThreadDeath td) {
+            throw td;
+        }
+        catch (Throwable t) {
             debugPrintln("failed to instanciate "+className);
             if(debug)   t.printStackTrace();
         }

Modified: xml/commons/trunk/java/external/src/javax/xml/xpath/XPathFactoryFinder.java
URL: http://svn.apache.org/viewvc/xml/commons/trunk/java/external/src/javax/xml/xpath/XPathFactoryFinder.java?rev=670432&r1=670431&r2=670432&view=diff
==============================================================================
--- xml/commons/trunk/java/external/src/javax/xml/xpath/XPathFactoryFinder.java (original)
+++ xml/commons/trunk/java/external/src/javax/xml/xpath/XPathFactoryFinder.java Sun Jun 22
19:02:08 2008
@@ -110,7 +110,16 @@
                 debugPrintln("using thread context class loader ("+classLoader+") for search");
                 return;
             }
-        } catch( Throwable _ ) {
+        }
+        // The VM ran out of memory or there was some other serious problem. Re-throw.
+        catch (VirtualMachineError vme) {
+            throw vme;
+        }
+        // ThreadDeath should always be re-thrown
+        catch (ThreadDeath td) {
+            throw td;
+        }
+        catch (Throwable _) {
             ; // getContextClassLoader() undefined in JDK1.1 
         }
         
@@ -171,7 +180,16 @@
             else if (debug) {
                 debugPrintln("The property is undefined.");
             }
-        } catch( Throwable t ) {
+        }
+        // The VM ran out of memory or there was some other serious problem. Re-throw.
+        catch (VirtualMachineError vme) {
+            throw vme;
+        }
+        // ThreadDeath should always be re-thrown
+        catch (ThreadDeath td) {
+            throw td;
+        }
+        catch (Throwable t) {
             if( debug ) {
                 debugPrintln("failed to look up system property '"+propertyName+"'" );
                 t.printStackTrace();
@@ -263,7 +281,16 @@
                 return (XPathFactory)o;
             
             if (debug) debugPrintln(className+" is not assignable to "+SERVICE_CLASS.getName());
-        } catch( Throwable t ) {
+        }
+        // The VM ran out of memory or there was some other serious problem. Re-throw.
+        catch (VirtualMachineError vme) {
+            throw vme;
+        }
+        // ThreadDeath should always be re-thrown
+        catch (ThreadDeath td) {
+            throw td;
+        }
+        catch (Throwable t) {
             if (debug) {
                 debugPrintln("failed to instanciate "+className);
                 t.printStackTrace();



Mime
View raw message