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

Nullsafe method selection?

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • None
    • 4.0.x
    • None
    • None

    Description

      For some reason it seems that with Struts 2.3.1 sending a null value does lead to confusion in OGNL. For example:

      setToken(String token){}

      should be set by OGNL. It works, if String != null. If String is null, OGNL claims this method does not exist for unknown reason. Probably this is somehow related to Struts, but feeling says solution can be found in OGNL.

      Workaround is not to send null

      2012-01-13 15:58:29,830 WARN [CommonsLogger.java:60] : Error setting expression 'week' with value '[Ljava.lang.String;@6e895972'
      ognl.MethodFailedException: Method "setWeek" failed for object de.grobmeier.tab.webapp.services.DateTimeService@332b6f2a [java.lang.NoSuchMethodException: de.grobmeier.tab.webapp.services.DateTimeService.setWeek([Ljava.lang.String;)]
      at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:1292)
      at ognl.OgnlRuntime.setMethodValue(OgnlRuntime.java:1481)
      at ognl.ObjectPropertyAccessor.setPossibleProperty(ObjectPropertyAccessor.java:85)
      at ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:162)
      at com.opensymphony.xwork2.ognl.accessor.ObjectAccessor.setProperty(ObjectAccessor.java:27)
      at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:2318)
      at com.opensymphony.xwork2.ognl.accessor.CompoundRootAccessor.setProperty(CompoundRootAccessor.java:77)
      at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:2318)
      at ognl.ASTProperty.setValueBody(ASTProperty.java:127)
      at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:220)
      at ognl.SimpleNode.setValue(SimpleNode.java:301)
      at ognl.Ognl.setValue(Ognl.java:737)
      at com.opensymphony.xwork2.ognl.OgnlUtil.setValue(OgnlUtil.java:209)
      at com.opensymphony.xwork2.ognl.OgnlValueStack.trySetValue(OgnlValueStack.java:173)
      at com.opensymphony.xwork2.ognl.OgnlValueStack.setValue(OgnlValueStack.java:160)
      at com.opensymphony.xwork2.ognl.OgnlValueStack.setValue(OgnlValueStack.java:151)
      at com.opensymphony.xwork2.interceptor.ParametersInterceptor.setParameters(ParametersInterceptor.java:292)
      at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:203)
      at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)

      Attachments

        Activity

          People

            Unassigned Unassigned
            grobmeier Christian Grobmeier
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: