logo separator

[mkgmap-dev] Convert.java bug fix

From WanMil wmgcnfg at web.de on Wed May 25 18:23:33 BST 2011

Hi Alin,

thanks for your report. For all: this is a splitter issue. The splitter 
should throw an ArrayIndexOutOfBoundsException if such numbers appear.

The bugfix looks good to me.

Steve, can you commit it?

Here is the expanded test case:

Index: test/uk/me/parabola/splitter/TestConvert.java
===================================================================
--- test/uk/me/parabola/splitter/TestConvert.java	(revision 173)
+++ test/uk/me/parabola/splitter/TestConvert.java	(working copy)
@@ -25,6 +25,8 @@
  		parse("0");
  		parse("1");
  		parse("0.0000012345");
+		parse("12.");
+		parse(".12");
  		parse("1.123");
  		parse("1.123456789");
  		parse("1.1234567891");


WanMil

> Ahoy there,
>
> I've found a bug in function parseDouble. In short, the function is
> unable to parse float numbers such as ".12" or "12.".
> This simple patch fixes the issue:
>
> --- Convert.java.old    2011-05-24 21:37:52.000000000 +0200
> +++ Convert.java        2011-05-24 21:38:31.000000000 +0200
> @@ -180,7 +180,7 @@
>                  if (isNegative)
>                          decimal = -decimal;
>
> -               if (decimalPoint>  0)
> +               if (decimalPoint>= 0&&  decimalPoint<  i - 1)
>                          return decimal / PowersOfTen[i - decimalPoint - 2];
>                  else
>                          return decimal;
>
> Cheers,
> Alin
> _______________________________________________
> mkgmap-dev mailing list
> mkgmap-dev at lists.mkgmap.org.uk
> http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev




More information about the mkgmap-dev mailing list