[OpenMap Users] Bug parsing MGRS String

From: Vairoj A. <vairoj_at_hotpop.com>
Date: Mon, 06 Mar 2006 18:12:10 +0700

Hi,

I come across a problem that is possibly a bug in MGRSPoint class.

 From my understanding and javadoc in zone_number field, the number must
be between 1 to 60. But passing the MGRS string with 3 digit zone number
pass the construction just fine.

Sample test data: 477PMN300400

The problem seems to come from line 397 in MGRSPoint.java:

       // get Zone number
       while (!Character.isLetter(testChar = mgrsString.charAt(i))) {
           if (i > 2) {
               throw new NumberFormatException("MGRSPoint bad conversion
from: "
                       + mgrsString);
           }
           sb.append(testChar);
           i++;
       }

the if statement should be
if ( i >=2 ) {

to only allow 2 digit.


OpenMap version 4.6.3.

Regards,

Vairoj


--
[To unsubscribe to this list send an email to "majdart_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Mon Mar 06 2006 - 06:41:20 EST

This archive was generated by hypermail 2.3.0 : Tue Mar 28 2017 - 23:25:07 EDT