Author: remm
Date: Thu Dec  6 15:04:24 2018
New Revision: 1848329

URL: http://svn.apache.org/viewvc?rev=1848329&view=rev
Log:
Add i18n for the session package.

Modified:
    tomcat/trunk/java/org/apache/catalina/session/LocalStrings.properties
    tomcat/trunk/java/org/apache/catalina/session/PersistentManagerBase.java

Modified: tomcat/trunk/java/org/apache/catalina/session/LocalStrings.properties
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/session/LocalStrings.properties?rev=1848329&r1=1848328&r2=1848329&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/session/LocalStrings.properties 
[UTF-8] (original)
+++ tomcat/trunk/java/org/apache/catalina/session/LocalStrings.properties 
[UTF-8] Thu Dec  6 15:04:24 2018
@@ -44,9 +44,14 @@ managerBase.setContextNotNew=It is illeg
 
 persistentManager.backupMaxIdle=Backing up session [{0}] to Store, idle for 
[{1}] seconds
 persistentManager.deserializeError=Error deserializing Session [{0}]: [{1}]
+persistentManager.isLoadedError=Error checking if session [{0}] is loaded in 
memory
 persistentManager.loading=Loading [{0}] persisted sessions
+persistentManager.removeError=Error removing session [{0}] from the store
 persistentManager.serializeError=Error serializing Session [{0}]: [{1}]
+persistentManager.storeClearError=Error clearning all sessions from the store
 persistentManager.storeKeysException=Unable to determine the list of session 
IDs for sessions in the session store, assuming that the store is empty
+persistentManager.storeLoadError=Error swapping in sessions from the store
+persistentManager.storeLoadKeysError=Error loading sessions keys from the store
 persistentManager.storeSizeException=Unable to determine the number of 
sessions in the session store, assuming that the store is empty
 persistentManager.swapIn=Swapping session [{0}] in from Store
 persistentManager.swapInException=Exception in the Store during swapIn: [{0}]

Modified: 
tomcat/trunk/java/org/apache/catalina/session/PersistentManagerBase.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/session/PersistentManagerBase.java?rev=1848329&r1=1848328&r2=1848329&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/session/PersistentManagerBase.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/session/PersistentManagerBase.java 
Thu Dec  6 15:04:24 2018
@@ -307,14 +307,15 @@ public abstract class PersistentManagerB
      *
      * @param id The session id for the session to be searched for
      * @return {@code true}, if the session id is loaded in memory
-     * otherwise {@code false} is returned
+     *  otherwise {@code false} is returned
      */
-    public boolean isLoaded( String id ){
+    public boolean isLoaded(String id){
         try {
-            if ( super.findSession(id) != null )
+            if (super.findSession(id) != null) {
                 return true;
+            }
         } catch (IOException e) {
-            log.error("checking isLoaded for id, " + id + ", "+e.getMessage(), 
e);
+            log.error(sm.getString("persistentManager.isLoadedError", id), e);
         }
         return false;
     }
@@ -397,19 +398,17 @@ public abstract class PersistentManagerB
             return;
 
         try {
-            if (SecurityUtil.isPackageProtectionEnabled()){
-                try{
+            if (SecurityUtil.isPackageProtectionEnabled()) {
+                try {
                     AccessController.doPrivileged(new PrivilegedStoreClear());
-                }catch(PrivilegedActionException ex){
-                    Exception exception = ex.getException();
-                    log.error("Exception clearing the Store: " + exception,
-                            exception);
+                } catch (PrivilegedActionException e) {
+                    
log.error(sm.getString("persistentManager.storeClearError"), e.getException());
                 }
             } else {
                 store.clear();
             }
         } catch (IOException e) {
-            log.error("Exception clearing the Store: " + e, e);
+            log.error(sm.getString("persistentManager.storeClearError"), e);
         }
 
     }
@@ -527,21 +526,19 @@ public abstract class PersistentManagerB
 
         String[] ids = null;
         try {
-            if (SecurityUtil.isPackageProtectionEnabled()){
-                try{
-                    ids = AccessController.doPrivileged(
-                            new PrivilegedStoreKeys());
-                }catch(PrivilegedActionException ex){
-                    Exception exception = ex.getException();
-                    log.error("Exception in the Store during load: "
-                              + exception, exception);
+            if (SecurityUtil.isPackageProtectionEnabled()) {
+                try {
+                    ids = AccessController.doPrivileged(new 
PrivilegedStoreKeys());
+                } catch (PrivilegedActionException e) {
+                    
log.error(sm.getString("persistentManager.storeLoadKeysError"),
+                            e.getException());
                     return;
                 }
             } else {
                 ids = store.keys();
             }
         } catch (IOException e) {
-            log.error("Can't load sessions from store, " + e.getMessage(), e);
+            log.error(sm.getString("persistentManager.storeLoadKeysError"), e);
             return;
         }
 
@@ -556,7 +553,7 @@ public abstract class PersistentManagerB
             try {
                 swapIn(ids[i]);
             } catch (IOException e) {
-                log.error("Failed load session from store, " + e.getMessage(), 
e);
+                log.error(sm.getString("persistentManager.storeLoadError"), e);
             }
 
     }
@@ -586,19 +583,17 @@ public abstract class PersistentManagerB
      */
     protected void removeSession(String id){
         try {
-            if (SecurityUtil.isPackageProtectionEnabled()){
-                try{
+            if (SecurityUtil.isPackageProtectionEnabled()) {
+                try {
                     AccessController.doPrivileged(new 
PrivilegedStoreRemove(id));
-                }catch(PrivilegedActionException ex){
-                    Exception exception = ex.getException();
-                    log.error("Exception in the Store during removeSession: "
-                              + exception, exception);
+                } catch (PrivilegedActionException e) {
+                    log.error(sm.getString("persistentManager.removeError"), 
e.getException());
                 }
             } else {
-                 store.remove(id);
+                store.remove(id);
             }
         } catch (IOException e) {
-            log.error("Exception removing session  " + e.getMessage(), e);
+            log.error(sm.getString("persistentManager.removeError"), e);
         }
     }
 
@@ -841,15 +836,14 @@ public abstract class PersistentManagerB
                     if (exception instanceof IOException) {
                         throw (IOException) exception;
                     }
-                    log.error("Exception in the Store during writeSession: "
-                              + exception, exception);
+                    log.error(sm.getString("persistentManager.serializeError",
+                            session.getIdInternal(), exception));
                 }
             } else {
                  store.save(session);
             }
         } catch (IOException e) {
-            log.error(sm.getString
-                ("persistentManager.serializeError", session.getIdInternal(), 
e));
+            log.error(sm.getString("persistentManager.serializeError", 
session.getIdInternal(), e));
             throw e;
         }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to