bodewig 2003/07/24 05:59:19 Modified: src/main/org/apache/tools/ant/taskdefs/optional/jlink jlink.java Log: Fix potential stream leak Revision Changes Path 1.11 +11 -4 ant/src/main/org/apache/tools/ant/taskdefs/optional/jlink/jlink.java Index: jlink.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/jlink/jlink.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- jlink.java 19 Jul 2003 11:20:18 -0000 1.10 +++ jlink.java 24 Jul 2003 12:59:19 -0000 1.11 @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2000,2002 The Apache Software Foundation. All rights + * Copyright (c) 2000,2002-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -302,19 +302,26 @@ if (!name.endsWith(".class")) { // see if the file is in fact a .class file, and determine its actual name. + InputStream input = null; try { - InputStream input = new FileInputStream(file); + input = new FileInputStream(file); String className = ClassNameReader.getClassName(input); - input.close(); if (className != null) { return className.replace('.', '/') + ".class"; } } catch (IOException ioe) { + } finally { + if (input != null) { + try { + input.close(); + } catch (IOException e) { + } + } } } System.out.println("From " + file.getPath() + " and prefix " + prefix - + ", creating entry " + prefix + name); + + ", creating entry " + prefix + name); return (prefix + name); }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]