Created
September 29, 2015 20:01
Fix for six resource leaks in the JAX-P implementation of OpenJDK 8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -r 0c49f9209035 src/javax/xml/datatype/FactoryFinder.java | |
--- a/src/javax/xml/datatype/FactoryFinder.java Tue Mar 04 11:51:21 2014 -0800 | |
+++ b/src/javax/xml/datatype/FactoryFinder.java Tue Sep 29 12:58:52 2015 -0700 | |
@@ -26,6 +26,7 @@ | |
package javax.xml.datatype; | |
import java.io.File; | |
+import java.io.FileInputStream; | |
import java.security.AccessController; | |
import java.security.PrivilegedAction; | |
import java.util.Iterator; | |
@@ -248,7 +249,9 @@ | |
firstTime = false; | |
if (ss.doesFileExist(f)) { | |
dPrint("Read properties file "+f); | |
- cacheProps.load(ss.getFileInputStream(f)); | |
+ try (FileInputStream propertyInputStream = ss.getFileInputStream(f)) { | |
+ cacheProps.load(propertyInputStream); | |
+ } | |
} | |
} | |
} | |
diff -r 0c49f9209035 src/javax/xml/parsers/FactoryFinder.java | |
--- a/src/javax/xml/parsers/FactoryFinder.java Tue Mar 04 11:51:21 2014 -0800 | |
+++ b/src/javax/xml/parsers/FactoryFinder.java Tue Sep 29 12:58:52 2015 -0700 | |
@@ -26,6 +26,7 @@ | |
package javax.xml.parsers; | |
import java.io.File; | |
+import java.io.FileInputStream; | |
import java.security.AccessController; | |
import java.security.PrivilegedAction; | |
import java.util.Iterator; | |
@@ -247,7 +248,9 @@ | |
firstTime = false; | |
if (ss.doesFileExist(f)) { | |
dPrint("Read properties file "+f); | |
- cacheProps.load(ss.getFileInputStream(f)); | |
+ try (FileInputStream propertyInputStream = ss.getFileInputStream(f)) { | |
+ cacheProps.load(propertyInputStream); | |
+ } | |
} | |
} | |
} | |
diff -r 0c49f9209035 src/javax/xml/stream/FactoryFinder.java | |
--- a/src/javax/xml/stream/FactoryFinder.java Tue Mar 04 11:51:21 2014 -0800 | |
+++ b/src/javax/xml/stream/FactoryFinder.java Tue Sep 29 12:58:52 2015 -0700 | |
@@ -26,6 +26,7 @@ | |
package javax.xml.stream; | |
import java.io.File; | |
+import java.io.FileInputStream; | |
import java.security.AccessController; | |
import java.security.PrivilegedAction; | |
import java.util.Iterator; | |
@@ -283,7 +284,9 @@ | |
firstTime = false; | |
if (ss.doesFileExist(f)) { | |
dPrint("Read properties file "+f); | |
- cacheProps.load(ss.getFileInputStream(f)); | |
+ try (FileInputStream propertyInputStream = ss.getFileInputStream(f)) { | |
+ cacheProps.load(propertyInputStream); | |
+ } | |
} | |
else { | |
configFile = ss.getSystemProperty("java.home") + File.separator + | |
@@ -291,7 +294,9 @@ | |
f = new File(configFile); | |
if (ss.doesFileExist(f)) { | |
dPrint("Read properties file "+f); | |
- cacheProps.load(ss.getFileInputStream(f)); | |
+ try (FileInputStream propertyInputStream = ss.getFileInputStream(f)) { | |
+ cacheProps.load(propertyInputStream); | |
+ } | |
} | |
} | |
} | |
diff -r 0c49f9209035 src/javax/xml/transform/FactoryFinder.java | |
--- a/src/javax/xml/transform/FactoryFinder.java Tue Mar 04 11:51:21 2014 -0800 | |
+++ b/src/javax/xml/transform/FactoryFinder.java Tue Sep 29 12:58:52 2015 -0700 | |
@@ -26,6 +26,7 @@ | |
package javax.xml.transform; | |
import java.io.File; | |
+import java.io.FileInputStream; | |
import java.lang.reflect.Method; | |
import java.lang.reflect.Modifier; | |
import java.security.AccessController; | |
@@ -279,7 +280,9 @@ | |
firstTime = false; | |
if (ss.doesFileExist(f)) { | |
dPrint("Read properties file "+f); | |
- cacheProps.load(ss.getFileInputStream(f)); | |
+ try (FileInputStream propertyInputStream = ss.getFileInputStream(f)) { | |
+ cacheProps.load(propertyInputStream); | |
+ } | |
} | |
} | |
} | |
diff -r 0c49f9209035 src/javax/xml/validation/SchemaFactoryFinder.java | |
--- a/src/javax/xml/validation/SchemaFactoryFinder.java Tue Mar 04 11:51:21 2014 -0800 | |
+++ b/src/javax/xml/validation/SchemaFactoryFinder.java Tue Sep 29 12:58:52 2015 -0700 | |
@@ -26,6 +26,7 @@ | |
package javax.xml.validation; | |
import java.io.File; | |
+import java.io.FileInputStream; | |
import java.lang.reflect.Method; | |
import java.lang.reflect.Modifier; | |
import java.net.URL; | |
@@ -194,7 +195,9 @@ | |
firstTime = false; | |
if(ss.doesFileExist(f)){ | |
debugPrintln("Read properties file " + f); | |
- cacheProps.load(ss.getFileInputStream(f)); | |
+ try (FileInputStream propertyInputStream = ss.getFileInputStream(f)) { | |
+ cacheProps.load(propertyInputStream); | |
+ } | |
} | |
} | |
} | |
diff -r 0c49f9209035 src/javax/xml/xpath/XPathFactoryFinder.java | |
--- a/src/javax/xml/xpath/XPathFactoryFinder.java Tue Mar 04 11:51:21 2014 -0800 | |
+++ b/src/javax/xml/xpath/XPathFactoryFinder.java Tue Sep 29 12:58:52 2015 -0700 | |
@@ -26,6 +26,7 @@ | |
package javax.xml.xpath; | |
import java.io.File; | |
+import java.io.FileInputStream; | |
import java.lang.reflect.Method; | |
import java.lang.reflect.Modifier; | |
import java.net.URL; | |
@@ -188,7 +189,9 @@ | |
firstTime = false; | |
if(ss.doesFileExist(f)){ | |
debugPrintln("Read properties file " + f); | |
- cacheProps.load(ss.getFileInputStream(f)); | |
+ try (FileInputStream propertyInputStream = ss.getFileInputStream(f)) { | |
+ cacheProps.load(propertyInputStream); | |
+ } | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment