mrglavas 2004/06/06 08:23:52 Modified: java/samples/xni 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.5 +9 -2 xml-xerces/java/samples/xni/ObjectFactory.java Index: ObjectFactory.java =================================================================== RCS file: /home/cvs/xml-xerces/java/samples/xni/ObjectFactory.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- ObjectFactory.java 11 Mar 2004 22:59:15 -0000 1.4 +++ ObjectFactory.java 6 Jun 2004 15:23:52 -0000 1.5 @@ -447,10 +447,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]