From: markt Date: Mon, 27 Sep 2010 22:29:30 +0000 (+0000) Subject: Remaining fix for https://issues.apache.org/bugzilla/show_bug.cgi?id=48644 X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=28ad1a827e1e9d0774862f0c54273c30c9bcc070;p=tomcat7.0 Remaining fix for https://issues.apache.org/bugzilla/show_bug.cgi?id=48644 Some Throwables must always be re-thrown git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1001939 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/tomcat/jni/Library.java b/java/org/apache/tomcat/jni/Library.java index 17a8ebaf5..e26b53ca0 100644 --- a/java/org/apache/tomcat/jni/Library.java +++ b/java/org/apache/tomcat/jni/Library.java @@ -17,6 +17,8 @@ package org.apache.tomcat.jni; +import org.apache.tomcat.util.ExceptionUtils; + /** Library * * @author Mladen Turk @@ -43,6 +45,7 @@ public final class Library { loaded = true; } catch (Throwable e) { + ExceptionUtils.handleThrowable(e); String name = System.mapLibraryName(NAMES[i]); String path = System.getProperty("java.library.path"); String sep = System.getProperty("path.separator"); diff --git a/java/org/apache/tomcat/util/digester/Digester.java b/java/org/apache/tomcat/util/digester/Digester.java index aae5e2708..195da2a12 100644 --- a/java/org/apache/tomcat/util/digester/Digester.java +++ b/java/org/apache/tomcat/util/digester/Digester.java @@ -37,6 +37,7 @@ import javax.xml.parsers.SAXParserFactory; import org.apache.juli.logging.Log; import org.apache.juli.logging.LogFactory; +import org.apache.tomcat.util.ExceptionUtils; import org.apache.tomcat.util.IntrospectionUtils; import org.xml.sax.Attributes; import org.xml.sax.EntityResolver; @@ -100,6 +101,7 @@ public class Digester extends DefaultHandler { sources[0] = src; initialized = true; } catch (Throwable t) { + ExceptionUtils.handleThrowable(t); LogFactory.getLog("org.apache.commons.digester.Digester"). error("Unable to load property source["+className+"].",t); } diff --git a/java/org/apache/tomcat/util/http/fileupload/FileUploadBase.java b/java/org/apache/tomcat/util/http/fileupload/FileUploadBase.java index 687204afe..ccd949557 100644 --- a/java/org/apache/tomcat/util/http/fileupload/FileUploadBase.java +++ b/java/org/apache/tomcat/util/http/fileupload/FileUploadBase.java @@ -340,7 +340,7 @@ public abstract class FileUploadBase { FileItem fileItem = iterator.next(); try { fileItem.delete(); - } catch (Throwable e) { + } catch (Exception e) { // ignore it } } diff --git a/java/org/apache/tomcat/util/http/fileupload/util/Streams.java b/java/org/apache/tomcat/util/http/fileupload/util/Streams.java index 20b04845c..00b311c52 100644 --- a/java/org/apache/tomcat/util/http/fileupload/util/Streams.java +++ b/java/org/apache/tomcat/util/http/fileupload/util/Streams.java @@ -119,14 +119,14 @@ public final class Streams { if (in != null) { try { in.close(); - } catch (Throwable t) { + } catch (IOException ioe) { /* Ignore me */ } } if (pClose && out != null) { try { out.close(); - } catch (Throwable t) { + } catch (IOException ioe) { /* Ignore me */ } } diff --git a/java/org/apache/tomcat/util/net/AprEndpoint.java b/java/org/apache/tomcat/util/net/AprEndpoint.java index 93a445866..ce40830b9 100644 --- a/java/org/apache/tomcat/util/net/AprEndpoint.java +++ b/java/org/apache/tomcat/util/net/AprEndpoint.java @@ -39,6 +39,7 @@ import org.apache.tomcat.jni.SSLContext; import org.apache.tomcat.jni.SSLSocket; import org.apache.tomcat.jni.Socket; import org.apache.tomcat.jni.Status; +import org.apache.tomcat.util.ExceptionUtils; /** @@ -723,6 +724,7 @@ public class AprEndpoint extends AbstractEndpoint { } } catch (Throwable t) { + ExceptionUtils.handleThrowable(t); if (log.isDebugEnabled()) { if (step == 2) { log.debug(sm.getString("endpoint.err.handshake"), t); @@ -770,6 +772,7 @@ public class AprEndpoint extends AbstractEndpoint { log.warn("Socket processing request was rejected for:"+socket,x); return false; } catch (Throwable t) { + ExceptionUtils.handleThrowable(t); // This means we got an OOM or similar creating a thread, or that // the pool and its queue are full log.error(sm.getString("endpoint.process.fail"), t); @@ -791,6 +794,7 @@ public class AprEndpoint extends AbstractEndpoint { log.warn("Socket processing request was rejected for:"+socket,x); return false; } catch (Throwable t) { + ExceptionUtils.handleThrowable(t); // This means we got an OOM or similar creating a thread, or that // the pool and its queue are full log.error(sm.getString("endpoint.process.fail"), t); @@ -834,6 +838,7 @@ public class AprEndpoint extends AbstractEndpoint { log.warn("Socket processing request was rejected for:"+socket,x); return false; } catch (Throwable t) { + ExceptionUtils.handleThrowable(t); // This means we got an OOM or similar creating a thread, or that // the pool and its queue are full log.error(sm.getString("endpoint.process.fail"), t); @@ -873,6 +878,7 @@ public class AprEndpoint extends AbstractEndpoint { log.warn("Socket processing request was rejected for:"+socket,x); return false; } catch (Throwable t) { + ExceptionUtils.handleThrowable(t); // This means we got an OOM or similar creating a thread, or that // the pool and its queue are full log.error(sm.getString("endpoint.process.fail"), t); @@ -945,6 +951,7 @@ public class AprEndpoint extends AbstractEndpoint { destroySocket(socket); } } catch (Throwable t) { + ExceptionUtils.handleThrowable(t); if (running) log.error(sm.getString("endpoint.accept.fail"), t); } @@ -1230,6 +1237,7 @@ public class AprEndpoint extends AbstractEndpoint { } } } catch (Throwable t) { + ExceptionUtils.handleThrowable(t); log.error(sm.getString("endpoint.poll.error"), t); } @@ -1560,6 +1568,7 @@ public class AprEndpoint extends AbstractEndpoint { } } } catch (Throwable t) { + ExceptionUtils.handleThrowable(t); log.error(sm.getString("endpoint.poll.error"), t); } } diff --git a/java/org/apache/tomcat/util/net/JIoEndpoint.java b/java/org/apache/tomcat/util/net/JIoEndpoint.java index 0c489adb0..441c85a5f 100644 --- a/java/org/apache/tomcat/util/net/JIoEndpoint.java +++ b/java/org/apache/tomcat/util/net/JIoEndpoint.java @@ -31,6 +31,7 @@ import java.util.concurrent.RejectedExecutionException; import org.apache.catalina.Globals; import org.apache.juli.logging.Log; import org.apache.juli.logging.LogFactory; +import org.apache.tomcat.util.ExceptionUtils; import org.apache.tomcat.util.net.AbstractEndpoint.Handler.SocketState; @@ -226,6 +227,7 @@ public class JIoEndpoint extends AbstractEndpoint { log.error(sm.getString("endpoint.accept.fail"), npe); } } catch (Throwable t) { + ExceptionUtils.handleThrowable(t); log.error(sm.getString("endpoint.accept.fail"), t); } // The processor will recycle itself when it finishes @@ -267,6 +269,7 @@ public class JIoEndpoint extends AbstractEndpoint { // SSL handshake serverSocketFactory.handshake(socket.getSocket()); } catch (Throwable t) { + ExceptionUtils.handleThrowable(t); if (log.isDebugEnabled()) { log.debug(sm.getString("endpoint.err.handshake"), t); } @@ -484,6 +487,7 @@ public class JIoEndpoint extends AbstractEndpoint { // Close the socket return false; } catch (Throwable t) { + ExceptionUtils.handleThrowable(t); log.error(sm.getString("endpoint.err.unexpected"), t); // Close the socket return false; @@ -519,6 +523,7 @@ public class JIoEndpoint extends AbstractEndpoint { log.warn("Socket processing request was rejected for:"+socket,x); return false; } catch (Throwable t) { + ExceptionUtils.handleThrowable(t); // This means we got an OOM or similar creating a thread, or that // the pool and its queue are full log.error(sm.getString("endpoint.process.fail"), t); @@ -572,6 +577,7 @@ public class JIoEndpoint extends AbstractEndpoint { } } } catch (Throwable t) { + ExceptionUtils.handleThrowable(t); // This means we got an OOM or similar creating a thread, or that // the pool and its queue are full log.error(sm.getString("endpoint.process.fail"), t); diff --git a/java/org/apache/tomcat/util/net/NioBlockingSelector.java b/java/org/apache/tomcat/util/net/NioBlockingSelector.java index 231259830..8a97571af 100644 --- a/java/org/apache/tomcat/util/net/NioBlockingSelector.java +++ b/java/org/apache/tomcat/util/net/NioBlockingSelector.java @@ -33,6 +33,7 @@ import java.util.concurrent.atomic.AtomicInteger; import org.apache.juli.logging.Log; import org.apache.juli.logging.LogFactory; +import org.apache.tomcat.util.ExceptionUtils; import org.apache.tomcat.util.MutableInteger; import org.apache.tomcat.util.net.NioEndpoint.KeyAttachment; @@ -328,6 +329,7 @@ public class NioBlockingSelector { if ( log.isDebugEnabled() ) log.debug("Possibly encountered sun bug 5076772 on windows JDK 1.5",x); continue; } catch (Throwable x) { + ExceptionUtils.handleThrowable(x); log.error("",x); continue; } diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java b/java/org/apache/tomcat/util/net/NioEndpoint.java index 9d811509b..74c1dbeb9 100644 --- a/java/org/apache/tomcat/util/net/NioEndpoint.java +++ b/java/org/apache/tomcat/util/net/NioEndpoint.java @@ -51,6 +51,7 @@ import javax.net.ssl.X509KeyManager; import org.apache.juli.logging.Log; import org.apache.juli.logging.LogFactory; +import org.apache.tomcat.util.ExceptionUtils; import org.apache.tomcat.util.IntrospectionUtils; import org.apache.tomcat.util.net.AbstractEndpoint.Handler.SocketState; import org.apache.tomcat.util.net.SecureNioChannel.ApplicationBufferHandler; @@ -408,6 +409,7 @@ public class NioEndpoint extends AbstractEndpoint { try { log.fatal(oomParachuteMsg); }catch (Throwable t) { + ExceptionUtils.handleThrowable(t); System.err.println(oomParachuteMsg); } lastParachuteCheck = System.currentTimeMillis(); @@ -702,9 +704,12 @@ public class NioEndpoint extends AbstractEndpoint { } getPoller0().register(channel); } catch (Throwable t) { + ExceptionUtils.handleThrowable(t); try { log.error("",t); - }catch ( Throwable tt){} + } catch (Throwable tt) { + ExceptionUtils.handleThrowable(t); + } // Tell to close the socket return false; } @@ -750,6 +755,7 @@ public class NioEndpoint extends AbstractEndpoint { log.warn("Socket processing request was rejected for:"+socket,rx); return false; } catch (Throwable t) { + ExceptionUtils.handleThrowable(t); // This means we got an OOM or similar creating a thread, or that // the pool and its queue are full log.error(sm.getString("endpoint.process.fail"), t); @@ -827,10 +833,15 @@ public class NioEndpoint extends AbstractEndpoint { try { System.err.println(oomParachuteMsg); oomt.printStackTrace(); - }catch (Throwable letsHopeWeDontGetHere){} - }catch (Throwable letsHopeWeDontGetHere){} + }catch (Throwable letsHopeWeDontGetHere){ + ExceptionUtils.handleThrowable(letsHopeWeDontGetHere); + } + }catch (Throwable letsHopeWeDontGetHere){ + ExceptionUtils.handleThrowable(letsHopeWeDontGetHere); + } } } catch (Throwable t) { + ExceptionUtils.handleThrowable(t); log.error(sm.getString("endpoint.accept.fail"), t); } }//while @@ -1038,6 +1049,7 @@ public class NioEndpoint extends AbstractEndpoint { try {if (ka!=null && ka.getSendfileData()!=null && ka.getSendfileData().fchannel!=null && ka.getSendfileData().fchannel.isOpen()) ka.getSendfileData().fchannel.close();}catch (Exception ignore){} if (ka!=null) ka.reset(); } catch (Throwable e) { + ExceptionUtils.handleThrowable(e); if ( log.isDebugEnabled() ) log.error("",e); // Ignore } @@ -1097,6 +1109,7 @@ public class NioEndpoint extends AbstractEndpoint { if ( wakeupCounter == null || selector == null ) throw x; continue; } catch (Throwable x) { + ExceptionUtils.handleThrowable(x); log.error("",x); continue; } @@ -1127,7 +1140,9 @@ public class NioEndpoint extends AbstractEndpoint { try { System.err.println(oomParachuteMsg); oomt.printStackTrace(); - }catch (Throwable letsHopeWeDontGetHere){} + }catch (Throwable letsHopeWeDontGetHere){ + ExceptionUtils.handleThrowable(letsHopeWeDontGetHere); + } } } }//while @@ -1189,6 +1204,7 @@ public class NioEndpoint extends AbstractEndpoint { } catch ( CancelledKeyException ckx ) { cancelledKey(sk, SocketStatus.ERROR,false); } catch (Throwable t) { + ExceptionUtils.handleThrowable(t); log.error("",t); } return result; @@ -1557,7 +1573,9 @@ public class NioEndpoint extends AbstractEndpoint { try { System.err.println(oomParachuteMsg); oomt.printStackTrace(); - }catch (Throwable letsHopeWeDontGetHere){} + }catch (Throwable letsHopeWeDontGetHere){ + ExceptionUtils.handleThrowable(letsHopeWeDontGetHere); + } } }catch ( Throwable t ) { log.error("",t);