changeset 3405:b0ba96bbf01d

Use Integer.parseInt() instead of Integer.valueOf() + Autounboxing. flys-artifacts/trunk@5057 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 19 Jul 2012 09:37:52 +0000
parents d7b065b88f10
children 3732e1bab0aa
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/CrossSectionArtifact.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/RiverAxisArtifact.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/StaticWKmsArtifact.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/StaticWQKmsArtifact.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSCatchmentArtifact.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSDBArtifact.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSFloodplainArtifact.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSHwsArtifact.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSKmArtifact.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSLineArtifact.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSQPSArtifact.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/WQKmsInterpolArtifact.java flys-artifacts/src/main/java/de/intevation/flys/exports/ChartSettings.java flys-artifacts/src/main/java/de/intevation/flys/jfree/XYStyle.java flys-artifacts/src/main/java/de/intevation/flys/utils/FLYSUtils.java flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java
diffstat 17 files changed, 60 insertions(+), 40 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Thu Jul 19 09:11:56 2012 +0000
+++ b/flys-artifacts/ChangeLog	Thu Jul 19 09:37:52 2012 +0000
@@ -1,3 +1,23 @@
+2012-07-19	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/StaticWKmsArtifact.java,
+	  src/main/java/de/intevation/flys/artifacts/WMSQPSArtifact.java,
+	  src/main/java/de/intevation/flys/artifacts/WMSKmArtifact.java,
+	  src/main/java/de/intevation/flys/artifacts/CrossSectionArtifact.java,
+	  src/main/java/de/intevation/flys/artifacts/WQKmsInterpolArtifact.java,
+	  src/main/java/de/intevation/flys/artifacts/WMSHwsArtifact.java,
+	  src/main/java/de/intevation/flys/artifacts/WMSCatchmentArtifact.java,
+	  src/main/java/de/intevation/flys/artifacts/StaticWQKmsArtifact.java,
+	  src/main/java/de/intevation/flys/artifacts/WMSDBArtifact.java,
+	  src/main/java/de/intevation/flys/artifacts/RiverAxisArtifact.java,
+	  src/main/java/de/intevation/flys/artifacts/WMSFloodplainArtifact.java,
+	  src/main/java/de/intevation/flys/artifacts/WMSLineArtifact.java,
+	  src/main/java/de/intevation/flys/utils/ThemeUtil.java,
+	  src/main/java/de/intevation/flys/utils/FLYSUtils.java,
+	  src/main/java/de/intevation/flys/exports/ChartSettings.java,
+	  src/main/java/de/intevation/flys/jfree/XYStyle.java:
+	  Use Integer.parseInt() instead of Integer.valueOf() + Autounboxing.
+	
 2012-07-19	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/flys/exports/fixings/FixDeltaWtGenerator.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/CrossSectionArtifact.java	Thu Jul 19 09:11:56 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/CrossSectionArtifact.java	Thu Jul 19 09:37:52 2012 +0000
