You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Michael C (JIRA)" <ji...@apache.org> on 2018/05/26 17:30:00 UTC

[jira] [Commented] (POOL-338) GenericObjectPool constructor may throw an exception under OSGi

    [ https://issues.apache.org/jira/browse/POOL-338?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16491749#comment-16491749 ] 

Michael C commented on POOL-338:
--------------------------------

I don't see 2.6.0-SNAPSHOT yet for some reason. 

For 2.5.x, I just attached commons-pool-2.5.1.patch. It uses a different try block for {{BaseGenericObjectPool.setEvictionPolicyClassName(String)}} with the help of a private method. Compared to the 2.6 patch, this is actually cleaner. I may submit this for 2.6 later.

> GenericObjectPool constructor may throw an exception under OSGi
> ---------------------------------------------------------------
>
>                 Key: POOL-338
>                 URL: https://issues.apache.org/jira/browse/POOL-338
>             Project: Commons Pool
>          Issue Type: Bug
>    Affects Versions: 2.4.2, 2.4.3, 2.5.0
>         Environment: Java 8, Liferay DXP (an OSGi environment).
>            Reporter: Michael C
>            Assignee: Gary Gregory
>            Priority: Major
>             Fix For: 2.6.0
>
>         Attachments: commons-pool-2.5.1.patch, commons-pool-gg.patch, commons-pool-mc.patch
>
>
> Version 2.4.3 GenericObjectPool constructor throws this exception:
> {{java.lang.IllegalArgumentException: [org.apache.commons.pool2.impl.DefaultEvictionPolicy] does not implement EvictionPolicy}}
> {{    at org.apache.commons.pool2.impl.BaseGenericObjectPool.setEvictionPolicyClassName(BaseGenericObjectPool.java:618)}}
> {{    at org.apache.commons.pool2.impl.GenericObjectPool.setConfig(GenericObjectPool.java:318)}}
> {{    at org.apache.commons.pool2.impl.GenericObjectPool.<init>(GenericObjectPool.java:115)}}
> {{    at org.apache.commons.pool2.impl.GenericObjectPool.<init>(GenericObjectPool.java:88)}}
>  
> Version 2.5.0 throws the same exception. Version 2.4.2 or older's setEvictionPolicyClassName method fail silently for the same reason. This line in BaseGenericObjectPool evaluates to false for all versions:
> {{        if (policy instanceof EvictionPolicy<?>) {}}
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)