Browse Source

checkstyle

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@470130 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Reilly 18 years ago
parent
commit
f58d3967f0
46 changed files with 189 additions and 181 deletions
  1. +3
    -3
      src/main/org/apache/tools/ant/ProjectHelper.java
  2. +1
    -1
      src/main/org/apache/tools/ant/Task.java
  3. +13
    -12
      src/main/org/apache/tools/ant/launch/Locator.java
  4. +1
    -1
      src/main/org/apache/tools/ant/listener/TimestampedLogger.java
  5. +1
    -1
      src/main/org/apache/tools/ant/loader/AntClassLoader2.java
  6. +14
    -13
      src/main/org/apache/tools/ant/taskdefs/AbstractJarSignerTask.java
  7. +3
    -3
      src/main/org/apache/tools/ant/taskdefs/Ant.java
  8. +14
    -10
      src/main/org/apache/tools/ant/taskdefs/AntStructure.java
  9. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/Apt.java
  10. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/Available.java
  11. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/BUnzip2.java
  12. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/BZip2.java
  13. +7
    -7
      src/main/org/apache/tools/ant/taskdefs/Checksum.java
  14. +4
    -2
      src/main/org/apache/tools/ant/taskdefs/Concat.java
  15. +7
    -7
      src/main/org/apache/tools/ant/taskdefs/Copy.java
  16. +9
    -9
      src/main/org/apache/tools/ant/taskdefs/CopyPath.java
  17. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/DefBase.java
  18. +8
    -7
      src/main/org/apache/tools/ant/taskdefs/Definer.java
  19. +7
    -7
      src/main/org/apache/tools/ant/taskdefs/Delete.java
  20. +9
    -9
      src/main/org/apache/tools/ant/taskdefs/DiagnosticsTask.java
  21. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/Ear.java
  22. +3
    -3
      src/main/org/apache/tools/ant/taskdefs/Echo.java
  23. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/Exec.java
  24. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/ExecTask.java
  25. +6
    -7
      src/main/org/apache/tools/ant/taskdefs/Execute.java
  26. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java
  27. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java
  28. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/ExecuteWatchdog.java
  29. +3
    -3
      src/main/org/apache/tools/ant/taskdefs/FixCRLF.java
  30. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/GZip.java
  31. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/Get.java
  32. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/ImportTask.java
  33. +7
    -7
      src/main/org/apache/tools/ant/taskdefs/Jar.java
  34. +3
    -2
      src/main/org/apache/tools/ant/taskdefs/Java.java
  35. +0
    -1
      src/main/org/apache/tools/ant/taskdefs/Javac.java
  36. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/JikesOutputParser.java
  37. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/LoadResource.java
  38. +2
    -1
      src/main/org/apache/tools/ant/taskdefs/LogOutputStream.java
  39. +4
    -4
      src/main/org/apache/tools/ant/taskdefs/MacroDef.java
  40. +6
    -11
      src/main/org/apache/tools/ant/taskdefs/Manifest.java
  41. +24
    -23
      src/main/org/apache/tools/ant/taskdefs/ManifestClassPath.java
  42. +2
    -1
      src/main/org/apache/tools/ant/taskdefs/Mkdir.java
  43. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/Pack.java
  44. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/PreSetDef.java
  45. +2
    -1
      src/main/org/apache/tools/ant/taskdefs/ProcessDestroyer.java
  46. +3
    -2
      src/main/org/apache/tools/ant/taskdefs/Property.java

+ 3
- 3
src/main/org/apache/tools/ant/ProjectHelper.java View File

