ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peterrei...@apache.org
Subject svn commit: r578200 - in /ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant: taskdefs/optional/net/ taskdefs/optional/sos/ taskdefs/optional/vss/ types/ types/mappers/ types/resources/ types/selectors/modifiedselector/ util/
Date Fri, 21 Sep 2007 16:34:16 GMT
Author: peterreilly
Date: Fri Sep 21 09:34:12 2007
New Revision: 578200

URL: http://svn.apache.org/viewvc?rev=578200&view=rev
Log:
sync magic numbers

Modified:
    ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/net/RExecTask.java
    ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/sos/SOS.java
    ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java
    ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/types/Quantifier.java
    ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/types/mappers/FilterMapper.java
    ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/types/resources/CompressedResource.java
    ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/types/selectors/modifiedselector/DigestAlgorithm.java
    ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/util/DOMElementWriter.java

Modified: ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/net/RExecTask.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/net/RExecTask.java?rev=578200&r1=578199&r2=578200&view=diff
==============================================================================
--- ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/net/RExecTask.java
(original)
+++ ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/net/RExecTask.java
Fri Sep 21 09:34:12 2007
@@ -37,6 +37,9 @@
  */
 
 public class RExecTask extends Task {
+
+    private static final int PAUSE_TIME = 250;
+
     /**
      *  The userid to login with, if automated login is used
      */
@@ -210,7 +213,7 @@
                     while (sb.toString().indexOf(s) == -1) {
                         while (Calendar.getInstance().before(endTime)
                             && is.available() == 0) {
-                            Thread.sleep(250);
+                            Thread.sleep(PAUSE_TIME);
                         }
                         if (is.available() == 0) {
                             throw new BuildException(
@@ -270,7 +273,7 @@
                 int read = 0;
                     while (read != -1) {
                         while (Calendar.getInstance().before(endTime) && is.available()
== 0) {
-                            Thread.sleep(250);
+                            Thread.sleep(PAUSE_TIME);
                         }
                         if (is.available() == 0) {
                         log(sb.toString(), Project.MSG_INFO);

Modified: ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/sos/SOS.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/sos/SOS.java?rev=578200&r1=578199&r2=578200&view=diff
==============================================================================
--- ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/sos/SOS.java
(original)
+++ ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/sos/SOS.java
Fri Sep 21 09:34:12 2007
@@ -36,6 +36,8 @@
 
 public abstract class SOS extends Task implements SOSCmd {
 
+    private static final int ERROR_EXIT_STATUS = 255;
+
     private String sosCmdDir = null;
     private String sosUsername = null;
     private String sosPassword = "";
@@ -390,7 +392,7 @@
         int result = 0;
         buildCmdLine();
         result = run(commandLine);
-        if (result == 255) {  // This is the exit status
+        if (result == ERROR_EXIT_STATUS) {  // This is the exit status
             String msg = "Failed executing: " + commandLine.toString();
             throw new BuildException(msg, getLocation());
         }

Modified: ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java?rev=578200&r1=578199&r2=578200&view=diff
==============================================================================
--- ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java
(original)
+++ ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java
Fri Sep 21 09:34:12 2007
@@ -138,11 +138,13 @@
      */
     public final void setVsspath(final String vssPath) {
         String projectPath;
+        // CheckStyle:MagicNumber OFF
         if (vssPath.startsWith("vss://")) { //$NON-NLS-1$
             projectPath = vssPath.substring(5);
         } else {
             projectPath = vssPath;
         }
+        // CheckStyle:MagicNumber ON
 
         if (projectPath.startsWith(PROJECT_PREFIX)) {
             this.vssPath = projectPath;
@@ -425,6 +427,7 @@
      */
     private String getShortLabel() {
         String shortLabel;
+        // CheckStyle:MagicNumber OFF
         if (label !=  null && label.length() > 31) {
             shortLabel = this.label.substring(0, 30);
             log("Label is longer than 31 characters, truncated to: " + shortLabel,
@@ -432,6 +435,7 @@
         } else {
             shortLabel = label;
         }
+        // CheckStyle:MagicNumber ON
         return shortLabel;
     }
     /**
@@ -554,6 +558,7 @@
         if (fromLabel == null && toLabel == null) {
             return "";
         }
+        // CheckStyle:MagicNumber OFF
         if (fromLabel != null && toLabel != null) {
             if (fromLabel.length() > 31) {
                 fromLabel = fromLabel.substring(0, 30);
@@ -581,6 +586,7 @@
             }
             return FLAG_VERSION_LABEL + toLabel;
         }
+        // CheckStyle:MagicNumber ON
     }
 
     /**

Modified: ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/types/Quantifier.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/types/Quantifier.java?rev=578200&r1=578199&r2=578200&view=diff
==============================================================================
--- ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/types/Quantifier.java (original)
+++ ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/types/Quantifier.java Fri
Sep 21 09:34:12 2007
@@ -78,6 +78,7 @@
     private static final Predicate[] PREDS = new Predicate[VALUES.length];
 
     static {
+        // CheckStyle:MagicNumber OFF
         PREDS[0] = ALL_PRED;
         PREDS[1] = ALL_PRED;
         PREDS[2] = ALL_PRED;
@@ -87,6 +88,7 @@
         PREDS[6] = MAJORITY_PRED;
         PREDS[7] = MAJORITY_PRED;
         PREDS[8] = NONE_PRED;
+        // CheckStyle:MagicNumber ON
     }
 
     /**

Modified: ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/types/mappers/FilterMapper.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/types/mappers/FilterMapper.java?rev=578200&r1=578199&r2=578200&view=diff
==============================================================================
--- ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/types/mappers/FilterMapper.java
(original)
+++ ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/types/mappers/FilterMapper.java
Fri Sep 21 09:34:12 2007
@@ -34,6 +34,9 @@
  * This is a FileNameMapper based on a FilterChain.
  */
 public class FilterMapper extends FilterChain implements FileNameMapper {
+
+    private static final int BUFFER_SIZE = 8192;
+
     /**
      * From attribute not supported.
      * @param from a string
@@ -64,7 +67,7 @@
         try {
             Reader stringReader = new StringReader(sourceFileName);
             ChainReaderHelper helper = new ChainReaderHelper();
-            helper.setBufferSize(8192);
+            helper.setBufferSize(BUFFER_SIZE);
             helper.setPrimaryReader(stringReader);
             helper.setProject(getProject());
             Vector filterChains = new Vector();

Modified: ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/types/resources/CompressedResource.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/types/resources/CompressedResource.java?rev=578200&r1=578199&r2=578200&view=diff
==============================================================================
--- ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/types/resources/CompressedResource.java
(original)
+++ ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/types/resources/CompressedResource.java
Fri Sep 21 09:34:12 2007
@@ -38,6 +38,8 @@
  */
 public abstract class CompressedResource extends Resource {
 
+    private static final int BUFFER_SIZE = 8192;
+
     private Resource resource;
 
     /** no arg constructor */
@@ -153,7 +155,7 @@
             InputStream in = null;
             try {
                 in = getInputStream();
-                byte[] buf = new byte[8192];
+                byte[] buf = new byte[BUFFER_SIZE];
                 int size = 0;
                 int readNow;
                 while ((readNow = in.read(buf, 0, buf.length)) > 0) {

Modified: ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/types/selectors/modifiedselector/DigestAlgorithm.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/types/selectors/modifiedselector/DigestAlgorithm.java?rev=578200&r1=578199&r2=578200&view=diff
==============================================================================
--- ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/types/selectors/modifiedselector/DigestAlgorithm.java
(original)
+++ ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/types/selectors/modifiedselector/DigestAlgorithm.java
Fri Sep 21 09:34:12 2007
@@ -56,6 +56,7 @@
  */
 public class DigestAlgorithm implements Algorithm {
 
+    private static final int BUFFER_SIZE = 8192;
 
     // -----  member variables  -----
 
@@ -78,7 +79,7 @@
     /**
      * Size of the read buffer to use.
      */
-    private int readBufferSize = 8 * 1024;
+    private int readBufferSize = BUFFER_SIZE;
 
 
     // -----  Algorithm-Configuration  -----

Modified: ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/util/DOMElementWriter.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/util/DOMElementWriter.java?rev=578200&r1=578199&r2=578200&view=diff
==============================================================================
--- ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/util/DOMElementWriter.java
(original)
+++ ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/util/DOMElementWriter.java
Fri Sep 21 09:34:12 2007
@@ -532,6 +532,7 @@
      * @since 1.10, Ant 1.5
      */
     public boolean isLegalCharacter(char c) {
+        // CheckStyle:MagicNumber OFF
         if (c == 0x9 || c == 0xA || c == 0xD) {
             return true;
         } else if (c < 0x20) {
@@ -543,6 +544,7 @@
         } else if (c <= 0xFFFD) {
             return true;
         }
+        // CheckStyle:MagicNumber ON
         return false;
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message