Fixing a potential memory leak. The reader used to read

the service provider is never closed if an IOException is
thrown while reading from it.  Adding a finally block so
that the reader will always be closed.


git-svn-id: https://svn.apache.org/repos/asf/xml/commons/trunk@226227 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
mrglavas 2005-06-05 01:59:03 +00:00
parent ad5eac5eb9
commit de9abff1b4

View File

@ -283,8 +283,13 @@ public final class DOMImplementationRegistry {
new BufferedReader(new InputStreamReader(is),
DEFAULT_LINE_LENGTH);
}
String serviceValue = rd.readLine();
rd.close();
String serviceValue = null;
try {
serviceValue = rd.readLine();
}
finally {
rd.close();
}
if (serviceValue != null && serviceValue.length() > 0) {
return serviceValue;
}