commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb AT ASF <s...@apache.org>
Subject Re: svn commit: r1334103 - /commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java
Date Fri, 04 May 2012 18:05:02 GMT
The following change to the GKOP ctor seems to fix the problem:


        if (factory == null) {
            this.close(); // <============= close the parent
            throw new IllegalArgumentException("factory may not be null");
        }

Not 100% sure if that is the correct fix - perhaps tearDown() needs to
be adjusted?

On 4 May 2012 19:02,  <sebb@apache.org> wrote:
> Author: sebb
> Date: Fri May  4 18:02:27 2012
> New Revision: 1334103
>
> URL: http://svn.apache.org/viewvc?rev=1334103&view=rev
> Log:
> Add specific test for null factory
> TODO causes tearDown error
>
> Modified:
>    commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java
>
> Modified: commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java
> URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java?rev=1334103&r1=1334102&r2=1334103&view=diff
> ==============================================================================
> --- commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java
(original)
> +++ commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java
Fri May  4 18:02:27 2012
> @@ -1111,6 +1111,14 @@ public class TestGenericKeyedObjectPool
>         pool.close();
>     }
>
> +    @Test(expected=IllegalArgumentException.class)
> +    public void testConstructorNullFactory() {
> +        // add dummy assert (won't be invoked because of IAE) to avoid "unused"
warning
> +        assertNotNull(new GenericKeyedObjectPool<String,String>(null));
> +        // TODO this currently causes tearDown to report an error
> +        // Looks like GKOP needs to call close() on its parent before throwing IAE
> +    }
> +
>     @Test(timeout=60000)
>     public void testExceptionOnPassivateDuringReturn() throws Exception {
>         SimpleFactory<String> factory = new SimpleFactory<String>();
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message