I display a Tree with more than 1000 nodes using a lazy-loading sx:tree
with struts2.1.2.
Whenever I select a node with nodeid >=1000, I get a
NumberFormatException because the nodeid seems to be i18n'ized and gets
transported to (and from) the browser as a string literal "1.271"
instead of "1271" (here, for German locale):

java.lang.NumberFormatException: For input string: "1.271"
        at java.lang.NumberFormatException.forInputString(Unknown
Source)
        at java.lang.Long.parseLong(Unknown Source)
        at java.lang.Long.parseLong(Unknown Source)
        at
com.opensymphony.xwork2.conversion.impl.DefaultTypeConverter.longValue(D
efaultTypeConverter.java:209)
        at
com.opensymphony.xwork2.conversion.impl.DefaultTypeConverter.convertValu
e(DefaultTypeConverter.java:122)
        at
com.opensymphony.xwork2.conversion.impl.DefaultTypeConverter.convertValu
e(DefaultTypeConverter.java:72)
        at
com.opensymphony.xwork2.conversion.impl.XWorkBasicConverter.doConvertToN
umber(XWorkBasicConverter.java:396)
        at
com.opensymphony.xwork2.conversion.impl.XWorkBasicConverter.doConvertToN
umber(XWorkBasicConverter.java:421)
        at
com.opensymphony.xwork2.conversion.impl.XWorkBasicConverter.convertValue
(XWorkBasicConverter.java:132)
        at
com.opensymphony.xwork2.conversion.impl.XWorkConverter.convertValue(XWor
kConverter.java:313)
        at
com.opensymphony.xwork2.ognl.OgnlTypeConverterWrapper.convertValue(OgnlT
ypeConverterWrapper.java:28)
        at ognl.OgnlRuntime.getConvertedType(OgnlRuntime.java:687)
        at ognl.OgnlRuntime.getConvertedTypes(OgnlRuntime.java:703)
        at
ognl.OgnlRuntime.getConvertedMethodAndArgs(OgnlRuntime.java:726)
        at ognl.OgnlRuntime.getAppropriateMethod(OgnlRuntime.java:783)
        at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:794)
        at ognl.OgnlRuntime.setMethodValue(OgnlRuntime.java:964)
        at
ognl.ObjectPropertyAccessor.setPossibleProperty(ObjectPropertyAccessor.j
ava:75)
        at
ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:131)
        at
com.opensymphony.xwork2.ognl.accessor.ObjectAccessor.setProperty(ObjectA
ccessor.java:27)


I use a FTL to put the nodes to the sx:tree:
[
<#list middleNode.children as node>
  {
    label: '${node.name}',
    id: '${node.id}',
    hasChildren: ${(node.children.size() > 0)?string}
  },
</#list>
] 

Is this a bug or is there a solution to turn the i18n off?

Thank you,
Andreas

Reply via email to