ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peterrei...@apache.org
Subject svn commit: r578740 - in /ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools: ant/taskdefs/optional/junit/ ant/taskdefs/optional/splash/ ant/taskdefs/optional/ssh/ ant/taskdefs/rmic/ ant/types/optional/depend/ ant/types/selectors/modifiedselecto...
Date Mon, 24 Sep 2007 10:00:33 GMT
Author: peterreilly
Date: Mon Sep 24 03:00:31 2007
New Revision: 578740

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

Modified:
    ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/junit/BriefJUnitResultFormatter.java
    ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/junit/PlainJUnitResultFormatter.java
    ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/junit/SummaryJUnitResultFormatter.java
    ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLJUnitResultFormatter.java
    ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/splash/SplashScreen.java
    ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/ssh/AbstractSshMessage.java
    ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java
    ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/types/optional/depend/ClassfileSet.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/tar/TarInputStream.java

Modified: ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/junit/BriefJUnitResultFormatter.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/junit/BriefJUnitResultFormatter.java?rev=578740&r1=578739&r2=578740&view=diff
==============================================================================
--- ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/junit/BriefJUnitResultFormatter.java
(original)
+++ ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/junit/BriefJUnitResultFormatter.java
Mon Sep 24 03:00:31 2007
@@ -38,6 +38,8 @@
  */
 public class BriefJUnitResultFormatter implements JUnitResultFormatter {
 
+    private static final double ONE_SECOND = 1000.0;
+
     /**
      * Where to write the log to.
      */
@@ -134,7 +136,7 @@
         sb.append(", Errors: ");
         sb.append(suite.errorCount());
         sb.append(", Time elapsed: ");
-        sb.append(numberFormat.format(suite.getRunTime() / 1000.0));
+        sb.append(numberFormat.format(suite.getRunTime() / ONE_SECOND));
         sb.append(" sec");
         sb.append(StringUtils.LINE_SEP);
         sb.append(StringUtils.LINE_SEP);

Modified: ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/junit/PlainJUnitResultFormatter.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/junit/PlainJUnitResultFormatter.java?rev=578740&r1=578739&r2=578740&view=diff
==============================================================================
--- ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/junit/PlainJUnitResultFormatter.java
(original)
+++ ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/junit/PlainJUnitResultFormatter.java
Mon Sep 24 03:00:31 2007
@@ -40,6 +40,8 @@
 
 public class PlainJUnitResultFormatter implements JUnitResultFormatter {
 
+    private static final double ONE_SECOND = 1000.0;
+
     /**
      * Formatter for timings.
      */
@@ -122,7 +124,7 @@
         sb.append(", Errors: ");
         sb.append(suite.errorCount());
         sb.append(", Time elapsed: ");
-        sb.append(nf.format(suite.getRunTime() / 1000.0));
+        sb.append(nf.format(suite.getRunTime() / ONE_SECOND));
         sb.append(" sec");
         sb.append(StringUtils.LINE_SEP);
 
@@ -190,7 +192,7 @@
             // can be null if an error occurred in setUp
             if (l != null) {
                 seconds =
-                    (System.currentTimeMillis() - l.longValue()) / 1000.0;
+                    (System.currentTimeMillis() - l.longValue()) / ONE_SECOND;
             }
 
             wri.println(" took " + nf.format(seconds) + " sec");

Modified: ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/junit/SummaryJUnitResultFormatter.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/junit/SummaryJUnitResultFormatter.java?rev=578740&r1=578739&r2=578740&view=diff
==============================================================================
--- ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/junit/SummaryJUnitResultFormatter.java
(original)
+++ ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/junit/SummaryJUnitResultFormatter.java
Mon Sep 24 03:00:31 2007
@@ -33,6 +33,8 @@
 public class SummaryJUnitResultFormatter
     implements JUnitResultFormatter, JUnitTaskMirror.SummaryJUnitResultFormatterMirror {
 
+    private static final double ONE_SECOND = 1000.0;
+
     /**
      * Formatter for timings.
      */
@@ -143,7 +145,7 @@
         sb.append(", Errors: ");
         sb.append(suite.errorCount());
         sb.append(", Time elapsed: ");
-        sb.append(nf.format(suite.getRunTime() / 1000.0));
+        sb.append(nf.format(suite.getRunTime() / ONE_SECOND));
         sb.append(" sec");
         sb.append(newLine);
 

Modified: ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLJUnitResultFormatter.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLJUnitResultFormatter.java?rev=578740&r1=578739&r2=578740&view=diff
==============================================================================
--- ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLJUnitResultFormatter.java
(original)
+++ ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLJUnitResultFormatter.java
Mon Sep 24 03:00:31 2007
@@ -50,6 +50,8 @@
 
 public class XMLJUnitResultFormatter implements JUnitResultFormatter, XMLConstants {
 
+    private static final double ONE_SECOND = 1000.0;
+
     /** constant for unnnamed testsuites/cases */
     private static final String UNKNOWN = "unknown";
 
@@ -159,7 +161,8 @@
         rootElement.setAttribute(ATTR_TESTS, "" + suite.runCount());
         rootElement.setAttribute(ATTR_FAILURES, "" + suite.failureCount());
         rootElement.setAttribute(ATTR_ERRORS, "" + suite.errorCount());
-        rootElement.setAttribute(ATTR_TIME, "" + (suite.getRunTime() / 1000.0));
+        rootElement.setAttribute(
+            ATTR_TIME, "" + (suite.getRunTime() / ONE_SECOND));
         if (out != null) {
             Writer wri = null;
             try {
@@ -219,7 +222,8 @@
 
         Long l = (Long) testStarts.get(test);
         currentTest.setAttribute(ATTR_TIME,
-            "" + ((System.currentTimeMillis() - l.longValue()) / 1000.0));
+            "" + ((System.currentTimeMillis()
+                   - l.longValue()) / ONE_SECOND));
     }
 
     /**

Modified: ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/splash/SplashScreen.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/splash/SplashScreen.java?rev=578740&r1=578739&r2=578740&view=diff
==============================================================================
--- ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/splash/SplashScreen.java
(original)
+++ ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/splash/SplashScreen.java
Mon Sep 24 03:00:31 2007
@@ -35,7 +35,7 @@
 import org.apache.tools.ant.BuildListener;
 
 class SplashScreen extends JWindow implements ActionListener, BuildListener {
-
+    private static final int FONT_SIZE = 12;
     private JLabel text;
     private JProgressBar pb;
     private int total;
@@ -63,7 +63,7 @@
 
         piccy.setBorder(BorderFactory.createLineBorder(Color.black, 1));
         text = new JLabel("Building....", JLabel.CENTER);
-        text.setFont(new Font("Sans-Serif", Font.BOLD, 12));
+        text.setFont(new Font("Sans-Serif", Font.BOLD, FONT_SIZE));
         text.setBorder(BorderFactory.createEtchedBorder());
 
         pb = new JProgressBar(MIN, MAX);

Modified: ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/ssh/AbstractSshMessage.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/ssh/AbstractSshMessage.java?rev=578740&r1=578739&r2=578740&view=diff
==============================================================================
--- ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/ssh/AbstractSshMessage.java
(original)
+++ ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/ssh/AbstractSshMessage.java
Mon Sep 24 03:00:31 2007
@@ -36,6 +36,7 @@
  * Abstract class for ssh upload and download
  */
 public abstract class AbstractSshMessage {
+    private static final double ONE_SECOND = 1000.0;
 
     private Session session;
     private boolean verbose;
@@ -172,7 +173,7 @@
     protected void logStats(long timeStarted,
                              long timeEnded,
                              long totalLength) {
-        double duration = (timeEnded - timeStarted) / 1000.0;
+        double duration = (timeEnded - timeStarted) / ONE_SECOND;
         NumberFormat format = NumberFormat.getNumberInstance();
         format.setMaximumFractionDigits(2);
         format.setMinimumFractionDigits(1);
@@ -201,6 +202,7 @@
     protected final int trackProgress(long filesize, long totalLength,
                                       int percentTransmitted) {
 
+        // CheckStyle:MagicNumber OFF
         int percent = (int) Math.round(Math.floor((totalLength
                                                    / (double) filesize) * 100));
 
@@ -223,6 +225,7 @@
                 }
             }
         }
+        // CheckStyle:MagicNumber ON
 
         return percent;
     }

Modified: ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java?rev=578740&r1=578739&r2=578740&view=diff
==============================================================================
--- ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java
(original)
+++ ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java
Mon Sep 24 03:00:31 2007
@@ -365,7 +365,7 @@
             }
 
             // we know that name.endsWith(".class")
-            String base = name.substring(0, name.length() - 6);
+            String base = name.substring(0, name.length() - ".class".length());
 
             String classname = base.replace(File.separatorChar, '.');
             if (attributes.getVerify()

Modified: ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/types/optional/depend/ClassfileSet.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/types/optional/depend/ClassfileSet.java?rev=578740&r1=578739&r2=578740&view=diff
==============================================================================
--- ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/types/optional/depend/ClassfileSet.java
(original)
+++ ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/types/optional/depend/ClassfileSet.java
Mon Sep 24 03:00:31 2007
@@ -126,7 +126,8 @@
             for (int i = 0; i < files.length; ++i) {
                 if (files[i].endsWith(".class")) {
                     String classFilePath
-                        = files[i].substring(0, files[i].length() - 6);
+                        = files[i].substring(
+                            0, files[i].length() - ".class".length());
                     String className
                         = classFilePath.replace('/', '.').replace('\\', '.');
                     allRootClasses.addElement(className);

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=578740&r1=578739&r2=578740&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
Mon Sep 24 03:00:31 2007
@@ -56,6 +56,7 @@
  */
 public class DigestAlgorithm implements Algorithm {
 
+    private static final int BYTE_MASK = 0xFF;
     private static final int BUFFER_SIZE = 8192;
 
     // -----  member variables  -----
@@ -171,7 +172,8 @@
                 byte[] fileDigest = messageDigest.digest();
                 StringBuffer checksumSb = new StringBuffer();
                 for (int i = 0; i < fileDigest.length; i++) {
-                    String hexStr = Integer.toHexString(0x00ff & fileDigest[i]);
+                    String hexStr
+                        = Integer.toHexString(BYTE_MASK & fileDigest[i]);
                     if (hexStr.length() < 2) {
                         checksumSb.append("0");
                     }

Modified: ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/tar/TarInputStream.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/tar/TarInputStream.java?rev=578740&r1=578739&r2=578740&view=diff
==============================================================================
--- ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/tar/TarInputStream.java (original)
+++ ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/tar/TarInputStream.java Mon
Sep 24 03:00:31 2007
@@ -36,6 +36,8 @@
  *
  */
 public class TarInputStream extends FilterInputStream {
+    private static final int BUFFER_SIZE = 8 * 1024;
+    private static final int BYTE_MASK = 0xFF;
 
     // CheckStyle:VisibilityModifier OFF - bc
     protected boolean debug;
@@ -149,7 +151,7 @@
         // This is horribly inefficient, but it ensures that we
         // properly skip over bytes via the TarBuffer...
         //
-        byte[] skipBuf = new byte[8 * 1024];
+        byte[] skipBuf = new byte[BUFFER_SIZE];
         long skip = numToSkip;
         while (skip > 0) {
             int realSkip = (int) (skip > skipBuf.length ? skipBuf.length : skip);
@@ -287,7 +289,7 @@
      */
     public int read() throws IOException {
         int num = this.read(this.oneBuf, 0, 1);
-        return num == -1 ? -1 : ((int) this.oneBuf[0]) & 0xFF;
+        return num == -1 ? -1 : ((int) this.oneBuf[0]) & BYTE_MASK;
     }
 
     /**



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


Mime
View raw message