Uploaded image for project: 'Commons JCS'
  1. Commons JCS
  2. JCS-139

PropertySetter doesn't set Enum properly

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • jcs-2.0
    • jcs-2.0-beta-2
    • None
    • None

    Description

      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

      Attachments

        1. PropertySetter.java.patch
          0.7 kB
          Youngho Cho

        Activity

          People

            tv Thomas Vandahl
            youngho Youngho Cho
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: