Repository: ant
Updated Branches:
  refs/heads/master 30f52135a -> 79c8cb54f


More StringBuffer size checks

Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/79c8cb54
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/79c8cb54
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/79c8cb54

Branch: refs/heads/master
Commit: 79c8cb54fedcd3143c8db06bccd6f4e4797f7c18
Parents: 30f5213
Author: Gintas Grigelionis <gin...@apache.org>
Authored: Fri Apr 6 15:07:45 2018 +0200
Committer: Gintas Grigelionis <gin...@apache.org>
Committed: Fri Apr 6 15:07:45 2018 +0200

----------------------------------------------------------------------
 .../apache/tools/ant/filters/EscapeUnicode.java   |  8 ++++----
 .../org/apache/tools/ant/taskdefs/ExecuteOn.java  |  4 ++--
 .../org/apache/tools/ant/taskdefs/Redirector.java |  2 +-
 .../ant/taskdefs/optional/ejb/IPlanetEjbc.java    | 18 +++++++++---------
 4 files changed, 16 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/79c8cb54/src/main/org/apache/tools/ant/filters/EscapeUnicode.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/filters/EscapeUnicode.java 
b/src/main/org/apache/tools/ant/filters/EscapeUnicode.java
index dd45439..46c5463 100644
--- a/src/main/org/apache/tools/ant/filters/EscapeUnicode.java
+++ b/src/main/org/apache/tools/ant/filters/EscapeUnicode.java
@@ -82,7 +82,10 @@ public class EscapeUnicode
         }
 
         int ch = -1;
-        if (unicodeBuf.length() == 0) {
+        if (unicodeBuf.length() > 0) {
+            ch = (int) unicodeBuf.charAt(0);
+            unicodeBuf.deleteCharAt(0);
+        } else {
             ch = in.read();
             if (ch != -1) {
                 char achar = (char) ch;
@@ -91,9 +94,6 @@ public class EscapeUnicode
                     ch = '\\';
                 }
             }
-        } else {
-            ch = (int) unicodeBuf.charAt(0);
-            unicodeBuf.deleteCharAt(0);
         }
         return ch;
     }

http://git-wip-us.apache.org/repos/asf/ant/blob/79c8cb54/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java 
b/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java
index 7825fac..8994978 100644
--- a/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java
+++ b/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java
@@ -615,8 +615,8 @@ public class ExecuteOn extends ExecTask {
             if (forwardSlash && fileSeparator != '/') {
                 src = src.replace(fileSeparator, '/');
             }
-            if (srcFilePos != null && (srcFilePos.getPrefix().length() > 0
-                    || srcFilePos.getSuffix().length() > 0)) {
+            if (srcFilePos != null
+                    && (!srcFilePos.getPrefix().isEmpty() || 
!srcFilePos.getSuffix().isEmpty())) {
                 src = srcFilePos.getPrefix() + src + srcFilePos.getSuffix();
             }
             result[srcIndex + i] = src;

http://git-wip-us.apache.org/repos/asf/ant/blob/79c8cb54/src/main/org/apache/tools/ant/taskdefs/Redirector.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/Redirector.java 
b/src/main/org/apache/tools/ant/taskdefs/Redirector.java
index 6bb740e..036a1bf 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Redirector.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Redirector.java
@@ -561,7 +561,7 @@ public class Redirector {
         String line = null;
         final StringBuffer val = new StringBuffer();
         while ((line = in.readLine()) != null) {
-            if (val.length() != 0) {
+            if (val.length() > 0) {
                 val.append(StringUtils.LINE_SEP);
             }
             val.append(line);

http://git-wip-us.apache.org/repos/asf/ant/blob/79c8cb54/src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbc.java
----------------------------------------------------------------------
diff --git 
a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbc.java 
b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbc.java
index 03ce331..8c930bc 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbc.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbc.java
@@ -436,31 +436,31 @@ public class IPlanetEjbc {
      */
     protected void checkConfiguration() throws EjbcException {
 
-        String msg = "";
+        StringBuilder msg = new StringBuilder();
 
         if (stdDescriptor == null) {
-            msg += "A standard XML descriptor file must be specified.  ";
+            msg.append("A standard XML descriptor file must be specified.  ");
         }
         if (iasDescriptor == null) {
-            msg += "An iAS-specific XML descriptor file must be specified.  ";
+            msg.append("An iAS-specific XML descriptor file must be specified. 
 ");
         }
         if (classpath == null) {
-            msg += "A classpath must be specified.    ";
+            msg.append("A classpath must be specified.    ");
         }
         if (parser == null) {
-            msg += "An XML parser must be specified.    ";
+            msg.append("An XML parser must be specified.    ");
         }
 
         if (destDirectory == null) {
-            msg += "A destination directory must be specified.  ";
+            msg.append("A destination directory must be specified.  ");
         } else if (!destDirectory.exists()) {
-            msg += "The destination directory specified does not exist.  ";
+            msg.append("The destination directory specified does not exist.  
");
         } else if (!destDirectory.isDirectory()) {
-            msg += "The destination specified is not a directory.  ";
+            msg.append("The destination specified is not a directory.  ");
         }
 
         if (msg.length() > 0) {
-            throw new EjbcException(msg);
+            throw new EjbcException(msg.toString());
         }
     }
 

Reply via email to