# HG changeset patch # User Sascha L. Teichmann # Date 1345104849 0 # Node ID f1814efec71442ab5429beaab4342a7c760233e6 # Parent e1ac8f5a213933fa5eb1bb26aafd490b27f56f49 Replaced another attribute fetching XPath with a simple DOM getAttributeNS() call. flys-client/trunk@5215 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r e1ac8f5a2139 -r f1814efec714 flys-client/ChangeLog --- a/flys-client/ChangeLog Wed Aug 15 14:20:51 2012 +0000 +++ b/flys-client/ChangeLog Thu Aug 16 08:14:09 2012 +0000 @@ -1,3 +1,9 @@ +2012-08-16 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/client/server/RiverServiceImpl.java: + Replaced another attribute fetching XPath with a simple DOM + getAttributeNS() call. + 2012-08-15 Björn Ricks * src/main/java/de/intevation/flys/client/server/RiverServiceImpl.java: diff -r e1ac8f5a2139 -r f1814efec714 flys-client/src/main/java/de/intevation/flys/client/server/RiverServiceImpl.java --- a/flys-client/src/main/java/de/intevation/flys/client/server/RiverServiceImpl.java Wed Aug 15 14:20:51 2012 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/server/RiverServiceImpl.java Thu Aug 16 08:14:09 2012 +0000 @@ -7,7 +7,7 @@ import org.w3c.dom.Document; import org.w3c.dom.NodeList; -import org.w3c.dom.Node; +import org.w3c.dom.Element; import org.apache.log4j.Logger; @@ -50,6 +50,7 @@ /** Get river list. */ + @Override public River[] list(String locale) throws ServerException { @@ -80,24 +81,23 @@ } int count = rivers.getLength(); - int rcount = 0; List theRivers = new ArrayList(count); User user = this.getUser(); for (int i = 0; i < count; i++) { - Node tmp = rivers.item(i); + Element tmp = (Element)rivers.item(i); - String name = XMLUtils.xpathString( - tmp, "@art:name", ArtifactNamespaceContext.INSTANCE); + String name = tmp.getAttributeNS( + ArtifactNamespaceContext.NAMESPACE_URI, "name"); - if (user == null || user.canUseFeature("river:" + name)) { + if (name.length() > 0 + && (user == null || user.canUseFeature("river:" + name))) { theRivers.add(new DefaultRiver(name)); - rcount++; } } - return theRivers.toArray(new River[rcount]); + return theRivers.toArray(new River[theRivers.size()]); } catch (ConnectionException ce) { logger.error(ce, ce);