directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: rev 10330 - incubator/directory/rms/trunk/je/src/java/org/apache/rms/je/permissions
Date Wed, 28 Apr 2004 00:11:14 GMT
Author: akarasulu
Date: Tue Apr 27 17:11:13 2004
New Revision: 10330

Modified:
   incubator/directory/rms/trunk/je/src/java/org/apache/rms/je/permissions/BitPermissionDAOMonitorAdapter.java
   incubator/directory/rms/trunk/je/src/java/org/apache/rms/je/permissions/BitPermissionIndexDAOMonitorAdapter.java
   incubator/directory/rms/trunk/je/src/java/org/apache/rms/je/permissions/LoggingBitPermissionDAOMonitor.java
   incubator/directory/rms/trunk/je/src/java/org/apache/rms/je/permissions/LoggingBitPermissionIndexDAOMonitor.java
Log:
Commit changes ...
 
 o wrapped all monitor callback blocks in try catch for Throwable
 o made adapters check for null exceptions since they report exceptions



Modified: incubator/directory/rms/trunk/je/src/java/org/apache/rms/je/permissions/BitPermissionDAOMonitorAdapter.java
==============================================================================
--- incubator/directory/rms/trunk/je/src/java/org/apache/rms/je/permissions/BitPermissionDAOMonitorAdapter.java
(original)
+++ incubator/directory/rms/trunk/je/src/java/org/apache/rms/je/permissions/BitPermissionDAOMonitorAdapter.java
Tue Apr 27 17:11:13 2004
@@ -41,7 +41,10 @@
     public void failedOnCreate( BitPermissionDAO dao, String appName,
                                 String name, Throwable fault )
     {
-        fault.printStackTrace() ;
+        if ( fault != null )
+        {
+            fault.printStackTrace() ;
+        }
     }
 
 
@@ -98,7 +101,10 @@
     public void deleteFailed( BitPermissionDAO dao, String appName,
                               String name, Throwable fault )
     {
-        fault.printStackTrace() ;
+        if ( fault != null )
+        {
+            fault.printStackTrace() ;
+        }
     }
 
 
@@ -144,7 +150,10 @@
     public void failedOnRename( JeBitPermissionDAO dao, String appName,
                                 String name, String newName, Throwable fault )
     {
-        fault.printStackTrace() ;
+        if ( fault != null )
+        {
+            fault.printStackTrace() ;
+        }
     }
 
 
@@ -187,7 +196,10 @@
     public void failedPermissionLookup( JeBitPermissionDAO dao, String appName,
                                         String name, Throwable fault )
     {
-        fault.printStackTrace() ;
+        if ( fault != null )
+        {
+            fault.printStackTrace() ;
+        }
     }
 
 
@@ -214,7 +226,10 @@
     public void failedNameLookup( JeBitPermissionDAO dao, String appName,
                                   int index, Throwable fault )
     {
-        fault.printStackTrace() ;
+        if ( fault != null )
+        {
+            fault.printStackTrace() ;
+        }
     }
 
 
@@ -245,7 +260,10 @@
                                         String appName, int index,
                                         Throwable fault )
     {
-        fault.printStackTrace() ;
+        if ( fault != null )
+        {
+            fault.printStackTrace() ;
+        }
     }
 
 
@@ -260,7 +278,10 @@
     public void failedOnCleanupOperation( JeBitPermissionDAO dao, String op,
                                           Object resource, Throwable fault )
     {
-        fault.printStackTrace() ;
+        if ( fault != null )
+        {
+            fault.printStackTrace() ;
+        }
     }
 
 
@@ -332,7 +353,10 @@
                                String appName, boolean onlyNames,
                                Throwable fault )
     {
-        fault.printStackTrace() ;
+        if ( fault != null )
+        {
+            fault.printStackTrace() ;
+        }
     }
 
 
@@ -387,7 +411,10 @@
                                  String appName, boolean onlyNames,
                                  Object retVal, Throwable fault )
     {
-        fault.printStackTrace() ;
+        if ( fault != null )
+        {
+            fault.printStackTrace() ;
+        }
     }
 
 

Modified: incubator/directory/rms/trunk/je/src/java/org/apache/rms/je/permissions/BitPermissionIndexDAOMonitorAdapter.java
==============================================================================
--- incubator/directory/rms/trunk/je/src/java/org/apache/rms/je/permissions/BitPermissionIndexDAOMonitorAdapter.java
(original)
+++ incubator/directory/rms/trunk/je/src/java/org/apache/rms/je/permissions/BitPermissionIndexDAOMonitorAdapter.java
Tue Apr 27 17:11:13 2004
@@ -58,7 +58,10 @@
     public void putFailure( BitPermissionIndexDAO dao, String appName,
                             int index, Throwable fault )
     {
-        fault.printStackTrace() ;
+        if ( fault != null )
+        {
+            fault.printStackTrace() ;
+        }
     }
 
 
@@ -87,7 +90,10 @@
     public void deleteFailure( BitPermissionIndexDAO dao, String appName,
                                int index, Throwable fault )
     {
-        fault.printStackTrace() ;
+        if ( fault != null )
+        {
+            fault.printStackTrace() ;
+        }
     }
 
 
@@ -115,7 +121,10 @@
     public void lookupFailure( BitPermissionIndexDAO dao, String appName,
                                int index, Throwable fault )
     {
-        fault.printStackTrace() ;
+        if ( fault != null )
+        {
+            fault.printStackTrace() ;
+        }
     }
 
 
@@ -130,7 +139,10 @@
     public void closeFailure( BitPermissionIndexDAO dao, Object o,
                               Throwable fault )
     {
-        fault.printStackTrace() ;
+        if ( fault != null )
+        {
+            fault.printStackTrace() ;
+        }
     }
 
 
@@ -145,7 +157,10 @@
     public void listFailure( BitPermissionIndexDAO dao, String appName,
                              Throwable fault )
     {
-        fault.printStackTrace() ;
+        if ( fault != null )
+        {
+            fault.printStackTrace() ;
+        }
     }
 
 
@@ -172,7 +187,10 @@
     public void getFirstFailure( BitPermissionIndexDAO dao, String appName,
                                  Throwable fault )
     {
-        fault.printStackTrace() ;
+        if ( fault != null )
+        {
+            fault.printStackTrace() ;
+        }
     }
 
 
@@ -200,7 +218,10 @@
     public void getLastFailure( BitPermissionIndexDAO dao, String appName,
                                 Throwable fault )
     {
-        fault.printStackTrace() ;
+        if ( fault != null )
+        {
+            fault.printStackTrace() ;
+        }
     }
 
 

Modified: incubator/directory/rms/trunk/je/src/java/org/apache/rms/je/permissions/LoggingBitPermissionDAOMonitor.java
==============================================================================
--- incubator/directory/rms/trunk/je/src/java/org/apache/rms/je/permissions/LoggingBitPermissionDAOMonitor.java
(original)
+++ incubator/directory/rms/trunk/je/src/java/org/apache/rms/je/permissions/LoggingBitPermissionDAOMonitor.java
Tue Apr 27 17:11:13 2004
@@ -18,15 +18,14 @@
 
 
 import java.util.Iterator ;
-import java.io.IOException;
+import java.io.IOException ;
 
 import org.apache.rms.BitPermission ;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.commons.logging.impl.SimpleLog;
-import org.apache.commons.logging.impl.Jdk14Logger;
-import com.sleepycat.bind.EntryBinding;
-import com.sleepycat.je.DatabaseEntry;
+import org.apache.commons.logging.Log ;
+import org.apache.commons.logging.LogFactory ;
+
+import com.sleepycat.je.DatabaseEntry ;
+import com.sleepycat.bind.EntryBinding ;
 
 
 /**
@@ -40,7 +39,7 @@
     /** the entry <-> object binding used for prefetched entry transformation */
     private EntryBinding BINDING = new JeBitPermissionTupleBinding() ;
     /** the log used by this logging monitor */
