View | Details | Raw Unified | Return to bug 48644
Collapse All | Expand All

(-)java/org/apache/catalina/ant/AbstractCatalinaTask.java (-2 / +3 lines)
Lines 26-31 Link Here
26
import java.net.URL;
26
import java.net.URL;
27
import java.net.URLConnection;
27
import java.net.URLConnection;
28
import org.apache.catalina.util.Base64;
28
import org.apache.catalina.util.Base64;
29
import org.apache.tomcat.util.ExceptionUtils;
29
import org.apache.tools.ant.BuildException;
30
import org.apache.tools.ant.BuildException;
30
import org.apache.tools.ant.Project;
31
import org.apache.tools.ant.Project;
31
32
Lines 272-278 Link Here
272
                try {
273
                try {
273
                    reader.close();
274
                    reader.close();
274
                } catch (Throwable u) {
275
                } catch (Throwable u) {
275
                    // Ignore
276
                	ExceptionUtils.handleThrowable(u);
276
                }
277
                }
277
                reader = null;
278
                reader = null;
278
            }
279
            }
Lines 280-286 Link Here
280
                try {
281
                try {
281
                    istream.close();
282
                    istream.close();
282
                } catch (Throwable u) {
283
                } catch (Throwable u) {
283
                    // Ignore
284
                    ExceptionUtils.handleThrowable(u);
284
                }
285
                }
285
                istream = null;
286
                istream = null;
286
            }
287
            }
(-)java/org/apache/catalina/core/AprLifecycleListener.java (-1 / +2 lines)
Lines 24-29 Link Here
24
import org.apache.catalina.Lifecycle;
24
import org.apache.catalina.Lifecycle;
25
import org.apache.catalina.LifecycleEvent;
25
import org.apache.catalina.LifecycleEvent;
26
import org.apache.catalina.LifecycleListener;
26
import org.apache.catalina.LifecycleListener;
27
import org.apache.tomcat.util.ExceptionUtils;
27
import org.apache.tomcat.util.res.StringManager;
28
import org.apache.tomcat.util.res.StringManager;
28
import org.apache.juli.logging.Log;
29
import org.apache.juli.logging.Log;
29
import org.apache.juli.logging.LogFactory;
30
import org.apache.juli.logging.LogFactory;
Lines 162-168 Link Here
162
                // is below required.                
163
                // is below required.                
163
                terminateAPR();
164
                terminateAPR();
164
            } catch (Throwable t) {
165
            } catch (Throwable t) {
165
                // Ignore
166
                ExceptionUtils.handleThrowable(t);
166
            }
167
            }
167
            return;
168
            return;
168
        }
169
        }
(-)java/org/apache/catalina/core/StandardPipeline.java (-1 / +2 lines)
Lines 34-39 Link Here
34
import org.apache.catalina.valves.ValveBase;
34
import org.apache.catalina.valves.ValveBase;
35
import org.apache.juli.logging.Log;
35
import org.apache.juli.logging.Log;
36
import org.apache.juli.logging.LogFactory;
36
import org.apache.juli.logging.LogFactory;
37
import org.apache.tomcat.util.ExceptionUtils;
37
import org.apache.tomcat.util.modeler.Registry;
38
import org.apache.tomcat.util.modeler.Registry;
38
39
39
40
Lines 315-321 Link Here
315
                try {
316
                try {
316
                    ((Contained) oldBasic).setContainer(null);
317
                    ((Contained) oldBasic).setContainer(null);
317
                } catch (Throwable t) {
318
                } catch (Throwable t) {
318
                    // Ignore
319
                    ExceptionUtils.handleThrowable(t);
319
                }
320
                }
320
            }
321
            }
321
        }
322
        }
(-)java/org/apache/catalina/core/StandardWrapper.java (-1 / +2 lines)
Lines 60-65 Link Here
60
import org.apache.catalina.util.LifecycleBase;
60
import org.apache.catalina.util.LifecycleBase;
61
import org.apache.tomcat.InstanceManager;
61
import org.apache.tomcat.InstanceManager;
62
import org.apache.tomcat.PeriodicEventListener;
62
import org.apache.tomcat.PeriodicEventListener;
63
import org.apache.tomcat.util.ExceptionUtils;
63
import org.apache.tomcat.util.log.SystemLogHandler;
64
import org.apache.tomcat.util.log.SystemLogHandler;
64
import org.apache.tomcat.util.modeler.Registry;
65
import org.apache.tomcat.util.modeler.Registry;
65
66
Lines 585-591 Link Here
585
        try {
586
        try {
586
            loadServlet();
587
            loadServlet();
587
        } catch (Throwable t) {
588
        } catch (Throwable t) {
588
            // Ignore
589
            ExceptionUtils.handleThrowable(t);
589
        }
590
        }
590
        return (singleThreadModel);
591
        return (singleThreadModel);
