changeset 110:b465f1bbe368

Some Codeimprovments done gnv-artifacts/trunk@159 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Tue, 29 Sep 2009 15:02:27 +0000
parents 678aad19a08d
children 065ec0a29394
files gnv-artifacts/Changelog gnv-artifacts/src/main/java/de/intevation/gnv/chart/VerticalProfileChartFactory.java
diffstat 2 files changed, 17 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- 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  <tim.englich@intevation.de>
+
+    * 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  <tim.englich@intevation.de>
 
     * src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCase.java Edited:
--- 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<KeyValueDescibeData> values, String pMmtId){
-    	int id = 0;
-    	try {
-            id = Integer.parseInt(pMmtId);
-        } catch (NumberFormatException e) {
-            sLogger.warn(e,e);
-            return pMmtId;
+    private String findValueTitle(Collection<KeyValueDescibeData> values, String id){
+        if (values != null){
+            Iterator<KeyValueDescibeData> it = values.iterator();
+            while(it.hasNext()){
+                KeyValueDescibeData data = it.next();
+                if (id.equals(data.getKey())){
+                   return data.getValue();
+                }
+            }
         }
-        
-        Iterator<KeyValueDescibeData> it = values.iterator();
-    	while(it.hasNext()){
-    	    KeyValueDescibeData data = it.next();
-    		if (id  ==Integer.parseInt(data.getKey())){
-    		    return data.getValue();
-    		}
-    	}
-    	return "";
+        return id;
     }
 }

http://dive4elements.wald.intevation.org