Author: rwatler
Date: Thu Jan  1 21:02:30 2015
New Revision: 1648940

URL: http://svn.apache.org/r1648940
Log:
Correct exception logging/wrapping in SecurityConstraintsImpl implementations.

Modified:
    
portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/SecurityConstraintsImpl.java
    
portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/psml/SecurityConstraintsImpl.java

Modified: 
portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/SecurityConstraintsImpl.java
URL: 
http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/SecurityConstraintsImpl.java?rev=1648940&r1=1648939&r2=1648940&view=diff
==============================================================================
--- 
portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/SecurityConstraintsImpl.java
 (original)
+++ 
portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/SecurityConstraintsImpl.java
 Thu Jan  1 21:02:30 2015
@@ -207,14 +207,27 @@ public class SecurityConstraintsImpl imp
                 // since no other constraints were found
                 if ((getOwner() != null) && !actions.isEmpty())
                 {
-                    String action = (String)actions.get(0);
+                    String action = actions.get(0);
                     throw new 
SecurityException("SecurityConstraintsImpl.checkConstraints(): Access for " + 
action + " not permitted, (not owner).");
                 }
             }
         }
+        catch (SecurityException se)
+        {
+            // rethrow expected SecurityExceptions
+            throw se;
+        }
         catch (Exception e)
         {
-            log.error("Security constraints check exception: "+e);
+            // log and wrap other unexpected exceptions
+            if (log.isDebugEnabled())
+            {
+                log.error("Security constraints check exception: "+e, e);
+            }
+            else
+            {
+                log.error("Security constraints check exception: "+e);
+            }
             throw new 
SecurityException("SecurityConstraintsImpl.checkConstraints(): Exception 
detected: "+e);
         }
     }

Modified: 
portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/psml/SecurityConstraintsImpl.java
URL: 
http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/psml/SecurityConstraintsImpl.java?rev=1648940&r1=1648939&r2=1648940&view=diff
==============================================================================
--- 
portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/psml/SecurityConstraintsImpl.java
 (original)
+++ 
portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/psml/SecurityConstraintsImpl.java
 Thu Jan  1 21:02:30 2015
@@ -258,9 +258,22 @@ public class SecurityConstraintsImpl imp
                 }
             }
         }
+        catch (SecurityException se)
+        {
+            // rethrow expected SecurityExceptions
+            throw se;
+        }
         catch (Exception e)
         {
-            log.error("Security constraints check exception: "+e);
+            // log and wrap other unexpected exceptions
+            if (log.isDebugEnabled())
+            {
+                log.error("Security constraints check exception: "+e, e);
+            }
+            else
+            {
+                log.error("Security constraints check exception: "+e);
+            }
             throw new 
SecurityException("SecurityConstraintsImpl.checkConstraints(): Exception 
detected: "+e);
         }
     }



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

Reply via email to