Uploaded image for project: 'Commons OGNL (Dormant)'
  1. Commons OGNL (Dormant)
  2. OGNL-134

primitive character conversion in statement compilation

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • 2.7.1
    • 2.7.2
    • ExpressionCompiler
    • None
    • any

    Description

      investigate forum post:

      The following logic is common ListPropertyAccessor, ArrayPropertyAccessor and ObjectPropertyAccessor. Eg. in ObjectPropertyAccessor's getSourceSetter

      conversion = OgnlRuntime.getCompiler().createLocalReference(context,

      "((" + wrapClass.getName() + ")ognl.OgnlOps#convertValue($3," + wrapClass.getName()

      + ".class, true))." + OgnlRuntime.getNumericValueGetter(wrapClass),

      parm);

      It uses

      OgnlRuntime.getNumericValueGetter(wrapClass)

      which looks like

      static

      { NUMERIC_VALUES.put(Double.class, "doubleValue()"); NUMERIC_VALUES.put(Float.class, "floatValue()"); NUMERIC_VALUES.put(Integer.class, "intValue()"); NUMERIC_VALUES.put(Long.class, "longValue()"); NUMERIC_VALUES.put(Short.class, "shortValue()"); NUMERIC_VALUES.put(Byte.class, "byteValue()"); NUMERIC_VALUES.put(BigDecimal.class, "doubleValue()"); NUMERIC_VALUES.put(BigInteger.class, "doubleValue()"); NUMERIC_VALUES.put(Boolean.class, "booleanValue()"); }

      to return string like eg.

      "doubleValue()", "intValue()" etc. to convert the Wrapped object to its primitive types, however it doesn't cover character, so we will get a compilation problem when javassist try to compile the code when we are dealing with character.

      Maybe we could define a separate method in OgnlRuntime to deal with all primitive types instead of just numeric values.

      Thoughs? Should I open up a jira ticket for this?

      Thanks guys

      Attachments

        Activity

          People

            jkuhnert Jesse Kuhnert
            jkuhnert Jesse Kuhnert
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: