You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "VIJAY KUMAR (JIRA)" <ji...@apache.org> on 2009/09/16 14:46:57 UTC

[jira] Created: (POOL-150) GenericKeyedObjectPool.preparePool does not throw an exception if supplied factory is null

GenericKeyedObjectPool.preparePool does not throw an exception if supplied factory is null
------------------------------------------------------------------------------------------

                 Key: POOL-150
                 URL: https://issues.apache.org/jira/browse/POOL-150
             Project: Commons Pool
          Issue Type: Bug
    Affects Versions: 1.4
         Environment: Java 5
            Reporter: VIJAY KUMAR


GenericKeyedObjectPool.preparePool  doesnot throw an exception if supplied factory is null. 

GenericKeyedObjectPool.preparePool invokes ensureMinIdle() if populateImmediately is true and GenericKeyedObjectPool.ensureMinIdle() invokes GenericKeyedObjectPool.addObject() which throws an IllegalStateException if factory is null but this exception does not throw further in GenericKeyedObjectPool.preparePool.

Catch block of  GenericKeyedObjectPool..preparePool is empty.

public synchronized void preparePool(Object key, boolean populateImmediately) {
    	ObjectQueue pool = (ObjectQueue)(_poolMap.get(key));
    	System.out.println(this.getClass().getName()+".preparePool() pool  ["+pool +"]");
        if (null == pool) {
            pool = new ObjectQueue();
            _poolMap.put(key,pool);
            _poolList.add(key);
        }

        if (populateImmediately) {
            try {
                // Create the pooled objects
            	System.out.println(this.getClass().getName()+".preparePool() Create the pooled objects ");
                ensureMinIdle(key);
            }
            catch (Exception e) {
                //Do nothing
            }
        }
    }


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (POOL-150) GenericKeyedObjectPool.preparePool does not throw an exception if supplied factory is null

Posted by "Sebb (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/POOL-150?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12801210#action_12801210 ] 

Sebb commented on POOL-150:
---------------------------

Also, GenericKeyedObjectPool.returnObject() fails to check if _factory is non-null before calling the private method addObjectToPool() which always dereferences _factory.

Likewise, borrowObject assumes that _factory is non-null.


> GenericKeyedObjectPool.preparePool does not throw an exception if supplied factory is null
> ------------------------------------------------------------------------------------------
>
>                 Key: POOL-150
>                 URL: https://issues.apache.org/jira/browse/POOL-150
>             Project: Commons Pool
>          Issue Type: Bug
>    Affects Versions: 1.4
>         Environment: Java 5
>            Reporter: VIJAY KUMAR
>             Fix For: 2.0
>
>   Original Estimate: 3h
>  Remaining Estimate: 3h
>
> GenericKeyedObjectPool.preparePool  doesnot throw an exception if supplied factory is null. 
> GenericKeyedObjectPool.preparePool invokes ensureMinIdle() if populateImmediately is true and GenericKeyedObjectPool.ensureMinIdle() invokes GenericKeyedObjectPool.addObject() which throws an IllegalStateException if factory is null but this exception does not throw further in GenericKeyedObjectPool.preparePool.
> Catch block of  GenericKeyedObjectPool..preparePool is empty.
> public synchronized void preparePool(Object key, boolean populateImmediately) {
>     	ObjectQueue pool = (ObjectQueue)(_poolMap.get(key));
>     	System.out.println(this.getClass().getName()+".preparePool() pool  ["+pool +"]");
>         if (null == pool) {
>             pool = new ObjectQueue();
>             _poolMap.put(key,pool);
>             _poolList.add(key);
>         }
>         if (populateImmediately) {
>             try {
>                 // Create the pooled objects
>             	System.out.println(this.getClass().getName()+".preparePool() Create the pooled objects ");
>                 ensureMinIdle(key);
>             }
>             catch (Exception e) {
>                 //Do nothing
>             }
>         }
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (POOL-150) GenericKeyedObjectPool.preparePool does not throw an exception if supplied factory is null

Posted by "Mark Thomas (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/POOL-150?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mark Thomas updated POOL-150:
-----------------------------

    Fix Version/s: 2.0

Point taken.

Throwing an exception is an API change so this will have to wait until 2.0

> GenericKeyedObjectPool.preparePool does not throw an exception if supplied factory is null
> ------------------------------------------------------------------------------------------
>
>                 Key: POOL-150
>                 URL: https://issues.apache.org/jira/browse/POOL-150
>             Project: Commons Pool
>          Issue Type: Bug
>    Affects Versions: 1.4
>         Environment: Java 5
>            Reporter: VIJAY KUMAR
>             Fix For: 2.0
>
>   Original Estimate: 3h
>  Remaining Estimate: 3h
>
> GenericKeyedObjectPool.preparePool  doesnot throw an exception if supplied factory is null. 
> GenericKeyedObjectPool.preparePool invokes ensureMinIdle() if populateImmediately is true and GenericKeyedObjectPool.ensureMinIdle() invokes GenericKeyedObjectPool.addObject() which throws an IllegalStateException if factory is null but this exception does not throw further in GenericKeyedObjectPool.preparePool.
> Catch block of  GenericKeyedObjectPool..preparePool is empty.
> public synchronized void preparePool(Object key, boolean populateImmediately) {
>     	ObjectQueue pool = (ObjectQueue)(_poolMap.get(key));
>     	System.out.println(this.getClass().getName()+".preparePool() pool  ["+pool +"]");
>         if (null == pool) {
>             pool = new ObjectQueue();
>             _poolMap.put(key,pool);
>             _poolList.add(key);
>         }
>         if (populateImmediately) {
>             try {
>                 // Create the pooled objects
>             	System.out.println(this.getClass().getName()+".preparePool() Create the pooled objects ");
>                 ensureMinIdle(key);
>             }
>             catch (Exception e) {
>                 //Do nothing
>             }
>         }
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.