Changeset 223 in josm for src/org


Ignore:
Timestamp:
2007-04-28T12:02:51+02:00 (17 years ago)
Author:
imi
Message:
  • fixed valid URL detection in MarkerLayer (removed com.sun.* stuff)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/org/openstreetmap/josm/gui/layer/markerlayer/Marker.java

    r215 r223  
    66import java.awt.event.ActionListener;
    77import java.io.File;
     8import java.net.MalformedURLException;
     9import java.net.URL;
    810import java.util.HashMap;
    911import java.util.LinkedList;
     
    1719import org.openstreetmap.josm.gui.MapView;
    1820import org.openstreetmap.josm.tools.ImageProvider;
    19 
    20 import com.sun.org.apache.xerces.internal.util.URI;
    2121
    2222/**
     
    7575
    7676                                // Try a relative file:// url, if the link is not in an URL-compatible form
    77                                 if (relativePath != null && link != null && !URI.isWellFormedAddress(link))
     77                                if (relativePath != null && link != null && !isWellFormedAddress(link))
    7878                                        link = new File(relativePath, link).toURI().toString();
    7979
     
    8787                                        return WebMarker.create(ll, link);
    8888                        }
     89
     90                        private boolean isWellFormedAddress(String link) {
     91                                try {
     92                                        new URL(link);
     93                                        return true;
     94                                } catch (MalformedURLException x) {
     95                                        return false;
     96                                }
     97            }
    8998                });
    9099        }
Note: See TracChangeset for help on using the changeset viewer.