-    private Log log = LogFactory.getLog( "BitPermissionDAO" ) ;
+    private Log log = LogFactory.getLog( BitPermissionDAO.class ) ;
 
 
     /**
@@ -54,11 +53,18 @@
     public void failedOnCreate( BitPermissionDAO dao, String appName,
                                 String name, Throwable fault )
     {
-        if ( log.isErrorEnabled() )
+        try
+        {
+            if ( log.isErrorEnabled() )
+            {
+                log.error( "Creation of permission with name " + name
+                        + " for application " + appName + " failed using " + dao,
+                        fault ) ;
+            }
+        }
+        catch ( Throwable t )
         {
-            log.error( "Creation of permission with name " + name
-                    + " for application " + appName + " failed using " + dao,
-                    fault ) ;
+            log.warn( "monitor failure", t ) ;
         }
     }
 
@@ -76,11 +82,17 @@
     public void permissionExists( BitPermissionDAO dao, String op,
                                   String appName, String name )
     {
-        if ( log.isWarnEnabled() )
+        try {
+            if ( log.isWarnEnabled() )
+            {
+                log.warn( dao + "." + op + "() on permission " + name
+                        + " for application " + appName + " failed"
+                        + " because a permission by that name already exists" ) ;
+            }
+        }
+        catch ( Throwable t )
         {
-            log.warn( dao + "." + op + "() on permission " + name
-                    + " for application " + appName + " failed"
-                    + " because a permission by that name already exists" ) ;
+            log.warn( "monitor failure", t ) ;
         }
     }
 
@@ -95,11 +107,18 @@
     public void permissionCreated( BitPermissionDAO dao, String appName,
                                    String name )
     {
-        if ( log.isDebugEnabled() )
+        try
         {
-            log.debug( "Creation of permission with name " + name
-                    + " for application " + appName + " succeeded using "
-                    + dao ) ;
+            if ( log.isDebugEnabled() )
+            {
+                log.debug( "Creation of permission with name " + name
+                        + " for application " + appName + " succeeded using "
+                        + dao ) ;
+            }
+        }
+        catch ( Throwable t )
+        {
+            log.warn( "monitor failure", t ) ;
         }
     }
 
@@ -114,11 +133,18 @@
     public void permissionDeleted( BitPermissionDAO dao, String appName,
                                    String name )
     {
-        if ( log.isDebugEnabled() )
+        try
         {
-            log.debug( "Deletion of permission with name " + name
-                    + " for application " + appName + " succeeded using "
-                    + dao ) ;
+            if ( log.isDebugEnabled() )
+            {
+                log.debug( "Deletion of permission with name " + name
+                        + " for application " + appName + " succeeded using "
+                        + dao ) ;
+            }
+        }
+        catch ( Throwable t )
+        {
+            log.warn( "monitor failure", t ) ;
         }
     }
 
@@ -134,11 +160,18 @@
     public void deleteFailed( BitPermissionDAO dao, String appName,
                               String name, Throwable fault )
     {
-        if ( log.isErrorEnabled() )
+        try
         {
-            log.error( "Deletion of permission with name " + name
-                    + " for application " + appName + " failed using "
-                    + dao, fault ) ;
+            if ( log.isErrorEnabled() )
+            {
+                log.error( "Deletion of permission with name " + name
+                        + " for application " + appName + " failed using "
+                        + dao, fault ) ;
+            }
+        }
+        catch ( Throwable t )
+        {
+            log.warn( "monitor failure", t ) ;
         }
     }
 
@@ -155,11 +188,18 @@
     public void permissionDoesNotExist( BitPermissionDAO dao, String op,
                                         String appName, String name )
     {
-        if ( log.isWarnEnabled() )
+        try
         {
-            log.warn( "Attempt to " + op + " permission with name " + name
-                    + " for application " + appName
-                    + " failed because no such permission exists." ) ;
+            if ( log.isWarnEnabled() )
+            {
+                log.warn( "Attempt to " + op + " permission with name " + name
+                        + " for application " + appName
+                        + " failed because no such permission exists." ) ;
+            }
+        }
+        catch ( Throwable t )
+        {
+            log.warn( "monitor failure", t ) ;
         }
     }
 
@@ -176,11 +216,18 @@
     public void permissionDoesNotExist( JeBitPermissionDAO dao, String op,
                                         String appName, int index )
     {
-        if ( log.isWarnEnabled() )
+        try
+        {
+            if ( log.isWarnEnabled() )
+            {
+                log.warn( "Attempt to " + op + " permission with index " + index
+                    + " for application " + appName
+                    + " failed because no such permission exists." ) ;
+            }
+        }
+        catch ( Throwable t )
         {
-            log.warn( "Attempt to " + op + " permission with index " + index
-                + " for application " + appName
-                + " failed because no such permission exists." ) ;
+            log.warn( "monitor failure", t ) ;
         }
     }
 
@@ -197,11 +244,18 @@
     public void failedOnRename( JeBitPermissionDAO dao, String appName,
                                 String name, String newName, Throwable fault )
     {
-        if ( log.isErrorEnabled() )
+        try
         {
-            log.error( "Rename of permission originally named " + name
-                    + " to new name of " + newName + " for application "
-                    + appName + " failed using " + dao, fault ) ;
+            if ( log.isErrorEnabled() )
+            {
+                log.error( "Rename of permission originally named " + name
+                        + " to new name of " + newName + " for application "
+                        + appName + " failed using " + dao, fault ) ;
+            }
+        }
+        catch ( Throwable t )
+        {
+            log.warn( "monitor failure", t ) ;
         }
     }
 
@@ -217,11 +271,18 @@
     public void permissionRenamed( JeBitPermissionDAO dao, String appName,
                                    String name, String newName )
     {
-        if ( log.isDebugEnabled() )
+        try
+        {
+            if ( log.isDebugEnabled() )
+            {
+                log.debug( "Rename of permission originally named " + name
+                        + " to new name of " + newName + " for application "
+                        + appName + " succeeded using " + dao ) ;
+            }
+        }
+        catch ( Throwable t )
         {
-            log.debug( "Rename of permission originally named " + name
-                    + " to new name of " + newName + " for application "
-                    + appName + " succeeded using " + dao ) ;
+            log.warn( "monitor failure", t ) ;
         }
     }
 
@@ -237,11 +298,18 @@
     public void indexLookedUp( JeBitPermissionDAO dao, String appName,
                                String name, int index )
     {
-        if ( log.isDebugEnabled() )
+        try
+        {
+            if ( log.isDebugEnabled() )
+            {
+                log.debug( "Lookup of permission named " + name
+                        + " with index " + name + " for application "
+                        + appName + " succeeded using " + dao ) ;
+            }
+        }
+        catch ( Throwable t )
         {
-            log.debug( "Lookup of permission named " + name
-                    + " with index " + name + " for application "
-                    + appName + " succeeded using " + dao ) ;
+            log.warn( "monitor failure", t ) ;
         }
     }
 
@@ -257,11 +325,18 @@
     public void failedPermissionLookup( JeBitPermissionDAO dao, String appName,
                                         String name, Throwable fault )
     {
-        if ( log.isErrorEnabled() )
+        try
         {
-            log.error( "Lookup of permission with name " + name
-                    + " for application " + appName + " failed using " + dao,
-                    fault ) ;
+            if ( log.isErrorEnabled() )
+            {
+                log.error( "Lookup of permission with name " + name
+                        + " for application " + appName + " failed using " + dao,
+                        fault ) ;
+            }
+        }
+        catch ( Throwable t )
+        {
+            log.warn( "monitor failure", t ) ;
         }
     }
 
@@ -278,11 +353,18 @@
                                         String appName, int index,
                                         Throwable fault )
     {
-        if ( log.isErrorEnabled() )
+        try
+        {
+            if ( log.isErrorEnabled() )
+            {
+                log.error( "Lookup of permission with index " + index
+                        + " for application " + appName + " failed using " + dao,
+                        fault ) ;
+            }
+        }
+        catch ( Throwable t )
         {
-            log.error( "Lookup of permission with index " + index
-                    + " for application " + appName + " failed using " + dao,
-                    fault ) ;
+            log.warn( "monitor failure", t ) ;
         }
     }
 
@@ -296,11 +378,18 @@
     public void permissionLookedUp( JeBitPermissionDAO dao,
                                     BitPermission perm )
     {
-        if ( log.isDebugEnabled() )
+        try
+        {
+            if ( log.isDebugEnabled() )
+            {
+                log.debug( "Lookup of permission named " + perm.getName()
+                        + " with index " + perm.getIndex() + " for application "
+                        + perm.getApplication() + " succeeded using " + dao ) ;
+            }
+        }
+        catch ( Throwable t )
         {
-            log.debug( "Lookup of permission named " + perm.getName()
-                    + " with index " + perm.getIndex() + " for application "
-                    + perm.getApplication() + " succeeded using " + dao ) ;
+            log.warn( "monitor failure", t ) ;
         }
     }
 
@@ -316,11 +405,18 @@
     public void failedNameLookup( JeBitPermissionDAO dao, String appName,
                                   int index, Throwable fault )
     {
-        if ( log.isErrorEnabled() )
+        try
         {
-            log.error( "Lookup of a permission's name with index " + index
-                    + " for application " + appName + " failed using " + dao,
-                    fault ) ;
+            if ( log.isErrorEnabled() )
+            {
+                log.error( "Lookup of a permission's name with index " + index
+                        + " for application " + appName + " failed using " + dao,
+                        fault ) ;
+            }
+        }
+        catch ( Throwable t )
+        {
+            log.warn( "monitor failure", t ) ;
         }
     }
 
@@ -337,11 +433,18 @@
     public void nameLookedUP( JeBitPermissionDAO dao, String appName,
                               String name, int index )
     {
-        if ( log.isDebugEnabled() )
+        try
         {
-            log.debug( "Lookup of permission name " + name + " with index "
-                    + index + " for application " + appName
-                    + " succeeded using " + dao ) ;
+            if ( log.isDebugEnabled() )
+            {
+                log.debug( "Lookup of permission name " + name + " with index "
+                        + index + " for application " + appName
+                        + " succeeded using " + dao ) ;
+            }
+        }
+        catch ( Throwable t )
+        {
+            log.warn( "monitor failure", t ) ;
         }
     }
 
@@ -357,10 +460,17 @@
     public void failedOnCleanupOperation( JeBitPermissionDAO dao, String op,
                                           Object resource, Throwable fault )
     {
-        if ( log.isWarnEnabled() )
+        try
+        {
+            if ( log.isWarnEnabled() )
+            {
+                log.warn( dao + " clean up of resource failed while calling "
+                        + resource + "." + op + "()", fault ) ;
+            }
+        }
+        catch ( Throwable t )
         {
-            log.warn( dao + " clean up of resource failed while calling "
-                    + resource + "." + op + "()", fault ) ;
+            log.warn( "monitor failure", t ) ;
         }
     }
 
@@ -374,10 +484,17 @@
      */
     public void cleanedUp( JeBitPermissionDAO dao, String op, Object resource )
     {
-        if ( log.isDebugEnabled() )
+        try
         {
-            log.debug( dao + " cleaned up resource by calling " + resource
-                    + "." + op + "()" ) ;
+            if ( log.isDebugEnabled() )
+            {
+                log.debug( dao + " cleaned up resource by calling " + resource
+                        + "." + op + "()" ) ;
+            }
+        }
+        catch ( Throwable t )
+        {
+            log.warn( "monitor failure", t ) ;
         }
     }
 
