jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rve...@apache.org
Subject svn commit: r1492789 - /jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/JenaDriver.java
Date Thu, 13 Jun 2013 18:07:11 GMT
Author: rvesse
Date: Thu Jun 13 18:07:11 2013
New Revision: 1492789

URL: http://svn.apache.org/r1492789
Log:
Minor fix to avoid a possible open file handle

Modified:
    jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/JenaDriver.java

Modified: jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/JenaDriver.java
URL: http://svn.apache.org/viewvc/jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/JenaDriver.java?rev=1492789&r1=1492788&r2=1492789&view=diff
==============================================================================
--- jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/JenaDriver.java
(original)
+++ jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/JenaDriver.java
Thu Jun 13 18:07:11 2013
@@ -22,6 +22,7 @@ import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.IOException;
+import java.io.InputStream;
 import java.net.URL;
 import java.sql.Connection;
 import java.sql.Driver;
@@ -709,7 +710,9 @@ public abstract class JenaDriver impleme
         File propFile = new File(resource);
         if (propFile.exists() && propFile.isFile()) {
             try {
-                ps.load(new FileInputStream(propFile));
+                FileInputStream input = new FileInputStream(propFile);
+                ps.load(input);
+                input.close();
             } catch (FileNotFoundException e) {
                 throw new SQLException("Located external properties file " + propFile.getAbsolutePath()
                         + " on file system but it was removed before it could be read", e);
@@ -722,7 +725,9 @@ public abstract class JenaDriver impleme
             URL propURL = this.getClass().getResource(resource);
             if (propURL != null) {
                 try {
-                    ps.load(propURL.openStream());
+                    InputStream input = propURL.openStream();
+                    ps.load(input);
+                    input.close();
                 } catch (IOException e) {
                     throw new SQLException("IO Error attempting to load class path properties
file from resource " + resource, e);
                 }



Mime
View raw message