ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peterrei...@apache.org
Subject svn commit: r577685 - in /ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional: dotnet/ jlink/ jsp/ junit/ net/ splash/ ssh/
Date Thu, 20 Sep 2007 11:12:59 GMT
Author: peterreilly
Date: Thu Sep 20 04:12:57 2007
New Revision: 577685

URL: http://svn.apache.org/viewvc?rev=577685&view=rev
Log:
sync: more magic num

Modified:
    ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/NetCommand.java
    ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/jlink/ClassNameReader.java
    ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/jlink/jlink.java
    ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/jsp/Jasper41Mangler.java
    ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/jsp/JspNameMangler.java
    ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
    ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/net/SetProxy.java
    ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/net/TelnetTask.java
    ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/splash/SplashTask.java
    ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHExec.java

Modified: ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/NetCommand.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/NetCommand.java?rev=577685&r1=577684&r2=577685&view=diff
==============================================================================
--- ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/NetCommand.java
(original)
+++ ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/NetCommand.java
Thu Sep 20 04:12:57 2007
@@ -55,7 +55,7 @@
  */
 
 public class NetCommand {
-
+    private static final int DEFAULT_RESPONSE_THRESHOLD = 64;
     private static final FileUtils FILE_UTILS = FileUtils.getFileUtils();
     // CheckStyle:VisibilityModifier OFF - bc
 
@@ -115,7 +115,7 @@
     /**
      * internal threshold for auto-switch
      */
-    private int automaticResponseFileThreshold = 64;
+    private int automaticResponseFileThreshold = DEFAULT_RESPONSE_THRESHOLD;
 
     /**
      *  constructor

Modified: ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/jlink/ClassNameReader.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/jlink/ClassNameReader.java?rev=577685&r1=577684&r2=577685&view=diff
==============================================================================
--- ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/jlink/ClassNameReader.java
(original)
+++ ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/jlink/ClassNameReader.java
Thu Sep 20 04:12:57 2007
@@ -105,6 +105,7 @@
  * minimal task only.
  */
 public class ClassNameReader extends Object {
+    private static final int CLASS_MAGIC_NUMBER =  0xCAFEBABE;
 
     /**
      * Get the class name of a class in an input stream.
@@ -117,7 +118,7 @@
         DataInputStream data = new DataInputStream(input);
         // verify this is a valid class file.
         int cookie = data.readInt();
-        if (cookie != 0xCAFEBABE) {
+        if (cookie != CLASS_MAGIC_NUMBER) {
             return null;
         }
         /* int version = */ data.readInt();

Modified: ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/jlink/jlink.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/jlink/jlink.java?rev=577685&r1=577684&r2=577685&view=diff
==============================================================================
--- ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/jlink/jlink.java
(original)
+++ ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/jlink/jlink.java
Thu Sep 20 04:12:57 2007
@@ -44,19 +44,20 @@
  * jlink links together multiple .jar files.
  */
 public class jlink {
-
+    private static final int BUFFER_SIZE = 8192;
+    private static final int VECTOR_INIT_SIZE = 10;
 
     private String outfile = null;
 
-    private Vector mergefiles = new Vector(10);
+    private Vector mergefiles = new Vector(VECTOR_INIT_SIZE);
 
-    private Vector addfiles = new Vector(10);
+    private Vector addfiles = new Vector(VECTOR_INIT_SIZE);
 
     private boolean compression = false;
 
     // CheckStyle:VisibilityModifier OFF - bc
 
-    byte[] buffer = new byte[8192];
+    byte[] buffer = new byte[BUFFER_SIZE];
 
     // CheckStyle:VisibilityModifier OFF - bc
 

Modified: ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/jsp/Jasper41Mangler.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/jsp/Jasper41Mangler.java?rev=577685&r1=577684&r2=577685&view=diff
==============================================================================
--- ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/jsp/Jasper41Mangler.java
(original)
+++ ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/jsp/Jasper41Mangler.java
Thu Sep 20 04:12:57 2007
@@ -63,7 +63,7 @@
      * Mangle the specified character to create a legal Java class name.
      */
     private static String mangleChar(char ch) {
-
+        // CheckStyle:MagicNumber OFF
         String s = Integer.toHexString(ch);
         int nzeros = 5 - s.length();
         char[] result = new char[6];
@@ -75,6 +75,7 @@
             result[i] = s.charAt(j);
         }
         return new String(result);
+        // CheckStyle:MagicNumber ON
     }
 
 

Modified: ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/jsp/JspNameMangler.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/jsp/JspNameMangler.java?rev=577685&r1=577684&r2=577685&view=diff
==============================================================================
--- ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/jsp/JspNameMangler.java
(original)
+++ ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/jsp/JspNameMangler.java
Thu Sep 20 04:12:57 2007
@@ -112,7 +112,7 @@
         String className;
         String filename = jspFile.getName();
         if (filename.endsWith(".jsp")) {
-            className = filename.substring(0, filename.length() - 4);
+            className = filename.substring(0, filename.length() - ".jsp".length());
         } else {
             className = filename;
         }
@@ -127,7 +127,7 @@
      * @return mangled string; 5 digit hex value
      */
     private static String mangleChar(char ch) {
-
+        // CheckStyle:MagicNumber OFF
         if (ch == File.separatorChar) {
             ch = '/';
         }
@@ -143,6 +143,7 @@
             result[i] = s.charAt(resultIndex++);
         }
         return new String(result);
+        // CheckStyle:MagicNumber ON
     }
 
     /**

Modified: ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java?rev=577685&r1=577684&r2=577685&view=diff
==============================================================================
--- ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
(original)
+++ ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
Thu Sep 20 04:12:57 2007
@@ -1670,9 +1670,11 @@
          * @return hash code value
          */
         public int hashCode() {
+            // CheckStyle:MagicNumber OFF
             return (filterTrace ? 1 : 0)
                 + (haltOnError ? 2 : 0)
                 + (haltOnFailure ? 4 : 0);
+            // CheckStyle:MagicNumber ON
         }
     }
 

