Make sure we close our stream.

git-svn-id: https://samskivert.googlecode.com/svn/trunk@2722 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
samskivert
2010-02-09 20:47:54 +00:00
parent 8be87e9412
commit 033c67d81b
+23 -20
View File
@@ -26,6 +26,8 @@ import java.security.AccessControlException;
import java.util.*;
import java.util.Map;
import com.samskivert.io.StreamUtil;
import static com.samskivert.Log.log;
/**
@@ -425,28 +427,29 @@ public class ConfigUtil
throws IOException
{
InputStream input = sourceURL.openStream();
BufferedReader bin = new BufferedReader(new InputStreamReader(input));
PropRecord record = new PropRecord(path, sourceURL);
boolean started = false;
String line;
while ((line = bin.readLine()) != null) {
if (line.startsWith(PACKAGE_KEY)) {
record._package = parseValue(line);
started = true;
} else if (line.startsWith(EXTENDS_KEY)) {
record._extends = parseValue(line);
started = true;
} else if (line.startsWith(OVERRIDES_KEY)) {
record._overrides = parseValues(line);
started = true;
} else if (started) {
break;
try {
BufferedReader bin = new BufferedReader(new InputStreamReader(input));
PropRecord record = new PropRecord(path, sourceURL);
boolean started = false;
String line;
while ((line = bin.readLine()) != null) {
if (line.startsWith(PACKAGE_KEY)) {
record._package = parseValue(line);
started = true;
} else if (line.startsWith(EXTENDS_KEY)) {
record._extends = parseValue(line);
started = true;
} else if (line.startsWith(OVERRIDES_KEY)) {
record._overrides = parseValues(line);
started = true;
} else if (started) {
break;
}
}
return record;
} finally {
StreamUtil.close(input);
}
input.close();
return record;
}
/** {@link #parseMetaData} helper function. */