struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dariusz Wojtas (JIRA)" <j...@apache.org>
Subject [jira] Created: (WW-1581) Problems with handling of Double in the request parameters
Date Fri, 29 Dec 2006 13:51:57 GMT
Problems with handling of Double in the request parameters
----------------------------------------------------------

                 Key: WW-1581
                 URL: http://issues.apache.org/struts/browse/WW-1581
             Project: Struts 2
          Issue Type: Bug
          Components: Actions
    Affects Versions: 2.0.2
         Environment: windows XP [Polish locale], tomcat 5.5.17, Java 6
            Reporter: Dariusz Wojtas
            Priority: Critical


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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/struts/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message