Changeset 4164 in josm for trunk/src


Ignore:
Timestamp:
2011-06-25T00:05:35+02:00 (13 years ago)
Author:
stoecker
Message:

fix #5510 - strip white space and return from WMS/TMS URLs

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

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/preferences/AddWMSLayerPanel.java

    r4015 r4164  
    108108                try {
    109109                    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    110                     attemptGetCapabilities(serviceUrlText.getText());
     110                    attemptGetCapabilities(sanitize(serviceUrlText.getText()));
    111111                } finally {
    112112                    setCursor(beforeCursor);
     
    224224    }
    225225
     226    private String sanitize(String s) {
     227        return s.replaceAll("[\r\n]+","").trim();
     228    }
     229
    226230    private String buildTMSUrl() {
    227231        StringBuilder a = new StringBuilder("tms:");
    228         a.append(tmsURL.getText());
     232        a.append(sanitize(tmsURL.getText()));
    229233        return a.toString();
    230234    }
  • trunk/src/org/openstreetmap/josm/gui/preferences/ImageryPreference.java

    r4126 r4164  
    444444            public NewEntryAction() {
    445445                putValue(NAME, tr("New"));
    446                 putValue(SHORT_DESCRIPTION, tr("add a new wms/tms entry by entering the url"));
     446                putValue(SHORT_DESCRIPTION, tr("Add a new WMS/TMS entry by entering the URL"));
    447447                putValue(SMALL_ICON, ImageProvider.get("dialogs", "add"));
    448448            }
     
    464464            public RemoveEntryAction() {
    465465                putValue(NAME, tr("Remove"));
    466                 putValue(SHORT_DESCRIPTION, tr("remove entry"));
     466                putValue(SHORT_DESCRIPTION, tr("Remove entry"));
    467467                putValue(SMALL_ICON, ImageProvider.get("dialogs", "delete"));
    468468                updateEnabledState();
Note: See TracChangeset for help on using the changeset viewer.