#373 Non-locale-compliant numeric parsing code in AAVSOPhotometryURLObservationSourceBase

Defect
closed-fixed
9
2013-05-16
2013-05-11
David Benn
No

I have allowed non-locale-compliant numeric parsing code to creep back into the code base, specifically in:

https://sourceforge.net/p/vstar/code/986/tree/trunk/src/org/aavso/tools/vstar/plugin/ob/src/impl/AAVSOPhotometryURLObservationSourceBase.java#l148

However, I can see why I missed this. It's a different scenario this time. In the past we systematically fixed all UI code to handle locale specific numeric input. The common code used by APASS/BSM above does this correctly. However, what it fails to do correctly (locale-wise) is to construct a URL in the correct locale! The problem in this case is that unlike for UI code, we want to ignore the default locale (the one used by the rest of VStar) and generate the one required by the PHP APASS/BSM server.

In getUrls(), we have:

String params = String.format("radeg=%f&decdeg=%f&raddeg=%f",
raDegs, decDegs, radiusDegs);

The locale-specific version of this method needs to be used instead to avoid generating numbers with commas, for example. The plugins will need to be rebuilt with this and re-released.

A new VStar release will be required because the bug is in common code not plugin code.

Discussion

  • David Benn

    David Benn - 2013-05-11
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -2,7 +2,7 @@
    
     https://sourceforge.net/p/vstar/code/986/tree/trunk/src/org/aavso/tools/vstar/plugin/ob/src/impl/AAVSOPhotometryURLObservationSourceBase.java#l148
    
    -It's a different scenario this time. In the past we systematically fixed all UI code to handle locale specific numeric input. The common code used by APASS/BSM above does this correctly. However, what it fails to do correctly (locale-wise) is to construct a URL in the correct locale! The problem in this case is that unlike for UI code, we want to ignore the default locale (the one used by the rest of VStar) and generate the one required by the PHP APASS/BSM server.
    +However, I can see why I missed this. It's a different scenario this time. In the past we systematically fixed all UI code to handle locale specific numeric input. The common code used by APASS/BSM above does this correctly. However, what it fails to do correctly (locale-wise) is to construct a URL in the correct locale! The problem in this case is that unlike for UI code, we want to ignore the default locale (the one used by the rest of VStar) and generate the one required by the PHP APASS/BSM server.
    
     In getUrls(), we have:
    
     
  • David Benn

    David Benn - 2013-05-11
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -9,6 +9,6 @@
       String params = String.format("radeg=%f&decdeg=%f&raddeg=%f",
                    raDegs, decDegs, radiusDegs);
    
    -The locale-specific version of this method needs to be used instead to avoid generating numbers with commas, for example.
    +The locale-specific version of this method needs to be used instead to avoid generating numbers with commas, for example. The plugins will need to be rebuilt with this and re-released.
    
     A new VStar release will be required because the bug is in common code not plugin code. 
    
     
  • David Benn

    David Benn - 2013-05-16
    • status: open --> closed-fixed
     
  • David Benn

    David Benn - 2013-05-16

    Fixed in https://sourceforge.net/p/vstar/code/988

    Tested in an Ubuntu VM with German locale.
    Pierre (bug reporter) tested this with Swedish locale.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks