Merge in a fix from the tck-jaxp-1_2_0 branch:
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@226238 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
729661318d
commit
ea4dcf269c
@ -292,11 +292,19 @@ class FactoryFinder {
|
|||||||
// XXX Does not handle all possible input as specified by the
|
// XXX Does not handle all possible input as specified by the
|
||||||
// Jar Service Provider specification
|
// Jar Service Provider specification
|
||||||
factoryClassName = rd.readLine();
|
factoryClassName = rd.readLine();
|
||||||
rd.close();
|
}
|
||||||
} catch (IOException x) {
|
catch (IOException x) {
|
||||||
// No provider found
|
// No provider found
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
try {
|
||||||
|
// try to close the reader.
|
||||||
|
rd.close();
|
||||||
|
}
|
||||||
|
// Ignore the exception.
|
||||||
|
catch (IOException exc) {}
|
||||||
|
}
|
||||||
|
|
||||||
if (factoryClassName != null &&
|
if (factoryClassName != null &&
|
||||||
! "".equals(factoryClassName)) {
|
! "".equals(factoryClassName)) {
|
||||||
|
|||||||
@ -275,11 +275,19 @@ class FactoryFinder {
|
|||||||
// XXX Does not handle all possible input as specified by the
|
// XXX Does not handle all possible input as specified by the
|
||||||
// Jar Service Provider specification
|
// Jar Service Provider specification
|
||||||
factoryClassName = rd.readLine();
|
factoryClassName = rd.readLine();
|
||||||
rd.close();
|
}
|
||||||
} catch (IOException x) {
|
catch (IOException x) {
|
||||||
// No provider found
|
// No provider found
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
try {
|
||||||
|
// try to close the reader.
|
||||||
|
rd.close();
|
||||||
|
}
|
||||||
|
// Ignore the exception.
|
||||||
|
catch (IOException exc) {}
|
||||||
|
}
|
||||||
|
|
||||||
if (factoryClassName != null &&
|
if (factoryClassName != null &&
|
||||||
! "".equals(factoryClassName)) {
|
! "".equals(factoryClassName)) {
|
||||||
|
|||||||
@ -275,11 +275,19 @@ class FactoryFinder {
|
|||||||
// XXX Does not handle all possible input as specified by the
|
// XXX Does not handle all possible input as specified by the
|
||||||
// Jar Service Provider specification
|
// Jar Service Provider specification
|
||||||
factoryClassName = rd.readLine();
|
factoryClassName = rd.readLine();
|
||||||
rd.close();
|
}
|
||||||
} catch (IOException x) {
|
catch (IOException x) {
|
||||||
// No provider found
|
// No provider found
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
try {
|
||||||
|
// try to close the reader.
|
||||||
|
rd.close();
|
||||||
|
}
|
||||||
|
// Ignore the exception.
|
||||||
|
catch (IOException exc) {}
|
||||||
|
}
|
||||||
|
|
||||||
if (factoryClassName != null &&
|
if (factoryClassName != null &&
|
||||||
! "".equals(factoryClassName)) {
|
! "".equals(factoryClassName)) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user