4 Replies Latest reply on Jun 29, 2005 1:46 PM by Adrian Brock

    AbstractInstancePool.java is eating up exceptions

    Clebert Suconic Master

      I?m doing some tests with PooledInvokers, and I took 2 hours to discover that my Datasource was not configured properly as AbstractInstancePool.java ate the NamingException from the operation.

      Here is the code I would suggest to fix the problem (around line 160).

       // Pool is empty, create an instance
       Object instance = container.createBeanClassInstance();
       return create(instance);
       catch (Throwable e)
       // Release the strict max size mutex if it exists
       if( strictMaxSize != null )
       // Don't wrap CreateExceptions
       if( e instanceof CreateException )
       throw (CreateException) e;
       // Wrap e in an Exception if needed
       Exception ex = null;
       if( (e instanceof Exception) == false )
       ex = new UndeclaredThrowableException(e);
       } else
       ex = (Exception)e; // that?s the change
       throw new EJBException("Could not instantiate bean", (Exception)ex);

      It would be okay as this will be executed only when e is an instanceof Exception.

      Anyway, I would invert the Boolean operation here.

      Any concerns?