mrglavas 2004/06/06 08:21:25 Modified: java/src/org/apache/xml/serialize ObjectFactory.java java/src/org/apache/html/dom ObjectFactory.java java/src/org/apache/xerces/xinclude ObjectFactory.java java/src/org/apache/xerces/parsers ObjectFactory.java java/src/org/apache/xerces/impl/dv ObjectFactory.java java/src/org/apache/xerces/dom ObjectFactory.java Log: 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. Revision Changes Path 1.6 +9 -2 xml-xerces/java/src/org/apache/xml/serialize/ObjectFactory.java Index: ObjectFactory.java =================================================================== RCS file: /home/cvs/xml-xerces/java/src/org/apache/xml/serialize/ObjectFactory.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- ObjectFactory.java 11 Mar 2004 22:57:27 -0000 1.5 +++ ObjectFactory.java 6 Jun 2004 15:21:25 -0000 1.6 @@ -444,10 +444,17 @@ // XXX Does not handle all possible input as specified by the // Jar Service Provider specification factoryClassName = rd.readLine(); - rd.close(); } catch (IOException x) { // No provider found return null; + } + finally { + try { + // try to close the reader. + rd.close(); + } + // Ignore the exception. + catch (IOException exc) {} } if (factoryClassName != null && 1.6 +9 -2 xml-xerces/java/src/org/apache/html/dom/ObjectFactory.java Index: ObjectFactory.java =================================================================== RCS file: /home/cvs/xml-xerces/java/src/org/apache/html/dom/ObjectFactory.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- ObjectFactory.java 11 Mar 2004 22:57:27 -0000 1.5 +++ ObjectFactory.java 6 Jun 2004 15:21:25 -0000 1.6 @@ -444,10 +444,17 @@ // XXX Does not handle all possible input as specified by the // Jar Service Provider specification factoryClassName = rd.readLine(); - rd.close(); } catch (IOException x) { // No provider found return null; + } + finally { + try { + // try to close the reader. + rd.close(); + } + // Ignore the exception. + catch (IOException exc) {} } if (factoryClassName != null && 1.5 +9 -2 xml-xerces/java/src/org/apache/xerces/xinclude/ObjectFactory.java Index: ObjectFactory.java =================================================================== RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/xinclude/ObjectFactory.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- ObjectFactory.java 11 Mar 2004 22:57:27 -0000 1.4 +++ ObjectFactory.java 6 Jun 2004 15:21:25 -0000 1.5 @@ -444,10 +444,17 @@ // XXX Does not handle all possible input as specified by the // Jar Service Provider specification factoryClassName = rd.readLine(); - rd.close(); } catch (IOException x) { // No provider found return null; + } + finally { + try { + // try to close the reader. + rd.close(); + } + // Ignore the exception. + catch (IOException exc) {} } if (factoryClassName != null && 1.6 +9 -2 xml-xerces/java/src/org/apache/xerces/parsers/ObjectFactory.java Index: ObjectFactory.java =================================================================== RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/ObjectFactory.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- ObjectFactory.java 11 Mar 2004 22:57:28 -0000 1.5 +++ ObjectFactory.java 6 Jun 2004 15:21:25 -0000 1.6 @@ -444,10 +444,17 @@ // XXX Does not handle all possible input as specified by the // Jar Service Provider specification factoryClassName = rd.readLine(); - rd.close(); } catch (IOException x) { // No provider found return null; + } + finally { + try { + // try to close the reader. + rd.close(); + } + // Ignore the exception. + catch (IOException exc) {} } if (factoryClassName != null && 1.6 +9 -2 xml-xerces/java/src/org/apache/xerces/impl/dv/ObjectFactory.java Index: ObjectFactory.java =================================================================== RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/dv/ObjectFactory.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- ObjectFactory.java 11 Mar 2004 22:57:28 -0000 1.5 +++ ObjectFactory.java 6 Jun 2004 15:21:25 -0000 1.6 @@ -444,10 +444,17 @@ // XXX Does not handle all possible input as specified by the // Jar Service Provider specification factoryClassName = rd.readLine(); - rd.close(); } catch (IOException x) { // No provider found return null; + } + finally { + try { + // try to close the reader. + rd.close(); + } + // Ignore the exception. + catch (IOException exc) {} } if (factoryClassName != null && 1.6 +9 -2 xml-xerces/java/src/org/apache/xerces/dom/ObjectFactory.java Index: ObjectFactory.java =================================================================== RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/ObjectFactory.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- ObjectFactory.java 11 Mar 2004 22:57:27 -0000 1.5 +++ ObjectFactory.java 6 Jun 2004 15:21:25 -0000 1.6 @@ -444,10 +444,17 @@ // XXX Does not handle all possible input as specified by the // Jar Service Provider specification factoryClassName = rd.readLine(); - rd.close(); } catch (IOException x) { // No provider found return null; + } + finally { + try { + // try to close the reader. + rd.close(); + } + // Ignore the exception. + catch (IOException exc) {} } if (factoryClassName != null && --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]