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:
mrglavas 2005-06-17 19:32:50 +00:00
parent 729661318d
commit ea4dcf269c
3 changed files with 30 additions and 6 deletions

View File

@ -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)) {

View File

@ -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)) {

View File

@ -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)) {