Skip to content

Commit

Permalink
Fix null pointer exception when harvesting from a WMS server with non…
Browse files Browse the repository at this point in the history
…-requestable category layers (i.e. layers without a name element)
  • Loading branch information
jonescc committed Jul 5, 2012
1 parent 649a719 commit 739d013
Showing 1 changed file with 9 additions and 3 deletions.
Expand Up @@ -500,13 +500,19 @@ private WxSLayerRegistry addLayerMetadata (Element layer, Element capa) throws J
boolean loaded = false;

if (params.ogctype.substring(0,3).equals("WMS")) {

Element name;
if (params.ogctype.substring(3,8).equals("1.3.0")) {
Namespace wms = Namespace.getNamespace("http://www.opengis.net/wms");
reg.name = layer.getChild ("Name", wms).getValue ();
name = layer.getChild ("Name", wms);
} else {
reg.name = layer.getChild ("Name").getValue ();
name = layer.getChild ("Name");
}
//--- For the moment, skip non-requestable category layers
if (name == null || name.getValue().trim().equals("")) {
log.info(" - skipping layer with no name element");
return null;
}
reg.name = name.getValue();
} else if (params.ogctype.substring(0,3).equals("WFS")) {
Namespace wfs = Namespace.getNamespace("http://www.opengis.net/wfs");
reg.name = layer.getChild ("Name", wfs).getValue ();
Expand Down

0 comments on commit 739d013

Please sign in to comment.