aclute      2005/08/24 07:48:57

  Modified:    src/java/org/apache/ojb/broker/core/proxy Tag:
                        OJB_1_0_RELEASE OJBSerializableProxy.java
  Log:
  Handle exceptions a little bit more gracefully, as we don't want to kill the 
entire stack
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.1.2.2   +8 -2      
db-ojb/src/java/org/apache/ojb/broker/core/proxy/Attic/OJBSerializableProxy.java
  
  Index: OJBSerializableProxy.java
  ===================================================================
  RCS file: 
/home/cvs/db-ojb/src/java/org/apache/ojb/broker/core/proxy/Attic/OJBSerializableProxy.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- OJBSerializableProxy.java 17 Aug 2005 21:19:39 -0000      1.1.2.1
  +++ OJBSerializableProxy.java 24 Aug 2005 14:48:56 -0000      1.1.2.2
  @@ -16,6 +16,9 @@
   import java.io.ObjectStreamException;
   import java.io.Serializable;
   
  +import org.apache.ojb.broker.util.logging.Logger;
  +import org.apache.ojb.broker.util.logging.LoggerFactory;
  +
   /**
    * @author andrew.clute
    * Simple class that is serializable, and containes references to an 
IndirectionHandler
  @@ -27,6 +30,7 @@
   {
   
        private static final long serialVersionUID = 568312334450175549L;
  +     private Logger logger = 
LoggerFactory.getLogger(OJBSerializableProxy.class);
   
        private Class classObject;
   
  @@ -43,9 +47,11 @@
                try
                {
                        return 
ProxyHelper.getProxyFactory().createProxy(classObject, indirectionHandler);
  -             } catch (Exception e)
  +             } catch (Throwable e)
                {
  -                     e.printStackTrace();
  +                     //Fail gracefully -- there a bunch of reasons why we 
cannot create the Proxy, and
  +                     //so we just want to put a null into the reference.
  +                     logger.warn("Unable to create a new Proxy of type '" + 
classObject.getName() + "' due to a '" + e.getClass().getName() + "'.");
                        return null;
                }
        }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to