.............." /> .............." /> .............."/>

java.lang.NumberFormatException : Not a valid char constructor input: aa

640 Views Asked by At

I have a xml job where I define resources:

 <Resources>
                    <Resource name="VMDSCP1"/>
                    <Resource name="VMDSCP2"/>
                    <Resource name="VMDSCP3"/>
                    ...............
                    <Resource name="VMDSCP26"/>
                    <Resource name="VMDSCP27"/>
 </Resources>

And create conversion for them:

<FromResources>
                          <FromResource name="VMDSCP1" symbol="a"/>
                          <FromResource name="VMDSCP2" symbol="b"/>
                          <FromResource name="VMDSCP3" symbol="c"/>
                          ..............
                          <FromResource name="VMDSCP26" symbol="z"/>
                          <FromResource name="VMDSCP27" symbol="aa"/>
</FromResources>

And everything running smooth until:

<Parameters>
                    <Parameter formula="(a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p+q+r+s+t+u+v+w+x+y+z+aa)/1024/1024"/>
</Parameters>

After which, following error ocures:

    java.lang.NumberFormatException: Not a valid char constructor input: aa
    at java.math.BigDecimal.bad(BigDecimal.java:1854)
    at java.math.BigDecimal.charParser(BigDecimal.java:1185)
    at java.math.BigDecimal.<init>(BigDecimal.java:917)
    at java.math.BigDecimal.<init>(BigDecimal.java:896)

Could you please suggest how can I converse resources - what symbol can I use? Currently I use whole alphabet (a-z) but need 9 symbols more.

Best regards

1

There are 1 best solutions below

1
Mikkel Løkke On

The problem is that a char can only contain a single character. aa is two. If you are missing 9 additional symbols, might I suggest using '1' through '9' instead perhaps? Or maybe 'A' through 'I', or literally any other unicode character.