@@ -395,22 +512,29 @@
     public void listingEmpty( JeBitPermissionDAO dao, Iterator listing,
                               String appName, boolean onlyNames )
     {
-        if ( log.isDebugEnabled() )
+        try
         {
-            String itemType = null ;
-
-            if ( onlyNames )
+            if ( log.isDebugEnabled() )
             {
-                itemType = "String name" ;
-            }
-            else
-            {
-                itemType = "BitPermission object" ;
-            }
+                String itemType = null ;
 
-            log.debug( "Iterator " + listing + " was successfully created over"
-                    + " an empty set of " + itemType + "s for application "
-                    + appName ) ;
+                if ( onlyNames )
+                {
+                    itemType = "String name" ;
+                }
+                else
+                {
+                    itemType = "BitPermission object" ;
+                }
+
+                log.debug( "Iterator " + listing + " was successfully created over"
+                        + " an empty set of " + itemType + "s for application "
+                        + appName ) ;
+            }
+        }
+        catch ( Throwable t )
+        {
+            log.warn( "monitor failure", t ) ;
         }
     }
 
@@ -426,11 +550,18 @@
     public void listingNamesOnly( JeBitPermissionDAO dao, Iterator listing,
                                   String appName )
     {
-        if ( log.isDebugEnabled() )
+        try
         {
-            log.debug( "Iterator " + listing + " was successfully created over"
-                    + " the set of BitPermission names only for application "
-                    + appName ) ;
+            if ( log.isDebugEnabled() )
+            {
+                log.debug( "Iterator " + listing + " was successfully created over"
+                        + " the set of BitPermission names only for application "
+                        + appName ) ;
+            }
+        }
+        catch ( Throwable t )
+        {
+            log.warn( "monitor failure", t ) ;
         }
     }
 