@@ -97,7 +97,7 @@
 
         List<Facet> fs = new ArrayList<Facet>();
         CrossSection cs = CrossSectionFactory.getCrossSection(
-            Integer.valueOf(ids));
+            Integer.parseInt(ids));
 
         List<CrossSectionLine> csls = cs.getLines();
         if (!csls.isEmpty()) {
@@ -198,7 +198,7 @@
     public int getDataAsIntNull(String dataName) {
         String val = getDataAsString(dataName);
         try {
-            return Integer.valueOf(val);
+            return Integer.parseInt(val);
         }
         catch (NumberFormatException e) {
             logger.warn("Could not get data " + dataName + " as int", e);
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/RiverAxisArtifact.java	Thu Jul 19 09:11:56 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/RiverAxisArtifact.java	Thu Jul 19 09:37:52 2012 +0000
@@ -92,7 +92,7 @@
                 String ids = artifact.getDataAsString("ids");
 
                 try {
-                    riverId = Integer.valueOf(ids);
+                    riverId = Integer.parseInt(ids);
                 }
                 catch (NumberFormatException nfe) {
                     logger.error("Cannot parse river id from '" + ids + "'");
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/StaticWKmsArtifact.java	Thu Jul 19 09:11:56 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/StaticWKmsArtifact.java	Thu Jul 19 09:37:52 2012 +0000
@@ -97,10 +97,10 @@
 
             if (parts.length >= 4) {
                 int col = -1;
-                int wst = Integer.valueOf(parts[3]);
+                int wst = Integer.parseInt(parts[3]);
 
                 if (!parts[2].equals("A")) {
-                    col = Integer.valueOf(parts[2]);
+                    col = Integer.parseInt(parts[2]);
                 }
 
                 addStringData("col_pos", parts[2]);
@@ -236,8 +236,8 @@
         logger.debug("StaticWKmsArtifact.getWKms");
 
         return WKmsFactory.getWKms(
-            Integer.valueOf(getDataAsString("col_pos")),
-            Integer.valueOf(getDataAsString("wst_id")));
+            Integer.parseInt(getDataAsString("col_pos")),
+            Integer.parseInt(getDataAsString("wst_id")));
     }
 
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/StaticWQKmsArtifact.java	Thu Jul 19 09:11:56 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/StaticWQKmsArtifact.java	Thu Jul 19 09:37:52 2012 +0000
@@ -64,7 +64,9 @@
         logger.debug("StaticWQKmsArtifact.setup");
 
         // Store the 'ids' (from datacage).
-        logger.debug("StaticWQKmsArtiact.setup" + XMLUtils.toString(data));
+        if (logger.isDebugEnabled()) {
+            logger.debug("StaticWQKmsArtiact.setup" + XMLUtils.toString(data));
+        }
 
         String code = getDatacageIDValue(data);
         addStringData("ids", code);
@@ -72,8 +74,8 @@
             String [] parts = code.split("-");
 
             if (parts.length >= 4) {
-                int col = Integer.valueOf(parts[2]);
-                int wst = Integer.valueOf(parts[3]);
+                int col = Integer.parseInt(parts[2]);
+                int wst = Integer.parseInt(parts[3]);
 
                 addStringData("col_pos", parts[2]);
                 addStringData("wst_id",  parts[3]);
@@ -123,15 +125,13 @@
     public WQKms getWQKms() {
         logger.debug("StaticWQKmsArtifact.getWQKms");
 
-        int col = Integer.valueOf(getDataAsString("col_pos"));
-        int wst = Integer.valueOf(getDataAsString("wst_id"));
+        int col = Integer.parseInt(getDataAsString("col_pos"));
+        int wst = Integer.parseInt(getDataAsString("wst_id"));
 
         /** TODO do not run twice against db to do this. */
         String wkmsName = WKmsFactory.getWKmsName(col, wst);
 
-        WQKms res = WQKmsFactory.getWQKms(
-            Integer.valueOf(getDataAsString("col_pos")),
-            Integer.valueOf(getDataAsString("wst_id")));
+        WQKms res = WQKmsFactory.getWQKms(col, wst);
         res.setName(wkmsName);
         return res;
     }
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSCatchmentArtifact.java	Thu Jul 19 09:11:56 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSCatchmentArtifact.java	Thu Jul 19 09:37:52 2012 +0000
@@ -90,7 +90,7 @@
                 String[] parts = ids.split(";");
 
                 try {
-                    riverId = Integer.valueOf(parts[0]);
+                    riverId = Integer.parseInt(parts[0]);
                 }
                 catch (NumberFormatException nfe) {
                     logger.error("Cannot parse river id from '" + ids + "'");
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSDBArtifact.java	Thu Jul 19 09:11:56 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSDBArtifact.java	Thu Jul 19 09:37:52 2012 +0000
@@ -242,7 +242,7 @@
                 String[] parts = ids.split(";");
 
                 try {
-                    riverId = Integer.valueOf(parts[0]);
+                    riverId = Integer.parseInt(parts[0]);
                 }
                 catch (NumberFormatException nfe) {
                     logger.error("Cannot parse river id from '" + parts[0] + "'");
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSFloodplainArtifact.java	Thu Jul 19 09:11:56 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSFloodplainArtifact.java	Thu Jul 19 09:37:52 2012 +0000
@@ -89,7 +89,7 @@
                 String ids = artifact.getDataAsString("ids");
 
                 try {
-                    riverId = Integer.valueOf(ids);
+                    riverId = Integer.parseInt(ids);
                 }
                 catch (NumberFormatException nfe) {
                     logger.error("Cannot parse river id from '" + ids + "'");
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSHwsArtifact.java	Thu Jul 19 09:11:56 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSHwsArtifact.java	Thu Jul 19 09:37:52 2012 +0000
@@ -90,7 +90,7 @@
                 String[] parts = ids.split(";");
 
                 try {
-                    riverId = Integer.valueOf(parts[0]);
+                    riverId = Integer.parseInt(parts[0]);
                 }
                 catch (NumberFormatException nfe) {
                     logger.error("Cannot parse river id from '" + parts[0] + "'");
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSKmArtifact.java	Thu Jul 19 09:11:56 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSKmArtifact.java	Thu Jul 19 09:37:52 2012 +0000
@@ -91,7 +91,7 @@
                 String ids = artifact.getDataAsString("ids");
 
                 try {
-                    riverId = Integer.valueOf(ids);
+                    riverId = Integer.parseInt(ids);
                 }
                 catch (NumberFormatException nfe) {
                     logger.error("Cannot parse river id from '" + ids + "'");
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSLineArtifact.java	Thu Jul 19 09:11:56 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSLineArtifact.java	Thu Jul 19 09:37:52 2012 +0000
@@ -90,7 +90,7 @@
                 String[] parts = ids.split(";");
 
                 try {
-                    riverId = Integer.valueOf(parts[0]);
+                    riverId = Integer.parseInt(parts[0]);
                 }
                 catch (NumberFormatException nfe) {
                     logger.error("Cannot parse river id from '" + parts[0] + "'");
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSQPSArtifact.java	Thu Jul 19 09:11:56 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSQPSArtifact.java	Thu Jul 19 09:37:52 2012 +0000
@@ -89,7 +89,7 @@
                 String ids = artifact.getDataAsString("ids");
 
                 try {
-                    riverId = Integer.valueOf(ids);
+                    riverId = Integer.parseInt(ids);
                 }
                 catch (NumberFormatException nfe) {
                     logger.error("Cannot parse river id from '" + ids + "'");
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WQKmsInterpolArtifact.java	Thu Jul 19 09:11:56 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WQKmsInterpolArtifact.java	Thu Jul 19 09:37:52 2012 +0000
@@ -81,7 +81,7 @@
             String [] parts = code.split("-");
 
             if (parts.length >= 4) {
-                int wst = Integer.valueOf(parts[3]);
+                int wst = Integer.parseInt(parts[3]);
                 int col = -1;
                 String colpos = parts[2];
                 // Are we interested in a single column or in all columns?
@@ -89,7 +89,7 @@
                     ; // Take all.
                 }
                 else {
-                    col = Integer.valueOf(colpos);
+                    col = Integer.parseInt(colpos);
                     addStringData("col_pos", parts[2]);
                 }
                 addStringData("wst_id",  parts[3]);
@@ -207,7 +207,7 @@
     public int getDataAsInt(String dataName) {
         String val = getDataAsString(dataName);
         try {
-            return Integer.valueOf(val);
+            return Integer.parseInt(val);
         }
         catch (NumberFormatException e) {
             logger.warn("Could not get data " + dataName + " as int", e);
@@ -260,8 +260,8 @@
         logger.warn("Stub, getWQKms not yet implemented.");
 
         return WQKmsFactory.getWQKms(
-            Integer.valueOf(getDataAsString("col_pos")),
-            Integer.valueOf(getDataAsString("wst_id")));
+            Integer.parseInt(getDataAsString("col_pos")),
+            Integer.parseInt(getDataAsString("wst_id")));
     }
 
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/ChartSettings.java	Thu Jul 19 09:11:56 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/ChartSettings.java	Thu Jul 19 09:37:52 2012 +0000
@@ -215,10 +215,10 @@
 
         section.setIdentifier(id);
         section.setLabel(label);
-        section.setFontSize(Integer.valueOf(fSize.length() > 0 ? fSize : "-1"));
+        section.setFontSize(Integer.parseInt(fSize.length() > 0 ? fSize : "-1"));
         section.setFixed(Boolean.valueOf(fixation));
-        section.setLowerRange(Double.valueOf(low.length() > 0 ? low : "0"));
-        section.setUpperRange(Double.valueOf(up.length() > 0 ? up : "0"));
+        section.setLowerRange(Double.parseDouble(low.length() > 0 ? low : "0"));
+        section.setUpperRange(Double.parseDouble(up.length() > 0 ? up : "0"));
 
         target.addAxisSection(section);
     }
--- a/flys-artifacts/src/main/java/de/intevation/flys/jfree/XYStyle.java	Thu Jul 19 09:11:56 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/jfree/XYStyle.java	Thu Jul 19 09:37:52 2012 +0000
@@ -125,7 +125,7 @@
         int size = ThemeUtil.parseLineWidth(theme);
         r.setSeriesStroke(
             idx,
-            new BasicStroke(Integer.valueOf(size)));
+            new BasicStroke(size));
     }
 
 
@@ -141,7 +141,7 @@
 
         r.setSeriesStroke(
             idx,
-            new BasicStroke(Integer.valueOf(size),
+            new BasicStroke(size,
                             BasicStroke.CAP_BUTT,
                             BasicStroke.JOIN_ROUND,
                             1.0f,
--- a/flys-artifacts/src/main/java/de/intevation/flys/utils/FLYSUtils.java	Thu Jul 19 09:11:56 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/FLYSUtils.java	Thu Jul 19 09:37:52 2012 +0000
@@ -819,7 +819,7 @@
 
         for (String value: splitted) {
             try {
-                integers.add(Integer.valueOf(value));
+                integers.add(Integer.parseInt(value));
             }
             catch (NumberFormatException nfe) {
                 logger.warn("Parsing integer failed: " + nfe);
--- a/flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java	Thu Jul 19 09:11:56 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java	Thu Jul 19 09:37:52 2012 +0000
@@ -169,7 +169,7 @@
         }
 
         try {
-            return Integer.valueOf(value);
+            return Integer.parseInt(value);
         }
         catch (NumberFormatException nfe) {
             // do nothing
@@ -213,7 +213,7 @@
         }
 
         try {
-            return Integer.valueOf(size);
+            return Integer.parseInt(size);
         }
         catch (NumberFormatException nfe) {
             logger.warn("Unable to set line size from string: '" + size + "'");
@@ -289,7 +289,7 @@
         }
 
         try {
-            return Integer.valueOf(size);
+            return Integer.parseInt(size);
         }
         catch (NumberFormatException nfe) {
         }
@@ -563,9 +563,9 @@
         Color c = null;
         try {
             c = new Color(
-                    Integer.valueOf(rgb[0].trim()),
-                    Integer.valueOf(rgb[1].trim()),
-                    Integer.valueOf(rgb[2].trim()));
+                    Integer.parseInt(rgb[0].trim()),
+                    Integer.parseInt(rgb[1].trim()),
+                    Integer.parseInt(rgb[2].trim()));
         }
         catch (NumberFormatException nfe) {
             c = null;
@@ -689,7 +689,7 @@
 
             try {
                 int length = name.length();
-                int idx    = Integer.valueOf(name.substring(length-1, length));
+                int idx    = Integer.parseInt(name.substring(length-1, length));
 
                 expr = createWSPLGENExpression(idx);
             }

http://dive4elements.wald.intevation.org