Youngho Cho created JCS-139:
-------------------------------
Summary: PropertySetter doesn't set Enum properly
Key: JCS-139
URL: https://issues.apache.org/jira/browse/JCS-139
Project: Commons JCS
Issue Type: Bug
Affects Versions: jcs-2.0
Reporter: Youngho Cho
I saw following log
2014-12-30 11:42:44,937 [main] WARN
org.apache.commons.jcs.utils.config.PropertySetter - Failed to set property
eventQueueType to value "POOLED". Conversion to type [class
org.apache.commons.jcs.engine.behavior.ICacheEventQueue$QueueType] failed.
Looks like enum doesn't set properly
Here is a patch
Index: PropertySetter.java
===================================================================
--- PropertySetter.java (revision 1648479)
+++ PropertySetter.java (working copy)
@@ -263,6 +263,19 @@
return Boolean.FALSE;
}
}
+ else if( type.isEnum() )
+ {
+ try
+ {
+ @SuppressWarnings("unchecked")
+ Class<Enum> cl = (Class<Enum>) Class.forName(type.getName());
+ return Enum.valueOf( cl, v );
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
else if ( File.class.isAssignableFrom( type ) )
{
return new File( v );
Thanks
Youngho
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)