Changeset 5412 in josm


Ignore:
Timestamp:
2012-08-09T22:27:54+02:00 (12 years ago)
Author:
Don-vip
Message:

see #7943 - fix NPE when switching back to default OSM API server after having tried to upload data to another server instance

Location:
trunk/src/org/openstreetmap/josm
Files:
2 edited

Legend:

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

    r5391 r5412  
    123123        @Override
    124124        public String toString() {
    125             return value.toString();
     125            return value != null ? value.toString() : "null";
    126126        }
    127127    }
  • trunk/src/org/openstreetmap/josm/gui/io/UploadDialog.java

    r5266 r5412  
    2323import javax.swing.Icon;
    2424import javax.swing.ImageIcon;
    25 import javax.swing.InputMap;
    2625import javax.swing.JButton;
    2726import javax.swing.JComponent;
     
    3635import org.openstreetmap.josm.data.Preferences.PreferenceChangeEvent;
    3736import org.openstreetmap.josm.data.Preferences.PreferenceChangedListener;
     37import org.openstreetmap.josm.data.Preferences.Setting;
    3838import org.openstreetmap.josm.data.osm.Changeset;
    3939import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    500500        if (e.getKey() == null || ! e.getKey().equals("osm-server.url"))
    501501            return;
    502         if (e.getNewValue() == null) {
    503             setTitle(tr("Upload"));
     502        final Setting<?> newValue = e.getNewValue();
     503        final String url;
     504        if (newValue == null || newValue.getValue() == null) {
     505            url = OsmApi.getOsmApi().getBaseUrl();
    504506        } else {
    505             setTitle(tr("Upload to ''{0}''", e.getNewValue()));
    506         }
     507            url = newValue.getValue().toString();
     508        }
     509        setTitle(tr("Upload to ''{0}''", url));
    507510    }
    508511}
Note: See TracChangeset for help on using the changeset viewer.