Opened 11 years ago

Closed 11 years ago

#1537 closed defect (fixed)

Type.parseString() can't parse numbers containing 'E+' when aNumberFormater is used

Reported by: Nicklas Nordborg Owned by: everyone
Priority: minor Milestone: BASE 2.16
Component: core Version:
Keywords: Cc:

Description

For example:

NumberFormat nf = NumberFormatUtil.getNumberFormat('.', ';');
Type.FLOAT.parseString("1.23E+2", nf, false);

results in:

java.lang.NumberFormatException: For input string: "1.23E+2"
  at net.sf.basedb.core.Type.parseString(Type.java:571)  

Ticket #743 claims to have fixed the problem, but it seems like it only fixed the case with 'e+'. I guess we have to add some more test cases to TestNumberFormat?, including all possible variations of:

  • 'e' vs. 'E'
  • 'E+' vs. 'E'
  • E0, E-0, E+0
  • Negative vs. positive numbers

Workaround is to replace all 'E+' with 'E' or 'e+'.

Change History (2)

comment:1 Changed 11 years ago by Nicklas Nordborg

(In [5458]) References #1537: Type.parseString() can't parse numbers containing 'E+' when aNumberFormater is used

Adding more test cases.

comment:2 Changed 11 years ago by Nicklas Nordborg

Resolution: fixed
Status: newclosed

(In [5460]) Fixes #1537: Type.parseString() can't parse numbers containing 'E+' when aNumberFormater is used

Note: See TracTickets for help on using tickets.