Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-1581

Problems with handling of Double in the request parameters

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Not A Problem
    • 2.0.2
    • 2.0.3
    • Core Actions
    • None
    • windows XP [Polish locale], tomcat 5.5.17, Java 6

    Description

      I have a property in my form
      private Double someValue;
      with get/set methods

      Then I display it on my form
      <s:textfield name="someValue" cssStyle="width: 100px;"/>

      fill some value: 1234
      and submit the form [Firefox]

      the URL looks like this:
      /my.action?someValue=1234.0
      and is automatically generated by the browser.
      On the console I get stacktrace and no hint what is going on:

      java.lang.NullPointerException
      at com.opensymphony.xwork2.DefaultActionInvocation.createResult(DefaultActionInvocation.java:197)
      at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:337)
      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
      at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:115)
      at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
      at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
      at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:217)
      at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
      at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:123)
      at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
      at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:217)

      (A bit related to WW-1577)

      If I change URL to one of:
      /my.action?someValue=1234,0 [colon instead of dot]
      /my.action?someValue=1234
      then it works.

      IE 6 does not add '.0' if the number is an integer.
      But if I add it by hand:
      1234.5 [english user using my polish server]
      then if fails.

      Most likely the Double handler initializes itself with the machine specific locale (in Poland colon is the separator for doubles) and it fails.

      In fact this is a highly critical issue if this cannot accept simple numeric value on non english server machine.

      Solution?
      I am not sure if this is not in conflict with some other conditions, but possibly the Double converter should use one specific locale and try to convert input data first to be compatible.
      For example use locale ENGLISH, and try to format the input strings by replacing comma with dot.

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            mrdon Donald J. Brown
            dwojtas@gmail.com Dariusz Wojtas
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment