close stream after error
authorpero <pero@13f79535-47bb-0310-9956-ffa450edef68>
Fri, 8 May 2009 07:40:59 +0000 (07:40 +0000)
committerpero <pero@13f79535-47bb-0310-9956-ffa450edef68>
Fri, 8 May 2009 07:40:59 +0000 (07:40 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@772872 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/loader/LocalStrings.properties
java/org/apache/catalina/loader/WebappClassLoader.java

index 8948981..2ac41a5 100644 (file)
@@ -29,6 +29,7 @@ standardLoader.removeRepository=Removing repository {0}
 standardLoader.starting=Starting this Loader
 standardLoader.stopping=Stopping this Loader
 webappClassLoader.stopped=Illegal access: this web application instance has been stopped already.  Could not load {0}.  The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
+webappClassLoader.readError=Resource read error: Could not load {0}.
 webappClassLoader.wrongVersion=(unable to load class {0})
 webappLoader.addRepository=Adding repository {0}
 webappLoader.deploy=Deploying class repositories to work directory {0}
index 4e8b8bf..1a48c75 100644 (file)
@@ -2097,15 +2097,14 @@ public class WebappClassLoader
                             break;
                         pos += n;
                     }
-                    binaryStream.close();
                 } catch (IOException e) {
-                    e.printStackTrace();
-                    return null;
-                } catch (Exception e) {
-                    e.printStackTrace();
+                    log.error(sm.getString("webappClassLoader.readError", name), e);
                     return null;
+                } finally {
+                    try {
+                        binaryStream.close();
+                    } catch (IOException e) {}
                 }
-
                 if (fileNeedConvert) {
                     String str = new String(binaryContent,0,pos);
                     try {