Ignore:
Timestamp:
2014-12-19T01:52:29+01:00 (9 years ago)
Author:
Don-vip
Message:

fix #10855 - fix NPE - better handling of nodes without coordinates

Location:
trunk/src/org/openstreetmap/josm/data/osm
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/DatasetConsistencyTest.java

    r7502 r7828  
    9292        long startTime = System.currentTimeMillis();
    9393        for (Node node : dataSet.getNodes()) {
    94             if (!node.isIncomplete() && node.isVisible() && (node.getCoor() == null || node.getEastNorth() == null)) {
     94            if (!node.isIncomplete() && node.isVisible() && !node.isLatLonKnown()) {
    9595                printError("COMPLETE WITHOUT COORDINATES", "%s is not incomplete but has null coordinates", node);
    9696            }
  • trunk/src/org/openstreetmap/josm/data/osm/Node.java

    r6830 r7828  
    3535    private double north = Double.NaN;
    3636
    37     private boolean isLatLonKnown() {
     37    /**
     38     * Determines if this node has valid coordinates.
     39     * @return {@code true} if this node has valid coordinates
     40     * @since 7828
     41     */
     42    public final boolean isLatLonKnown() {
    3843        return !Double.isNaN(lat) && !Double.isNaN(lon);
    3944    }
     
    198203    void setDataset(DataSet dataSet) {
    199204        super.setDataset(dataSet);
    200         if (!isIncomplete() && isVisible() && (getCoor() == null || getEastNorth() == null))
     205        if (!isIncomplete() && isVisible() && !isLatLonKnown())
    201206            throw new DataIntegrityProblemException("Complete node with null coordinates: " + toString());
    202207    }
  • trunk/src/org/openstreetmap/josm/data/osm/Way.java

    r7796 r7828  
    601601            if (Main.pref.getBoolean("debug.checkNullCoor", true)) {
    602602                for (Node n: nodes) {
    603                     if (n.isVisible() && !n.isIncomplete() && (n.getCoor() == null || n.getEastNorth() == null))
     603                    if (n.isVisible() && !n.isIncomplete() && !n.isLatLonKnown())
    604604                        throw new DataIntegrityProblemException("Complete visible node with null coordinates: " + toString(),
    605605                                "<html>" + tr("Complete node {0} with null coordinates in way {1}",
Note: See TracChangeset for help on using the changeset viewer.