changeset 20965:913493fcadde

8013502: Improve stream factories Reviewed-by: joehw, mullan, lancea
author dfuchs
date Wed, 17 Jul 2013 18:46:28 +0200
parents a5cd729f176d
children 4ebc253169b5
files jaxp/src/javax/xml/stream/FactoryFinder.java
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/jaxp/src/javax/xml/stream/FactoryFinder.java	Wed Jul 17 09:31:39 2013 -0700
+++ b/jaxp/src/javax/xml/stream/FactoryFinder.java	Wed Jul 17 18:46:28 2013 +0200
@@ -253,7 +253,13 @@
 
         // Use the system property first
         try {
-            String systemProp = ss.getSystemProperty(factoryId);
+
+            final String systemProp;
+            if (type.getName().equals(factoryId)) {
+                systemProp = ss.getSystemProperty(factoryId);
+            } else {
+                systemProp = System.getProperty(factoryId);
+            }
             if (systemProp != null) {
                 dPrint("found system property, value=" + systemProp);
                 // There's a bug here - because 'cl' is ignored.
@@ -262,7 +268,8 @@
             }
         }
         catch (SecurityException se) {
-            if (debug) se.printStackTrace();
+            throw new FactoryConfigurationError(
+                    "Failed to read factoryId '" + factoryId + "'", se);
         }
 
         // Try read $java.home/lib/stax.properties followed by