Author: peterreilly Date: Wed Sep 19 05:04:42 2007 New Revision: 577263 URL: http://svn.apache.org/viewvc?rev=577263&view=rev Log: magicnumbers
Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Execute.java ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Get.java ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/JDBCTask.java ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Jikes.java ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/KeySubst.java Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Execute.java URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Execute.java?rev=577263&r1=577262&r2=577263&view=diff ============================================================================== --- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Execute.java (original) +++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Execute.java Wed Sep 19 05:04:42 2007 @@ -712,6 +712,7 @@ HashMap logicals = new HashMap(); String logName = null, logValue = null, newLogName; String line = null; + // CheckStyle:MagicNumber OFF while ((line = in.readLine()) != null) { // parse the VMS logicals into required format ("VAR=VAL[,VAL2]") if (line.startsWith("\t=")) { @@ -735,6 +736,7 @@ } } } + // CheckStyle:MagicNumber ON // Since we "look ahead" before adding, there's one last env var. if (logName != null) { logicals.put(logName, logValue); @@ -1115,11 +1117,13 @@ if (workingDir == null) { commandDir = project.getBaseDir(); } + // CheckStyle:MagicNumber OFF String[] newcmd = new String[cmd.length + 3]; newcmd[0] = "perl"; newcmd[1] = antRun; newcmd[2] = commandDir.getAbsolutePath(); System.arraycopy(cmd, 0, newcmd, 3, cmd.length); + // CheckStyle:MagicNumber ON return exec(project, newcmd, env); } Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Get.java URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Get.java?rev=577263&r1=577262&r2=577263&view=diff ============================================================================== --- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Get.java (original) +++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Get.java Wed Sep 19 05:04:42 2007 @@ -44,6 +44,8 @@ * @ant.task category="network" */ public class Get extends Task { + private static final int NUMBER_RETRIES = 3; + private static final int DOTS_PER_LINE = 50; private static final int BIG_BUFFER_SIZE = 100 * 1024; private static final FileUtils FILE_UTILS = FileUtils.getFileUtils(); @@ -178,7 +180,7 @@ //course. InputStream is = null; - for (int i = 0; i < 3; i++) { + for (int i = 0; i < NUMBER_RETRIES; i++) { //this three attempt trick is to get round quirks in different //Java implementations. Some of them take a few goes to bind //property; we ignore the first couple of such failures. @@ -429,7 +431,7 @@ */ public void onTick() { out.print("."); - if (dots++ > 50) { + if (dots++ > DOTS_PER_LINE) { out.flush(); dots = 0; } Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/JDBCTask.java URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/JDBCTask.java?rev=577263&r1=577262&r2=577263&view=diff ============================================================================== --- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/JDBCTask.java (original) +++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/JDBCTask.java Wed Sep 19 05:04:42 2007 @@ -92,14 +92,14 @@ */ public abstract class JDBCTask extends Task { - + private static final int HASH_TABLE_SIZE = 3; /** * Used for caching loaders / driver. This is to avoid * getting an OutOfMemoryError when calling this task * multiple times in a row. */ - private static Hashtable loaderMap = new Hashtable(3); + private static Hashtable loaderMap = new Hashtable(HASH_TABLE_SIZE); private boolean caching = true; Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Jikes.java URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Jikes.java?rev=577263&r1=577262&r2=577263&view=diff ============================================================================== --- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Jikes.java (original) +++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Jikes.java Wed Sep 19 05:04:42 2007 @@ -39,7 +39,9 @@ * Merged into the class Javac. */ public class Jikes { - + // There have been reports that 300 files could be compiled + // on a command line so 250 is a conservative approach + private static final int MAX_FILES_ON_COMMAND_LINE = 250; // CheckStyle:VisibilityModifier OFF - bc protected JikesOutputParser jop; protected String command; @@ -80,10 +82,8 @@ // Windows has a 32k limit on total arg size, so // create a temporary file to store all the arguments - // There have been reports that 300 files could be compiled - // so 250 is a conservative approach if (myos.toLowerCase().indexOf("windows") >= 0 - && args.length > 250) { + && args.length > MAX_FILES_ON_COMMAND_LINE) { PrintWriter out = null; try { String tempFileName = "jikes" Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/KeySubst.java URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/KeySubst.java?rev=577263&r1=577262&r2=577263&view=diff ============================================================================== --- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/KeySubst.java (original) +++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/KeySubst.java Wed Sep 19 05:04:42 2007 @@ -180,6 +180,7 @@ int index = 0; int i = 0; String key = null; + // CheckStyle:MagicNumber OFF while ((index = origString.indexOf("${", i)) > -1) { key = origString.substring(index + 2, origString.indexOf("}", index + 3)); @@ -193,6 +194,7 @@ } i = index + 3 + key.length(); } + // CheckStyle:MagicNumber ON finalString.append (origString.substring(i)); return finalString.toString(); } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]