User: oberg   
  Date: 00/08/28 08:47:56

  Modified:    src/main/org/jboss/ejb/plugins BMPPersistenceManager.java
  Log:
  Fixed FinderException handling. Thanks to Paul Austin for fix!
  
  Revision  Changes    Path
  1.7       +17 -6     jboss/src/main/org/jboss/ejb/plugins/BMPPersistenceManager.java
  
  Index: BMPPersistenceManager.java
  ===================================================================
  RCS file: 
/products/cvs/ejboss/jboss/src/main/org/jboss/ejb/plugins/BMPPersistenceManager.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- BMPPersistenceManager.java        2000/08/25 01:55:56     1.6
  +++ BMPPersistenceManager.java        2000/08/28 15:47:55     1.7
  @@ -17,6 +17,7 @@
   
   import javax.ejb.EntityBean;
   import javax.ejb.CreateException;
  +import javax.ejb.FinderException;
   
   import org.jboss.util.FastKey;
   import org.jboss.ejb.Container;
  @@ -33,7 +34,7 @@
   *    @see <related>
   *    @author Rickard �berg ([EMAIL PROTECTED])
   *  @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a>
  -*    @version $Revision: 1.6 $
  +*    @version $Revision: 1.7 $
   */
   public class BMPPersistenceManager
   implements EntityPersistenceManager
  @@ -146,7 +147,7 @@
        }
        
        public Object findEntity(Method finderMethod, Object[] args, 
EntityEnterpriseContext ctx)
  -     throws RemoteException
  +        throws RemoteException, FinderException
        {
                // call the finder method
                Object objectId = callFinderMethod(finderMethod, args, ctx);
  @@ -156,7 +157,7 @@
        }
        
        public Collection findEntities(Method finderMethod, Object[] args, 
EntityEnterpriseContext ctx)
  -     throws RemoteException
  +     throws RemoteException, FinderException
        {
                // call the finder method
                Object result = callFinderMethod(finderMethod, args, ctx);
  @@ -262,7 +263,9 @@
        // Protected -----------------------------------------------------
        
        // Private -------------------------------------------------------
  -     private Object callFinderMethod(Method finderMethod, Object[] args, 
EntityEnterpriseContext ctx) throws RemoteException {
  +     private Object callFinderMethod(Method finderMethod, Object[] args, 
EntityEnterpriseContext ctx) 
  +      throws RemoteException, FinderException
  +   {
                // get the finder method
                Method callMethod = null;
                try {
  @@ -277,10 +280,18 @@
                Object result = null;
                try {
                        result = callMethod.invoke(ctx.getInstance(), args);
  -             } catch (Exception e) {
  +             } catch (InvocationTargetException e) {
  +        Throwable targetException = e.getTargetException();
  +        if (targetException instanceof FinderException) {
  +          throw (FinderException)targetException;
  +        }
  +        else {
  +          throw new ServerException("exception occured while invoking finder 
method", (Exception)targetException);
  +        }
  +      } catch (Exception e) {
                        // debug
                        // DEBUG Logger.exception(e);
  -                     throw new RemoteException("exception occured while invoking 
finder method:" + e.toString());
  +                     throw new ServerException("exception occured while invoking 
finder method",e);
                }
                
                return result;
  
  
  

Reply via email to