@@ -446,11 +577,18 @@
     public void listingPermissions( JeBitPermissionDAO dao, Iterator listing,
                                     String appName )
     {
-        if ( log.isDebugEnabled() )
+        try
         {
-            log.debug( "Iterator " + listing + " was successfully created "
-                + "over the set of BitPermissions for application "
-                + appName ) ;
+            if ( log.isDebugEnabled() )
+            {
+                log.debug( "Iterator " + listing + " was successfully created "
+                    + "over the set of BitPermissions for application "
+                    + appName ) ;
+            }
+        }
+        catch ( Throwable t )
+        {
+            log.warn( "monitor failure", t ) ;
         }
     }
 
@@ -469,21 +607,28 @@
     {
         String itemType = null ;
 
-        if ( log.isErrorEnabled() )
+        try
         {
-            if ( onlyNames )
+            if ( log.isErrorEnabled() )
             {
-                itemType = "String name" ;
-            }
-            else
-            {
-                itemType = "BitPermission object" ;
-            }
+                if ( onlyNames )
+                {
+                    itemType = "String name" ;
+                }
+                else
+                {
+                    itemType = "BitPermission object" ;
+                }
 
-            log.error( "Iterator " + listing + " created by " + dao
-                    + " to return items of " + itemType
-                    + " for application " + appName
-                    + " failed to initialize", fault ) ;
+                log.error( "Iterator " + listing + " created by " + dao
+                        + " to return items of " + itemType
+                        + " for application " + appName
+                        + " failed to initialize", fault ) ;
+            }
+        }
+        catch ( Throwable t )
+        {
+            log.warn( "monitor failure", t ) ;
         }
     }
 
@@ -502,13 +647,36 @@
                                    String appName, Object retVal,
                                    Object prefetched )
     {
-        if ( log.isDebugEnabled() )
+        try
         {
-            String name = new String( ( ( DatabaseEntry ) prefetched ).getData() ) ;
-            log.debug( "Iterator " + listing + " created by " + dao
-                    + " successfully prefetch a BitPermission name of " + name
-                    + " for application " + appName
-                    + " after retrieving the value " + retVal ) ;
+            String name = null ;
+
+            if ( log.isDebugEnabled() )
+            {
+                if ( prefetched instanceof DatabaseEntry )
+                {
+                    DatabaseEntry entry = ( DatabaseEntry ) prefetched ;
+                    name = new String( entry.getData() ) ;
+                }
+                else if ( prefetched instanceof String )
+                {
+                    name = ( String ) prefetched ;
+                }
+                else
+                {
+                    throw new IllegalArgumentException( "unknow type "
+                            + prefetched.getClass() ) ;
+                }
+
+                log.debug( "Iterator " + listing + " created by " + dao
+                        + " successfully prefetch a BitPermission name of " + name
+                        + " for application " + appName
+                        + " after retrieving the value " + retVal ) ;
+            }
+        }
+        catch ( Throwable t )
+        {
+            log.warn( "monitor failure", t ) ;
         }
     }
 
@@ -529,29 +697,36 @@
     {
         BitPermission perm = null ;
 
-        if ( log.isDebugEnabled() )
+        try
         {
-            if ( prefetched instanceof BitPermission )
-            {
-                perm = ( BitPermission ) prefetched ;
-            }
-            else if ( prefetched instanceof DatabaseEntry )
+            if ( log.isDebugEnabled() )
             {
-                try
+                if ( prefetched instanceof BitPermission )
                 {
-                    perm = ( BitPermission )
-                            BINDING.entryToObject( ( DatabaseEntry ) prefetched ) ;
+                    perm = ( BitPermission ) prefetched ;
                 }
-                catch ( IOException e )
+                else if ( prefetched instanceof DatabaseEntry )
                 {
-                    log.error( "Failed to bind database entry to BitPermission" ) ;
+                    try
+                    {
+                        perm = ( BitPermission )
+                                BINDING.entryToObject( ( DatabaseEntry ) prefetched ) ;
+                    }
+                    catch ( IOException e )
+                    {
+                        log.error( "Failed to bind database entry to BitPermission" ) ;
+                    }
                 }
-            }
 
-            log.debug( "Iterator " + listing + " created by " + dao
-                    + " successfully prefetch a BitPermission of " + perm
-                    + " for application " + appName
-                    + " after retrieving the value " + retVal ) ;
+                log.debug( "Iterator " + listing + " created by " + dao
+                        + " successfully prefetch a BitPermission of " + perm
+                        + " for application " + appName
+                        + " after retrieving the value " + retVal ) ;
+            }
+        }
+        catch ( Throwable t )
+        {
+            log.warn( "monitor failure", t ) ;
         }
     }
 