591
592
(-)java/org/apache/catalina/ha/session/DeltaManager.java (-1 / +2 lines)
Lines 43-48 Link Here
43
import org.apache.catalina.tribes.Member;
43
import org.apache.catalina.tribes.Member;
44
import org.apache.catalina.tribes.io.ReplicationStream;
44
import org.apache.catalina.tribes.io.ReplicationStream;
45
import org.apache.catalina.util.LifecycleBase;
45
import org.apache.catalina.util.LifecycleBase;
46
import org.apache.tomcat.util.ExceptionUtils;
46
import org.apache.tomcat.util.res.StringManager;
47
import org.apache.tomcat.util.res.StringManager;
47
import org.apache.catalina.ha.ClusterManager;
48
import org.apache.catalina.ha.ClusterManager;
48
49
Lines 979-985 Link Here
979
            try {
980
            try {
980
                session.expire(true, isExpireSessionsOnShutdown());
981
                session.expire(true, isExpireSessionsOnShutdown());
981
            } catch (Throwable ignore) {
982
            } catch (Throwable ignore) {
982
                // Ignore
983
                ExceptionUtils.handleThrowable(t);
983
            } 
984
            } 
984
        }
985
        }
985
986
(-)java/org/apache/catalina/manager/ManagerServlet.java (-4 / +5 lines)
Lines 56-61 Link Here
56
import org.apache.catalina.core.StandardServer;
56
import org.apache.catalina.core.StandardServer;
57
import org.apache.catalina.util.RequestUtil;
57
import org.apache.catalina.util.RequestUtil;
58
import org.apache.catalina.util.ServerInfo;
58
import org.apache.catalina.util.ServerInfo;
59
import org.apache.tomcat.util.ExceptionUtils;
59
import org.apache.tomcat.util.res.StringManager;
60
import org.apache.tomcat.util.res.StringManager;
60
import org.apache.tomcat.util.modeler.Registry;
61
import org.apache.tomcat.util.modeler.Registry;
61
62
Lines 442-448 Link Here
442
            value = getServletConfig().getInitParameter("debug");
443
            value = getServletConfig().getInitParameter("debug");
443
            debug = Integer.parseInt(value);
444
            debug = Integer.parseInt(value);
444
        } catch (Throwable t) {
445
        } catch (Throwable t) {
445
            // Ignore
446
        	ExceptionUtils.handleThrowable(t);
446
        }
447
        }
447
448
448
        // Acquire global JNDI resources if available
449
        // Acquire global JNDI resources if available
Lines 1348-1354 Link Here
1348
                    // Try to stop the context first to be nicer
1349
                    // Try to stop the context first to be nicer
1349
                    context.stop();
1350
                    context.stop();
1350
                } catch (Throwable t) {
1351
                } catch (Throwable t) {
1351
                    // Ignore
1352
                	ExceptionUtils.handleThrowable(t);
1352
                }
1353
                }
1353
                try {
1354
                try {
1354
                    if (path.lastIndexOf('/') > 0) {
1355
                    if (path.lastIndexOf('/') > 0) {
Lines 1560-1566 Link Here
1560
                try {
1561
                try {
1561
                    ostream.close();
1562
                    ostream.close();
1562
                } catch (Throwable t) {
1563
                } catch (Throwable t) {
1563
                    // Ignore
1564
                	ExceptionUtils.handleThrowable(t);
1564
                }
1565
                }
1565
                ostream = null;
1566
                ostream = null;
1566
            }
1567
            }
Lines 1568-1574 Link Here
1568
                try {
1569
                try {
1569
                    istream.close();
1570
                    istream.close();
1570
                } catch (Throwable t) {
1571
                } catch (Throwable t) {
1571
                    // Ignore
1572
                	ExceptionUtils.handleThrowable(t);
1572
                }
1573
                }
1573
                istream = null;
1574
                istream = null;
1574
            }
1575
            }
