git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@578199 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -37,6 +37,9 @@ import org.apache.tools.ant.Task; | |||||
| */ | */ | ||||
| public class RExecTask extends Task { | public class RExecTask extends Task { | ||||
| private static final int PAUSE_TIME = 250; | |||||
| /** | /** | ||||
| * The userid to login with, if automated login is used | * The userid to login with, if automated login is used | ||||
| */ | */ | ||||
| @@ -210,7 +213,7 @@ public class RExecTask extends Task { | |||||
| while (sb.toString().indexOf(s) == -1) { | while (sb.toString().indexOf(s) == -1) { | ||||
| while (Calendar.getInstance().before(endTime) | while (Calendar.getInstance().before(endTime) | ||||
| && is.available() == 0) { | && is.available() == 0) { | ||||
| Thread.sleep(250); | |||||
| Thread.sleep(PAUSE_TIME); | |||||
| } | } | ||||
| if (is.available() == 0) { | if (is.available() == 0) { | ||||
| throw new BuildException( | throw new BuildException( | ||||
| @@ -270,7 +273,7 @@ public class RExecTask extends Task { | |||||
| int read = 0; | int read = 0; | ||||
| while (read != -1) { | while (read != -1) { | ||||
| while (Calendar.getInstance().before(endTime) && is.available() == 0) { | while (Calendar.getInstance().before(endTime) && is.available() == 0) { | ||||
| Thread.sleep(250); | |||||
| Thread.sleep(PAUSE_TIME); | |||||
| } | } | ||||
| if (is.available() == 0) { | if (is.available() == 0) { | ||||
| log(sb.toString(), Project.MSG_INFO); | log(sb.toString(), Project.MSG_INFO); | ||||
| @@ -36,6 +36,8 @@ import org.apache.tools.ant.util.FileUtils; | |||||
| public abstract class SOS extends Task implements SOSCmd { | public abstract class SOS extends Task implements SOSCmd { | ||||
| private static final int ERROR_EXIT_STATUS = 255; | |||||
| private String sosCmdDir = null; | private String sosCmdDir = null; | ||||
| private String sosUsername = null; | private String sosUsername = null; | ||||
| private String sosPassword = ""; | private String sosPassword = ""; | ||||
| @@ -390,7 +392,7 @@ public abstract class SOS extends Task implements SOSCmd { | |||||
| int result = 0; | int result = 0; | ||||
| buildCmdLine(); | buildCmdLine(); | ||||
| result = run(commandLine); | 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(); | String msg = "Failed executing: " + commandLine.toString(); | ||||
| throw new BuildException(msg, getLocation()); | throw new BuildException(msg, getLocation()); | ||||
| } | } | ||||
| @@ -138,11 +138,13 @@ public abstract class MSVSS extends Task implements MSVSSConstants { | |||||
| */ | */ | ||||
| public final void setVsspath(final String vssPath) { | public final void setVsspath(final String vssPath) { | ||||
| String projectPath; | String projectPath; | ||||
| // CheckStyle:MagicNumber OFF | |||||
| if (vssPath.startsWith("vss://")) { //$NON-NLS-1$ | if (vssPath.startsWith("vss://")) { //$NON-NLS-1$ | ||||
| projectPath = vssPath.substring(5); | projectPath = vssPath.substring(5); | ||||
| } else { | } else { | ||||
| projectPath = vssPath; | projectPath = vssPath; | ||||
| } | } | ||||
| // CheckStyle:MagicNumber ON | |||||
| if (projectPath.startsWith(PROJECT_PREFIX)) { | if (projectPath.startsWith(PROJECT_PREFIX)) { | ||||
| this.vssPath = projectPath; | this.vssPath = projectPath; | ||||
| @@ -425,6 +427,7 @@ public abstract class MSVSS extends Task implements MSVSSConstants { | |||||
| */ | */ | ||||
| private String getShortLabel() { | private String getShortLabel() { | ||||
| String shortLabel; | String shortLabel; | ||||
| // CheckStyle:MagicNumber OFF | |||||
| if (label != null && label.length() > 31) { | if (label != null && label.length() > 31) { | ||||
| shortLabel = this.label.substring(0, 30); | shortLabel = this.label.substring(0, 30); | ||||
| log("Label is longer than 31 characters, truncated to: " + shortLabel, | log("Label is longer than 31 characters, truncated to: " + shortLabel, | ||||
| @@ -432,6 +435,7 @@ public abstract class MSVSS extends Task implements MSVSSConstants { | |||||
| } else { | } else { | ||||
| shortLabel = label; | shortLabel = label; | ||||
| } | } | ||||
| // CheckStyle:MagicNumber ON | |||||
| return shortLabel; | return shortLabel; | ||||
| } | } | ||||
| /** | /** | ||||
| @@ -554,6 +558,7 @@ public abstract class MSVSS extends Task implements MSVSSConstants { | |||||
| if (fromLabel == null && toLabel == null) { | if (fromLabel == null && toLabel == null) { | ||||
| return ""; | return ""; | ||||
| } | } | ||||
| // CheckStyle:MagicNumber OFF | |||||
| if (fromLabel != null && toLabel != null) { | if (fromLabel != null && toLabel != null) { | ||||
| if (fromLabel.length() > 31) { | if (fromLabel.length() > 31) { | ||||
| fromLabel = fromLabel.substring(0, 30); | fromLabel = fromLabel.substring(0, 30); | ||||
| @@ -581,6 +586,7 @@ public abstract class MSVSS extends Task implements MSVSSConstants { | |||||
| } | } | ||||
| return FLAG_VERSION_LABEL + toLabel; | return FLAG_VERSION_LABEL + toLabel; | ||||
| } | } | ||||
| // CheckStyle:MagicNumber ON | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -78,6 +78,7 @@ public class Quantifier extends EnumeratedAttribute { | |||||
| private static final Predicate[] PREDS = new Predicate[VALUES.length]; | private static final Predicate[] PREDS = new Predicate[VALUES.length]; | ||||
| static { | static { | ||||
| // CheckStyle:MagicNumber OFF | |||||
| PREDS[0] = ALL_PRED; | PREDS[0] = ALL_PRED; | ||||
| PREDS[1] = ALL_PRED; | PREDS[1] = ALL_PRED; | ||||
| PREDS[2] = ALL_PRED; | PREDS[2] = ALL_PRED; | ||||
| @@ -87,6 +88,7 @@ public class Quantifier extends EnumeratedAttribute { | |||||
| PREDS[6] = MAJORITY_PRED; | PREDS[6] = MAJORITY_PRED; | ||||
| PREDS[7] = MAJORITY_PRED; | PREDS[7] = MAJORITY_PRED; | ||||
| PREDS[8] = NONE_PRED; | PREDS[8] = NONE_PRED; | ||||
| // CheckStyle:MagicNumber ON | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -34,6 +34,9 @@ import org.apache.tools.ant.util.FileUtils; | |||||
| * This is a FileNameMapper based on a FilterChain. | * This is a FileNameMapper based on a FilterChain. | ||||
| */ | */ | ||||
| public class FilterMapper extends FilterChain implements FileNameMapper { | public class FilterMapper extends FilterChain implements FileNameMapper { | ||||
| private static final int BUFFER_SIZE = 8192; | |||||
| /** | /** | ||||
| * From attribute not supported. | * From attribute not supported. | ||||
| * @param from a string | * @param from a string | ||||
| @@ -64,7 +67,7 @@ public class FilterMapper extends FilterChain implements FileNameMapper { | |||||
| try { | try { | ||||
| Reader stringReader = new StringReader(sourceFileName); | Reader stringReader = new StringReader(sourceFileName); | ||||
| ChainReaderHelper helper = new ChainReaderHelper(); | ChainReaderHelper helper = new ChainReaderHelper(); | ||||
| helper.setBufferSize(8192); | |||||
| helper.setBufferSize(BUFFER_SIZE); | |||||
| helper.setPrimaryReader(stringReader); | helper.setPrimaryReader(stringReader); | ||||
| helper.setProject(getProject()); | helper.setProject(getProject()); | ||||
| Vector filterChains = new Vector(); | Vector filterChains = new Vector(); | ||||
| @@ -38,6 +38,8 @@ import org.apache.tools.ant.util.FileUtils; | |||||
| */ | */ | ||||
| public abstract class CompressedResource extends Resource { | public abstract class CompressedResource extends Resource { | ||||
| private static final int BUFFER_SIZE = 8192; | |||||
| private Resource resource; | private Resource resource; | ||||
| /** no arg constructor */ | /** no arg constructor */ | ||||
| @@ -153,7 +155,7 @@ public abstract class CompressedResource extends Resource { | |||||
| InputStream in = null; | InputStream in = null; | ||||
| try { | try { | ||||
| in = getInputStream(); | in = getInputStream(); | ||||
| byte[] buf = new byte[8192]; | |||||
| byte[] buf = new byte[BUFFER_SIZE]; | |||||
| int size = 0; | int size = 0; | ||||
| int readNow; | int readNow; | ||||
| while ((readNow = in.read(buf, 0, buf.length)) > 0) { | while ((readNow = in.read(buf, 0, buf.length)) > 0) { | ||||
| @@ -56,6 +56,7 @@ import org.apache.tools.ant.BuildException; | |||||
| */ | */ | ||||
| public class DigestAlgorithm implements Algorithm { | public class DigestAlgorithm implements Algorithm { | ||||
| private static final int BUFFER_SIZE = 8192; | |||||
| // ----- member variables ----- | // ----- member variables ----- | ||||
| @@ -78,7 +79,7 @@ public class DigestAlgorithm implements Algorithm { | |||||
| /** | /** | ||||
| * Size of the read buffer to use. | * Size of the read buffer to use. | ||||
| */ | */ | ||||
| private int readBufferSize = 8 * 1024; | |||||
| private int readBufferSize = BUFFER_SIZE; | |||||
| // ----- Algorithm-Configuration ----- | // ----- Algorithm-Configuration ----- | ||||
| @@ -532,6 +532,7 @@ public class DOMElementWriter { | |||||
| * @since 1.10, Ant 1.5 | * @since 1.10, Ant 1.5 | ||||
| */ | */ | ||||
| public boolean isLegalCharacter(char c) { | public boolean isLegalCharacter(char c) { | ||||
| // CheckStyle:MagicNumber OFF | |||||
| if (c == 0x9 || c == 0xA || c == 0xD) { | if (c == 0x9 || c == 0xA || c == 0xD) { | ||||
| return true; | return true; | ||||
| } else if (c < 0x20) { | } else if (c < 0x20) { | ||||
| @@ -543,6 +544,7 @@ public class DOMElementWriter { | |||||
| } else if (c <= 0xFFFD) { | } else if (c <= 0xFFFD) { | ||||
| return true; | return true; | ||||
| } | } | ||||
| // CheckStyle:MagicNumber ON | |||||
| return false; | return false; | ||||
| } | } | ||||