# HG changeset patch # User Tim Englich # Date 1254236547 0 # Node ID b465f1bbe3681a1a70dffe6a2b8618f3d6205572 # Parent 678aad19a08d541a75c0b6fa6392c551c5dc08ea Some Codeimprovments done gnv-artifacts/trunk@159 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 678aad19a08d -r b465f1bbe368 gnv-artifacts/Changelog --- a/gnv-artifacts/Changelog Tue Sep 29 14:59:43 2009 +0000 +++ b/gnv-artifacts/Changelog Tue Sep 29 15:02:27 2009 +0000 @@ -1,3 +1,10 @@ +2009-09-29 Tim Englich + + * src/main/java/de/intevation/gnv/chart/VerticalProfileChartFactory.java (findValueTitle): + Key of KeyValueDescribeData is a String. So it is not nessessary to parse the + id into an Integer Value. + Also some NP-Access removed. + 2009-09-29 Tim Englich * src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCase.java Edited: diff -r 678aad19a08d -r b465f1bbe368 gnv-artifacts/src/main/java/de/intevation/gnv/chart/VerticalProfileChartFactory.java --- a/gnv-artifacts/src/main/java/de/intevation/gnv/chart/VerticalProfileChartFactory.java Tue Sep 29 14:59:43 2009 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/chart/VerticalProfileChartFactory.java Tue Sep 29 15:02:27 2009 +0000 @@ -313,22 +313,16 @@ } - private String findValueTitle(Collection values, String pMmtId){ - int id = 0; - try { - id = Integer.parseInt(pMmtId); - } catch (NumberFormatException e) { - sLogger.warn(e,e); - return pMmtId; + private String findValueTitle(Collection values, String id){ + if (values != null){ + Iterator it = values.iterator(); + while(it.hasNext()){ + KeyValueDescibeData data = it.next(); + if (id.equals(data.getKey())){ + return data.getValue(); + } + } } - - Iterator it = values.iterator(); - while(it.hasNext()){ - KeyValueDescibeData data = it.next(); - if (id ==Integer.parseInt(data.getKey())){ - return data.getValue(); - } - } - return ""; + return id; } }