Modify

Opened 5 years ago

Closed 5 years ago

#12450 closed defect (fixed)

NPE when illegal WMTS URL is added

Reported by: stoecker Owned by: wiktorn
Priority: normal Milestone: 16.02
Component: Core imagery Version: latest
Keywords: wmts Cc:

Description

When entering "http://josm.openstreetmap.de" as WMTS URL and later call menu entry it hangs a long time and finally says

java.lang.NullPointerException
        at org.openstreetmap.josm.data.imagery.WMTSTileSource.<init>(WMTSTileSource.java:235)
        at org.openstreetmap.josm.gui.layer.WMTSLayer.getTileSource(WMTSLayer.java:54)
        at org.openstreetmap.josm.gui.layer.AbstractTileSourceLayer.hookUpMapView(AbstractTileSourceLayer.java:593)
        at org.openstreetmap.josm.Main.addLayer(Main.java:768)

It should not hang or NPE, but give a meaningful error message. Also I'd appreciate when bad URL's are catched already in Preferences setup, not only when calling the added entry from menu.

Attachments (0)

Change History (3)

comment:1 Changed 5 years ago by Don-vip

Keywords: wmts added

comment:2 Changed 5 years ago by wiktorn

In 9664/josm:

Fix NPE and hang when adding erroneus imageries.

When user points to a getCapabilities document that is XHTML file, parser was by default loading external entities. For XHTML, it was trying to load for ex.: http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd - which takes about 15 seconds to load. It referes to other external entities, that take no shorter to load, hence was the hang.

Now factory will not try to load external resources, nor validate the XML, so this should prevent such errors.

See: #12450

comment:3 Changed 5 years ago by wiktorn

Resolution: fixed
Status: newclosed

In 9682/josm:

Check if the imagery is valid before returning the info object.

I decided for such solution, as WMTS is the only source, that needs such validation. Alternative approach is to change ImageryPreference.NewEntryAction.actionPerformed(...) so it would instantiate imagery layer using ImageryLayer.create(...) and then call getTileSource(...) on this object, but this would require making this method public.

Closes: #12450

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain wiktorn.
as The resolution will be set.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.