Improve exception handling in PersistentManagerBase.
authorkkolinko <kkolinko@13f79535-47bb-0310-9956-ffa450edef68>
Mon, 25 Oct 2010 00:13:56 +0000 (00:13 +0000)
committerkkolinko <kkolinko@13f79535-47bb-0310-9956-ffa450edef68>
Mon, 25 Oct 2010 00:13:56 +0000 (00:13 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1026920 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/session/PersistentManagerBase.java

index afa70c5..b288bc2 100644 (file)
@@ -412,15 +412,14 @@ public abstract class PersistentManagerBase extends ManagerBase {
                     AccessController.doPrivileged(new PrivilegedStoreClear());
                 }catch(PrivilegedActionException ex){
                     Exception exception = ex.getException();
-                    log.error("Exception clearing the Store: " + exception);
-                    exception.printStackTrace();                        
+                    log.error("Exception clearing the Store: " + exception,
+                            exception);
                 }
             } else {
                 store.clear();
             }
         } catch (IOException e) {
-            log.error("Exception clearing the Store: " + e);
-            e.printStackTrace();
+            log.error("Exception clearing the Store: " + e, e);
         }
 
     }
@@ -609,15 +608,13 @@ public abstract class PersistentManagerBase extends ManagerBase {
                 }catch(PrivilegedActionException ex){
                     Exception exception = ex.getException();
                     log.error("Exception in the Store during removeSession: "
-                              + exception);
-                    exception.printStackTrace();                        
+                              + exception, exception);
                 }
             } else {
                  store.remove(id);
             }               
         } catch (IOException e) {
-            log.error("Exception removing session  " + e.getMessage());
-            e.printStackTrace();
+            log.error("Exception removing session  " + e.getMessage(), e);
         }        
     }
 
@@ -797,9 +794,11 @@ public abstract class PersistentManagerBase extends ManagerBase {
                     AccessController.doPrivileged(new PrivilegedStoreSave(session));
                 }catch(PrivilegedActionException ex){
                     Exception exception = ex.getException();
+                    if (exception instanceof IOException) {
+                        throw (IOException) exception;
+                    }
                     log.error("Exception in the Store during writeSession: "
-                              + exception);
-                    exception.printStackTrace();                        
+                              + exception, exception);
                 }
             } else {
                  store.save(session);