Modified: ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/net/SetProxy.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/net/SetProxy.java?rev=577685&r1=577684&r2=577685&view=diff
==============================================================================
--- ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/net/SetProxy.java
(original)
+++ ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/net/SetProxy.java
Thu Sep 20 04:12:57 2007
@@ -56,7 +56,8 @@
  * @ant.task category="network"
  */
 public class SetProxy extends Task {
-
+    private static final int HTTP_PORT = 80;
+    private static final int SOCKS_PORT = 1080;
     // CheckStyle:VisibilityModifier OFF - bc
     /**
      * proxy details
@@ -66,7 +67,7 @@
     /**
      * name of proxy port
      */
-    protected int proxyPort = 80;
+    protected int proxyPort = HTTP_PORT;
 
     // CheckStyle:VisibilityModifier ON
 
@@ -78,7 +79,7 @@
     /**
      * Socks proxy port. Default is 1080.
      */
-    private int socksProxyPort = 1080;
+    private int socksProxyPort = SOCKS_PORT;
 
 
     /**

Modified: ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/net/TelnetTask.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/net/TelnetTask.java?rev=577685&r1=577684&r2=577685&view=diff
==============================================================================
--- ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/net/TelnetTask.java
(original)
+++ ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/net/TelnetTask.java
Thu Sep 20 04:12:57 2007
@@ -35,6 +35,9 @@
  */
 
 public class TelnetTask extends Task {
+    private static final int QUARTER_SECOND = 250;
+    private static final int TELNET_PORT = 23;
+
     /**
      *  The userid to login with, if automated login is used
      */
@@ -53,7 +56,7 @@
     /**
      *  The tcp port to connect to.
      */
-    private int port = 23;
+    private int port = TELNET_PORT;
 
     /**
      *  The list of read/write commands for this session
@@ -347,7 +350,7 @@
                     while (sb.toString().indexOf(s) == -1) {
                         while (Calendar.getInstance().before(endTime)
                                && is.available() == 0) {
-                            Thread.sleep(250);
+                            Thread.sleep(QUARTER_SECOND);
                         }
                         if (is.available() == 0) {
                             log("Read before running into timeout: "

Modified: ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/splash/SplashTask.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/splash/SplashTask.java?rev=577685&r1=577684&r2=577685&view=diff
==============================================================================
--- ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/splash/SplashTask.java
(original)
+++ ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/splash/SplashTask.java
Thu Sep 20 04:12:57 2007
@@ -38,13 +38,14 @@
  * @since Ant1.5
  */
 public class SplashTask extends Task {
+    private static final int FIVE_SECONDS = 5000;
 
     private String imgurl = null;
     private String proxy = null;
     private String user = null;
     private String password = null;
     private String port = "80";
-    private int showDuration = 5000;
+    private int showDuration = FIVE_SECONDS;
     private boolean useProxy = false;
 
     private static SplashScreen splash = null;

Modified: ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHExec.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHExec.java?rev=577685&r1=577684&r2=577685&view=diff
==============================================================================
--- ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHExec.java
(original)
+++ ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHExec.java
Thu Sep 20 04:12:57 2007
@@ -44,6 +44,9 @@
  */
 public class SSHExec extends SSHBase {
 
+    private static final int BUFFER_SIZE = 8192;
+    private static final int HALF_SECOND = 500;
+
     /** the command to execute via ssh */
     private String command = null;
 
@@ -192,7 +195,7 @@
                                 return;
                             }
                             try {
-                                sleep(500);
+                                sleep(HALF_SECOND);
                             } catch (Exception e) {
                                 // ignored
                             }
@@ -277,7 +280,7 @@
         try {
             out = new FileWriter(to.getAbsolutePath(), append);
             StringReader in = new StringReader(from);
-            char[] buffer = new char[8192];
+            char[] buffer = new char[BUFFER_SIZE];
             int bytesRead;
             while (true) {
                 bytesRead = in.read(buffer);



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


Mime
View raw message