remm        2004/12/17 04:39:56

  Modified:    jasper2/src/share/org/apache/jasper/compiler
                        JDTCompiler.java
  Log:
  - 32746: Close the input stream we get from getResourceAsStream.
  
  Revision  Changes    Path
  1.8       +10 -2     
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JDTCompiler.java
  
  Index: JDTCompiler.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JDTCompiler.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- JDTCompiler.java  5 Oct 2004 19:06:31 -0000       1.7
  +++ JDTCompiler.java  17 Dec 2004 12:39:55 -0000      1.8
  @@ -185,6 +185,7 @@
                   
                   private NameEnvironmentAnswer findType(String className) {
   
  +                    InputStream is = null;
                       try {
                           if (className.equals(targetClassName)) {
                               ICompilationUnit compilationUnit = 
  @@ -194,8 +195,7 @@
                           }
                           String resourceName = 
                               className.replace('.', '/') + ".class";
  -                        InputStream is = 
  -                            classLoader.getResourceAsStream(resourceName);
  +                        is = classLoader.getResourceAsStream(resourceName);
                           if (is != null) {
                               byte[] classBytes;
                               byte[] buf = new byte[8192];
  @@ -218,6 +218,14 @@
                           log.error("Compilation error", exc);
                       } catch 
(org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException exc) {
                           log.error("Compilation error", exc);
  +                    } finally {
  +                        if (is != null) {
  +                            try {
  +                                is.close();
  +                            } catch (IOException exc) {
  +                                // Ignore
  +                            }
  +                        }
                       }
                       return null;
                   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to