git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@469717 13f79535-47bb-0310-9956-ffa450edef68master
@@ -1538,6 +1538,10 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener { | |||||
} | } | ||||
} | } | ||||
/** | |||||
* Returns a <code>String</code> representing this loader. | |||||
* @return the path that this classloader has. | |||||
*/ | |||||
public String toString() { | public String toString() { | ||||
return "AntClassLoader[" + getClasspath() + "]"; | return "AntClassLoader[" + getClasspath() + "]"; | ||||
} | } | ||||
@@ -163,8 +163,9 @@ public class AntTypeDefinition { | |||||
/** | /** | ||||
* Try and load a class, with no attempt to catch any fault. | * Try and load a class, with no attempt to catch any fault. | ||||
* @return the class that implements this component | * @return the class that implements this component | ||||
* @throws ClassNotFoundException | |||||
* @throws NoClassDefFoundError | |||||
* @throws ClassNotFoundException if the class cannot be found. | |||||
* @throws NoClassDefFoundError if the there is an error | |||||
* finding the class. | |||||
*/ | */ | ||||
public Class innerGetTypeClass() throws ClassNotFoundException { | public Class innerGetTypeClass() throws ClassNotFoundException { | ||||
if (clazz != null) { | if (clazz != null) { | ||||
@@ -284,10 +285,10 @@ public class AntTypeDefinition { | |||||
* @param newclass class to create | * @param newclass class to create | ||||
* @param project | * @param project | ||||
* @return a newly constructed and bound instance. | * @return a newly constructed and bound instance. | ||||
* @throws NoSuchMethodException | |||||
* @throws InstantiationException | |||||
* @throws IllegalAccessException | |||||
* @throws InvocationTargetException | |||||
* @throws NoSuchMethodException no good construtor. | |||||
* @throws InstantiationException cannot initialize the object. | |||||
* @throws IllegalAccessException cannot access the object. | |||||
* @throws InvocationTargetException error in invocation. | |||||
*/ | */ | ||||
public Object innerCreateAndSet(Class newclass, Project project) | public Object innerCreateAndSet(Class newclass, Project project) | ||||
throws NoSuchMethodException, | throws NoSuchMethodException, | ||||
@@ -124,8 +124,8 @@ public class ComponentHelper { | |||||
* contrived work here to enable this early. | * contrived work here to enable this early. | ||||
*/ | */ | ||||
private static final String ANT_PROPERTY_TASK = "property"; | private static final String ANT_PROPERTY_TASK = "property"; | ||||
// {tasks, types} | |||||
// {tasks, types} | |||||
private static Properties[] defaultDefinitions = new Properties[2]; | private static Properties[] defaultDefinitions = new Properties[2]; | ||||
@@ -502,14 +502,17 @@ public class ComponentHelper { | |||||
if (c == null || !(Task.class.isAssignableFrom(c))) { | if (c == null || !(Task.class.isAssignableFrom(c))) { | ||||
return null; | return null; | ||||
} | } | ||||
Object _task = createComponent(taskType); | |||||
if (_task == null) { | |||||
Object obj= createComponent(taskType); | |||||
if (obj == null) { | |||||
return null; | return null; | ||||
} | } | ||||
if (!(_task instanceof Task)) { | |||||
throw new BuildException("Expected a Task from '" + taskType + "' but got an instance of " + _task.getClass().getName() + " instead"); | |||||
if (!(obj instanceof Task)) { | |||||
throw new BuildException( | |||||
"Expected a Task from '" + taskType | |||||
+ "' but got an instance of " + obj.getClass().getName() | |||||
+ " instead"); | |||||
} | } | ||||
Task task = (Task) _task; | |||||
Task task = (Task) obj; | |||||
task.setTaskType(taskType); | task.setTaskType(taskType); | ||||
// set default value, can be changed by the user | // set default value, can be changed by the user | ||||
@@ -741,7 +744,7 @@ public class ComponentHelper { | |||||
} | } | ||||
return classLoader; | return classLoader; | ||||
} | } | ||||
/** | /** | ||||
* Load default task or type definitions - just the names, | * Load default task or type definitions - just the names, | ||||
* no class loading. | * no class loading. | ||||
@@ -846,22 +849,22 @@ public class ComponentHelper { | |||||
String home = System.getProperty(Launcher.USER_HOMEDIR); | String home = System.getProperty(Launcher.USER_HOMEDIR); | ||||
File libDir = new File(home, Launcher.USER_LIBDIR); | File libDir = new File(home, Launcher.USER_LIBDIR); | ||||
String antHomeLib; | String antHomeLib; | ||||
boolean probablyIDE=false; | |||||
boolean probablyIDE = false; | |||||
String anthome = System.getProperty(MagicNames.ANT_HOME); | String anthome = System.getProperty(MagicNames.ANT_HOME); | ||||
if(anthome!=null) { | |||||
File antHomeLibDir = new File(anthome,"lib"); | |||||
antHomeLib=antHomeLibDir.getAbsolutePath(); | |||||
if (anthome != null) { | |||||
File antHomeLibDir = new File(anthome, "lib"); | |||||
antHomeLib = antHomeLibDir.getAbsolutePath(); | |||||
} else { | } else { | ||||
//running under an IDE that doesn't set ANT_HOME | //running under an IDE that doesn't set ANT_HOME | ||||
probablyIDE=true; | |||||
antHomeLib = "ANT_HOME" +File.separatorChar +"lib"; | |||||
probablyIDE = true; | |||||
antHomeLib = "ANT_HOME" + File.separatorChar + "lib"; | |||||
} | } | ||||
StringBuffer dirListingText = new StringBuffer(); | StringBuffer dirListingText = new StringBuffer(); | ||||
final String tab = " -"; | final String tab = " -"; | ||||
dirListingText.append(tab); | dirListingText.append(tab); | ||||
dirListingText.append(antHomeLib); | dirListingText.append(antHomeLib); | ||||
dirListingText.append('\n'); | dirListingText.append('\n'); | ||||
if(probablyIDE) { | |||||
if (probablyIDE) { | |||||
dirListingText.append(tab); | dirListingText.append(tab); | ||||
dirListingText.append("the IDE Ant configuration dialogs"); | dirListingText.append("the IDE Ant configuration dialogs"); | ||||
} else { | } else { | ||||
@@ -873,8 +876,8 @@ public class ComponentHelper { | |||||
"a directory added on the command line with the -lib argument"); | "a directory added on the command line with the -lib argument"); | ||||
} | } | ||||
String dirListing=dirListingText.toString(); | |||||
String dirListing = dirListingText.toString(); | |||||
//look up the name | //look up the name | ||||
AntTypeDefinition def = getDefinition(componentName); | AntTypeDefinition def = getDefinition(componentName); | ||||
if (def == null) { | if (def == null) { | ||||
@@ -883,7 +886,8 @@ public class ComponentHelper { | |||||
out.println("Cause: The name is undefined."); | out.println("Cause: The name is undefined."); | ||||
out.println("Action: Check the spelling."); | out.println("Action: Check the spelling."); | ||||
out.println("Action: Check that any custom tasks/types have been declared."); | out.println("Action: Check that any custom tasks/types have been declared."); | ||||
out.println("Action: Check that any <presetdef>/<macrodef> declarations have taken place."); | |||||
out.println("Action: Check that any <presetdef>/<macrodef>" | |||||
+ " declarations have taken place."); | |||||
if (isAntlib) { | if (isAntlib) { | ||||
out.println(); | out.println(); | ||||
out.println("This appears to be an antlib declaration. "); | out.println("This appears to be an antlib declaration. "); | ||||
@@ -921,12 +925,16 @@ public class ComponentHelper { | |||||
+ ncdfe.getMessage()); | + ncdfe.getMessage()); | ||||
if (optional) { | if (optional) { | ||||
out.println(" It is not enough to have Ant's optional JARs"); | out.println(" It is not enough to have Ant's optional JARs"); | ||||
out.println(" you need the JAR files that the optional tasks depend upon."); | |||||
out.println(" Ant's optional task dependencies are listed in the manual."); | |||||
out.println(" you need the JAR files that the" | |||||
+ " optional tasks depend upon."); | |||||
out.println(" Ant's optional task dependencies are" | |||||
+ " listed in the manual."); | |||||
} else { | } else { | ||||
out.println(" This class may be in a separate JAR that is not installed."); | |||||
out.println(" This class may be in a separate JAR" | |||||
+ " that is not installed."); | |||||
} | } | ||||
out.println("Action: Determine what extra JAR files are needed, and place them in one of:"); | |||||
out.println("Action: Determine what extra JAR files are" | |||||
+ " needed, and place them in one of:"); | |||||
out.println(dirListing); | out.println(dirListing); | ||||
} | } | ||||
//here we successfully loaded the class or failed. | //here we successfully loaded the class or failed. | ||||
@@ -960,7 +968,8 @@ public class ComponentHelper { | |||||
out.println("Cause: A class needed by class " | out.println("Cause: A class needed by class " | ||||
+ classname + " cannot be found: "); | + classname + " cannot be found: "); | ||||
out.println(" " + ncdfe.getMessage()); | out.println(" " + ncdfe.getMessage()); | ||||
out.println("Action: Determine what extra JAR files are needed, and place them in:"); | |||||
out.println("Action: Determine what extra JAR files are" | |||||
+ " needed, and place them in:"); | |||||
out.println(dirListing); | out.println(dirListing); | ||||
} | } | ||||
} | } | ||||
@@ -71,7 +71,8 @@ public final class Diagnostics { | |||||
* The error text when a security manager blocks access to a property. | * The error text when a security manager blocks access to a property. | ||||
* {@value} | * {@value} | ||||
*/ | */ | ||||
protected static final String ERROR_PROPERTY_ACCESS_BLOCKED = "Access to this property blocked by a security manager"; | |||||
protected static final String ERROR_PROPERTY_ACCESS_BLOCKED | |||||
= "Access to this property blocked by a security manager"; | |||||
/** utility class */ | /** utility class */ | ||||
private Diagnostics() { | private Diagnostics() { | ||||
@@ -239,14 +240,13 @@ public final class Diagnostics { | |||||
} | } | ||||
/** | /** | ||||
* ignore exceptions. This is to allow future | |||||
* ignore exceptions. This is to allow future | |||||
* implementations to log at a verbose level | * implementations to log at a verbose level | ||||
* @param thrown | * @param thrown | ||||
*/ | */ | ||||
private static void ignoreThrowable(Throwable thrown) { | private static void ignoreThrowable(Throwable thrown) { | ||||
} | } | ||||
/** | /** | ||||
* get the location of a class. Stolen from axis/webapps/happyaxis.jsp | * get the location of a class. Stolen from axis/webapps/happyaxis.jsp | ||||
* @param clazz | * @param clazz | ||||
@@ -279,7 +279,7 @@ public final class Diagnostics { | |||||
ignoreThrowable(e); | ignoreThrowable(e); | ||||
out.println("optional tasks : not available"); | out.println("optional tasks : not available"); | ||||
} | } | ||||
header(out, "ANT PROPERTIES"); | header(out, "ANT PROPERTIES"); | ||||
doReportAntProperties(out); | doReportAntProperties(out); | ||||
@@ -306,10 +306,10 @@ public final class Diagnostics { | |||||
header(out, "Locale information"); | header(out, "Locale information"); | ||||
doReportLocale(out); | doReportLocale(out); | ||||
header(out, "Proxy information"); | header(out, "Proxy information"); | ||||
doReportProxy(out); | doReportProxy(out); | ||||
out.println(); | out.println(); | ||||
} | } | ||||
@@ -344,7 +344,7 @@ public final class Diagnostics { | |||||
/** | /** | ||||
* Get the value of a system property. If a security manager | * Get the value of a system property. If a security manager | ||||
* blocks access to a property it fills the result in with an error | |||||
* blocks access to a property it fills the result in with an error | |||||
* @param key | * @param key | ||||
* @return the system property's value or error text | * @return the system property's value or error text | ||||
* @see #ERROR_PROPERTY_ACCESS_BLOCKED | * @see #ERROR_PROPERTY_ACCESS_BLOCKED | ||||
@@ -367,7 +367,8 @@ public final class Diagnostics { | |||||
Project p = new Project(); | Project p = new Project(); | ||||
p.initProperties(); | p.initProperties(); | ||||
out.println(MagicNames.ANT_VERSION + ": " + p.getProperty(MagicNames.ANT_VERSION)); | out.println(MagicNames.ANT_VERSION + ": " + p.getProperty(MagicNames.ANT_VERSION)); | ||||
out.println(MagicNames.ANT_JAVA_VERSION + ": " + p.getProperty(MagicNames.ANT_JAVA_VERSION)); | |||||
out.println(MagicNames.ANT_JAVA_VERSION + ": " | |||||
+ p.getProperty(MagicNames.ANT_JAVA_VERSION)); | |||||
out.println(MagicNames.ANT_LIB + ": " + p.getProperty(MagicNames.ANT_LIB)); | out.println(MagicNames.ANT_LIB + ": " + p.getProperty(MagicNames.ANT_LIB)); | ||||
out.println(MagicNames.ANT_HOME + ": " + p.getProperty(MagicNames.ANT_HOME)); | out.println(MagicNames.ANT_HOME + ": " + p.getProperty(MagicNames.ANT_HOME)); | ||||
} | } | ||||
@@ -462,7 +463,7 @@ public final class Diagnostics { | |||||
Class.forName(classname); | Class.forName(classname); | ||||
props.remove(key); | props.remove(key); | ||||
} catch (ClassNotFoundException e) { | } catch (ClassNotFoundException e) { | ||||
out.println(key + " : Not Available " | |||||
out.println(key + " : Not Available " | |||||
+ "(the implementation class is not present)"); | + "(the implementation class is not present)"); | ||||
} catch (NoClassDefFoundError e) { | } catch (NoClassDefFoundError e) { | ||||
String pkg = e.getMessage().replace('/', '.'); | String pkg = e.getMessage().replace('/', '.'); | ||||
@@ -474,8 +475,8 @@ public final class Diagnostics { | |||||
if (props.size() == 0) { | if (props.size() == 0) { | ||||
out.println("All defined tasks are available"); | out.println("All defined tasks are available"); | ||||
} else { | } else { | ||||
out.println("A task being missing/unavailable should only " | |||||
+"matter if you are trying to use it"); | |||||
out.println("A task being missing/unavailable should only " | |||||
+ "matter if you are trying to use it"); | |||||
} | } | ||||
} catch (IOException e) { | } catch (IOException e) { | ||||
out.println(e.getMessage()); | out.println(e.getMessage()); | ||||
@@ -491,8 +492,8 @@ public final class Diagnostics { | |||||
String parserName = getXmlParserName(); | String parserName = getXmlParserName(); | ||||
String parserLocation = getXMLParserLocation(); | String parserLocation = getXMLParserLocation(); | ||||
printParserInfo(out, "XML Parser", parserName, parserLocation); | printParserInfo(out, "XML Parser", parserName, parserLocation); | ||||
printParserInfo(out, "Namespace-aware parser", | |||||
getNamespaceParserName(), | |||||
printParserInfo(out, "Namespace-aware parser", | |||||
getNamespaceParserName(), | |||||
getNamespaceParserLocation()); | getNamespaceParserLocation()); | ||||
} | } | ||||
@@ -506,8 +507,8 @@ public final class Diagnostics { | |||||
if (parserLocation == null) { | if (parserLocation == null) { | ||||
parserLocation = "unknown"; | parserLocation = "unknown"; | ||||
} | } | ||||
out.println(parserType +" : " + parserName); | |||||
out.println(parserType +" Location: " + parserLocation); | |||||
out.println(parserType + " : " + parserName); | |||||
out.println(parserType + " Location: " + parserLocation); | |||||
} | } | ||||
/** | /** | ||||
@@ -566,7 +567,7 @@ public final class Diagnostics { | |||||
/** | /** | ||||
* Report locale information | * Report locale information | ||||
* @param out stream to print to | |||||
* @param out stream to print to | |||||
*/ | */ | ||||
private static void doReportLocale(PrintStream out) { | private static void doReportLocale(PrintStream out) { | ||||
//calendar stuff. | //calendar stuff. | ||||
@@ -590,9 +591,9 @@ public final class Diagnostics { | |||||
* @param out stream to print on | * @param out stream to print on | ||||
* @param key property name | * @param key property name | ||||
*/ | */ | ||||
private static void printProperty(PrintStream out,String key) { | |||||
String value= getProperty(key); | |||||
if(value!=null) { | |||||
private static void printProperty(PrintStream out, String key) { | |||||
String value = getProperty(key); | |||||
if (value != null) { | |||||
out.print(key); | out.print(key); | ||||
out.print(" = "); | out.print(" = "); | ||||
out.print('"'); | out.print('"'); | ||||
@@ -603,12 +604,12 @@ public final class Diagnostics { | |||||
/** | /** | ||||
* Report proxy information | * Report proxy information | ||||
* | |||||
* | |||||
* @param out stream to print to | * @param out stream to print to | ||||
* @since Ant1.7 | * @since Ant1.7 | ||||
*/ | */ | ||||
private static void doReportProxy(PrintStream out) { | private static void doReportProxy(PrintStream out) { | ||||
printProperty(out,ProxySetup.HTTP_PROXY_HOST); | |||||
printProperty(out, ProxySetup.HTTP_PROXY_HOST); | |||||
printProperty(out, ProxySetup.HTTP_PROXY_PORT); | printProperty(out, ProxySetup.HTTP_PROXY_PORT); | ||||
printProperty(out, ProxySetup.HTTP_PROXY_USERNAME); | printProperty(out, ProxySetup.HTTP_PROXY_USERNAME); | ||||
printProperty(out, ProxySetup.HTTP_PROXY_PASSWORD); | printProperty(out, ProxySetup.HTTP_PROXY_PASSWORD); | ||||
@@ -632,7 +633,7 @@ public final class Diagnostics { | |||||
= "org.apache.tools.ant.util.java15.ProxyDiagnostics"; | = "org.apache.tools.ant.util.java15.ProxyDiagnostics"; | ||||
try { | try { | ||||
Class proxyDiagClass = Class.forName(proxyDiagClassname); | Class proxyDiagClass = Class.forName(proxyDiagClassname); | ||||
Object instance =proxyDiagClass.newInstance(); | |||||
Object instance = proxyDiagClass.newInstance(); | |||||
out.println("Java1.5+ proxy settings:"); | out.println("Java1.5+ proxy settings:"); | ||||
out.println(instance.toString()); | out.println(instance.toString()); | ||||
} catch (ClassNotFoundException e) { | } catch (ClassNotFoundException e) { | ||||
@@ -136,7 +136,7 @@ public class DirectoryScanner | |||||
* reasons.</p> | * reasons.</p> | ||||
* | * | ||||
* @deprecated since 1.6.x. | * @deprecated since 1.6.x. | ||||
* Use the {@link #getDefaultExcludes getDefaultExcludes} | |||||
* Use the {@link #getDefaultExcludes getDefaultExcludes} | |||||
* method instead. | * method instead. | ||||
*/ | */ | ||||
protected static final String[] DEFAULTEXCLUDES = { | protected static final String[] DEFAULTEXCLUDES = { | ||||
@@ -864,7 +864,7 @@ public class DirectoryScanner | |||||
} | } | ||||
} | } | ||||
while (it.hasNext()) { | while (it.hasNext()) { | ||||
Map.Entry entry = (Map.Entry)it.next(); | |||||
Map.Entry entry = (Map.Entry)it.next(); | |||||
String currentelement = (String) entry.getKey(); | String currentelement = (String) entry.getKey(); | ||||
if (basedir == null && !FileUtils.isAbsolutePath(currentelement)) { | if (basedir == null && !FileUtils.isAbsolutePath(currentelement)) { | ||||
continue; | continue; | ||||
@@ -970,6 +970,7 @@ public class DirectoryScanner | |||||
try { | try { | ||||
slowScanLock.wait(); | slowScanLock.wait(); | ||||
} catch (InterruptedException e) { | } catch (InterruptedException e) { | ||||
// Empty | |||||
} | } | ||||
} | } | ||||
return; | return; | ||||
@@ -1014,7 +1015,7 @@ public class DirectoryScanner | |||||
} | } | ||||
} | } | ||||
} | } | ||||
/** | /** | ||||
* Scan the given directory for files and directories. Found files and | * Scan the given directory for files and directories. Found files and | ||||
* directories are placed in their respective collections, based on the | * directories are placed in their respective collections, based on the | ||||
@@ -1115,7 +1116,7 @@ public class DirectoryScanner | |||||
* @param file included File. | * @param file included File. | ||||
*/ | */ | ||||
private void accountForIncludedFile(String name, File file) { | private void accountForIncludedFile(String name, File file) { | ||||
processIncluded(name, file, filesIncluded, filesExcluded, filesDeselected); | |||||
processIncluded(name, file, filesIncluded, filesExcluded, filesDeselected); | |||||
} | } | ||||
/** | /** | ||||
@@ -1126,20 +1127,20 @@ public class DirectoryScanner | |||||
* @param fast whether to perform fast scans. | * @param fast whether to perform fast scans. | ||||
*/ | */ | ||||
private void accountForIncludedDir(String name, File file, boolean fast) { | private void accountForIncludedDir(String name, File file, boolean fast) { | ||||
processIncluded(name, file, dirsIncluded, dirsExcluded, dirsDeselected); | |||||
processIncluded(name, file, dirsIncluded, dirsExcluded, dirsDeselected); | |||||
if (fast && couldHoldIncluded(name) && !contentsExcluded(name)) { | if (fast && couldHoldIncluded(name) && !contentsExcluded(name)) { | ||||
scandir(file, name + File.separator, fast); | scandir(file, name + File.separator, fast); | ||||
} | } | ||||
} | } | ||||
private void processIncluded(String name, File file, Vector inc, Vector exc, Vector des) { | private void processIncluded(String name, File file, Vector inc, Vector exc, Vector des) { | ||||
if (inc.contains(name) || exc.contains(name) || des.contains(name)) { return; } | if (inc.contains(name) || exc.contains(name) || des.contains(name)) { return; } | ||||
boolean included = false; | boolean included = false; | ||||
if (isExcluded(name)) { | if (isExcluded(name)) { | ||||
exc.add(name); | exc.add(name); | ||||
} else if(isSelected(name, file)) { | |||||
} else if (isSelected(name, file)) { | |||||
included = true; | included = true; | ||||
inc.add(name); | inc.add(name); | ||||
} else { | } else { | ||||
@@ -147,7 +147,7 @@ public final class MagicNames { | |||||
public static final String BUILD_JAVAC_TARGET = "ant.build.javac.target"; | public static final String BUILD_JAVAC_TARGET = "ant.build.javac.target"; | ||||
/** | /** | ||||
* Name of the magic property that controls classloader reuse | |||||
* Name of the magic property that controls classloader reuse | |||||
* @since Ant 1.4. | * @since Ant 1.4. | ||||
* Value: {@value} | * Value: {@value} | ||||
*/ | */ | ||||
@@ -218,7 +218,7 @@ public class Main implements AntMain { | |||||
} | } | ||||
/** | /** | ||||
* This operation is expected to call {@link System#exit(int)}, which | |||||
* This operation is expected to call {@link System#exit(int)}, which | |||||
* is what the base version does. | * is what the base version does. | ||||
* However, it is possible to do something else. | * However, it is possible to do something else. | ||||
* @param exitCode code to exit with | * @param exitCode code to exit with | ||||
@@ -286,8 +286,8 @@ public class Main implements AntMain { | |||||
PrintStream logTo = null; | PrintStream logTo = null; | ||||
//this is the list of lu | //this is the list of lu | ||||
HashMap launchCommands =new HashMap(); | |||||
launchCommands.put("-lib",""); | |||||
HashMap launchCommands = new HashMap(); | |||||
launchCommands.put("-lib", ""); | |||||
launchCommands.put("-cp", ""); | launchCommands.put("-cp", ""); | ||||
launchCommands.put("-noclasspath", ""); | launchCommands.put("-noclasspath", ""); | ||||
launchCommands.put("--noclasspath", ""); | launchCommands.put("--noclasspath", ""); | ||||
@@ -443,7 +443,7 @@ public class Main implements AntMain { | |||||
throw new BuildException( | throw new BuildException( | ||||
"Niceness value is out of the range 1-10"); | "Niceness value is out of the range 1-10"); | ||||
} | } | ||||
} else if (launchCommands.get(arg)!=null) { | |||||
} else if (launchCommands.get(arg) != null) { | |||||
//catch script/ant mismatch with a meaningful message | //catch script/ant mismatch with a meaningful message | ||||
//we could ignore it, but there are likely to be other | //we could ignore it, but there are likely to be other | ||||
//version problems, so we stamp down on the configuration now | //version problems, so we stamp down on the configuration now | ||||
@@ -847,8 +847,8 @@ public class Main implements AntMain { | |||||
msg.append(" -nouserlib Run ant without using the jar files from" + lSep | msg.append(" -nouserlib Run ant without using the jar files from" + lSep | ||||
+ " ${user.home}/.ant/lib" + lSep); | + " ${user.home}/.ant/lib" + lSep); | ||||
msg.append(" -noclasspath Run ant without using CLASSPATH" + lSep); | msg.append(" -noclasspath Run ant without using CLASSPATH" + lSep); | ||||
msg.append(" -noproxy Java 1.5 only: do not use the OS proxies" + | |||||
lSep); | |||||
msg.append(" -noproxy Java 1.5 only: do not use the OS proxies" | |||||
+ lSep); | |||||
msg.append(" -main <class> override Ant's normal entry point"); | msg.append(" -main <class> override Ant's normal entry point"); | ||||
System.out.println(msg.toString()); | System.out.println(msg.toString()); | ||||
} | } | ||||
@@ -181,7 +181,8 @@ public class Project implements ResourceFactory { | |||||
private Map/*<Thread,Task>*/ threadTasks = Collections.synchronizedMap(new WeakHashMap()); | private Map/*<Thread,Task>*/ threadTasks = Collections.synchronizedMap(new WeakHashMap()); | ||||
/** Records the latest task to be executed on a thread group. */ | /** Records the latest task to be executed on a thread group. */ | ||||
private Map/*<ThreadGroup,Task>*/ threadGroupTasks = Collections.synchronizedMap(new WeakHashMap()); | |||||
private Map/*<ThreadGroup,Task>*/ threadGroupTasks | |||||
= Collections.synchronizedMap(new WeakHashMap()); | |||||
/** | /** | ||||
* Called to handle any input requests. | * Called to handle any input requests. | ||||
@@ -736,7 +737,7 @@ public class Project implements ResourceFactory { | |||||
* @return a hashtable of global filters, mapping tokens to values | * @return a hashtable of global filters, mapping tokens to values | ||||
* (String to String). | * (String to String). | ||||
* | * | ||||
* @deprecated since 1.4.x | |||||
* @deprecated since 1.4.x | |||||
* Use getGlobalFilterSet().getFilterHash(). | * Use getGlobalFilterSet().getFilterHash(). | ||||
* | * | ||||
* @see #getGlobalFilterSet() | * @see #getGlobalFilterSet() | ||||
@@ -1380,7 +1381,7 @@ public class Project implements ResourceFactory { | |||||
* | * | ||||
* @return the native version of the specified path or | * @return the native version of the specified path or | ||||
* an empty string if the path is <code>null</code> or empty. | * an empty string if the path is <code>null</code> or empty. | ||||
* | |||||
* | |||||
* @deprecated since 1.7 | * @deprecated since 1.7 | ||||
* Use FileUtils.translatePath instead. | * Use FileUtils.translatePath instead. | ||||
* | * | ||||
@@ -2280,6 +2281,7 @@ public class Project implements ResourceFactory { | |||||
/** | /** | ||||
* Resolve the file relative to the project's basedir and return it as a | * Resolve the file relative to the project's basedir and return it as a | ||||
* FileResource. | * FileResource. | ||||
* @param name the name of the file to resolve. | |||||
* @since Ant 1.7 | * @since Ant 1.7 | ||||
*/ | */ | ||||
public Resource getResource(String name) { | public Resource getResource(String name) { | ||||
@@ -27,8 +27,8 @@ public abstract class ProjectComponent { | |||||
/** | /** | ||||
* Project object of this component. | * Project object of this component. | ||||
* @deprecated since 1.6.x. | |||||
* You should not be directly accessing this variable directly. | |||||
* @deprecated since 1.6.x. | |||||
* You should not be directly accessing this variable directly. | |||||
* You should access project object via the getProject() | * You should access project object via the getProject() | ||||
* or setProject() accessor/mutators. | * or setProject() accessor/mutators. | ||||
*/ | */ | ||||
@@ -42,7 +42,7 @@ public abstract class Task extends ProjectComponent { | |||||
/** | /** | ||||
* Description of this task, if any. | * Description of this task, if any. | ||||
* @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. | ||||
*/ | */ | ||||
protected String description; | protected String description; | ||||
@@ -54,7 +54,7 @@ public abstract class Task extends ProjectComponent { | |||||
* isn't terribly descriptive for a task used within | * isn't terribly descriptive for a task used within | ||||
* another task - the outer task code can probably | * another task - the outer task code can probably | ||||
* provide a better one. | * provide a better one. | ||||
* @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 #getTaskName()} method. | * Please use the {@link #getTaskName()} method. | ||||
*/ | */ | ||||
@@ -63,7 +63,7 @@ public abstract class Task extends ProjectComponent { | |||||
/** | /** | ||||
* Type of this task. | * Type of this task. | ||||
* | * | ||||
* @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 #getTaskType()} method. | * Please use the {@link #getTaskType()} method. | ||||
*/ | */ | ||||
@@ -213,7 +213,6 @@ public class UnknownElement extends Task { | |||||
/** | /** | ||||
* @see Task#handleInput(byte[], int, int) | * @see Task#handleInput(byte[], int, int) | ||||
* | |||||
* @since Ant 1.6 | * @since Ant 1.6 | ||||
*/ | */ | ||||
protected int handleInput(byte[] buffer, int offset, int length) | protected int handleInput(byte[] buffer, int offset, int length) | ||||
@@ -101,6 +101,7 @@ public final class FixCrLfFilter extends BaseParamFilterReader implements Chaina | |||||
* @param in | * @param in | ||||
* A Reader object providing the underlying stream. Must not be | * A Reader object providing the underlying stream. Must not be | ||||
* <code>null</code>. | * <code>null</code>. | ||||
* @throws IOException on error. | |||||
*/ | */ | ||||
public FixCrLfFilter(final Reader in) throws IOException { | public FixCrLfFilter(final Reader in) throws IOException { | ||||
super(in); | super(in); | ||||
@@ -372,6 +373,7 @@ public final class FixCrLfFilter extends BaseParamFilterReader implements Chaina | |||||
* @param tabLength | * @param tabLength | ||||
* specify the length of tab in spaces. Valid values are between | * specify the length of tab in spaces. Valid values are between | ||||
* 2 and 80 inclusive. The default for this parameter is 8. | * 2 and 80 inclusive. The default for this parameter is 8. | ||||
* @throws IOException on error. | |||||
*/ | */ | ||||
public void setTablength(int tabLength) throws IOException { | public void setTablength(int tabLength) throws IOException { | ||||
if (tabLength < 2 || tabLength > 80) { | if (tabLength < 2 || tabLength > 80) { | ||||
@@ -850,7 +852,7 @@ public final class FixCrLfFilter extends BaseParamFilterReader implements Chaina | |||||
private static final AddAsisRemove REMOVE = newInstance("remove"); | private static final AddAsisRemove REMOVE = newInstance("remove"); | ||||
public String[] getValues() { | public String[] getValues() { | ||||
return new String[] { "add", "asis", "remove" }; | |||||
return new String[] {"add", "asis", "remove"}; | |||||
} | } | ||||
public boolean equals(Object other) { | public boolean equals(Object other) { | ||||
@@ -239,7 +239,7 @@ public final class ReplaceTokens | |||||
} finally { | } finally { | ||||
FileUtils.close(in); | FileUtils.close(in); | ||||
} | } | ||||
return props; | return props; | ||||
} | } | ||||
@@ -259,7 +259,7 @@ public class ProjectHelper2 extends ProjectHelper { | |||||
* @param handler new main handler | * @param handler new main handler | ||||
*/ | */ | ||||
protected static void setMainHandler(AntHandler handler) { | protected static void setMainHandler(AntHandler handler) { | ||||
mainHandler=handler; | |||||
mainHandler = handler; | |||||
} | } | ||||
/** | /** | ||||
@@ -275,7 +275,7 @@ public class ProjectHelper2 extends ProjectHelper { | |||||
* @param handler new project handler | * @param handler new project handler | ||||
*/ | */ | ||||
protected static void setProjectHandler(AntHandler handler) { | protected static void setProjectHandler(AntHandler handler) { | ||||
projectHandler=handler; | |||||
projectHandler = handler; | |||||
} | } | ||||
/** | /** | ||||
@@ -291,7 +291,7 @@ public class ProjectHelper2 extends ProjectHelper { | |||||
* @param handler new target handler | * @param handler new target handler | ||||
*/ | */ | ||||
protected static void setTargetHandler(AntHandler handler) { | protected static void setTargetHandler(AntHandler handler) { | ||||
targetHandler=handler; | |||||
targetHandler = handler; | |||||
} | } | ||||
/** | /** | ||||
@@ -307,7 +307,7 @@ public class ProjectHelper2 extends ProjectHelper { | |||||
* @param handler new element handler | * @param handler new element handler | ||||
*/ | */ | ||||
protected static void setElementHandler(AntHandler handler) { | protected static void setElementHandler(AntHandler handler) { | ||||
elementHandler=handler; | |||||
elementHandler = handler; | |||||
} | } | ||||
@@ -479,9 +479,9 @@ public class ProjectHelper2 extends ProjectHelper { | |||||
if (!file.isAbsolute()) { | if (!file.isAbsolute()) { | ||||
file = FILE_UTILS.resolveFile(context.getBuildFileParent(), path); | file = FILE_UTILS.resolveFile(context.getBuildFileParent(), path); | ||||
context.getProject().log( | context.getProject().log( | ||||
"Warning: '" + systemId + "' in " + context.getBuildFile() + | |||||
" should be expressed simply as '" + path.replace('\\', '/') + | |||||
"' for compliance with other XML tools", | |||||
"Warning: '" + systemId + "' in " + context.getBuildFile() | |||||
+ " should be expressed simply as '" + path.replace('\\', '/') | |||||
+ "' for compliance with other XML tools", | |||||
Project.MSG_WARN); | Project.MSG_WARN); | ||||
} | } | ||||
context.getProject().log("file=" + file, Project.MSG_DEBUG); | context.getProject().log("file=" + file, Project.MSG_DEBUG); | ||||
@@ -298,9 +298,9 @@ public class ProjectHelperImpl extends ProjectHelper { | |||||
if (!file.isAbsolute()) { | if (!file.isAbsolute()) { | ||||
file = FILE_UTILS.resolveFile(helperImpl.buildFileParent, path); | file = FILE_UTILS.resolveFile(helperImpl.buildFileParent, path); | ||||
helperImpl.project.log( | helperImpl.project.log( | ||||
"Warning: '" + systemId + "' in " + helperImpl.buildFile + | |||||
" should be expressed simply as '" + path.replace('\\', '/') + | |||||
"' for compliance with other XML tools", | |||||
"Warning: '" + systemId + "' in " + helperImpl.buildFile | |||||
+ " should be expressed simply as '" + path.replace('\\', '/') | |||||
+ "' for compliance with other XML tools", | |||||
Project.MSG_WARN); | Project.MSG_WARN); | ||||
} | } | ||||
try { | try { | ||||
@@ -62,6 +62,7 @@ public class GreedyInputHandler extends DefaultInputHandler { | |||||
try { | try { | ||||
t.join(); | t.join(); | ||||
} catch (InterruptedException e2) { | } catch (InterruptedException e2) { | ||||
// Ignore | |||||
} | } | ||||
} | } | ||||
request.setInput(new String(baos.toByteArray())); | request.setInput(new String(baos.toByteArray())); | ||||
@@ -74,6 +74,7 @@ public class InputRequest { | |||||
/** | /** | ||||
* Gets a configured default value. | * Gets a configured default value. | ||||
* @return the default value. | |||||
* @since Ant 1.7.0 | * @since Ant 1.7.0 | ||||
*/ | */ | ||||
public String getDefaultValue() { | public String getDefaultValue() { | ||||
@@ -82,6 +83,7 @@ public class InputRequest { | |||||
/** | /** | ||||
* Configures a default value. | * Configures a default value. | ||||
* @param d the value to set. | |||||
* @since Ant 1.7.0 | * @since Ant 1.7.0 | ||||
*/ | */ | ||||
public void setDefaultValue(String d) { | public void setDefaultValue(String d) { | ||||
@@ -126,7 +126,7 @@ public class Launcher { | |||||
private void addPath(String path, boolean getJars, List libPathURLs) | private void addPath(String path, boolean getJars, List libPathURLs) | ||||
throws MalformedURLException { | throws MalformedURLException { | ||||
StringTokenizer tokenizer = new StringTokenizer(path, File.pathSeparator); | StringTokenizer tokenizer = new StringTokenizer(path, File.pathSeparator); | ||||
while(tokenizer.hasMoreElements()) { | |||||
while (tokenizer.hasMoreElements()) { | |||||
String elementName = tokenizer.nextToken(); | String elementName = tokenizer.nextToken(); | ||||
File element = new File(elementName); | File element = new File(elementName); | ||||
if (elementName.indexOf("%") != -1 && !element.exists()) { | if (elementName.indexOf("%") != -1 && !element.exists()) { | ||||
@@ -291,14 +291,14 @@ public class Launcher { | |||||
URLClassLoader loader = new URLClassLoader(jars); | URLClassLoader loader = new URLClassLoader(jars); | ||||
Thread.currentThread().setContextClassLoader(loader); | Thread.currentThread().setContextClassLoader(loader); | ||||
Class mainClass = null; | Class mainClass = null; | ||||
int exitCode=0; | |||||
int exitCode = 0; | |||||
try { | try { | ||||
mainClass = loader.loadClass(mainClassname); | mainClass = loader.loadClass(mainClassname); | ||||
AntMain main = (AntMain) mainClass.newInstance(); | AntMain main = (AntMain) mainClass.newInstance(); | ||||
main.startAnt(newArgs, null, null); | main.startAnt(newArgs, null, null); | ||||
} catch (InstantiationException ex) { | } catch (InstantiationException ex) { | ||||
System.err.println( | System.err.println( | ||||
"Incompatible version of "+mainClassname+" detected"); | |||||
"Incompatible version of " + mainClassname + " detected"); | |||||
File mainJar = Locator.getClassSource(mainClass); | File mainJar = Locator.getClassSource(mainClass); | ||||
System.err.println( | System.err.println( | ||||
"Location of this class " + mainJar); | "Location of this class " + mainJar); | ||||
@@ -308,7 +308,5 @@ public class Launcher { | |||||
exitCode = EXIT_CODE_ERROR; | exitCode = EXIT_CODE_ERROR; | ||||
} | } | ||||
return exitCode; | return exitCode; | ||||
} | } | ||||
} | } |