(-)java/org/apache/catalina/manager/StatusTransformer.java (-1 / +2 lines)
Lines 33-38 Link Here
33
import javax.servlet.http.HttpServletResponse;
33
import javax.servlet.http.HttpServletResponse;
34
34
35
import org.apache.catalina.util.RequestUtil;
35
import org.apache.catalina.util.RequestUtil;
36
import org.apache.tomcat.util.ExceptionUtils;
36
37
37
/**
38
/**
38
 * This is a refactoring of the servlet to externalize
39
 * This is a refactoring of the servlet to externalize
Lines 158-164 Link Here
158
            method.invoke(null, paramValues);
159
            method.invoke(null, paramValues);
159
            ok = true;
160
            ok = true;
160
        } catch (Throwable t) {
161
        } catch (Throwable t) {
161
            // Ignore
162
        	ExceptionUtils.handleThrowable(t);
162
        }
163
        }
163
        
164
        
164
        if (ok) {
165
        if (ok) {
(-)java/org/apache/catalina/manager/host/HostManagerServlet.java (-1 / +2 lines)
Lines 42-47 Link Here
42
import org.apache.catalina.Wrapper;
42
import org.apache.catalina.Wrapper;
43
import org.apache.catalina.core.StandardHost;
43
import org.apache.catalina.core.StandardHost;
44
import org.apache.catalina.startup.HostConfig;
44
import org.apache.catalina.startup.HostConfig;
45
import org.apache.tomcat.util.ExceptionUtils;
45
import org.apache.tomcat.util.res.StringManager;
46
import org.apache.tomcat.util.res.StringManager;
46
import org.apache.tomcat.util.modeler.Registry;
47
import org.apache.tomcat.util.modeler.Registry;
47
import org.apache.catalina.core.ContainerBase;
48
import org.apache.catalina.core.ContainerBase;
Lines 316-322 Link Here
316
            value = getServletConfig().getInitParameter("debug");
317
            value = getServletConfig().getInitParameter("debug");
317
            debug = Integer.parseInt(value);
318
            debug = Integer.parseInt(value);
318
        } catch (Throwable t) {
319
        } catch (Throwable t) {
319
            // Ignore
320
        	ExceptionUtils.handleThrowable(t);
320
        }
321
        }
321
322
322
    }
323
    }
(-)java/org/apache/catalina/mbeans/MBeanUtils.java (-1 / +2 lines)
Lines 54-59 Link Here
54
import org.apache.coyote.http11.Http11AprProtocol;
54
import org.apache.coyote.http11.Http11AprProtocol;
55
import org.apache.coyote.http11.Http11NioProtocol;
55
import org.apache.coyote.http11.Http11NioProtocol;
56
import org.apache.coyote.http11.Http11Protocol;
56
import org.apache.coyote.http11.Http11Protocol;
57
import org.apache.tomcat.util.ExceptionUtils;
57
import org.apache.tomcat.util.IntrospectionUtils;
58
import org.apache.tomcat.util.IntrospectionUtils;
58
import org.apache.tomcat.util.modeler.ManagedBean;
59
import org.apache.tomcat.util.modeler.ManagedBean;
59
import org.apache.tomcat.util.modeler.Registry;
60
import org.apache.tomcat.util.modeler.Registry;
Lines 1617-1623 Link Here
1617
        try {
1618
        try {
1618
            ((Contained)valve).setContainer(null);
1619
            ((Contained)valve).setContainer(null);
1619
        } catch (Throwable t) {
1620
        } catch (Throwable t) {
1620
            // Ignore
1621
        	ExceptionUtils.handleThrowable(t);
1621
        }
1622
        }
1622
        if( mserver.isRegistered(oname) ) {
1623
        if( mserver.isRegistered(oname) ) {
1623
            mserver.unregisterMBean(oname);
1624
            mserver.unregisterMBean(oname);
(-)java/org/apache/catalina/realm/JDBCRealm.java (-2 / +3 lines)
Lines 30-35 Link Here
30
30
31
import org.apache.catalina.LifecycleException;
31
import org.apache.catalina.LifecycleException;
32
import org.apache.catalina.util.LifecycleBase;
32
import org.apache.catalina.util.LifecycleBase;
33
import org.apache.tomcat.util.ExceptionUtils;
33
34
34
35
35
/**
36
/**
Lines 450-456 Link Here
450
        try {
451
        try {
451
            preparedCredentials.close();
452
            preparedCredentials.close();
452
        } catch (Throwable f) {
453
        } catch (Throwable f) {
453
            // Ignore
454
        	ExceptionUtils.handleThrowable(f);
454
        }
455
        }
455
        this.preparedCredentials = null;
456
        this.preparedCredentials = null;
456
457
Lines 458-464 Link Here
458
        try {
459
        try {
459
            preparedRoles.close();
460
            preparedRoles.close();
460
        } catch (Throwable f) {
461
        } catch (Throwable f) {
461
            // Ignore
462
        	ExceptionUtils.handleThrowable(f);
462
        }
463
        }
463
        this.preparedRoles = null;
464
        this.preparedRoles = null;
464
465
(-)java/org/apache/catalina/session/JDBCStore.java (-6 / +7 lines)
Lines 23-28 Link Here
23
import org.apache.catalina.Session;
23
import org.apache.catalina.Session;
24
import org.apache.catalina.util.CustomObjectInputStream;
24
import org.apache.catalina.util.CustomObjectInputStream;
25
import org.apache.catalina.util.LifecycleBase;
25
import org.apache.catalina.util.LifecycleBase;
26
import org.apache.tomcat.util.ExceptionUtils;
26
27
27
import java.io.BufferedInputStream;
28
import java.io.BufferedInputStream;
28
import java.io.BufferedOutputStream;
29
import java.io.BufferedOutputStream;
Lines 901-941 Link Here
901
        try {
902
        try {
902
            preparedSizeSql.close();
903
            preparedSizeSql.close();
903
        } catch (Throwable f) {
904
        } catch (Throwable f) {
904
            // Ignore
905
        	ExceptionUtils.handleThrowable(f);
905
        }
906
        }
906
        this.preparedSizeSql = null;
907
        this.preparedSizeSql = null;
907
908
908
        try {
909
        try {
909
            preparedKeysSql.close();
910
            preparedKeysSql.close();
910
        } catch (Throwable f) {
911
        } catch (Throwable f) {
911
            // Ignore
912
        	ExceptionUtils.handleThrowable(f);
912
        }
913
        }
913
        this.preparedKeysSql = null;
914
        this.preparedKeysSql = null;
914
915
915
        try {
916
        try {
916
            preparedSaveSql.close();
917
            preparedSaveSql.close();
917
        } catch (Throwable f) {
918
        } catch (Throwable f) {
918
            // Ignore
919
        	ExceptionUtils.handleThrowable(f);
919
        }
920
        }
920
        this.preparedSaveSql = null;
921
        this.preparedSaveSql = null;
921
922
922
        try {
923
        try {
923
            preparedClearSql.close();
924
            preparedClearSql.close();
924
        } catch (Throwable f) {
925
        } catch (Throwable f) {
925
            // Ignore
926
        	ExceptionUtils.handleThrowable(f);
926
        }
927
        }
927
         
928
         
928
		try {
929
		try {
929
            preparedRemoveSql.close();
930
            preparedRemoveSql.close();
930
        } catch (Throwable f) {
931
        } catch (Throwable f) {
931
            // Ignore
932
        	ExceptionUtils.handleThrowable(f);
932
        }
933
        }
933
        this.preparedRemoveSql = null;
934
        this.preparedRemoveSql = null;
934
935
935
        try {
936
        try {
936
            preparedLoadSql.close();
937
            preparedLoadSql.close();
937
        } catch (Throwable f) {
938
        } catch (Throwable f) {
938
            // Ignore
939
        	ExceptionUtils.handleThrowable(f);
939
        }
940
        }
940
        this.preparedLoadSql = null;
941
        this.preparedLoadSql = null;
941
942
(-)java/org/apache/catalina/session/ManagerBase.java (-1 / +2 lines)
Lines 50-55 Link Here
50
import org.apache.catalina.core.StandardContext;
50
import org.apache.catalina.core.StandardContext;
51
import org.apache.catalina.core.StandardHost;
51
import org.apache.catalina.core.StandardHost;
52
import org.apache.catalina.util.LifecycleBase;
52
import org.apache.catalina.util.LifecycleBase;
53
import org.apache.tomcat.util.ExceptionUtils;
53
import org.apache.tomcat.util.res.StringManager;
54
import org.apache.tomcat.util.res.StringManager;
54
import org.apache.juli.logging.Log;
55
import org.apache.juli.logging.Log;
55
import org.apache.juli.logging.LogFactory;
56
import org.apache.juli.logging.LogFactory;
Lines 402-408 Link Here
402
                method.invoke(null, paramValues);
403
                method.invoke(null, paramValues);
403
                apr = true;
404
                apr = true;
404
            } catch (Throwable t) {
405
            } catch (Throwable t) {
405
                // Ignore
406
            	ExceptionUtils.handleThrowable(t);
406
            }
407
            }
407
            if (apr) {
408
            if (apr) {
408
                setEntropy(new String(result));
409
                setEntropy(new String(result));
(-)java/org/apache/catalina/session/StandardManager.java (-2 / +3 lines)
Lines 47-52 Link Here
47
import org.apache.catalina.security.SecurityUtil;
47
import org.apache.catalina.security.SecurityUtil;
48
import org.apache.juli.logging.Log;
48
import org.apache.juli.logging.Log;
49
import org.apache.juli.logging.LogFactory;
49
import org.apache.juli.logging.LogFactory;
50
import org.apache.tomcat.util.ExceptionUtils;
50
/**
51
/**
51
 * Standard implementation of the <b>Manager</b> interface that provides
52
 * Standard implementation of the <b>Manager</b> interface that provides
52
 * simple session persistence across restarts of this component (such as
53
 * simple session persistence across restarts of this component (such as
Lines 547-553 Link Here
547
            try {
548
            try {
548
                session.expire(false);
549
                session.expire(false);
549
            } catch (Throwable t) {
550
            } catch (Throwable t) {
550
                // Ignore
551
            	ExceptionUtils.handleThrowable(t);
551
            } finally {
552
            } finally {
552
                session.recycle();
553
                session.recycle();
553
            }
554
            }
Lines 621-627 Link Here
621
                    session.expire();
622
                    session.expire();
622
                }
623
                }
623
            } catch (Throwable t) {
624
            } catch (Throwable t) {
624
                // Ignore
625
            	ExceptionUtils.handleThrowable(t);
625
            } finally {
626
            } finally {
626
                // Measure against memory leaking if references to the session
627
                // Measure against memory leaking if references to the session
627
                // object are kept in a shared field somewhere
628
                // object are kept in a shared field somewhere
(-)java/org/apache/catalina/ssi/ResponseIncludeWrapper.java (-2 / +4 lines)
Lines 31-36 Link Here
31
import javax.servlet.http.HttpServletResponse;
31
import javax.servlet.http.HttpServletResponse;
32
import javax.servlet.http.HttpServletResponseWrapper;
32
import javax.servlet.http.HttpServletResponseWrapper;
33
33
34
import org.apache.tomcat.util.ExceptionUtils;
35
34
/**
36
/**
35
 * A HttpServletResponseWrapper, used from
37
 * A HttpServletResponseWrapper, used from
36
 * <code>SSIServletExternalResolver</code>
38
 * <code>SSIServletExternalResolver</code>
Lines 228-234 Link Here
228
                    lastModified = RFC1123_FORMAT.parse(value).getTime();
230
                    lastModified = RFC1123_FORMAT.parse(value).getTime();
229
                }
231
                }
230
            } catch (Throwable ignore) {
232
            } catch (Throwable ignore) {
231
                // Ignore
233
            	ExceptionUtils.handleThrowable(ignore);
232
            }
234
            }
233
        } else if (lname.equals(CONTENT_TYPE)) {
235
        } else if (lname.equals(CONTENT_TYPE)) {
234
            contentType = value;
236
            contentType = value;
Lines 254-260 Link Here
254
                    lastModified = RFC1123_FORMAT.parse(value).getTime();
256
                    lastModified = RFC1123_FORMAT.parse(value).getTime();
255
                }
257
                }
256
            } catch (Throwable ignore) {
258
            } catch (Throwable ignore) {
257
                // Ignore
259
            	ExceptionUtils.handleThrowable(ignore);
258
            }
260
            }
259
        }
261
        }
260
        else if (lname.equals(CONTENT_TYPE))
262
        else if (lname.equals(CONTENT_TYPE))
(-)java/org/apache/catalina/startup/CatalinaProperties.java (-3 / +5 lines)
Lines 25-31 Link Here
25
import java.util.Enumeration;
25
import java.util.Enumeration;
26
import java.util.Properties;
26
import java.util.Properties;
27
27
28
import org.apache.tomcat.util.ExceptionUtils;
28
29
30
29
/**
31
/**
30
 * Utility class to read the bootstrap Catalina configuration.
32
 * Utility class to read the bootstrap Catalina configuration.
31
 *
33
 *
Lines 91-97 Link Here
91
                is = (new URL(configUrl)).openStream();
93
                is = (new URL(configUrl)).openStream();
92
            }
94
            }
93
        } catch (Throwable t) {
95
        } catch (Throwable t) {
94
            // Ignore
96
        	ExceptionUtils.handleThrowable(t);
95
        }
97
        }
96
98
97
        if (is == null) {
99
        if (is == null) {
Lines 101-107 Link Here
101
                File properties = new File(conf, "catalina.properties");
103
                File properties = new File(conf, "catalina.properties");
102
                is = new FileInputStream(properties);
104
                is = new FileInputStream(properties);
103
            } catch (Throwable t) {
105
            } catch (Throwable t) {
104
                // Ignore
106
            	ExceptionUtils.handleThrowable(t);
105
            }
107
            }
106
        }
108
        }
107
109
Lines 110-116 Link Here
110
                is = CatalinaProperties.class.getResourceAsStream
112
                is = CatalinaProperties.class.getResourceAsStream
111
                    ("/org/apache/catalina/startup/catalina.properties");
113
                    ("/org/apache/catalina/startup/catalina.properties");
112
            } catch (Throwable t) {
114
            } catch (Throwable t) {
113
                // Ignore
115
            	ExceptionUtils.handleThrowable(t);
114
            }
116
            }
115
        }
117
        }
116
118
(-)java/org/apache/catalina/startup/ContextConfig.java (-7 / +8 lines)
Lines 41-46 Link Here
41
41
42
import javax.servlet.ServletContext;
42
import javax.servlet.ServletContext;
43
43
44
import org.apache.tomcat.util.ExceptionUtils;
44
import org.apache.tomcat.util.bcel.classfile.AnnotationElementValue;
45
import org.apache.tomcat.util.bcel.classfile.AnnotationElementValue;
45
import org.apache.tomcat.util.bcel.classfile.AnnotationEntry;
46
import org.apache.tomcat.util.bcel.classfile.AnnotationEntry;
46
import org.apache.tomcat.util.bcel.classfile.ArrayElementValue;
47
import org.apache.tomcat.util.bcel.classfile.ArrayElementValue;
Lines 1521-1527 Link Here
1521
                            try {
1522
                            try {
1522
                                is.close();
1523
                                is.close();
1523
                            } catch (Throwable t) {
1524
                            } catch (Throwable t) {
1524
                                // ignore
1525
                            	ExceptionUtils.handleThrowable(t);
1525
                            }
1526
                            }
1526
                        }
1527
                        }
1527
                    }
1528
                    }
Lines 1534-1540 Link Here
1534
                try {
1535
                try {
1535
                    jarFile.close();
1536
                    jarFile.close();
1536
                } catch (Throwable t) {
1537
                } catch (Throwable t) {
1537
                    // ignore
1538
                	ExceptionUtils.handleThrowable(t);
1538
                }
1539
                }
1539
            }
1540
            }
1540
        }
1541
        }
Lines 1579-1585 Link Here
1579
                            try {
1580
                            try {
1580
                                is.close();
1581
                                is.close();
1581
                            } catch (Throwable t) {
1582
                            } catch (Throwable t) {
1582
                                // ignore
1583
                            	ExceptionUtils.handleThrowable(t);
1583
                            }
1584
                            }
1584
                        }
1585
                        }
1585
                    }
1586
                    }
Lines 1611-1617 Link Here
1611
                    try {
1612
                    try {
1612
                        fis.close();
1613
                        fis.close();
1613
                    } catch (Throwable t) {
1614
                    } catch (Throwable t) {
1614
                        // ignore
1615
                    	ExceptionUtils.handleThrowable(t);
1615
                    }
1616
                    }
1616
                }
1617
                }
1617
            }
1618
            }
Lines 1841-1854 Link Here
1841
                    try {
1842
                    try {
1842
                        jarFile.close();
1843
                        jarFile.close();
1843
                    } catch (Throwable t) {
1844
                    } catch (Throwable t) {
1844
                        // ignore
1845
                    	ExceptionUtils.handleThrowable(t);
1845
                    }
1846
                    }
1846
                }
1847
                }
1847
                if (stream != null) {
1848
                if (stream != null) {
1848
                    try {
1849
                    try {
1849
                        stream.close();
1850
                        stream.close();
1850
                    } catch (Throwable t) {
1851
                    } catch (Throwable t) {
1851
                        // ignore
1852
                    	ExceptionUtils.handleThrowable(t);
1852
                    }
1853
                    }
1853
                }
1854
                }
1854
                fragment.setURL(urlConn.getURL());
1855
                fragment.setURL(urlConn.getURL());
Lines 1880-1886 Link Here
1880
                    try {
1881
                    try {
1881
                        stream.close();
1882
                        stream.close();
1882
                    } catch (Throwable t) {
1883
                    } catch (Throwable t) {
1883
                        // ignore
1884
                    	ExceptionUtils.handleThrowable(t);
1884
                    }
1885
                    }
1885
                }
1886
                }
1886
                if (fragment == null) {
1887
                if (fragment == null) {
(-)java/org/apache/catalina/startup/ExpandWar.java (-3 / +4 lines)
Lines 32-37 Link Here
32
import java.util.jar.JarFile;
32
import java.util.jar.JarFile;
33
33
34
import org.apache.catalina.Host;
34
import org.apache.catalina.Host;
35
import org.apache.tomcat.util.ExceptionUtils;
35
import org.apache.tomcat.util.res.StringManager;
36
import org.apache.tomcat.util.res.StringManager;
36
import org.apache.juli.logging.Log;
37
import org.apache.juli.logging.Log;
37
import org.apache.juli.logging.LogFactory;
38
import org.apache.juli.logging.LogFactory;
Lines 153-159 Link Here
153
                try {
154
                try {
154
                    input.close();
155
                    input.close();
155
                } catch (Throwable t) {
156
                } catch (Throwable t) {
156
                    // Ignore
157
                	ExceptionUtils.handleThrowable(t);
157
                }
158
                }
158
                input = null;
159
                input = null;
159
            }
160
            }
Lines 161-167 Link Here
161
                try {
162
                try {
162
                    jarFile.close();
163
                    jarFile.close();
163
                } catch (Throwable t) {
164
                } catch (Throwable t) {
164
                    // Ignore
165
                	ExceptionUtils.handleThrowable(t);
165
                }
166
                }
166
                jarFile = null;
167
                jarFile = null;
167
            }
168
            }
Lines 228-234 Link Here
228
                try {
229
                try {
229
                    jarFile.close();
230
                    jarFile.close();
230
                } catch (Throwable t) {
231
                } catch (Throwable t) {
231
                    // Ignore
232
                	ExceptionUtils.handleThrowable(t);
232
                }
233
                }
233
                jarFile = null;
234
                jarFile = null;
234
            }
235
            }
(-)java/org/apache/catalina/startup/HostConfig.java (-5 / +6 lines)
Lines 49-54 Link Here
49
import org.apache.catalina.util.IOTools;
49
import org.apache.catalina.util.IOTools;
50
import org.apache.juli.logging.Log;
50
import org.apache.juli.logging.Log;
51
import org.apache.juli.logging.LogFactory;
51
import org.apache.juli.logging.LogFactory;
52
import org.apache.tomcat.util.ExceptionUtils;
52
import org.apache.tomcat.util.res.StringManager;
53
import org.apache.tomcat.util.res.StringManager;
53
import org.apache.tomcat.util.digester.Digester;
54
import org.apache.tomcat.util.digester.Digester;
54
import org.apache.tomcat.util.modeler.Registry;
55
import org.apache.tomcat.util.modeler.Registry;
Lines 872-878 Link Here
872
                    try {
873
                    try {
873
                        ostream.close();
874
                        ostream.close();
874
                    } catch (Throwable t) {
875
                    } catch (Throwable t) {
875
                        // Ignore
876
                    	ExceptionUtils.handleThrowable(t);
876
                    }
877
                    }
877
                    ostream = null;
878
                    ostream = null;
878
                }
879
                }
Lines 880-886 Link Here
880
                    try {
881
                    try {
881
                        istream.close();
882
                        istream.close();
882
                    } catch (Throwable t) {
883
                    } catch (Throwable t) {
883
                        // Ignore
884
                    	ExceptionUtils.handleThrowable(t);
884
                    }
885
                    }
885
                    istream = null;
886
                    istream = null;
886
                }
887
                }
Lines 890-896 Link Here
890
                    try {
891
                    try {
891
                        jar.close();
892
                        jar.close();
892
                    } catch (Throwable t) {
893
                    } catch (Throwable t) {
893
                        // Ignore
894
                    	ExceptionUtils.handleThrowable(t);
894
                    }
895
                    }
895
                    jar = null;
896
                    jar = null;
896
                }
897
                }
Lines 942-948 Link Here
942
                            try {
943
                            try {
943
                                istream.close();
944
                                istream.close();
944
                            } catch (Throwable t) {
945
                            } catch (Throwable t) {
945
                                // Ignore
946
                            	ExceptionUtils.handleThrowable(t);
946
                            }
947
                            }
947
                            istream = null;
948
                            istream = null;
948
                        }
949
                        }
Lines 952-958 Link Here
952
                            try {
953
                            try {
953
                                jar.close();
954
                                jar.close();
954
                            } catch (Throwable t) {
955
                            } catch (Throwable t) {
955
                                // Ignore
956
                            	ExceptionUtils.handleThrowable(t);
956
                            }
957
                            }
957
                            jar = null;
958
                            jar = null;
958
                        }
959
                        }
(-)java/org/apache/catalina/startup/TldConfig.java (-1 / +2 lines)
Lines 45-50 Link Here
45
import org.apache.catalina.core.StandardHost;
45
import org.apache.catalina.core.StandardHost;
46
import org.apache.tomcat.JarScanner;
46
import org.apache.tomcat.JarScanner;
47
import org.apache.tomcat.JarScannerCallback;
47
import org.apache.tomcat.JarScannerCallback;
48
import org.apache.tomcat.util.ExceptionUtils;
48
import org.apache.tomcat.util.res.StringManager;
49
import org.apache.tomcat.util.res.StringManager;
49
import org.apache.tomcat.util.digester.Digester;
50
import org.apache.tomcat.util.digester.Digester;
50
import org.xml.sax.InputSource;
51
import org.xml.sax.InputSource;
Lines 518-524 Link Here
518
                try {
519
                try {
519
                    jarFile.close();
520
                    jarFile.close();
520
                } catch (Throwable t) {
521
                } catch (Throwable t) {
521
                    // ignore
522
                	ExceptionUtils.handleThrowable(t);
522
                }
523
                }
523
            }
524
            }
524
        }
525
        }
(-)java/org/apache/catalina/users/MemoryUserDatabase.java (-1 / +2 lines)
Lines 31-36 Link Here
31
import org.apache.catalina.Role;
31
import org.apache.catalina.Role;
32
import org.apache.catalina.User;
32
import org.apache.catalina.User;
33
import org.apache.catalina.UserDatabase;
33
import org.apache.catalina.UserDatabase;
34
import org.apache.tomcat.util.ExceptionUtils;
34
import org.apache.tomcat.util.res.StringManager;
35
import org.apache.tomcat.util.res.StringManager;
35
import org.apache.juli.logging.Log;
36
import org.apache.juli.logging.Log;
36
import org.apache.juli.logging.LogFactory;
37
import org.apache.juli.logging.LogFactory;
Lines 412-418 Link Here
412
                    try {
413
                    try {
413
                        fis.close();
414
                        fis.close();
414
                    } catch (Throwable t) {
415
                    } catch (Throwable t) {
415
                        // Ignore
416
                    	ExceptionUtils.handleThrowable(t);
416
                    }
417
                    }
417
                    throw e;
418
                    throw e;
418
                }
419
                }
(-)java/org/apache/catalina/util/ExtensionValidator.java (-3 / +4 lines)
Lines 35-40 Link Here
35
35
36
import org.apache.catalina.Context;
36
import org.apache.catalina.Context;
37
import org.apache.naming.resources.Resource;
37
import org.apache.naming.resources.Resource;
38
import org.apache.tomcat.util.ExceptionUtils;
38
import org.apache.tomcat.util.res.StringManager;
39
import org.apache.tomcat.util.res.StringManager;
39
40
40
41
Lines 167-173 Link Here
167
                try {
168
                try {
168
                    inputStream.close();
169
                    inputStream.close();
169
                } catch (Throwable t) {
170
                } catch (Throwable t) {
170
                    // Ignore
171
                	ExceptionUtils.handleThrowable(t);
171
                }
172
                }
172
            }
173
            }
173
        }
174
        }
Lines 206-212 Link Here
206
                try {
207
                try {
207
                    inputStream.close();
208
                    inputStream.close();
208
                } catch (Throwable t) {
209
                } catch (Throwable t) {
209
                    // Ignore
210
                	ExceptionUtils.handleThrowable(t);
210
                }
211
                }
211
            }
212
            }
212
        }
213
        }
Lines 397-403 Link Here
397
                try {
398
                try {
398
                    jin.close();
399
                    jin.close();
399
                } catch (Throwable t) {
400
                } catch (Throwable t) {
400
                    // Ignore
401
                	ExceptionUtils.handleThrowable(t);
401
                }
402
                }
402
            }
403
            }
403
        }
404
        }
(-)java/org/apache/catalina/valves/ErrorReportValve.java (-2 / +3 lines)
Lines 30-35 Link Here
30
import org.apache.catalina.connector.Response;
30
import org.apache.catalina.connector.Response;
31
import org.apache.catalina.util.RequestUtil;
31
import org.apache.catalina.util.RequestUtil;
32
import org.apache.catalina.util.ServerInfo;
32
import org.apache.catalina.util.ServerInfo;
33
import org.apache.tomcat.util.ExceptionUtils;
33
import org.apache.tomcat.util.res.StringManager;
34
import org.apache.tomcat.util.res.StringManager;
34
35
35
/**
36
/**
Lines 139-145 Link Here
139
        try {
140
        try {
140
            report(request, response, throwable);
141
            report(request, response, throwable);
141
        } catch (Throwable tt) {
142
        } catch (Throwable tt) {
142
            // Ignore
143
        	ExceptionUtils.handleThrowable(tt);
143
        }
144
        }
144
145
145
    }
146
    }
Lines 176-182 Link Here
176
        try {
177
        try {
177
            report = sm.getString("http." + statusCode, message);
178
            report = sm.getString("http." + statusCode, message);
178
        } catch (Throwable t) {
179
        } catch (Throwable t) {
179
            // Ignore
180
        	ExceptionUtils.handleThrowable(t);
180
        }
181
        }
181
        if (report == null)
182
        if (report == null)
182
            return;
183
            return;
(-)java/org/apache/catalina/valves/JDBCAccessLogValve.java (-1 / +2 lines)
Lines 34-39 Link Here
34
import org.apache.catalina.connector.Request;
34
import org.apache.catalina.connector.Request;
35
import org.apache.catalina.connector.Response;
35
import org.apache.catalina.connector.Response;
36
import org.apache.catalina.util.LifecycleBase;
36
import org.apache.catalina.util.LifecycleBase;
37
import org.apache.tomcat.util.ExceptionUtils;
37
import org.apache.tomcat.util.res.StringManager;
38
import org.apache.tomcat.util.res.StringManager;
38
39
39
/**
40
/**
Lines 575-581 Link Here
575
        try {
576
        try {
576
            ps.close();
577
            ps.close();
577
        } catch (Throwable f) {
578
        } catch (Throwable f) {
578
            // Ignore
579
        	ExceptionUtils.handleThrowable(f);
579
        }
580
        }
580
        this.ps = null;
581
        this.ps = null;
581
582
(-)java/org/apache/jasper/compiler/TldLocationsCache.java (-1 / +2 lines)
Lines 38-43 Link Here
38
import org.apache.jasper.xmlparser.TreeNode;
38
import org.apache.jasper.xmlparser.TreeNode;
39
import org.apache.tomcat.JarScanner;
39
import org.apache.tomcat.JarScanner;
40
import org.apache.tomcat.JarScannerCallback;
40
import org.apache.tomcat.JarScannerCallback;
41
import org.apache.tomcat.util.ExceptionUtils;
41
42
42
/**
43
/**
43
 * A container for all tag libraries that are defined "globally"
44
 * A container for all tag libraries that are defined "globally"
Lines 388-394 Link Here
388
                try {
389
                try {
389
                    jarFile.close();
390
                    jarFile.close();
390
                } catch (Throwable t) {
391
                } catch (Throwable t) {
391
                    // ignore
392
                	ExceptionUtils.handleThrowable(t);
392
                }
393
                }
393
            }
394
            }
394
        }
395
        }
(-)java/org/apache/jasper/servlet/JspCServletContext.java (-1 / +3 lines)
Lines 44-50 Link Here
44
import javax.servlet.FilterRegistration.Dynamic;
44
import javax.servlet.FilterRegistration.Dynamic;
45
import javax.servlet.descriptor.JspConfigDescriptor;
45
import javax.servlet.descriptor.JspConfigDescriptor;
46
46
47
import org.apache.tomcat.util.ExceptionUtils;
47
48
49
48
/**
50
/**
49
 * Simple <code>ServletContext</code> implementation without
51
 * Simple <code>ServletContext</code> implementation without
50
 * HTTP-specific methods.
52
 * HTTP-specific methods.
Lines 267-273 Link Here
267
                try {
269
                try {
268
                    is.close();
270
                    is.close();
269
                } catch (Throwable t2) {
271
                } catch (Throwable t2) {
270
                    // Ignore
272
                	ExceptionUtils.handleThrowable(t2);
271
                }
273
                }
272
            }
274
            }
273
        }
275
        }
(-)java/org/apache/tomcat/util/ExceptionUtils.java (+38 lines)
Line 0 Link Here
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
3
 * contributor license agreements.  See the NOTICE file distributed with
4
 * this work for additional information regarding copyright ownership.
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
6
 * (the "License"); you may not use this file except in compliance with
7
 * the License.  You may obtain a copy of the License at
8
 * 
9
 *      http://www.apache.org/licenses/LICENSE-2.0
10
 * 
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
package org.apache.tomcat.util;
18
19
/**
20
 * Utilities for handling Throwables and Exceptions.
21
 */