@@ -575,21 +750,28 @@
     {
         String itemType = null ;
 
-        if ( log.isErrorEnabled() )
+        try
         {
-            if ( onlyNames )
-            {
-                itemType = "String name" ;
-            }
-            else
+            if ( log.isErrorEnabled() )
             {
-                itemType = "BitPermission object" ;
-            }
+                if ( onlyNames )
+                {
+                    itemType = "String name" ;
+                }
+                else
+                {
+                    itemType = "BitPermission object" ;
+                }
 
-            log.error( "Iterator " + listing + " created by " + dao
-                    + " failed on prefetch of " + itemType
-                    + " for application " + appName
-                    + " after retrieving the value " + retVal, fault ) ;
+                log.error( "Iterator " + listing + " created by " + dao
+                        + " failed on prefetch of " + itemType
+                        + " for application " + appName
+                        + " after retrieving the value " + retVal, fault ) ;
+            }
+        }
+        catch ( Throwable t )
+        {
+            log.warn( "monitor failure", t ) ;
         }
     }
 
@@ -611,20 +793,27 @@
     {
         String itemType = null ;
 
-        if ( log.isDebugEnabled() )
+        try
         {
-            if ( onlyNames )
-            {
-                itemType = "String names" ;
-            }
-            else
+            if ( log.isDebugEnabled() )
             {
-                itemType = "BitPermission objects" ;
-            }
+                if ( onlyNames )
+                {
+                    itemType = "String names" ;
+                }
+                else
+                {
+                    itemType = "BitPermission objects" ;
+                }
 
-            log.debug( "Iterator " + listing + " created by " + dao
-                    + " exhaused all " + itemType + " for application "
-                    + appName + ".  Will return final value of " + lastVal ) ;
+                log.debug( "Iterator " + listing + " created by " + dao
+                        + " exhaused all " + itemType + " for application "
+                        + appName + ".  Will return final value of " + lastVal ) ;
+            }
+        }
+        catch ( Throwable t )
+        {
+            log.warn( "monitor failure", t ) ;
         }
     }
 }

Modified: incubator/directory/rms/trunk/je/src/java/org/apache/rms/je/permissions/LoggingBitPermissionIndexDAOMonitor.java
==============================================================================
--- incubator/directory/rms/trunk/je/src/java/org/apache/rms/je/permissions/LoggingBitPermissionIndexDAOMonitor.java
(original)
+++ incubator/directory/rms/trunk/je/src/java/org/apache/rms/je/permissions/LoggingBitPermissionIndexDAOMonitor.java
Tue Apr 27 17:11:13 2004
@@ -47,11 +47,18 @@
     public void putFailure( BitPermissionIndexDAO dao, Object info,
                             String appName, int index )
     {
-        if ( log.isErrorEnabled() )
+        try
         {
-            String msg = dao + ".put(" + appName + ", " + index
-                    + ") failed: " + info.toString() ;
-            log.error( msg ) ;
+            if ( log.isErrorEnabled() )
+            {
+                String msg = dao + ".put(" + appName + ", " + index
+                        + ") failed: " + info.toString() ;
+                log.error( msg ) ;
+            }
+        }
+        catch ( Throwable t )
+        {
+            log.warn( "monitor failure", t ) ;
         }
     }
 
@@ -68,11 +75,18 @@
     public void putFailure( BitPermissionIndexDAO dao, String appName,
                             int index, Throwable fault )
     {
-        if ( log.isErrorEnabled() )
+        try
+        {
+            if ( log.isErrorEnabled() )
+            {
+                String msg = dao + ".put(" + appName + ", " + index
+                        + ") failed: " + fault.getMessage() ;
+                log.error( msg, fault ) ;
+            }
+        }
+        catch ( Throwable t )
         {
-            String msg = dao + ".put(" + appName + ", " + index
-                    + ") failed: " + fault.getMessage() ;
-            log.error( msg, fault ) ;
+            log.warn( "monitor failure", t ) ;
         }
     }
 
@@ -88,11 +102,18 @@
     public void deleteFailure( BitPermissionIndexDAO dao, Object info,
                                String appName, int index )
     {
-        if ( log.isErrorEnabled() )
+        try
+        {
+            if ( log.isErrorEnabled() )
+            {
+                String msg = dao + ".delete(" + appName + ", " + index
+                        + ") failed: " + info.toString() ;
+                log.error( msg ) ;
+            }
+        }
+        catch ( Throwable t )
         {
-            String msg = dao + ".delete(" + appName + ", " + index
-                    + ") failed: " + info.toString() ;
-            log.error( msg ) ;
+            log.warn( "monitor failure", t ) ;
         }
     }
 
@@ -108,11 +129,18 @@
     public void deleteFailure( BitPermissionIndexDAO dao, String appName,
                                int index, Throwable fault )
     {
-        if ( log.isErrorEnabled() )
+        try
         {
-            String msg = dao + ".delete(" + appName + ", " + index
-                    + ") failed: " + fault.getMessage() ;
-            log.error( msg, fault ) ;
+            if ( log.isErrorEnabled() )
+            {
+                String msg = dao + ".delete(" + appName + ", " + index
+                        + ") failed: " + fault.getMessage() ;
+                log.error( msg, fault ) ;
+            }
+        }
+        catch ( Throwable t )
+        {
+            log.warn( "monitor failure", t ) ;
         }
     }
 