@@ -267,7 +267,7 @@ public class ProjectHelper {
* JDK1.1 compatible access to the context class loader. * JDK1.1 compatible access to the context class loader.
* Cut&paste from JAXP. * Cut&paste from JAXP.
* *
* @deprecated since 1.6.x.
* @deprecated since 1.6.x.
* Use LoaderUtils.getContextClassLoader() * Use LoaderUtils.getContextClassLoader()
* *
* @return the current context class loader, or <code>null</code> * @return the current context class loader, or <code>null</code>
@@ -293,7 +293,7 @@ public class ProjectHelper {
* @param project The project containing the target. * @param project The project containing the target.
* Must not be <code>null</code>. * Must not be <code>null</code>.
* *
* @deprecated since 1.6.x.
* @deprecated since 1.6.x.
* Use IntrospectionHelper for each property. * Use IntrospectionHelper for each property.
* *
* @exception BuildException if any of the attributes can't be handled by * @exception BuildException if any of the attributes can't be handled by
@@ -435,7 +435,7 @@ public class ProjectHelper {
* <code>}</code> * <code>}</code>
* @return the original string with the properties replaced, or * @return the original string with the properties replaced, or
* <code>null</code> if the original string is <code>null</code>. * <code>null</code> if the original string is <code>null</code>.
* @deprecated since 1.6.x.
* @deprecated since 1.6.x.
* Use PropertyHelper. * Use PropertyHelper.
*/ */
public static String replaceProperties(Project project, String value, public static String replaceProperties(Project project, String value,


+ 1
- 1
src/main/org/apache/tools/ant/Task.java View File

@@ -72,7 +72,7 @@ public abstract class Task extends ProjectComponent {
/** /**
* Wrapper for this object, used to configure it at runtime. * Wrapper for this object, used to configure it at runtime.
* *
* @deprecated since 1.6.x.
* @deprecated since 1.6.x.
* You should not be accessing this variable directly. * You should not be accessing this variable directly.
* Please use the {@link #getWrapper()} method. * Please use the {@link #getWrapper()} method.
*/ */


+ 13
- 12
src/main/org/apache/tools/ant/launch/Locator.java View File

@@ -42,11 +42,11 @@ public final class Locator {
// stolen from org.apache.xerces.impl.XMLEntityManager#getUserDir() // stolen from org.apache.xerces.impl.XMLEntityManager#getUserDir()
// of the Xerces-J team // of the Xerces-J team
// which ASCII characters need to be escaped // which ASCII characters need to be escaped
private static boolean gNeedEscaping[] = new boolean[128];
private static boolean[] gNeedEscaping = new boolean[128];
// the first hex character if a character needs to be escaped // the first hex character if a character needs to be escaped
private static char gAfterEscaping1[] = new char[128];
private static char[] gAfterEscaping1 = new char[128];
// the second hex character if a character needs to be escaped // the second hex character if a character needs to be escaped
private static char gAfterEscaping2[] = new char[128];
private static char[] gAfterEscaping2 = new char[128];
private static char[] gHexChs = {'0', '1', '2', '3', '4', '5', '6', '7', private static char[] gHexChs = {'0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
// initialize the above 3 arrays // initialize the above 3 arrays
@@ -157,16 +157,18 @@ public final class Locator {
// things when the path is not absolute, and fall back to the old parsing behavior. // things when the path is not absolute, and fall back to the old parsing behavior.
if (uriClazz != null && uri.startsWith("file:/")) { if (uriClazz != null && uri.startsWith("file:/")) {
try { try {
java.lang.reflect.Method createMethod = uriClazz.getMethod("create", new Class[] {String.class});
java.lang.reflect.Method createMethod
= uriClazz.getMethod("create", new Class[] {String.class});
Object uriObj = createMethod.invoke(null, new Object[] {uri}); Object uriObj = createMethod.invoke(null, new Object[] {uri});
java.lang.reflect.Constructor fileConst = File.class.getConstructor(new Class[] {uriClazz});
File f = (File)fileConst.newInstance(new Object[] {uriObj});
java.lang.reflect.Constructor fileConst
= File.class.getConstructor(new Class[] {uriClazz});
File f = (File) fileConst.newInstance(new Object[] {uriObj});
return f.getAbsolutePath(); return f.getAbsolutePath();
} catch (java.lang.reflect.InvocationTargetException e) { } catch (java.lang.reflect.InvocationTargetException e) {
Throwable e2 = e.getTargetException(); Throwable e2 = e.getTargetException();
if (e2 instanceof IllegalArgumentException) { if (e2 instanceof IllegalArgumentException) {
// Bad URI, pass this on. // Bad URI, pass this on.
throw (IllegalArgumentException)e2;
throw (IllegalArgumentException) e2;
} else { } else {
// Unexpected target exception? Should not happen. // Unexpected target exception? Should not happen.
e2.printStackTrace(); e2.printStackTrace();
@@ -262,8 +264,9 @@ public final class Locator {
for (; i < len; i++) { for (; i < len; i++) {
ch = path.charAt(i); ch = path.charAt(i);
// if it's not an ASCII character, break here, and use UTF-8 encoding // if it's not an ASCII character, break here, and use UTF-8 encoding
if (ch >= 128)
if (ch >= 128) {
break; break;
}
if (gNeedEscaping[ch]) { if (gNeedEscaping[ch]) {
if (sb == null) { if (sb == null) {
sb = new StringBuffer(path.substring(0, i)); sb = new StringBuffer(path.substring(0, i));
@@ -272,8 +275,7 @@ public final class Locator {
sb.append(gAfterEscaping1[ch]); sb.append(gAfterEscaping1[ch]);
sb.append(gAfterEscaping2[ch]); sb.append(gAfterEscaping2[ch]);
// record the fact that it's escaped // record the fact that it's escaped
}
else if (sb != null) {
} else if (sb != null) {
sb.append((char) ch); sb.append((char) ch);
} }
} }
@@ -302,8 +304,7 @@ public final class Locator {
sb.append('%'); sb.append('%');
sb.append(gAfterEscaping1[b]); sb.append(gAfterEscaping1[b]);
sb.append(gAfterEscaping2[b]); sb.append(gAfterEscaping2[b]);
}
else {
} else {
sb.append((char) b); sb.append((char) b);
} }
} }


+ 1
- 1
src/main/org/apache/tools/ant/listener/TimestampedLogger.java View File

@@ -51,7 +51,7 @@ public class TimestampedLogger extends DefaultLogger {
* @return The classic "BUILD SUCCESSFUL" * @return The classic "BUILD SUCCESSFUL"
*/ */
protected String getBuildSuccessfulMessage() { protected String getBuildSuccessfulMessage() {
return super.getBuildSuccessfulMessage()+SPACER +getTimestamp();
return super.getBuildSuccessfulMessage() + SPACER + getTimestamp();
} }


protected String getTimestamp() { protected String getTimestamp() {


+ 1
- 1
src/main/org/apache/tools/ant/loader/AntClassLoader2.java View File

@@ -21,7 +21,7 @@ package org.apache.tools.ant.loader;
import org.apache.tools.ant.AntClassLoader; import org.apache.tools.ant.AntClassLoader;


/** /**
* @deprecated since 1.7
* @deprecated since 1.7
* Just use {@link AntClassLoader} itself. * Just use {@link AntClassLoader} itself.
*/ */
public class AntClassLoader2 extends AntClassLoader { public class AntClassLoader2 extends AntClassLoader {


+ 14
- 13
src/main/org/apache/tools/ant/taskdefs/AbstractJarSignerTask.java View File

@@ -22,7 +22,6 @@ import java.io.File;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.Vector; import java.util.Vector;


import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Task; import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.Environment; import org.apache.tools.ant.types.Environment;
import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.FileSet;
@@ -84,7 +83,7 @@ public abstract class AbstractJarSignerTask extends Task {
/** /**
* Java declarations -J-Dname=value * Java declarations -J-Dname=value
*/ */
private Environment sysProperties=new Environment();
private Environment sysProperties = new Environment();


/** /**
* error string for unit test verification: {@value} * error string for unit test verification: {@value}
@@ -98,7 +97,7 @@ public abstract class AbstractJarSignerTask extends Task {
* @since Ant 1.7 * @since Ant 1.7
*/ */
private Path path = null; private Path path = null;
/** /**
* Set the maximum memory to be used by the jarsigner process * Set the maximum memory to be used by the jarsigner process
* *
@@ -226,7 +225,7 @@ public abstract class AbstractJarSignerTask extends Task {
*/ */
private RedirectorElement createRedirector() { private RedirectorElement createRedirector() {
RedirectorElement result = new RedirectorElement(); RedirectorElement result = new RedirectorElement();
if(storepass!=null) {
if (storepass != null) {
StringBuffer input = new StringBuffer(storepass).append('\n'); StringBuffer input = new StringBuffer(storepass).append('\n');
if (keypass != null) { if (keypass != null) {
input.append(keypass).append('\n'); input.append(keypass).append('\n');
@@ -252,19 +251,19 @@ public abstract class AbstractJarSignerTask extends Task {
*/ */
protected void setCommonOptions(final ExecTask cmd) { protected void setCommonOptions(final ExecTask cmd) {
if (maxMemory != null) { if (maxMemory != null) {
addValue(cmd,"-J-Xmx" + maxMemory);
addValue(cmd, "-J-Xmx" + maxMemory);
} }


if (verbose) { if (verbose) {
addValue(cmd,"-verbose");
addValue(cmd, "-verbose");
} }


//now patch in all system properties //now patch in all system properties
Vector props=sysProperties.getVariablesVector();
Enumeration e=props.elements();
Vector props = sysProperties.getVariablesVector();
Enumeration e = props.elements();
while (e.hasMoreElements()) { while (e.hasMoreElements()) {
Environment.Variable variable = (Environment.Variable) e.nextElement(); Environment.Variable variable = (Environment.Variable) e.nextElement();
declareSysProperty(cmd,variable);
declareSysProperty(cmd, variable);
} }
} }


@@ -274,8 +273,9 @@ public abstract class AbstractJarSignerTask extends Task {
* @param property property to set * @param property property to set
* @throws BuildException if the property is not correctly defined. * @throws BuildException if the property is not correctly defined.
*/ */
protected void declareSysProperty(ExecTask cmd,Environment.Variable property) {
addValue(cmd, "-J-D"+property.getContent());
protected void declareSysProperty(
ExecTask cmd, Environment.Variable property) {
addValue(cmd, "-J-D" + property.getContent());
} }




@@ -286,7 +286,7 @@ public abstract class AbstractJarSignerTask extends Task {
protected void bindToKeystore(final ExecTask cmd) { protected void bindToKeystore(final ExecTask cmd) {
if (null != keystore) { if (null != keystore) {
// is the keystore a file // is the keystore a file
addValue(cmd,"-keystore");
addValue(cmd, "-keystore");
String loc; String loc;
File keystoreFile = getProject().resolveFile(keystore); File keystoreFile = getProject().resolveFile(keystore);
if (keystoreFile.exists()) { if (keystoreFile.exists()) {
@@ -323,7 +323,7 @@ public abstract class AbstractJarSignerTask extends Task {
* @return a vector of FileSet instances * @return a vector of FileSet instances
*/ */
protected Vector createUnifiedSources() { protected Vector createUnifiedSources() {
Vector sources = (Vector)filesets.clone();
Vector sources = (Vector) filesets.clone();
if (jar != null) { if (jar != null) {
//we create a fileset with the source file. //we create a fileset with the source file.
//this lets us combine our logic for handling output directories, //this lets us combine our logic for handling output directories,
@@ -356,6 +356,7 @@ public abstract class AbstractJarSignerTask extends Task {


/** /**
* Has either a path or a fileset been specified? * Has either a path or a fileset been specified?
* @return true if a path or fileset has been specified.
* @since Ant 1.7 * @since Ant 1.7
*/ */
protected boolean hasResources() { protected boolean hasResources() {


+ 3
- 3
src/main/org/apache/tools/ant/taskdefs/Ant.java View File

@@ -362,9 +362,9 @@ public class Ant extends Task {
+ "its own parent target."); + "its own parent target.");
} }
boolean circular = false; boolean circular = false;
for (Iterator it = locals.iterator();
for (Iterator it = locals.iterator();
!circular && it.hasNext();) { !circular && it.hasNext();) {
Target other =
Target other =
(Target) (getProject().getTargets().get(it.next())); (Target) (getProject().getTargets().get(it.next()));
circular |= (other != null circular |= (other != null
&& other.dependsOn(owningTargetName)); && other.dependsOn(owningTargetName));
@@ -381,7 +381,7 @@ public class Ant extends Task {


addReferences(); addReferences();


if (locals.size() > 0 && !(locals.size() == 1
if (locals.size() > 0 && !(locals.size() == 1
&& "".equals(locals.get(0)))) { && "".equals(locals.get(0)))) {
BuildException be = null; BuildException be = null;
try { try {


+ 14
- 10
src/main/org/apache/tools/ant/taskdefs/AntStructure.java View File

@@ -46,7 +46,8 @@ import org.apache.tools.ant.types.Reference;
*/ */
public class AntStructure extends Task { public class AntStructure extends Task {


private static final String lSep = System.getProperty("line.separator");
private static final String LINE_SEP
= System.getProperty("line.separator");


private File output; private File output;
private StructurePrinter printer = new DTDPrinter(); private StructurePrinter printer = new DTDPrinter();
@@ -61,6 +62,7 @@ public class AntStructure extends Task {


/** /**
* The StructurePrinter to use. * The StructurePrinter to use.
* @param p the printer to use.
* @since Ant 1.7 * @since Ant 1.7
*/ */
public void add(StructurePrinter p) { public void add(StructurePrinter p) {
@@ -101,8 +103,9 @@ public class AntStructure extends Task {
Enumeration dataTypes = getProject().getDataTypeDefinitions().keys(); Enumeration dataTypes = getProject().getDataTypeDefinitions().keys();
while (dataTypes.hasMoreElements()) { while (dataTypes.hasMoreElements()) {
String typeName = (String) dataTypes.nextElement(); String typeName = (String) dataTypes.nextElement();
printer.printElementDecl(out, getProject(), typeName,
(Class) getProject().getDataTypeDefinitions().get(typeName));
printer.printElementDecl(
out, getProject(), typeName,
(Class) getProject().getDataTypeDefinitions().get(typeName));
} }


Enumeration tasks = getProject().getTaskDefinitions().keys(); Enumeration tasks = getProject().getTaskDefinitions().keys();
@@ -282,11 +285,11 @@ public class AntStructure extends Task {
sb.append(name).append(" "); sb.append(name).append(" ");


if (org.apache.tools.ant.types.Reference.class.equals(element)) { if (org.apache.tools.ant.types.Reference.class.equals(element)) {
sb.append("EMPTY>").append(lSep);
sb.append("EMPTY>").append(LINE_SEP);
sb.append("<!ATTLIST ").append(name); sb.append("<!ATTLIST ").append(name);
sb.append(lSep).append(" id ID #IMPLIED");
sb.append(lSep).append(" refid IDREF #IMPLIED");
sb.append(">").append(lSep);
sb.append(LINE_SEP).append(" id ID #IMPLIED");
sb.append(LINE_SEP).append(" refid IDREF #IMPLIED");
sb.append(">").append(LINE_SEP);
out.println(sb); out.println(sb);
return; return;
} }
@@ -326,7 +329,7 @@ public class AntStructure extends Task {


sb = new StringBuffer("<!ATTLIST "); sb = new StringBuffer("<!ATTLIST ");
sb.append(name); sb.append(name);
sb.append(lSep).append(" id ID #IMPLIED");
sb.append(LINE_SEP).append(" id ID #IMPLIED");


e = ih.getAttributes(); e = ih.getAttributes();
while (e.hasMoreElements()) { while (e.hasMoreElements()) {
@@ -335,7 +338,8 @@ public class AntStructure extends Task {
continue; continue;
} }


sb.append(lSep).append(" ").append(attrName).append(" ");
sb.append(LINE_SEP).append(" ")
.append(attrName).append(" ");
Class type = ih.getAttributeType(attrName); Class type = ih.getAttributeType(attrName);
if (type.equals(java.lang.Boolean.class) if (type.equals(java.lang.Boolean.class)
|| type.equals(java.lang.Boolean.TYPE)) { || type.equals(java.lang.Boolean.TYPE)) {
@@ -371,7 +375,7 @@ public class AntStructure extends Task {
} }
sb.append("#IMPLIED"); sb.append("#IMPLIED");
} }
sb.append(">").append(lSep);
sb.append(">").append(LINE_SEP);
out.println(sb); out.println(sb);


final int count = v.size(); final int count = v.size();


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/Apt.java View File

@@ -51,7 +51,7 @@ public class Apt
/** A warning message if used with java < 1.5. */ /** A warning message if used with java < 1.5. */
public static final String ERROR_WRONG_JAVA_VERSION public static final String ERROR_WRONG_JAVA_VERSION
= "Apt task requires Java 1.5+"; = "Apt task requires Java 1.5+";
/** /**
* exposed for debug messages * exposed for debug messages
*/ */
@@ -140,7 +140,7 @@ public class Apt
*/ */
public void setFork(boolean fork) { public void setFork(boolean fork) {
if (!fork) { if (!fork) {
log(WARNING_IGNORING_FORK,Project.MSG_WARN);
log(WARNING_IGNORING_FORK, Project.MSG_WARN);
} }
} }




+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/Available.java View File

@@ -173,7 +173,7 @@ public class Available extends Task implements Condition {
} }


/** /**
* @deprecated since 1.5.x.
* @deprecated since 1.5.x.
* setType(String) is deprecated and is replaced with * setType(String) is deprecated and is replaced with
* setType(Available.FileDir) to make Ant's Introspection * setType(Available.FileDir) to make Ant's Introspection
* mechanism do the work and also to encapsulate operations on * mechanism do the work and also to encapsulate operations on


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/BUnzip2.java View File

@@ -100,7 +100,7 @@ public class BUnzip2 extends Unpack {
* support non-file resources needs to override this method. We * support non-file resources needs to override this method. We
* need to do so for backwards compatibility reasons since we * need to do so for backwards compatibility reasons since we
* can't expect subclasses to support resources.</p> * can't expect subclasses to support resources.</p>
*
* @return true if this class supports non file resources.
* @since Ant 1.7 * @since Ant 1.7
*/ */
protected boolean supportsNonFileResources() { protected boolean supportsNonFileResources() {


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/BZip2.java View File

@@ -61,7 +61,7 @@ public class BZip2 extends Pack {
* support non-file resources needs to override this method. We * support non-file resources needs to override this method. We
* need to do so for backwards compatibility reasons since we * need to do so for backwards compatibility reasons since we
* can't expect subclasses to support resources.</p> * can't expect subclasses to support resources.</p>
*
* @return true if this task support non file resources.
* @since Ant 1.7 * @since Ant 1.7
*/ */
protected boolean supportsNonFileResources() { protected boolean supportsNonFileResources() {


+ 7
- 7
src/main/org/apache/tools/ant/taskdefs/Checksum.java View File

@@ -449,13 +449,13 @@ public class Checksum extends MatchingTask implements Condition {
if (todir != null) { if (todir != null) {
// A separate directory was explicitly declared // A separate directory was explicitly declared
String path = (String) relativeFilePaths.get(file); String path = (String) relativeFilePaths.get(file);
if(path==null) {
if (path == null) {
//bug 37386. this should not occur, but it has, once. //bug 37386. this should not occur, but it has, once.
throw new BuildException("Internal error: " +
"relativeFilePaths could not match file"+
file+
"\n" +
"please file a bug report on this");
throw new BuildException(
"Internal error: "
+ "relativeFilePaths could not match file"
+ file + "\n"
+ "please file a bug report on this");
} }
directory = new File(todir, path).getParentFile(); directory = new File(todir, path).getParentFile();
// Create the directory, as it might not exist. // Create the directory, as it might not exist.
@@ -631,7 +631,7 @@ public class Checksum extends MatchingTask implements Condition {
} catch (ParseException e) { } catch (ParseException e) {
throw new BuildException("Couldn't read checksum file " + f, e); throw new BuildException("Couldn't read checksum file " + f, e);
} finally { } finally {
FileUtils.close(diskChecksumReader);
FileUtils.close(diskChecksumReader);
} }
} }




+ 4
- 2
src/main/org/apache/tools/ant/taskdefs/Concat.java View File

@@ -432,8 +432,9 @@ public class Concat extends Task {
if (!outofdate) { if (!outofdate) {
for (Iterator i = existRc.iterator(); !outofdate && i.hasNext();) { for (Iterator i = existRc.iterator(); !outofdate && i.hasNext();) {
Resource r = (Resource) i.next(); Resource r = (Resource) i.next();
outofdate = (r.getLastModified() == 0L ||
r.getLastModified() > destinationFile.lastModified());
outofdate =
(r.getLastModified() == 0L
|| r.getLastModified() > destinationFile.lastModified());
} }
} }
if (!outofdate) { if (!outofdate) {
@@ -493,6 +494,7 @@ public class Concat extends Task {
try { try {
t.join(); t.join();
} catch (InterruptedException ee) { } catch (InterruptedException ee) {
// Empty
} }
} }
} finally { } finally {


+ 7
- 7
src/main/org/apache/tools/ant/taskdefs/Copy.java View File

@@ -156,7 +156,7 @@ public class Copy extends Task {
/** /**
* Give the copied files the same last modified time as the original files. * Give the copied files the same last modified time as the original files.
* @param preserve a boolean string. * @param preserve a boolean string.
* @deprecated since 1.5.x.
* @deprecated since 1.5.x.
* setPreserveLastModified(String) has been deprecated and * setPreserveLastModified(String) has been deprecated and
* replaced with setPreserveLastModified(boolean) to * replaced with setPreserveLastModified(boolean) to
* consistently let the Introspection mechanism work. * consistently let the Introspection mechanism work.
@@ -289,7 +289,7 @@ public class Copy extends Task {
public void addFileset(FileSet set) { public void addFileset(FileSet set) {
add(set); add(set);
} }
/** /**
* Add a collection of files to copy. * Add a collection of files to copy.
* @param res a resource collection to copy. * @param res a resource collection to copy.
@@ -298,7 +298,7 @@ public class Copy extends Task {
public void add(ResourceCollection res) { public void add(ResourceCollection res) {
rcs.add(res); rcs.add(res);
} }
/** /**
* Define the mapper to map source to destination files. * Define the mapper to map source to destination files.
* @return a mapper to be configured. * @return a mapper to be configured.
@@ -423,7 +423,7 @@ public class Copy extends Task {


/* for historical and performance reasons we have to do /* for historical and performance reasons we have to do
things in a rather complex way. things in a rather complex way.
(1) Move is optimized to move directories if a fileset (1) Move is optimized to move directories if a fileset
has been included completely, therefore FileSets need a has been included completely, therefore FileSets need a
special treatment. This is also required to support special treatment. This is also required to support
@@ -498,7 +498,7 @@ public class Copy extends Task {
// files. // files.
if (r.isDirectory() || r instanceof FileResource) { if (r.isDirectory() || r instanceof FileResource) {
add(baseDir, name, add(baseDir, name,
r.isDirectory() ? dirsByBasedir
r.isDirectory() ? dirsByBasedir
: filesByBasedir); : filesByBasedir);
baseDirs.add(baseDir); baseDirs.add(baseDir);
} else { // a not-directory file resource } else { // a not-directory file resource
@@ -912,7 +912,7 @@ public class Copy extends Task {
* support non-file resources needs to override this method. We * support non-file resources needs to override this method. We
* need to do so for backwards compatibility reasons since we * need to do so for backwards compatibility reasons since we
* can't expect subclasses to support resources.</p> * can't expect subclasses to support resources.</p>
*
* @return true if this task supports non file resources.
* @since Ant 1.7 * @since Ant 1.7
*/ */
protected boolean supportsNonFileResources() { protected boolean supportsNonFileResources() {
@@ -977,7 +977,7 @@ public class Copy extends Task {
private String getMessage(Exception ex) { private String getMessage(Exception ex) {
return ex.getMessage() == null ? ex.toString() : ex.getMessage(); return ex.getMessage() == null ? ex.toString() : ex.getMessage();
} }
/** /**
* Returns a reason for failure based on * Returns a reason for failure based on
* the exception thrown. * the exception thrown.


+ 9
- 9
src/main/org/apache/tools/ant/taskdefs/CopyPath.java View File

@@ -31,9 +31,9 @@ import java.io.IOException;


/** /**
* Copy the contents of a path to a destination, using the mapper of choice * Copy the contents of a path to a destination, using the mapper of choice
*
*
* @since Ant 1.7 * @since Ant 1.7
*
*
* @ant.task category="filesystem" * @ant.task category="filesystem"
*/ */


@@ -69,8 +69,8 @@ public class CopyPath extends Task {


/** /**
* add a mapper * add a mapper
*
* @param newmapper
*
* @param newmapper the mapper to add.
*/ */
public void add(FileNameMapper newmapper) { public void add(FileNameMapper newmapper) {
if (mapper != null) { if (mapper != null) {
@@ -81,7 +81,7 @@ public class CopyPath extends Task {


/** /**
* Set the path to be used when running the Java class. * Set the path to be used when running the Java class.
*
*
* @param s * @param s
* an Ant Path object containing the path. * an Ant Path object containing the path.
*/ */
@@ -91,7 +91,7 @@ public class CopyPath extends Task {


/** /**
* Set the path to use by reference. * Set the path to use by reference.
*
*
* @param r * @param r
* a reference to an existing path. * a reference to an existing path.
*/ */
@@ -101,7 +101,7 @@ public class CopyPath extends Task {


/** /**
* Create a path. * Create a path.
*
*
* @return a path to be configured. * @return a path to be configured.
*/ */
public Path createPath() { public Path createPath() {
@@ -122,7 +122,7 @@ public class CopyPath extends Task {
/** /**
* Ensure we have a consistent and legal set of attributes, and set any * Ensure we have a consistent and legal set of attributes, and set any
* internal flags necessary based on different combinations of attributes. * internal flags necessary based on different combinations of attributes.
*
*
* @throws BuildException * @throws BuildException
* if an error occurs. * if an error occurs.
*/ */
@@ -140,7 +140,7 @@ public class CopyPath extends Task {


/** /**
* This is a very minimal derivative of the nomal copy logic. * This is a very minimal derivative of the nomal copy logic.
*
*
* @throws BuildException * @throws BuildException
* if something goes wrong with the build. * if something goes wrong with the build.
*/ */


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/DefBase.java View File

@@ -38,7 +38,7 @@ public abstract class DefBase extends AntlibDefinition {
/** /**
* @param reverseLoader if true a delegated loader will take precedence over * @param reverseLoader if true a delegated loader will take precedence over
* the parent * the parent
* @deprecated since 1.6.x.
* @deprecated since 1.6.x.
* stop using this attribute * stop using this attribute
* @ant.attribute ignore="true" * @ant.attribute ignore="true"
*/ */


+ 8
- 7
src/main/org/apache/tools/ant/taskdefs/Definer.java View File

@@ -290,7 +290,8 @@ public abstract class Definer extends DefBase {


/** /**
* This is where the logic to map from a URI to an antlib resource * This is where the logic to map from a URI to an antlib resource
* is kept.
* is kept.
* @param uri the xml namespace uri that to convert.
* @return the name of a resource. It may not exist * @return the name of a resource. It may not exist
*/ */


@@ -298,8 +299,8 @@ public abstract class Definer extends DefBase {
String path = uri.substring(MagicNames.ANTLIB_PREFIX.length()); String path = uri.substring(MagicNames.ANTLIB_PREFIX.length());
String resource; String resource;
if (path.startsWith("//")) { if (path.startsWith("//")) {
//handle new style full paths to an antlib, in which
//all but the forward slashes are allowed.
//handle new style full paths to an antlib, in which
//all but the forward slashes are allowed.
resource = path.substring("//".length()); resource = path.substring("//".length());
if (!resource.endsWith(".xml")) { if (!resource.endsWith(".xml")) {
//if we haven't already named an XML file, it gets antlib.xml //if we haven't already named an XML file, it gets antlib.xml
@@ -313,11 +314,11 @@ public abstract class Definer extends DefBase {
} }


/** /**
* Convert a file to a file: URL.
*
* Convert a file to a file: URL.
*
* @return the URL, or null if it isn't valid and the active error policy * @return the URL, or null if it isn't valid and the active error policy
* is not to raise a fault * is not to raise a fault
* @throws BuildException if the file is missing/not a file and the
* @throws BuildException if the file is missing/not a file and the
* policy requires failure at this point. * policy requires failure at this point.
*/ */
private URL fileToURL() { private URL fileToURL() {
@@ -480,7 +481,7 @@ public abstract class Definer extends DefBase {
"Invalid antlib attribute - it must start with antlib:"); "Invalid antlib attribute - it must start with antlib:");
} }
setURI(antlib); setURI(antlib);
this.resource = antlib.substring("antlib:".length()).replace('.','/')
this.resource = antlib.substring("antlib:".length()).replace('.', '/')
+ "/antlib.xml"; + "/antlib.xml";
definerSet = true; definerSet = true;
} }


+ 7
- 7
src/main/org/apache/tools/ant/taskdefs/Delete.java View File

@@ -600,10 +600,10 @@ public class Delete extends MatchingTask {
} catch (Exception e) { } catch (Exception e) {
handle(e); handle(e);
} finally { } finally {
if (implicit != null) {
filesets.remove(implicit);
}
}
if (implicit != null) {
filesets.remove(implicit);
}
}
} }


//************************************************************************ //************************************************************************
@@ -693,7 +693,7 @@ public class Delete extends MatchingTask {
+ d.getAbsolutePath(), quiet ? Project.MSG_VERBOSE : verbosity); + d.getAbsolutePath(), quiet ? Project.MSG_VERBOSE : verbosity);
for (int j = 0; j < files.length; j++) { for (int j = 0; j < files.length; j++) {
File f = new File(d, files[j]); File f = new File(d, files[j]);
log("Deleting " + f.getAbsolutePath(),
log("Deleting " + f.getAbsolutePath(),
quiet ? Project.MSG_VERBOSE : verbosity); quiet ? Project.MSG_VERBOSE : verbosity);
if (!delete(f)) { if (!delete(f)) {
handle("Unable to delete file " + f.getAbsolutePath()); handle("Unable to delete file " + f.getAbsolutePath());
@@ -707,7 +707,7 @@ public class Delete extends MatchingTask {
File currDir = new File(d, dirs[j]); File currDir = new File(d, dirs[j]);
String[] dirFiles = currDir.list(); String[] dirFiles = currDir.list();
if (dirFiles == null || dirFiles.length == 0) { if (dirFiles == null || dirFiles.length == 0) {
log("Deleting " + currDir.getAbsolutePath(),
log("Deleting " + currDir.getAbsolutePath(),
quiet ? Project.MSG_VERBOSE : verbosity); quiet ? Project.MSG_VERBOSE : verbosity);
if (!delete(currDir)) { if (!delete(currDir)) {
handle("Unable to delete directory " handle("Unable to delete directory "
@@ -722,7 +722,7 @@ public class Delete extends MatchingTask {
log("Deleted " log("Deleted "
+ dirCount + dirCount
+ " director" + (dirCount == 1 ? "y" : "ies") + " director" + (dirCount == 1 ? "y" : "ies")
+ " form " + d.getAbsolutePath(),
+ " form " + d.getAbsolutePath(),
quiet ? Project.MSG_VERBOSE : verbosity); quiet ? Project.MSG_VERBOSE : verbosity);
} }
} }


+ 9
- 9
src/main/org/apache/tools/ant/taskdefs/DiagnosticsTask.java View File

@@ -1,9 +1,3 @@
package org.apache.tools.ant.taskdefs;

import org.apache.tools.ant.Task;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Diagnostics;

/* /*
* Licensed to the Apache Software Foundation (ASF) under one or more * Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with * contributor license agreements. See the NOTICE file distributed with
@@ -21,6 +15,12 @@ import org.apache.tools.ant.Diagnostics;
* limitations under the License. * limitations under the License.
* *
*/ */
package org.apache.tools.ant.taskdefs;

import org.apache.tools.ant.Task;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Diagnostics;



/** /**
* This is a task that hands off work to the Diagnostics module. * This is a task that hands off work to the Diagnostics module.
@@ -28,10 +28,10 @@ import org.apache.tools.ant.Diagnostics;
*/ */
public class DiagnosticsTask extends Task { public class DiagnosticsTask extends Task {


private static final String[] args=new String[0];
private static final String[] ARGS = new String[0];
public void execute() throws BuildException { public void execute() throws BuildException {
Diagnostics.main(args);
Diagnostics.main(ARGS);
} }






+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/Ear.java View File

@@ -50,7 +50,7 @@ public class Ear extends Jar {
/** /**
* Set the destination file. * Set the destination file.
* @param earFile the destination file * @param earFile the destination file
* @deprecated since 1.5.x.
* @deprecated since 1.5.x.
* Use setDestFile(destfile) instead. * Use setDestFile(destfile) instead.
*/ */
public void setEarfile(File earFile) { public void setEarfile(File earFile) {


+ 3
- 3
src/main/org/apache/tools/ant/taskdefs/Echo.java View File

@@ -61,12 +61,12 @@ public class Echo extends Task {
Writer out = null; Writer out = null;
try { try {
String filename = file.getAbsolutePath(); String filename = file.getAbsolutePath();
if(encoding==null || encoding.length()==0) {
if(encoding == null || encoding.length() == 0) {
out = new FileWriter(filename, append); out = new FileWriter(filename, append);
} else { } else {
out = new BufferedWriter( out = new BufferedWriter(
new OutputStreamWriter( new OutputStreamWriter(
new FileOutputStream(filename, append),encoding));
new FileOutputStream(filename, append), encoding));
} }
out.write(message, 0, message.length()); out.write(message, 0, message.length());
} catch (IOException ioe) { } catch (IOException ioe) {
@@ -132,7 +132,7 @@ public class Echo extends Task {
/** /**
* Declare the encoding to use when outputting to a file; * Declare the encoding to use when outputting to a file;
* Use "" for the platform's default encoding. * Use "" for the platform's default encoding.
* @param encoding
* @param encoding the character encoding to use.
* @since 1.7 * @since 1.7
*/ */
public void setEncoding(String encoding) { public void setEncoding(String encoding) {


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/Exec.java View File

@@ -39,7 +39,7 @@ import org.apache.tools.ant.Task;
* dead code by the Ant developers and is unmaintained. Don't use * dead code by the Ant developers and is unmaintained. Don't use
* it.</strong></p> * it.</strong></p>
* *
* @deprecated since 1.2.
* @deprecated since 1.2.
* delegate to {@link org.apache.tools.ant.taskdefs.Execute Execute} * delegate to {@link org.apache.tools.ant.taskdefs.Execute Execute}
* instead. * instead.
*/ */


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/ExecTask.java View File

@@ -388,7 +388,7 @@ public class ExecTask extends Task {


/** /**
* Restrict this execution to a single OS Family * Restrict this execution to a single OS Family
* @param osFamily
* @param osFamily the family to restrict to.
*/ */
public void setOsFamily(String osFamily) { public void setOsFamily(String osFamily) {
this.osFamily = osFamily.toLowerCase(Locale.US); this.osFamily = osFamily.toLowerCase(Locale.US);
@@ -543,7 +543,7 @@ public class ExecTask extends Task {
*/ */
protected boolean isValidOs() { protected boolean isValidOs() {
//hand osfamily off to Os class, if set //hand osfamily off to Os class, if set
if(osFamily!=null && !Os.isOs(osFamily,null,null,null)) {
if (osFamily != null && !Os.isOs(osFamily, null, null, null)) {
return false; return false;
} }
//the Exec OS check is different from Os.isOs(), which //the Exec OS check is different from Os.isOs(), which


+ 6
- 7
src/main/org/apache/tools/ant/taskdefs/Execute.java View File

@@ -49,7 +49,7 @@ import org.apache.tools.ant.util.StringUtils;
*/ */
public class Execute { public class Execute {


/** Invalid exit code.
/** Invalid exit code.
* set to {@link Integer#MAX_VALUE} * set to {@link Integer#MAX_VALUE}
*/ */
public static final int INVALID = Integer.MAX_VALUE; public static final int INVALID = Integer.MAX_VALUE;
@@ -1033,8 +1033,8 @@ public class Execute {
throw new IOException("Cannot locate antRun script: " throw new IOException("Cannot locate antRun script: "
+ "Property '" + MagicNames.ANT_HOME + "' not found"); + "Property '" + MagicNames.ANT_HOME + "' not found");
} }
String antRun =
FILE_UTILS.resolveFile(project.getBaseDir(),
String antRun =
FILE_UTILS.resolveFile(project.getBaseDir(),
antHome + File.separator + myScript).toString(); antHome + File.separator + myScript).toString();


// Build the command // Build the command
@@ -1092,8 +1092,8 @@ public class Execute {
throw new IOException("Cannot locate antRun script: " throw new IOException("Cannot locate antRun script: "
+ "Property '" + MagicNames.ANT_HOME + "' not found"); + "Property '" + MagicNames.ANT_HOME + "' not found");
} }
String antRun =
FILE_UTILS.resolveFile(project.getBaseDir(),
String antRun =
FILE_UTILS.resolveFile(project.getBaseDir(),
antHome + File.separator + myScript).toString(); antHome + File.separator + myScript).toString();


// Build the command // Build the command
@@ -1210,8 +1210,7 @@ public class Execute {
public void run() { public void run() {
try { try {
p.waitFor(); p.waitFor();
}
catch (InterruptedException e) {
} catch (InterruptedException e) {
//ignore //ignore
} }
FileUtils.delete(f); FileUtils.delete(f);


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java View File

@@ -92,7 +92,7 @@ public class ExecuteJava implements Runnable, TimeoutObserver {
* Set the stream to which all output (System.out as well as System.err) * Set the stream to which all output (System.out as well as System.err)
* will be written. * will be written.
* @param out the PrintStream where output should be sent. * @param out the PrintStream where output should be sent.
* @deprecated since 1.4.x.
* @deprecated since 1.4.x.
* manage output at the task level. * manage output at the task level.
*/ */
public void setOutput(PrintStream out) { public void setOutput(PrintStream out) {


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java View File

@@ -417,7 +417,7 @@ public class ExecuteOn extends ExecTask {
baseDirs.removeAllElements(); baseDirs.removeAllElements();
} }
} }
if (resources != null) { if (resources != null) {
Iterator iter = resources.iterator(); Iterator iter = resources.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/ExecuteWatchdog.java View File

@@ -69,7 +69,7 @@ public class ExecuteWatchdog implements TimeoutObserver {


/** /**
* @see #ExecuteWatchdog(long) * @see #ExecuteWatchdog(long)
* @deprecated since 1.5.x.
* @deprecated since 1.5.x.
* Use constructor with a long type instead. * Use constructor with a long type instead.
* (1.4.x compatibility) * (1.4.x compatibility)
*/ */


+ 3
- 3
src/main/org/apache/tools/ant/taskdefs/FixCRLF.java View File

@@ -174,7 +174,7 @@ public class FixCRLF extends MatchingTask implements ChainableReader {
* <li>remove: remove all CR characters * <li>remove: remove all CR characters
* </ul> * </ul>
* *
* @deprecated since 1.4.x.
* @deprecated since 1.4.x.
* Use {@link #setEol setEol} instead. * Use {@link #setEol setEol} instead.
*/ */
public void setCr(AddAsisRemove attr) { public void setCr(AddAsisRemove attr) {
@@ -277,7 +277,7 @@ public class FixCRLF extends MatchingTask implements ChainableReader {
public void execute() throws BuildException { public void execute() throws BuildException {
// first off, make sure that we've got a srcdir and destdir // first off, make sure that we've got a srcdir and destdir
validate(); validate();
// log options used // log options used
String enc = encoding == null ? "default" : encoding; String enc = encoding == null ? "default" : encoding;
log("options:" log("options:"
@@ -326,7 +326,7 @@ public class FixCRLF extends MatchingTask implements ChainableReader {
} }
} }
} }
private void processFile(String file) throws BuildException { private void processFile(String file) throws BuildException {
File srcFile = new File(srcDir, file); File srcFile = new File(srcDir, file);
long lastModified = srcFile.lastModified(); long lastModified = srcFile.lastModified();


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/GZip.java View File

@@ -58,7 +58,7 @@ public class GZip extends Pack {
* support non-file resources needs to override this method. We * support non-file resources needs to override this method. We
* need to do so for backwards compatibility reasons since we * need to do so for backwards compatibility reasons since we
* can't expect subclasses to support resources.</p> * can't expect subclasses to support resources.</p>
*
* @return true if this case supports non file resources.
* @since Ant 1.7 * @since Ant 1.7
*/ */
protected boolean supportsNonFileResources() { protected boolean supportsNonFileResources() {


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/Get.java View File

@@ -339,9 +339,9 @@ public class Get extends Task {
/** /**
* Provide this for Backward Compatibility. * Provide this for Backward Compatibility.
*/ */
protected static class Base64Converter protected static class Base64Converter
extends org.apache.tools.ant.util.Base64Converter {}
extends org.apache.tools.ant.util.Base64Converter {
}


public interface DownloadProgress { public interface DownloadProgress {
/** /**


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/ImportTask.java View File

@@ -94,12 +94,12 @@ public class ImportTask extends Task {
ProjectHelper helper = ProjectHelper helper =
(ProjectHelper) getProject(). (ProjectHelper) getProject().
getReference(ProjectHelper.PROJECTHELPER_REFERENCE); getReference(ProjectHelper.PROJECTHELPER_REFERENCE);
if (helper == null) { if (helper == null) {
// this happens if the projecthelper was not registered with the project. // this happens if the projecthelper was not registered with the project.
throw new BuildException("import requires support in ProjectHelper"); throw new BuildException("import requires support in ProjectHelper");
} }
Vector importStack = helper.getImportStack(); Vector importStack = helper.getImportStack();


if (importStack.size() == 0) { if (importStack.size() == 0) {


+ 7
- 7
src/main/org/apache/tools/ant/taskdefs/Jar.java View File

@@ -147,7 +147,7 @@ public class Jar extends Zip {
private ZipExtraField[] JAR_MARKER = new ZipExtraField[] { private ZipExtraField[] JAR_MARKER = new ZipExtraField[] {
JarMarker.getInstance() JarMarker.getInstance()
}; };
protected String emptyBehavior = "create"; protected String emptyBehavior = "create";


/** constructor */ /** constructor */
@@ -183,7 +183,6 @@ public class Jar extends Zip {
emptyBehavior = we.getValue(); emptyBehavior = we.getValue();
} }


/** /**
* Set the destination file. * Set the destination file.
* @param jarFile the destination file * @param jarFile the destination file
@@ -390,12 +389,12 @@ public class Jar extends Zip {
private void writeServices(ZipOutputStream zOut) throws IOException { private void writeServices(ZipOutputStream zOut) throws IOException {
Iterator serviceIterator; Iterator serviceIterator;
Service service; Service service;
serviceIterator = serviceList.iterator(); serviceIterator = serviceList.iterator();
while(serviceIterator.hasNext()){
while(serviceIterator.hasNext()) {
service = (Service) serviceIterator.next(); service = (Service) serviceIterator.next();
//stolen from writeManifest //stolen from writeManifest
super.zipFile(service.getAsStream(), zOut,
super.zipFile(service.getAsStream(), zOut,
"META-INF/service/" + service.getType(), "META-INF/service/" + service.getType(),
System.currentTimeMillis(), null, System.currentTimeMillis(), null,
ZipFileSet.DEFAULT_FILE_MODE); ZipFileSet.DEFAULT_FILE_MODE);
@@ -708,7 +707,8 @@ public class Jar extends Zip {
} }
} }
} catch (Throwable t) { } catch (Throwable t) {
log("error while reading original manifest in file: " + zipFile.toString() + t.getMessage(),
log("error while reading original manifest in file: "
+ zipFile.toString() + t.getMessage(),
Project.MSG_WARN); Project.MSG_WARN);
needsUpdate = true; needsUpdate = true;
} }
@@ -744,7 +744,7 @@ public class Jar extends Zip {
+ ": no files were included.", + ": no files were included.",
getLocation()); getLocation());
} }
ZipOutputStream zOut = null; ZipOutputStream zOut = null;
try { try {
log("Building MANIFEST-only jar: " log("Building MANIFEST-only jar: "


+ 3
- 2
src/main/org/apache/tools/ant/taskdefs/Java.java View File

@@ -138,7 +138,8 @@ public class Java extends Task {
throw new BuildException("Cannot spawn a java process in non-forked mode." throw new BuildException("Cannot spawn a java process in non-forked mode."
+ " Please set fork='true'. "); + " Please set fork='true'. ");
} }
if (getCommandLine().getClasspath()!=null && getCommandLine().getJar()!=null) {
if (getCommandLine().getClasspath() != null
&& getCommandLine().getJar() != null) {
log("When using 'jar' attribute classpath-settings are ignored. " log("When using 'jar' attribute classpath-settings are ignored. "
+ "See the manual for more information.", Project.MSG_VERBOSE); + "See the manual for more information.", Project.MSG_VERBOSE);
} }
@@ -933,4 +934,4 @@ public class Java extends Task {
public CommandlineJava.SysProperties getSysProperties() { public CommandlineJava.SysProperties getSysProperties() {
return getCommandLine().getSystemProperties(); return getCommandLine().getSystemProperties();
} }
}
}

+ 0
- 1
src/main/org/apache/tools/ant/taskdefs/Javac.java View File

@@ -28,7 +28,6 @@ import org.apache.tools.ant.taskdefs.compilers.CompilerAdapter;
import org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory; import org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory;
import org.apache.tools.ant.types.Path; import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.Reference; import org.apache.tools.ant.types.Reference;
import org.apache.tools.ant.util.FileUtils;
import org.apache.tools.ant.util.GlobPatternMapper; import org.apache.tools.ant.util.GlobPatternMapper;
import org.apache.tools.ant.util.JavaEnvUtils; import org.apache.tools.ant.util.JavaEnvUtils;
import org.apache.tools.ant.util.SourceFileScanner; import org.apache.tools.ant.util.SourceFileScanner;


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/JikesOutputParser.java View File

@@ -34,7 +34,7 @@ import org.apache.tools.ant.Task;
* by the Ant developers and is unmaintained. Don't use * by the Ant developers and is unmaintained. Don't use
* it.</strong></p> * it.</strong></p>
* *
* @deprecated since 1.2.
* @deprecated since 1.2.
* Use Jikes' exit value to detect compilation failure. * Use Jikes' exit value to detect compilation failure.
*/ */
public class JikesOutputParser implements ExecuteStreamHandler { public class JikesOutputParser implements ExecuteStreamHandler {


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/LoadResource.java View File

@@ -133,7 +133,7 @@ public class LoadResource extends Task {
try { try {
final long len = src.getSize(); final long len = src.getSize();
log("resource size = " log("resource size = "
+ (len != Resource.UNKNOWN_SIZE ? String.valueOf(len)
+ (len != Resource.UNKNOWN_SIZE ? String.valueOf(len)
: "unknown"), Project.MSG_DEBUG); : "unknown"), Project.MSG_DEBUG);
//discard most of really big resources //discard most of really big resources
final int size = (int) len; final int size = (int) len;


+ 2
- 1
src/main/org/apache/tools/ant/taskdefs/LogOutputStream.java View File

@@ -84,6 +84,7 @@ public class LogOutputStream extends LineOrientedOutputStream {
* Logs a line to the log system of ant. * Logs a line to the log system of ant.
* *
* @param line the line to log. * @param line the line to log.
* @param level the logging level to use.
*/ */
protected void processLine(String line, int level) { protected void processLine(String line, int level) {
pc.log(line, level); pc.log(line, level);
@@ -93,4 +94,4 @@ public class LogOutputStream extends LineOrientedOutputStream {
return level; return level;
} }


}
}

+ 4
- 4
src/main/org/apache/tools/ant/taskdefs/MacroDef.java View File

@@ -345,7 +345,7 @@ public class MacroDef extends AntlibDefinition {
getProject()); getProject());


helper.addDataTypeDefinition(def); helper.addDataTypeDefinition(def);
log("creating macro " + name,Project.MSG_VERBOSE);
log("creating macro " + name, Project.MSG_VERBOSE);
} }


/** /**
@@ -426,7 +426,7 @@ public class MacroDef extends AntlibDefinition {
* @return a <code>boolean</code> value * @return a <code>boolean</code> value
*/ */
protected boolean equals(Member m) { protected boolean equals(Member m) {
return (name == null)? m.name == null: name.equals(m.name);
return (name == null) ? m.name == null : name.equals(m.name);
} }


/** /**
@@ -576,7 +576,7 @@ public class MacroDef extends AntlibDefinition {
* This is not allowed for the define nested element. * This is not allowed for the define nested element.
* *
* @param defaultValue not used * @param defaultValue not used
* @throws BuildException, always
* @throws BuildException always
*/ */
public void setDefault(String defaultValue) { public void setDefault(String defaultValue) {
throw new BuildException( throw new BuildException(
@@ -585,7 +585,7 @@ public class MacroDef extends AntlibDefinition {


/** /**
* Gets the default value for this attibute. * Gets the default value for this attibute.
*
*
* @return the generated <em>unique</em> name, of the form * @return the generated <em>unique</em> name, of the form
* "prefix#this classname#&lt;aCounter&gt;". * "prefix#this classname#&lt;aCounter&gt;".
*/ */


+ 6
- 11
src/main/org/apache/tools/ant/taskdefs/Manifest.java View File

@@ -86,7 +86,7 @@ public class Manifest {


/** Encoding to be used for JAR files. */ /** Encoding to be used for JAR files. */
public static final String JAR_ENCODING = "UTF-8"; public static final String JAR_ENCODING = "UTF-8";
/** /**
* An attribute for the manifest. * An attribute for the manifest.
* Those attributes that are not nested into a section will be added to the "Main" section. * Those attributes that are not nested into a section will be added to the "Main" section.
@@ -105,7 +105,7 @@ public class Manifest {
* In this case the first line will have 74 bytes total line length * In this case the first line will have 74 bytes total line length
* (including CRLF). This conflicts with the 72 bytes total line length * (including CRLF). This conflicts with the 72 bytes total line length
* max, but is the only possible conclusion from the manifest specification, if * max, but is the only possible conclusion from the manifest specification, if
* names with 70 bytes length are allowed, have to be on the first line, and
* names with 70 bytes length are allowed, have to be on the first line, and
* have to be followed by ": ". * have to be followed by ": ".
*/ */
private static final int MAX_NAME_LENGTH = 70; private static final int MAX_NAME_LENGTH = 70;
@@ -326,25 +326,20 @@ public class Manifest {
throws IOException { throws IOException {
String line = null; String line = null;
int nameLength = name.getBytes(JAR_ENCODING).length; int nameLength = name.getBytes(JAR_ENCODING).length;
if (nameLength > MAX_NAME_VALUE_LENGTH)
{
if (nameLength > MAX_NAME_LENGTH)
{
if (nameLength > MAX_NAME_VALUE_LENGTH) {
if (nameLength > MAX_NAME_LENGTH) {
throw new IOException("Unable to write manifest line " throw new IOException("Unable to write manifest line "
+ name + ": " + value); + name + ": " + value);
} }
writer.print(name + ": " + EOL); writer.print(name + ": " + EOL);
line = " " + value; line = " " + value;
}
else
{
} else {
line = name + ": " + value; line = name + ": " + value;
} }
while (line.getBytes(JAR_ENCODING).length > MAX_SECTION_LENGTH) { while (line.getBytes(JAR_ENCODING).length > MAX_SECTION_LENGTH) {
// try to find a MAX_LINE_LENGTH byte section // try to find a MAX_LINE_LENGTH byte section
int breakIndex = MAX_SECTION_LENGTH; int breakIndex = MAX_SECTION_LENGTH;
if (breakIndex >= line.length())
{
if (breakIndex >= line.length()) {
breakIndex = line.length() - 1; breakIndex = line.length() - 1;
} }
String section = line.substring(0, breakIndex); String section = line.substring(0, breakIndex);


+ 24
- 23
src/main/org/apache/tools/ant/taskdefs/ManifestClassPath.java View File

@@ -36,16 +36,16 @@ import org.apache.tools.ant.util.FileUtils;
public class ManifestClassPath extends Task { public class ManifestClassPath extends Task {


/** The property name to hold the classpath value. */ /** The property name to hold the classpath value. */
private String _name;
private String name;


/** The directory the classpath will be relative from. */ /** The directory the classpath will be relative from. */
private File _dir;
private File dir;


/** The maximum parent directory level to traverse. */ /** The maximum parent directory level to traverse. */
private int _maxParentLevels = 2;
private int maxParentLevels = 2;


/** The classpath to convert. */ /** The classpath to convert. */
private Path _path;
private Path path;


/** /**
* Sets a property, which must not already exist, with a space * Sets a property, which must not already exist, with a space
@@ -53,37 +53,37 @@ public class ManifestClassPath extends Task {
* file's parent directory. * file's parent directory.
*/ */
public void execute() { public void execute() {
if (_name == null) {
if (name == null) {
throw new BuildException("Missing 'property' attribute!"); throw new BuildException("Missing 'property' attribute!");
} }
if (_dir == null) {
if (dir == null) {
throw new BuildException("Missing 'jarfile' attribute!"); throw new BuildException("Missing 'jarfile' attribute!");
} }
if (getProject().getProperty(_name) != null) {
throw new BuildException("Property '" + _name + "' already set!");
if (getProject().getProperty(name) != null) {
throw new BuildException("Property '" + name + "' already set!");
} }
if (_path == null) {
if (path == null) {
throw new BuildException("Missing nested <classpath>!"); throw new BuildException("Missing nested <classpath>!");
} }


// Normalize the reference directory (containing the jar) // Normalize the reference directory (containing the jar)
final FileUtils fileUtils = FileUtils.getFileUtils(); final FileUtils fileUtils = FileUtils.getFileUtils();
_dir = fileUtils.normalize(_dir.getAbsolutePath());
dir = fileUtils.normalize(dir.getAbsolutePath());


// Create as many directory prefixes as parent levels to traverse, // Create as many directory prefixes as parent levels to traverse,
// in addition to the reference directory itself // in addition to the reference directory itself
File currDir = _dir;
String[] dirs = new String[_maxParentLevels + 1];
for (int i = 0; i < _maxParentLevels + 1; ++i) {
File currDir = dir;
String[] dirs = new String[maxParentLevels + 1];
for (int i = 0; i < maxParentLevels + 1; ++i) {
dirs[i] = currDir.getAbsolutePath() + File.separatorChar; dirs[i] = currDir.getAbsolutePath() + File.separatorChar;
currDir = currDir.getParentFile(); currDir = currDir.getParentFile();
if (currDir == null) { if (currDir == null) {
_maxParentLevels = i + 1;
maxParentLevels = i + 1;
break; break;
} }
} }


String[] elements = _path.list();
String[] elements = path.list();
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
StringBuffer element = new StringBuffer(); StringBuffer element = new StringBuffer();
for (int i = 0; i < elements.length; ++i) { for (int i = 0; i < elements.length; ++i) {
@@ -95,7 +95,7 @@ public class ManifestClassPath extends Task {
// Find the longest prefix shared by the current file // Find the longest prefix shared by the current file
// and the reference directory. // and the reference directory.
String relPath = null; String relPath = null;
for (int j = 0; j <= _maxParentLevels; ++j) {
for (int j = 0; j <= maxParentLevels; ++j) {
String dir = dirs[j]; String dir = dirs[j];
if (!fullPath.startsWith(dir)) { if (!fullPath.startsWith(dir)) {
continue; continue;
@@ -115,8 +115,9 @@ public class ManifestClassPath extends Task {


// No match, so bail out! // No match, so bail out!
if (relPath == null) { if (relPath == null) {
throw new BuildException("No suitable relative path from " +
_dir + " to " + fullPath);
throw new BuildException(
"No suitable relative path from "
+ dir + " to " + fullPath);
} }


// Manifest's ClassPath: attribute always uses forward // Manifest's ClassPath: attribute always uses forward
@@ -138,7 +139,7 @@ public class ManifestClassPath extends Task {
} }


// Finally assign the property with the manifest classpath // Finally assign the property with the manifest classpath
getProject().setNewProperty(_name, buffer.toString().trim());
getProject().setNewProperty(name, buffer.toString().trim());
} }


/** /**
@@ -147,7 +148,7 @@ public class ManifestClassPath extends Task {
* @param name the property name * @param name the property name
*/ */
public void setProperty(String name) { public void setProperty(String name) {
_name = name;
this.name = name;
} }


/** /**
@@ -161,7 +162,7 @@ public class ManifestClassPath extends Task {
if (!parent.isDirectory()) { if (!parent.isDirectory()) {
throw new BuildException("Jar's directory not found: " + parent); throw new BuildException("Jar's directory not found: " + parent);
} }
_dir = parent;
this.dir = parent;
} }


/** /**
@@ -171,7 +172,7 @@ public class ManifestClassPath extends Task {
* @param levels the max level. Defaults to 2. * @param levels the max level. Defaults to 2.
*/ */
public void setMaxParentLevels(int levels) { public void setMaxParentLevels(int levels) {
_maxParentLevels = levels;
this.maxParentLevels = levels;
} }


/** /**
@@ -180,7 +181,7 @@ public class ManifestClassPath extends Task {
* @param path the classpath to convert. * @param path the classpath to convert.
*/ */
public void addClassPath(Path path) { public void addClassPath(Path path) {
_path = path;
this.path = path;
} }


} }

+ 2
- 1
src/main/org/apache/tools/ant/taskdefs/Mkdir.java View File

@@ -65,7 +65,8 @@ public class Mkdir extends Task {
} }
log("Created dir: " + dir.getAbsolutePath()); log("Created dir: " + dir.getAbsolutePath());
} else { } else {
log("Skipping " + dir.getAbsolutePath() + " because it already exists.", Project.MSG_VERBOSE);
log("Skipping " + dir.getAbsolutePath()
+ " because it already exists.", Project.MSG_VERBOSE);
} }
} }




+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/Pack.java View File

@@ -183,7 +183,7 @@ public abstract class Pack extends Task {


/** /**
* The source resource. * The source resource.
*
* @return the source.
* @since Ant 1.7 * @since Ant 1.7
*/ */
public Resource getSrcResource() { public Resource getSrcResource() {
@@ -194,7 +194,7 @@ public abstract class Pack extends Task {
* Whether this task can deal with non-file resources. * Whether this task can deal with non-file resources.
* *
* <p>This implementation returns false.</p> * <p>This implementation returns false.</p>
*
* @return false.
* @since Ant 1.7 * @since Ant 1.7
*/ */
protected boolean supportsNonFileResources() { protected boolean supportsNonFileResources() {


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/PreSetDef.java View File

@@ -96,7 +96,7 @@ public class PreSetDef extends AntlibDefinition implements TaskContainer {
newDef.setName(name); newDef.setName(name);


helper.addDataTypeDefinition(newDef); helper.addDataTypeDefinition(newDef);
log("defining preset "+name,Project.MSG_VERBOSE);
log("defining preset " + name, Project.MSG_VERBOSE);
} }


/** /**


+ 2
- 1
src/main/org/apache/tools/ant/taskdefs/ProcessDestroyer.java View File

@@ -144,7 +144,8 @@ class ProcessDestroyer implements Runnable {
// Cf.: http://developer.java.sun.com/developer/bugParade/bugs/4533087.html // Cf.: http://developer.java.sun.com/developer/bugParade/bugs/4533087.html
destroyProcessThread.setShouldDestroy(false); destroyProcessThread.setShouldDestroy(false);
if (!destroyProcessThread.getThreadGroup().isDestroyed()) { if (!destroyProcessThread.getThreadGroup().isDestroyed()) {
// start() would throw IllegalThreadStateException from ThreadGroup.add if it were destroyed
// start() would throw IllegalThreadStateException from
// ThreadGroup.add if it were destroyed
destroyProcessThread.start(); destroyProcessThread.start();
} }
// this should return quickly, since it basically is a NO-OP. // this should return quickly, since it basically is a NO-OP.


+ 3
- 2
src/main/org/apache/tools/ant/taskdefs/Property.java View File

@@ -606,8 +606,9 @@ public class Property extends Task {
String propertyValue = props.getProperty(name); String propertyValue = props.getProperty(name);
Vector fragments = new Vector(); Vector fragments = new Vector();
Vector propertyRefs = new Vector(); Vector propertyRefs = new Vector();
PropertyHelper.getPropertyHelper(this.getProject()).parsePropertyString(propertyValue, fragments,
propertyRefs);
PropertyHelper.getPropertyHelper(
this.getProject()).parsePropertyString(
propertyValue, fragments, propertyRefs);


if (propertyRefs.size() != 0) { if (propertyRefs.size() != 0) {
referencesSeen.push(name); referencesSeen.push(name);


Loading…
Cancel
Save