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

Michael C edited comment on POOL-338 at 5/25/18 4:27 AM:
---------------------------------------------------------

The patch you posted yesterday (5/23) still does not help me. I posted *two* 
separate comments on 5/12. Please revisit both again. Both offer backward 
compatible solutions in two different places.

See the stack trace in the original bug description. I am using 
_DefaultEvictionPolicy_ instantiated in my code, so this if statement in your 
diff won't my _DefaultEvictionPolicy_:
{noformat}
+        // Maintain compatibility:
+        if 
(!BaseObjectPoolConfig.DEFAULT_EVICTION_POLICY_CLASS_NAME.equals(conf.getEvictionPolicyClassName()))
 {
+            // Use the class name if it is not the default
+            setEvictionPolicyClassName(conf.getEvictionPolicyClassName());
+        } else {
+            // Otherwise, use the class
+            setEvictionPolicy(conf.getEvictionPolicy());
+        }
{noformat}
Again, both changes in my 5/12 comments are backward compatible, and suggestion 
1) and 2) in the second comment should be reconsidered.


was (Author: mcgitty):
The patch you posted yesterday (5/23) still does not help me. I posted *two* 
separate comments on 5/12. Please revisit both again. Both offer backward 
compatible solutions in two different places.

Note the source code diff in the 2nd 5/12 comment, plus the stack trace in the 
original bug description. I am using the _DefaultEvictionPolicy_, so this if 
statement in your diff still prevents me from using the _EvitionPolicy_ 
instantiated in my code, which will avoid the _instanceof_ check failure.
{noformat}
+        // Maintain compatibility:
+        if 
(!BaseObjectPoolConfig.DEFAULT_EVICTION_POLICY_CLASS_NAME.equals(conf.getEvictionPolicyClassName()))
 {
+            // Use the class name if it is not the default
+            setEvictionPolicyClassName(conf.getEvictionPolicyClassName());
+        } else {
+            // Otherwise, use the class
+            setEvictionPolicy(conf.getEvictionPolicy());
+        }
{noformat}
Again, both changes in my 5/12 comments are backward compatible, and suggestion 
1) and 2) in the second comment should be reconsidered.

> GenericObjectPool constructor throws an exception
> -------------------------------------------------
>
>                 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
>            Priority: Major
>         Attachments: commons-pool-gg.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)

Reply via email to