changeset 3453:e74e707ff650

Replace string comparison with empty string with length equals zero comparison flys-artifacts/trunk@5117 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Tue, 24 Jul 2012 09:16:00 +0000
parents 200e70f31f6f
children 98745f308319
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/ManualPointsSingleState.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/StateFactory.java flys-artifacts/src/main/java/de/intevation/flys/exports/CrossSectionGenerator.java flys-artifacts/src/main/java/de/intevation/flys/themes/ThemeMapping.java
diffstat 5 files changed, 19 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Tue Jul 24 08:03:28 2012 +0000
+++ b/flys-artifacts/ChangeLog	Tue Jul 24 09:16:00 2012 +0000
@@ -1,4 +1,12 @@
-2012-07-23	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+2012-07-24	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/states/StateFactory.java,
+	  src/main/java/de/intevation/flys/artifacts/states/ManualPointsSingleState.java
+	  src/main/java/de/intevation/flys/exports/CrossSectionGenerator.java
+	  src/main/java/de/intevation/flys/themes/ThemeMapping.java:
+	  s/.equals("")/.length() == 0/
+
+2012-07-24	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/model/Calculation6.java,
 	  src/main/java/de/intevation/flys/artifacts/model/WQTimerange.java,
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/ManualPointsSingleState.java	Tue Jul 24 08:03:28 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/ManualPointsSingleState.java	Tue Jul 24 09:16:00 2012 +0000
@@ -69,7 +69,7 @@
             // Handle points.
             String pointData = points.getDataAsString(ct + "." + MANUALPOINTS +
                 DOT_DATA);
-            if (pointData != null && !pointData.equals("")
+            if (pointData != null && pointData.length() != 0
                 && !pointData.equals("[]")) {
                 String fName = ct + "." + MANUALPOINTS;
                 ManualPointsFacet facet = new ManualPointsFacet(
@@ -86,7 +86,7 @@
             // Handle lines.
             String linesData = points.getDataAsString(ct + "." + MANUALPOINTS +
                 DOT_LINES);
-            if (linesData != null && !linesData.equals("")
+            if (linesData != null && linesData.length() != 0
                 && !linesData.equals("[]")) {
                 try {
                     JSONArray lines = new JSONArray((String) linesData);
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/StateFactory.java	Tue Jul 24 08:03:28 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/StateFactory.java	Tue Jul 24 09:16:00 2012 +0000
@@ -103,12 +103,12 @@
             String desc = (String) XMLUtils.xpath(
                 data, XPATH_DATA_DESCRIPTION, XPathConstants.STRING);
 
-            if (name == null || name.equals("")) {
+            if (name == null || name.length() == 0) {
                 logger.warn("No name for data item at pos " + i + " found.");
                 continue;
             }
 
-            if (type == null || type.equals("")) {
+            if (type == null || type.length() == 0) {
                 logger.warn("No type for data item at pos " + i + " found.");
                 logger.warn("Default type 'string' used.");
                 type = "string";
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/CrossSectionGenerator.java	Tue Jul 24 08:03:28 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/CrossSectionGenerator.java	Tue Jul 24 09:16:00 2012 +0000
@@ -326,7 +326,7 @@
         if (ThemeUtil.parseShowWidth(theme)) {
             NumberFormat nf = Formatter.getMeterFormat(this.context);
             String labelAdd = "b=" + nf.format(lines.width) + "m";
-            if (series.getLabel().equals("")) {
+            if (series.getLabel().length() == 0) {
                series.setLabel(labelAdd);
             }
             else {
@@ -337,7 +337,7 @@
                 && lines.points[1].length > 0) {
             NumberFormat nf = Formatter.getMeterFormat(this.context);
             String labelAdd = "W=" + nf.format(lines.points[1][0]) + "NN+m";
-            if (series.getLabel().equals("")) {
+            if (series.getLabel().length() == 0) {
                series.setLabel(labelAdd);
             }
             else {
@@ -348,7 +348,7 @@
             NumberFormat nf = Formatter.getMeterFormat(this.context);
             String labelAdd = "H=" + nf.format(lines.area / lines.width) + "m";
                 // : " + lines.area + "/" + lines.width);
-            if (series.getLabel().equals("")) {
+            if (series.getLabel().length() == 0) {
                series.setLabel(labelAdd);
             }
             else {
--- a/flys-artifacts/src/main/java/de/intevation/flys/themes/ThemeMapping.java	Tue Jul 24 08:03:28 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/themes/ThemeMapping.java	Tue Jul 24 09:16:00 2012 +0000
@@ -84,7 +84,7 @@
      * @return true if pattern matches text or pattern is empty.
      */
     public boolean applyPattern(String text) {
-        if (patternStr == null || patternStr.equals("")) {
+        if (patternStr == null || patternStr.length() == 0) {
             return true;
         }
         Matcher m = pattern.matcher(text);
@@ -103,7 +103,7 @@
      * @return true if no condition is specified or condition is met.
      */
     public boolean masterAttrMatches(FLYSArtifact artifact) {
-        if (masterAttr == null || masterAttr.equals("")) {
+        if (masterAttr == null || masterAttr.length() == 0) {
            return true;
         }
 
@@ -125,7 +125,7 @@
      * in parameter output.
      */
     public boolean outputMatches(String output) {
-        if (this.output == null || this.output.equals("")) {
+        if (this.output == null || this.output.length() == 0) {
             return true;
         }
 

http://dive4elements.wald.intevation.org