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:
parent
ad5eac5eb9
commit
de9abff1b4
@ -283,8 +283,13 @@ public final class DOMImplementationRegistry {
|
|||||||
new BufferedReader(new InputStreamReader(is),
|
new BufferedReader(new InputStreamReader(is),
|
||||||
DEFAULT_LINE_LENGTH);
|
DEFAULT_LINE_LENGTH);
|
||||||
}
|
}
|
||||||
String serviceValue = rd.readLine();
|
String serviceValue = null;
|
||||||
rd.close();
|
try {
|
||||||
|
serviceValue = rd.readLine();
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
rd.close();
|
||||||
|
}
|
||||||
if (serviceValue != null && serviceValue.length() > 0) {
|
if (serviceValue != null && serviceValue.length() > 0) {
|
||||||
return serviceValue;
|
return serviceValue;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user