22
public class ExceptionUtils {
23
	
24
	/**
25
	 * Checks whether the supplied Throwable is one that needs to be 
26
	 * rethrown and swallows all others.
27
	 * @param t the Throwable to check
28
	 */
29
	public static void handleThrowable(Throwable t) {
30
		if (t instanceof ThreadDeath) {
31
			throw (ThreadDeath) t;
32
		}
33
		if (t instanceof VirtualMachineError) {
34
			throw (VirtualMachineError) t;
35
		}
36
		// All other instances of Throwable will be silently swallowed
37
	}
38
}
(-)modules/tomcat-lite/java/org/apache/tomcat/servlets/session/RandomGenerator.java (-1 / +3 lines)
Lines 28-33 Link Here
28
import java.util.logging.Level;
28
import java.util.logging.Level;
29
import java.util.logging.Logger;
29
import java.util.logging.Logger;
30
30
31
import org.apache.tomcat.util.ExceptionUtils;
32
31
/**
33
/**
32
 *  Generates random IDs, useable as cookies.
34
 *  Generates random IDs, useable as cookies.
33
 * 
35
 * 
Lines 252-258 Link Here
252
                method.invoke(null, paramValues);
254
                method.invoke(null, paramValues);
253
                apr = true;
255
                apr = true;
254
            } catch (Throwable t) {
256
            } catch (Throwable t) {
255
                // Ignore
257
            	ExceptionUtils.handleThrowable(t);
256
            }
258
            }
257
            if (apr) {
259
            if (apr) {
258
                setEntropy(new String(result));
260
                setEntropy(new String(result));

Return to bug 48644