Author: rlaidlaw
Date: Sat Mar 23 19:23:12 2013
New Revision: 1460212
URL: http://svn.apache.org/r1460212
Log:
OODT-576: Added try...finally to close BufferedReader.
Modified:
oodt/trunk/CHANGES.txt
oodt/trunk/commons/src/main/java/org/apache/oodt/commons/database/SqlScript.java
Modified: oodt/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/oodt/trunk/CHANGES.txt?rev=1460212&r1=1460211&r2=1460212&view=diff
==============================================================================
--- oodt/trunk/CHANGES.txt (original)
+++ oodt/trunk/CHANGES.txt Sat Mar 23 19:23:12 2013
@@ -3,6 +3,9 @@ Apache OODT Change Log
Release 0.6 - Current Development
--------------------------------------------
+* OODT-576 Used try...finally in oodt.commons.database.SqlScript.loadScript()
to
+ close BufferedReader (rlaidlaw)
+
* OODT-537 Push/Pull NullPointerException on startup (mattmann, joyce)
* OODT-578 Workflow Monitor experiences runtime exception (NPE) out
Modified:
oodt/trunk/commons/src/main/java/org/apache/oodt/commons/database/SqlScript.java
URL:
http://svn.apache.org/viewvc/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/database/SqlScript.java?rev=1460212&r1=1460211&r2=1460212&view=diff
==============================================================================
---
oodt/trunk/commons/src/main/java/org/apache/oodt/commons/database/SqlScript.java
(original)
+++
oodt/trunk/commons/src/main/java/org/apache/oodt/commons/database/SqlScript.java
Sat Mar 23 19:23:12 2013
@@ -109,22 +109,28 @@ public class SqlScript {
}
- public void loadScript() throws IOException, SQLException {
+ public void loadScript() throws IOException {
BufferedReader reader = new BufferedReader(new FileReader(script));
- String line;
- StringBuffer query = new StringBuffer();
- boolean queryEnds = false;
-
- while ((line = reader.readLine()) != null) {
- if (isComment(line))
- continue;
- queryEnds = checkStatementEnds(line);
- query.append(line);
- if (queryEnds) {
- statementList.add(query.toString());
- query.setLength(0);
+
+ try {
+ String line = null;
+ StringBuffer query = new StringBuffer();
+ boolean queryEnds = false;
+
+ while ((line = reader.readLine()) != null) {
+ if (isComment(line))
+ continue;
+ queryEnds = checkStatementEnds(line);
+ query.append(line);
+ if (queryEnds) {
+ statementList.add(query.toString());
+ query.setLength(0);
+ }
}
}
+ finally {
+ reader.close();
+ }
}
public void execute() throws SQLException {