git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@577263 13f79535-47bb-0310-9956-ffa450edef68master
@@ -712,6 +712,7 @@ public class Execute { | |||||
HashMap logicals = new HashMap(); | HashMap logicals = new HashMap(); | ||||
String logName = null, logValue = null, newLogName; | String logName = null, logValue = null, newLogName; | ||||
String line = null; | String line = null; | ||||
// CheckStyle:MagicNumber OFF | |||||
while ((line = in.readLine()) != null) { | while ((line = in.readLine()) != null) { | ||||
// parse the VMS logicals into required format ("VAR=VAL[,VAL2]") | // parse the VMS logicals into required format ("VAR=VAL[,VAL2]") | ||||
if (line.startsWith("\t=")) { | if (line.startsWith("\t=")) { | ||||
@@ -735,6 +736,7 @@ public class Execute { | |||||
} | } | ||||
} | } | ||||
} | } | ||||
// CheckStyle:MagicNumber ON | |||||
// Since we "look ahead" before adding, there's one last env var. | // Since we "look ahead" before adding, there's one last env var. | ||||
if (logName != null) { | if (logName != null) { | ||||
logicals.put(logName, logValue); | logicals.put(logName, logValue); | ||||
@@ -1115,11 +1117,13 @@ public class Execute { | |||||
if (workingDir == null) { | if (workingDir == null) { | ||||
commandDir = project.getBaseDir(); | commandDir = project.getBaseDir(); | ||||
} | } | ||||
// CheckStyle:MagicNumber OFF | |||||
String[] newcmd = new String[cmd.length + 3]; | String[] newcmd = new String[cmd.length + 3]; | ||||
newcmd[0] = "perl"; | newcmd[0] = "perl"; | ||||
newcmd[1] = antRun; | newcmd[1] = antRun; | ||||
newcmd[2] = commandDir.getAbsolutePath(); | newcmd[2] = commandDir.getAbsolutePath(); | ||||
System.arraycopy(cmd, 0, newcmd, 3, cmd.length); | System.arraycopy(cmd, 0, newcmd, 3, cmd.length); | ||||
// CheckStyle:MagicNumber ON | |||||
return exec(project, newcmd, env); | return exec(project, newcmd, env); | ||||
} | } | ||||
@@ -44,6 +44,8 @@ import java.util.Date; | |||||
* @ant.task category="network" | * @ant.task category="network" | ||||
*/ | */ | ||||
public class Get extends Task { | 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 int BIG_BUFFER_SIZE = 100 * 1024; | ||||
private static final FileUtils FILE_UTILS = FileUtils.getFileUtils(); | private static final FileUtils FILE_UTILS = FileUtils.getFileUtils(); | ||||
@@ -178,7 +180,7 @@ public class Get extends Task { | |||||
//course. | //course. | ||||
InputStream is = null; | 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 | //this three attempt trick is to get round quirks in different | ||||
//Java implementations. Some of them take a few goes to bind | //Java implementations. Some of them take a few goes to bind | ||||
//property; we ignore the first couple of such failures. | //property; we ignore the first couple of such failures. | ||||
@@ -429,7 +431,7 @@ public class Get extends Task { | |||||
*/ | */ | ||||
public void onTick() { | public void onTick() { | ||||
out.print("."); | out.print("."); | ||||
if (dots++ > 50) { | |||||
if (dots++ > DOTS_PER_LINE) { | |||||
out.flush(); | out.flush(); | ||||
dots = 0; | dots = 0; | ||||
} | } | ||||
@@ -92,14 +92,14 @@ public class SQLExampleTask extends JDBCTask { | |||||
*/ | */ | ||||
public abstract class JDBCTask extends Task { | public abstract class JDBCTask extends Task { | ||||
private static final int HASH_TABLE_SIZE = 3; | |||||
/** | /** | ||||
* Used for caching loaders / driver. This is to avoid | * Used for caching loaders / driver. This is to avoid | ||||
* getting an OutOfMemoryError when calling this task | * getting an OutOfMemoryError when calling this task | ||||
* multiple times in a row. | * 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; | private boolean caching = true; | ||||
@@ -39,7 +39,9 @@ import org.apache.tools.ant.util.FileUtils; | |||||
* Merged into the class Javac. | * Merged into the class Javac. | ||||
*/ | */ | ||||
public class Jikes { | 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 | // CheckStyle:VisibilityModifier OFF - bc | ||||
protected JikesOutputParser jop; | protected JikesOutputParser jop; | ||||
protected String command; | protected String command; | ||||
@@ -80,10 +82,8 @@ public class Jikes { | |||||
// Windows has a 32k limit on total arg size, so | // Windows has a 32k limit on total arg size, so | ||||
// create a temporary file to store all the arguments | // 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 | if (myos.toLowerCase().indexOf("windows") >= 0 | ||||
&& args.length > 250) { | |||||
&& args.length > MAX_FILES_ON_COMMAND_LINE) { | |||||
PrintWriter out = null; | PrintWriter out = null; | ||||
try { | try { | ||||
String tempFileName = "jikes" | String tempFileName = "jikes" | ||||
@@ -180,6 +180,7 @@ public class KeySubst extends Task { | |||||
int index = 0; | int index = 0; | ||||
int i = 0; | int i = 0; | ||||
String key = null; | String key = null; | ||||
// CheckStyle:MagicNumber OFF | |||||
while ((index = origString.indexOf("${", i)) > -1) { | while ((index = origString.indexOf("${", i)) > -1) { | ||||
key = origString.substring(index + 2, origString.indexOf("}", | key = origString.substring(index + 2, origString.indexOf("}", | ||||
index + 3)); | index + 3)); | ||||
@@ -193,6 +194,7 @@ public class KeySubst extends Task { | |||||
} | } | ||||
i = index + 3 + key.length(); | i = index + 3 + key.length(); | ||||
} | } | ||||
// CheckStyle:MagicNumber ON | |||||
finalString.append (origString.substring(i)); | finalString.append (origString.substring(i)); | ||||
return finalString.toString(); | return finalString.toString(); | ||||
} | } | ||||