Ignore:
Timestamp:
2017-10-29T14:57:41+01:00 (7 years ago)
Author:
Don-vip
Message:

fix #14602 - allow both dot and comma decimal separator everywhere possible for user-entered values

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/widgets/BoundingBoxSelectionPanel.java

    r12735 r13050  
    2020import org.openstreetmap.josm.data.coor.conversion.DecimalDegreesCoordinateFormat;
    2121import org.openstreetmap.josm.tools.GBC;
     22import org.openstreetmap.josm.tools.JosmDecimalFormatSymbolsProvider;
     23import org.openstreetmap.josm.tools.Logging;
    2224import org.openstreetmap.josm.tools.OsmUrlToBounds;
    2325
     
    99101        double minlon, minlat, maxlon, maxlat;
    100102        try {
    101             minlat = Double.parseDouble(tfLatLon[0].getText().trim());
    102             minlon = Double.parseDouble(tfLatLon[1].getText().trim());
    103             maxlat = Double.parseDouble(tfLatLon[2].getText().trim());
    104             maxlon = Double.parseDouble(tfLatLon[3].getText().trim());
     103            minlat = JosmDecimalFormatSymbolsProvider.parseDouble(tfLatLon[0].getText().trim());
     104            minlon = JosmDecimalFormatSymbolsProvider.parseDouble(tfLatLon[1].getText().trim());
     105            maxlat = JosmDecimalFormatSymbolsProvider.parseDouble(tfLatLon[2].getText().trim());
     106            maxlon = JosmDecimalFormatSymbolsProvider.parseDouble(tfLatLon[3].getText().trim());
    105107        } catch (NumberFormatException e) {
     108            Logging.trace(e);
    106109            return null;
    107110        }
    108111        if (!LatLon.isValidLon(minlon) || !LatLon.isValidLon(maxlon)
    109                 || !LatLon.isValidLat(minlat) || !LatLon.isValidLat(maxlat))
     112         || !LatLon.isValidLat(minlat) || !LatLon.isValidLat(maxlat))
    110113            return null;
    111114        if (minlon > maxlon)
     
    145148            double value = 0;
    146149            try {
    147                 value = Double.parseDouble(getComponent().getText());
     150                value = JosmDecimalFormatSymbolsProvider.parseDouble(getComponent().getText());
    148151            } catch (NumberFormatException ex) {
    149152                feedbackInvalid(tr("The string ''{0}'' is not a valid double value.", getComponent().getText()));
     153                Logging.trace(ex);
    150154                return;
    151155            }
     
    160164        public boolean isValid() {
    161165            try {
    162                 return LatLon.isValidLat(Double.parseDouble(getComponent().getText()));
    163             } catch (NumberFormatException ex) {
     166                return LatLon.isValidLat(JosmDecimalFormatSymbolsProvider.parseDouble(getComponent().getText()));
     167            } catch (NumberFormatException ex) {
     168                Logging.trace(ex);
    164169                return false;
    165170            }
     
    181186            double value = 0;
    182187            try {
    183                 value = Double.parseDouble(getComponent().getText());
     188                value = JosmDecimalFormatSymbolsProvider.parseDouble(getComponent().getText());
    184189            } catch (NumberFormatException ex) {
    185190                feedbackInvalid(tr("The string ''{0}'' is not a valid double value.", getComponent().getText()));
     191                Logging.trace(ex);
    186192                return;
    187193            }
     
    196202        public boolean isValid() {
    197203            try {
    198                 return LatLon.isValidLon(Double.parseDouble(getComponent().getText()));
    199             } catch (NumberFormatException ex) {
     204                return LatLon.isValidLon(JosmDecimalFormatSymbolsProvider.parseDouble(getComponent().getText()));
     205            } catch (NumberFormatException ex) {
     206                Logging.trace(ex);
    200207                return false;
    201208            }
Note: See TracChangeset for help on using the changeset viewer.