@@ -127,11 +155,18 @@
     public void nothingToDelete( JeBitPermissionIndexDAO dao, String appName,
                                  int index )
     {
-        if ( log.isWarnEnabled() )
+        try
         {
-            String msg = dao + ".delete(" + appName + ", " + index
-                    + ") failed because the index does not exist" ;
-            log.warn( msg ) ;
+            if ( log.isWarnEnabled() )
+            {
+                String msg = dao + ".delete(" + appName + ", " + index
+                        + ") failed because the index does not exist" ;
+                log.warn( msg ) ;
+            }
+        }
+        catch ( Throwable t )
+        {
+            log.warn( "monitor failure", t ) ;
         }
     }
 
@@ -147,11 +182,18 @@
     public void lookupFailure( BitPermissionIndexDAO dao, String appName,
                                int index, Throwable fault )
     {
-        if ( log.isErrorEnabled() )
+        try
         {
-            String msg = dao + ".has(" + appName + ", " + index
-                    + ") failed: " + fault.getMessage() ;
-            log.error( msg, fault ) ;
+            if ( log.isErrorEnabled() )
+            {
+                String msg = dao + ".has(" + appName + ", " + index
+                        + ") failed: " + fault.getMessage() ;
+                log.error( msg, fault ) ;
+            }
+        }
+        catch ( Throwable t )
+        {
+            log.warn( "monitor failure", t ) ;
         }
     }
 
@@ -167,11 +209,18 @@
     public void closeFailure( BitPermissionIndexDAO dao, Object o,
                               Throwable fault )
     {
-        if ( log.isErrorEnabled() )
+        try
+        {
+            if ( log.isErrorEnabled() )
+            {
+                String msg = o + ".close() by " + dao + " failed: "
+                        + fault.getMessage() ;
+                log.error( msg, fault ) ;
+            }
+        }
+        catch ( Throwable t )
         {
-            String msg = o + ".close() by " + dao + " failed: "
-                    + fault.getMessage() ;
-            log.error( msg, fault ) ;
+            log.warn( "monitor failure", t ) ;
         }
     }
 
@@ -187,11 +236,18 @@
     public void listFailure( BitPermissionIndexDAO dao, String appName,
                              Throwable fault )
     {
-        if ( log.isErrorEnabled() )
+        try
+        {
+            if ( log.isErrorEnabled() )
+            {
+                String msg = dao + ".list(" + appName + ") failed: "
+                        + fault.getMessage() ;
+                log.error( msg, fault ) ;
+            }
+        }
+        catch ( Throwable t )
         {
-            String msg = dao + ".list(" + appName + ") failed: "
-                    + fault.getMessage() ;
-            log.error( msg, fault ) ;
+            log.warn( "monitor failure", t ) ;
         }
     }
 
@@ -205,11 +261,18 @@
      */
     public void noFirstElement( BitPermissionIndexDAO dao, String appName )
     {
-        if ( log.isWarnEnabled() )
+        try
         {
-            String msg = dao + ".getFirst(" + appName
-                    + ") failed since there are no indices for " + appName ;
-            log.warn( msg ) ;
+            if ( log.isWarnEnabled() )
+            {
+                String msg = dao + ".getFirst(" + appName
+                        + ") failed since there are no indices for " + appName ;
+                log.warn( msg ) ;
+            }
+        }
+        catch ( Throwable t )
+        {
+            log.warn( "monitor failure", t ) ;
         }
     }
 
@@ -225,11 +288,18 @@
     public void getFirstFailure( BitPermissionIndexDAO dao, String appName,
                                  Throwable fault )
     {
-        if ( log.isErrorEnabled() )
+        try
         {
-            String msg = dao + ".getFirst(" + appName + ") failed: "
-                    + fault.getMessage() ;
-            log.error( msg, fault ) ;
+            if ( log.isErrorEnabled() )
+            {
+                String msg = dao + ".getFirst(" + appName + ") failed: "
+                        + fault.getMessage() ;
+                log.error( msg, fault ) ;
+            }
+        }
+        catch ( Throwable t )
+        {
+            log.warn( "monitor failure", t ) ;
         }
     }
 
@@ -244,11 +314,18 @@
      */
     public void noLastElement( BitPermissionIndexDAO dao, String appName )
     {
-        if ( log.isWarnEnabled() )
+        try
+        {
+            if ( log.isWarnEnabled() )
+            {
+                String msg = dao + ".getLast(" + appName
+                        + ") failed since there are no indices for " + appName ;
+                log.warn( msg ) ;
+            }
+        }
+        catch ( Throwable t )
         {
-            String msg = dao + ".getLast(" + appName
-                    + ") failed since there are no indices for " + appName ;
-            log.warn( msg ) ;
+            log.warn( "monitor failure", t ) ;
         }
     }
 
@@ -264,11 +341,18 @@
     public void getLastFailure( BitPermissionIndexDAO dao, String appName,
                                 Throwable fault )
     {
-        if ( log.isErrorEnabled() )
+        try
+        {
+            if ( log.isErrorEnabled() )
+            {
+                String msg = dao + ".getLast(" + appName + ") failed: "
+                        + fault.getMessage() ;
+                log.error( msg, fault ) ;
+            }
+        }
+        catch ( Throwable t )
         {
-            String msg = dao + ".getLast(" + appName + ") failed: "
-                    + fault.getMessage() ;
-            log.error( msg, fault ) ;
+            log.warn( "monitor failure", t ) ;
         }
     }
 
@@ -281,10 +365,17 @@
      */
     public void listExhausted( BitPermissionIndexDAO dao, IntIterator list )
     {
-        if ( log.isDebugEnabled() )
+        try
         {
-            String msg = list + " created by " + dao + " has been consumed" ;
-            log.debug( msg ) ;
+            if ( log.isDebugEnabled() )
+            {
+                String msg = list + " created by " + dao + " has been consumed" ;
+                log.debug( msg ) ;
+            }
+        }
+        catch ( Throwable t )
+        {
+            log.warn( "monitor failure", t ) ;
         }
     }
 
@@ -299,11 +390,18 @@
     public void listNextSuccess( BitPermissionIndexDAO dao, IntIterator list,
                                  int retVal )
     {
-        if ( log.isDebugEnabled() )
+        try
         {
-            String msg = list + " created by " + dao + " returning " + retVal
-                    + " on next()" ;
-            log.debug( msg ) ;
+            if ( log.isDebugEnabled() )
+            {
+                String msg = list + " created by " + dao + " returning " + retVal
+                        + " on next()" ;
+                log.debug( msg ) ;
+            }
+        }
+        catch ( Throwable t )
+        {
+            log.warn( "monitor failure", t ) ;
         }
     }
 
@@ -316,9 +414,16 @@
      */
     public void closeSuccess( BitPermissionIndexDAO dao, Object resource )
     {
-        if ( log.isDebugEnabled() )
+        try
+        {
+            if ( log.isDebugEnabled() )
+            {
+                log.debug( resource + " closed by " + dao ) ;
+            }
+        }
+        catch ( Throwable t )
         {
-            log.debug( resource + " closed by " + dao ) ;
+            log.warn( "monitor failure", t ) ;
         }
     }
 
@@ -334,9 +439,16 @@
     public void getLastSuccess( BitPermissionIndexDAO dao, String appName,
                                 int index )
     {
-        if ( log.isDebugEnabled() )
+        try
+        {
+            if ( log.isDebugEnabled() )
+            {
+                log.debug( dao + ".getLast(" + appName + ") returned " + index ) ;
+            }
+        }
+        catch ( Throwable t )
         {
-            log.debug( dao + ".getLast(" + appName + ") returned " + index ) ;
+            log.warn( "monitor failure", t ) ;
         }
     }
 
@@ -352,9 +464,16 @@
     public void getFirstSuccess( BitPermissionIndexDAO dao, String appName,
                                  int index )
     {
-        if ( log.isDebugEnabled() )
+        try
         {
-            log.debug( dao + ".getFirst(" + appName + ") returned " + index );
+            if ( log.isDebugEnabled() )
+            {
+                log.debug( dao + ".getFirst(" + appName + ") returned " + index );
+            }
+        }
+        catch ( Throwable t )
+        {
+            log.warn( "monitor failure", t ) ;
         }
     }
 
@@ -369,9 +488,16 @@
     public void listSuccess( BitPermissionIndexDAO dao, String appName,
                              IntIterator list )
     {
-        if ( log.isDebugEnabled() )
+        try
         {
-            log.debug( dao + ".list(" + appName + ") returned " + list ) ;
+            if ( log.isDebugEnabled() )
+            {
+                log.debug( dao + ".list(" + appName + ") returned " + list ) ;
+            }
+        }
+        catch ( Throwable t )
+        {
+            log.warn( "monitor failure", t ) ;
         }
     }
 
@@ -389,10 +515,17 @@
     public void lookupSuccess( BitPermissionIndexDAO dao, String appName,
                                int index, boolean exists )
     {
-        if ( log.isDebugEnabled() )
+        try
+        {
+            if ( log.isDebugEnabled() )
+            {
+                log.debug( dao + ".has(" + appName + ", " + index + ") returned "
+                        + exists ) ;
+            }
+        }
+        catch ( Throwable t )
         {
-            log.debug( dao + ".has(" + appName + ", " + index + ") returned "
-                    + exists ) ;
+            log.warn( "monitor failure", t ) ;
         }
     }
 
@@ -408,10 +541,17 @@
     public void deleteSuccess( BitPermissionIndexDAO dao, String appName,
                                int index )
     {
-        if ( log.isDebugEnabled() )
+        try
+        {
+            if ( log.isDebugEnabled() )
+            {
+                log.debug( dao + ".delete(" + appName + ", " + index
+                        + ") succeeded" ) ;
+            }
+        }
+        catch ( Throwable t )
         {
-            log.debug( dao + ".delete(" + appName + ", " + index
-                    + ") succeeded" ) ;
+            log.warn( "monitor failure", t ) ;
         }
     }
 
@@ -427,10 +567,17 @@
     public void putSuccess( BitPermissionIndexDAO dao, String appName,
                             int index )
     {
-        if ( log.isDebugEnabled() )
+        try
+        {
+            if ( log.isDebugEnabled() )
+            {
+                log.debug( dao + ".put(" + appName + ", " + index
+                        + ") succeeded" ) ;
+            }
+        }
+        catch ( Throwable t )
         {
-            log.debug( dao + ".put(" + appName + ", " + index
-                    + ") succeeded" ) ;
+            log.warn( "monitor failure", t ) ;
         }
     }
 }

Mime
View raw message