git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277443 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -1,5 +1,5 @@ | |||||
| /* | /* | ||||
| * Copyright 2004 The Apache Software Foundation. | |||||
| * Copyright 2004-2005 The Apache Software Foundation. | |||||
| * | * | ||||
| * Licensed under the Apache License, Version 2.0 (the "License"); | * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| * you may not use this file except in compliance with the License. | * you may not use this file except in compliance with the License. | ||||
| @@ -21,7 +21,6 @@ import java.util.List; | |||||
| import java.util.Arrays; | import java.util.Arrays; | ||||
| import java.util.Iterator; | import java.util.Iterator; | ||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import org.apache.tools.ant.types.Mapper; | |||||
| /** | /** | ||||
| * A <CODE>ContainerMapper</CODE> that chains the results of the first | * A <CODE>ContainerMapper</CODE> that chains the results of the first | ||||
| @@ -1,5 +1,5 @@ | |||||
| /* | /* | ||||
| * Copyright 2002-2004 The Apache Software Foundation | |||||
| * Copyright 2002-2005 The Apache Software Foundation | |||||
| * | * | ||||
| * Licensed under the Apache License, Version 2.0 (the "License"); | * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| * you may not use this file except in compliance with the License. | * you may not use this file except in compliance with the License. | ||||
| @@ -29,8 +29,10 @@ import java.util.Vector; | |||||
| public class CollectionUtils { | public class CollectionUtils { | ||||
| /** | /** | ||||
| * Please use Vector.equals() or List.equals() | |||||
| * | |||||
| * Please use Vector.equals() or List.equals(). | |||||
| * @param v1 the first vector. | |||||
| * @param v2 the second vector. | |||||
| * @return true if the vectors are equal. | |||||
| * @since Ant 1.5 | * @since Ant 1.5 | ||||
| * @deprecated | * @deprecated | ||||
| */ | */ | ||||
| @@ -48,10 +50,12 @@ public class CollectionUtils { | |||||
| /** | /** | ||||
| * Dictionary does not have an equals. | * Dictionary does not have an equals. | ||||
| * Please use Map.equals() | |||||
| * Please use Map.equals(). | |||||
| * | * | ||||
| * <p>Follows the equals contract of Java 2's Map.</p> | * <p>Follows the equals contract of Java 2's Map.</p> | ||||
| * | |||||
| * @param d1 the first directory. | |||||
| * @param d2 the second directory. | |||||
| * @return true if the directories are equal. | |||||
| * @since Ant 1.5 | * @since Ant 1.5 | ||||
| * @deprecated | * @deprecated | ||||
| */ | */ | ||||
| @@ -86,7 +90,8 @@ public class CollectionUtils { | |||||
| /** | /** | ||||
| * Dictionary does not know the putAll method. Please use Map.putAll(). | * Dictionary does not know the putAll method. Please use Map.putAll(). | ||||
| * | |||||
| * @param m1 the to directory. | |||||
| * @param m2 the from directory. | |||||
| * @since Ant 1.6 | * @since Ant 1.6 | ||||
| * @deprecated | * @deprecated | ||||
| */ | */ | ||||
| @@ -98,16 +103,25 @@ public class CollectionUtils { | |||||
| } | } | ||||
| /** | /** | ||||
| * An empty enumeration. | |||||
| * @since Ant 1.6 | * @since Ant 1.6 | ||||
| */ | */ | ||||
| public static final class EmptyEnumeration implements Enumeration { | public static final class EmptyEnumeration implements Enumeration { | ||||
| /** Constructor for the EmptyEnumeration */ | |||||
| public EmptyEnumeration() { | public EmptyEnumeration() { | ||||
| } | } | ||||
| /** | |||||
| * @return false always. | |||||
| */ | |||||
| public boolean hasMoreElements() { | public boolean hasMoreElements() { | ||||
| return false; | return false; | ||||
| } | } | ||||
| /** | |||||
| * @return nothing. | |||||
| * @throws NoSuchElementException always. | |||||
| */ | |||||
| public Object nextElement() throws NoSuchElementException { | public Object nextElement() throws NoSuchElementException { | ||||
| throw new NoSuchElementException(); | throw new NoSuchElementException(); | ||||
| } | } | ||||
| @@ -116,9 +130,9 @@ public class CollectionUtils { | |||||
| /** | /** | ||||
| * Append one enumeration to another. | * Append one enumeration to another. | ||||
| * Elements are evaluated lazily. | * Elements are evaluated lazily. | ||||
| * @param e1 the first enumeration | |||||
| * @param e2 the subsequent enumeration | |||||
| * @return an enumeration representing e1 followed by e2 | |||||
| * @param e1 the first enumeration. | |||||
| * @param e2 the subsequent enumeration. | |||||
| * @return an enumeration representing e1 followed by e2. | |||||
| * @since Ant 1.6.3 | * @since Ant 1.6.3 | ||||
| */ | */ | ||||
| public static Enumeration append(Enumeration e1, Enumeration e2) { | public static Enumeration append(Enumeration e1, Enumeration e2) { | ||||
| @@ -1,5 +1,5 @@ | |||||
| /* | /* | ||||
| * Copyright 2004 The Apache Software Foundation | |||||
| * Copyright 2004-2005 The Apache Software Foundation | |||||
| * | * | ||||
| * Licensed under the Apache License, Version 2.0 (the "License"); | * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| * you may not use this file except in compliance with the License. | * you may not use this file except in compliance with the License. | ||||
| @@ -112,13 +112,7 @@ public class ConcatFileInputStream extends InputStream { | |||||
| } | } | ||||
| private void closeCurrent() { | private void closeCurrent() { | ||||
| if (currentStream != null) { | |||||
| try { | |||||
| currentStream.close(); | |||||
| } catch (IOException eyeOhEx) { | |||||
| } | |||||
| currentStream = null; | |||||
| } | |||||
| FileUtils.close(currentStream); | |||||
| currentStream = null; | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,5 +1,5 @@ | |||||
| /* | /* | ||||
| * Copyright 2004 The Apache Software Foundation. | |||||
| * Copyright 2004-2005 The Apache Software Foundation. | |||||
| * | * | ||||
| * Licensed under the Apache License, Version 2.0 (the "License"); | * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| * you may not use this file except in compliance with the License. | * you may not use this file except in compliance with the License. | ||||
| @@ -86,12 +86,14 @@ public abstract class ContainerMapper implements FileNameMapper { | |||||
| /** | /** | ||||
| * Empty implementation. | * Empty implementation. | ||||
| * @param ignore ignored. | |||||
| */ | */ | ||||
| public void setFrom(String ignore) { | public void setFrom(String ignore) { | ||||
| } | } | ||||
| /** | /** | ||||
| * Empty implementation. | * Empty implementation. | ||||
| * @param ignore ignored. | |||||
| */ | */ | ||||
| public void setTo(String ignore) { | public void setTo(String ignore) { | ||||
| } | } | ||||
| @@ -1,5 +1,5 @@ | |||||
| /* | /* | ||||
| * Copyright 2000-2004 The Apache Software Foundation | |||||
| * Copyright 2000-2005 The Apache Software Foundation | |||||
| * | * | ||||
| * Licensed under the Apache License, Version 2.0 (the "License"); | * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| * you may not use this file except in compliance with the License. | * you may not use this file except in compliance with the License. | ||||
| @@ -145,6 +145,8 @@ public class DOMElementWriter { | |||||
| } | } | ||||
| out.write("?>"); | out.write("?>"); | ||||
| break; | break; | ||||
| default: | |||||
| // Do nothing | |||||
| } | } | ||||
| } | } | ||||
| @@ -168,6 +170,8 @@ public class DOMElementWriter { | |||||
| /** | /** | ||||
| * Escape <, > & ', " as their entities and | * Escape <, > & ', " as their entities and | ||||
| * drop characters that are illegal in XML documents. | * drop characters that are illegal in XML documents. | ||||
| * @param value the string to encode. | |||||
| * @return the encoded string. | |||||
| */ | */ | ||||
| public String encode(String value) { | public String encode(String value) { | ||||
| StringBuffer sb = new StringBuffer(); | StringBuffer sb = new StringBuffer(); | ||||
| @@ -217,6 +221,8 @@ public class DOMElementWriter { | |||||
| * href="http://www.w3.org/TR/1998/REC-xml-19980210#charsets">http://www.w3.org/TR/1998/REC-xml-19980210#charsets</a> and | * href="http://www.w3.org/TR/1998/REC-xml-19980210#charsets">http://www.w3.org/TR/1998/REC-xml-19980210#charsets</a> and | ||||
| * 2.7 <a | * 2.7 <a | ||||
| * href="http://www.w3.org/TR/1998/REC-xml-19980210#sec-cdata-sect">http://www.w3.org/TR/1998/REC-xml-19980210#sec-cdata-sect</a>.</p> | * href="http://www.w3.org/TR/1998/REC-xml-19980210#sec-cdata-sect">http://www.w3.org/TR/1998/REC-xml-19980210#sec-cdata-sect</a>.</p> | ||||
| * @param value the value to be encoded. | |||||
| * @return the encoded value. | |||||
| */ | */ | ||||
| public String encodedata(final String value) { | public String encodedata(final String value) { | ||||
| @@ -244,6 +250,8 @@ public class DOMElementWriter { | |||||
| /** | /** | ||||
| * Is the given argument a character or entity reference? | * Is the given argument a character or entity reference? | ||||
| * @param ent the value to be checked. | |||||
| * @return true if it is an entity. | |||||
| */ | */ | ||||
| public boolean isReference(String ent) { | public boolean isReference(String ent) { | ||||
| if (!(ent.charAt(0) == '&') || !ent.endsWith(";")) { | if (!(ent.charAt(0) == '&') || !ent.endsWith(";")) { | ||||
| @@ -283,7 +291,8 @@ public class DOMElementWriter { | |||||
| * <p>See XML 1.0 2.2 <a | * <p>See XML 1.0 2.2 <a | ||||
| * href="http://www.w3.org/TR/1998/REC-xml-19980210#charsets"> | * href="http://www.w3.org/TR/1998/REC-xml-19980210#charsets"> | ||||
| * http://www.w3.org/TR/1998/REC-xml-19980210#charsets</a>.</p> | * http://www.w3.org/TR/1998/REC-xml-19980210#charsets</a>.</p> | ||||
| * | |||||
| * @param c the character to test. | |||||
| * @return true if the character is allowed. | |||||
| * @since 1.10, Ant 1.5 | * @since 1.10, Ant 1.5 | ||||
| */ | */ | ||||
| public boolean isLegalCharacter(char c) { | public boolean isLegalCharacter(char c) { | ||||
| @@ -1,5 +1,5 @@ | |||||
| /* | /* | ||||
| * Copyright 2002-2004 The Apache Software Foundation | |||||
| * Copyright 2002-2005 The Apache Software Foundation | |||||
| * | * | ||||
| * Licensed under the Apache License, Version 2.0 (the "License"); | * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| * you may not use this file except in compliance with the License. | * you may not use this file except in compliance with the License. | ||||
| @@ -171,6 +171,8 @@ public final class DateUtils { | |||||
| * + 11/22 for rounding | * + 11/22 for rounding | ||||
| * </pre> | * </pre> | ||||
| * | * | ||||
| * @param cal the calander. | |||||
| * | |||||
| * @return The phase of the moon as a number between 0 and 7 with | * @return The phase of the moon as a number between 0 and 7 with | ||||
| * 0 meaning new moon and 4 meaning full moon. | * 0 meaning new moon and 4 meaning full moon. | ||||
| * | * | ||||
| @@ -189,7 +191,7 @@ public final class DateUtils { | |||||
| /** | /** | ||||
| * Returns the current Date in a format suitable for a SMTP date | * Returns the current Date in a format suitable for a SMTP date | ||||
| * header. | * header. | ||||
| * | |||||
| * @return the current date. | |||||
| * @since Ant 1.5.2 | * @since Ant 1.5.2 | ||||
| */ | */ | ||||
| public static String getDateForHeader() { | public static String getDateForHeader() { | ||||
| @@ -1,5 +1,5 @@ | |||||
| /* | /* | ||||
| * Copyright 2000,2004 The Apache Software Foundation | |||||
| * Copyright 2000,2004-2005 The Apache Software Foundation | |||||
| * | * | ||||
| * Licensed under the Apache License, Version 2.0 (the "License"); | * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| * you may not use this file except in compliance with the License. | * you may not use this file except in compliance with the License. | ||||
| @@ -32,11 +32,13 @@ public interface FileNameMapper { | |||||
| /** | /** | ||||
| * Sets the from part of the transformation rule. | * Sets the from part of the transformation rule. | ||||
| * @param from a string. | |||||
| */ | */ | ||||
| void setFrom(String from); | void setFrom(String from); | ||||
| /** | /** | ||||
| * Sets the to part of the transformation rule. | * Sets the to part of the transformation rule. | ||||
| * @param to a string. | |||||
| */ | */ | ||||
| void setTo(String to); | void setTo(String to); | ||||
| @@ -50,6 +52,8 @@ public interface FileNameMapper { | |||||
| * | * | ||||
| * @param sourceFileName the name of the source file relative to | * @param sourceFileName the name of the source file relative to | ||||
| * some given basedirectory. | * some given basedirectory. | ||||
| * @return an array of strings if the ruld applies to the source file, or | |||||
| * null if it does not. | |||||
| */ | */ | ||||
| String[] mapFileName(String sourceFileName); | String[] mapFileName(String sourceFileName); | ||||
| } | } | ||||
| @@ -1,5 +1,5 @@ | |||||
| /* | /* | ||||
| * Copyright 2000,2004 The Apache Software Foundation | |||||
| * Copyright 2000,2004-2005 The Apache Software Foundation | |||||
| * | * | ||||
| * Licensed under the Apache License, Version 2.0 (the "License"); | * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| * you may not use this file except in compliance with the License. | * you may not use this file except in compliance with the License. | ||||
| @@ -29,12 +29,14 @@ public class FlatFileNameMapper implements FileNameMapper { | |||||
| /** | /** | ||||
| * Ignored. | * Ignored. | ||||
| * @param from ignored. | |||||
| */ | */ | ||||
| public void setFrom(String from) { | public void setFrom(String from) { | ||||
| } | } | ||||
| /** | /** | ||||
| * Ignored. | * Ignored. | ||||
| * @param to ignored. | |||||
| */ | */ | ||||
| public void setTo(String to) { | public void setTo(String to) { | ||||
| } | } | ||||
| @@ -42,6 +44,8 @@ public class FlatFileNameMapper implements FileNameMapper { | |||||
| /** | /** | ||||
| * Returns an one-element array containing the source file name | * Returns an one-element array containing the source file name | ||||
| * without any leading directory information. | * without any leading directory information. | ||||
| * @param sourceFileName the name to map. | |||||
| * @return the file name in a one-element array. | |||||
| */ | */ | ||||
| public String[] mapFileName(String sourceFileName) { | public String[] mapFileName(String sourceFileName) { | ||||
| return new String[] {new java.io.File(sourceFileName).getName()}; | return new String[] {new java.io.File(sourceFileName).getName()}; | ||||
| @@ -1,5 +1,5 @@ | |||||
| /* | /* | ||||
| * Copyright 2000,2002,2004 The Apache Software Foundation | |||||
| * Copyright 2000,2002,2004-2005 The Apache Software Foundation | |||||
| * | * | ||||
| * Licensed under the Apache License, Version 2.0 (the "License"); | * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| * you may not use this file except in compliance with the License. | * you may not use this file except in compliance with the License. | ||||
| @@ -147,7 +147,6 @@ public class GlobPatternMapper implements FileNameMapper { | |||||
| name.length() - postfixLength); | name.length() - postfixLength); | ||||
| } | } | ||||
| /** | /** | ||||
| * modify string based on dir char mapping and case sensitivity | * modify string based on dir char mapping and case sensitivity | ||||
| * @param name the name to convert | * @param name the name to convert | ||||
| @@ -1,5 +1,5 @@ | |||||
| /* | /* | ||||
| * Copyright 2000,2004 The Apache Software Foundation | |||||
| * Copyright 2000,2004-2005 The Apache Software Foundation | |||||
| * | * | ||||
| * Licensed under the Apache License, Version 2.0 (the "License"); | * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| * you may not use this file except in compliance with the License. | * you may not use this file except in compliance with the License. | ||||
| @@ -28,18 +28,22 @@ public class IdentityMapper implements FileNameMapper { | |||||
| /** | /** | ||||
| * Ignored. | * Ignored. | ||||
| * @param from ignored. | |||||
| */ | */ | ||||
| public void setFrom(String from) { | public void setFrom(String from) { | ||||
| } | } | ||||
| /** | /** | ||||
| * Ignored. | * Ignored. | ||||
| * @param to ignored. | |||||
| */ | */ | ||||
| public void setTo(String to) { | public void setTo(String to) { | ||||
| } | } | ||||
| /** | /** | ||||
| * Returns an one-element array containing the source file name. | * Returns an one-element array containing the source file name. | ||||
| * @param sourceFileName the name to map. | |||||
| * @return the source filename in a one-element array. | |||||
| */ | */ | ||||
| public String[] mapFileName(String sourceFileName) { | public String[] mapFileName(String sourceFileName) { | ||||
| return new String[] {sourceFileName}; | return new String[] {sourceFileName}; | ||||
| @@ -71,7 +71,8 @@ public class JAXPUtils { | |||||
| * Returns the parser factory to use. Only one parser factory is | * Returns the parser factory to use. Only one parser factory is | ||||
| * ever created by this method and is then cached for future use. | * ever created by this method and is then cached for future use. | ||||
| * | * | ||||
| * @return a SAXParserFactory to use | |||||
| * @return a SAXParserFactory to use. | |||||
| * @throws BuildException on error. | |||||
| * | * | ||||
| * @since Ant 1.5 | * @since Ant 1.5 | ||||
| */ | */ | ||||
| @@ -88,7 +89,8 @@ public class JAXPUtils { | |||||
| * Returns the parser factory to use to create namespace aware parsers. | * Returns the parser factory to use to create namespace aware parsers. | ||||
| * | * | ||||
| * @return a SAXParserFactory to use which supports manufacture of | * @return a SAXParserFactory to use which supports manufacture of | ||||
| * namespace aware parsers | |||||
| * namespace aware parsers. | |||||
| * @throws BuildException on error. | |||||
| * | * | ||||
| * @since Ant 1.6 | * @since Ant 1.6 | ||||
| */ | */ | ||||
| @@ -105,6 +107,8 @@ public class JAXPUtils { | |||||
| /** | /** | ||||
| * Returns a new parser factory instance. | * Returns a new parser factory instance. | ||||
| * | * | ||||
| * @return the parser factory. | |||||
| * @throws BuildException on error. | |||||
| * @since Ant 1.5 | * @since Ant 1.5 | ||||
| */ | */ | ||||
| public static SAXParserFactory newParserFactory() throws BuildException { | public static SAXParserFactory newParserFactory() throws BuildException { | ||||
| @@ -123,6 +127,7 @@ public class JAXPUtils { | |||||
| * factory. | * factory. | ||||
| * | * | ||||
| * @return a SAX 1 Parser. | * @return a SAX 1 Parser. | ||||
| * @throws BuildException on error. | |||||
| * @see #getParserFactory | * @see #getParserFactory | ||||
| * @since Ant 1.5 | * @since Ant 1.5 | ||||
| */ | */ | ||||
| @@ -139,6 +144,7 @@ public class JAXPUtils { | |||||
| * factory. | * factory. | ||||
| * | * | ||||
| * @return a SAX 2 XMLReader. | * @return a SAX 2 XMLReader. | ||||
| * @throws BuildException on error. | |||||
| * @see #getParserFactory | * @see #getParserFactory | ||||
| * @since Ant 1.5 | * @since Ant 1.5 | ||||
| */ | */ | ||||
| @@ -154,6 +160,7 @@ public class JAXPUtils { | |||||
| * Returns a newly created SAX 2 XMLReader, which is namespace aware | * Returns a newly created SAX 2 XMLReader, which is namespace aware | ||||
| * | * | ||||
| * @return a SAX 2 XMLReader. | * @return a SAX 2 XMLReader. | ||||
| * @throws BuildException on error. | |||||
| * @see #getParserFactory | * @see #getParserFactory | ||||
| * @since Ant 1.6 | * @since Ant 1.6 | ||||
| */ | */ | ||||
| @@ -181,7 +188,8 @@ public class JAXPUtils { | |||||
| /** | /** | ||||
| * Returns a newly created DocumentBuilder. | * Returns a newly created DocumentBuilder. | ||||
| * | * | ||||
| * @return a DocumentBuilder | |||||
| * @return a DocumentBuilder. | |||||
| * @throws BuildException on error. | |||||
| * @since Ant 1.6 | * @since Ant 1.6 | ||||
| */ | */ | ||||
| public static DocumentBuilder getDocumentBuilder() throws BuildException { | public static DocumentBuilder getDocumentBuilder() throws BuildException { | ||||
| @@ -30,20 +30,20 @@ import org.apache.tools.ant.taskdefs.condition.Os; | |||||
| * | * | ||||
| * @since Ant 1.5 | * @since Ant 1.5 | ||||
| */ | */ | ||||
| public class JavaEnvUtils { | |||||
| public final class JavaEnvUtils { | |||||
| private JavaEnvUtils() { | private JavaEnvUtils() { | ||||
| } | } | ||||
| /** Are we on a DOS-based system */ | /** Are we on a DOS-based system */ | ||||
| private static final boolean isDos = Os.isFamily("dos"); | |||||
| private static final boolean IS_DOS = Os.isFamily("dos"); | |||||
| /** Are we on Novell NetWare */ | /** Are we on Novell NetWare */ | ||||
| private static final boolean isNetware = Os.isName("netware"); | |||||
| private static final boolean IS_NETWARE = Os.isName("netware"); | |||||
| /** Are we on AIX */ | /** Are we on AIX */ | ||||
| private static final boolean isAix = Os.isName("aix"); | |||||
| private static final boolean IS_AIX = Os.isName("aix"); | |||||
| /** shortcut for System.getProperty("java.home") */ | /** shortcut for System.getProperty("java.home") */ | ||||
| private static final String javaHome = System.getProperty("java.home"); | |||||
| private static final String JAVA_HOME = System.getProperty("java.home"); | |||||
| /** FileUtils instance for path normalization */ | /** FileUtils instance for path normalization */ | ||||
| private static final FileUtils FILE_UTILS = FileUtils.getFileUtils(); | private static final FileUtils FILE_UTILS = FileUtils.getFileUtils(); | ||||
| @@ -127,8 +127,8 @@ public class JavaEnvUtils { | |||||
| * Compares the current Java version to the passed in String - | * Compares the current Java version to the passed in String - | ||||
| * assumes the argument is one of the constants defined in this | * assumes the argument is one of the constants defined in this | ||||
| * class. | * class. | ||||
| * @return true if the version of Java is the same as the given | |||||
| * version. | |||||
| * @param version the version to check against the current version. | |||||
| * @return true if the version of Java is the same as the given version. | |||||
| * @since Ant 1.5 | * @since Ant 1.5 | ||||
| */ | */ | ||||
| public static boolean isJavaVersion(String version) { | public static boolean isJavaVersion(String version) { | ||||
| @@ -159,11 +159,12 @@ public class JavaEnvUtils { | |||||
| * <code>JAVA_HOME</code> points to your JDK installation. JDK | * <code>JAVA_HOME</code> points to your JDK installation. JDK | ||||
| * < 1.2 has them in the same directory as the JDK | * < 1.2 has them in the same directory as the JDK | ||||
| * executables.</p> | * executables.</p> | ||||
| * | |||||
| * @param command the java executable to find. | |||||
| * @return the path to the command. | |||||
| * @since Ant 1.5 | * @since Ant 1.5 | ||||
| */ | */ | ||||
| public static String getJreExecutable(String command) { | public static String getJreExecutable(String command) { | ||||
| if (isNetware) { | |||||
| if (IS_NETWARE) { | |||||
| // Extrapolating from: | // Extrapolating from: | ||||
| // "NetWare may have a "java" in that directory, but 99% of | // "NetWare may have a "java" in that directory, but 99% of | ||||
| // the time, you don't want to execute it" -- Jeff Tulley | // the time, you don't want to execute it" -- Jeff Tulley | ||||
| @@ -173,14 +174,14 @@ public class JavaEnvUtils { | |||||
| File jExecutable = null; | File jExecutable = null; | ||||
| if (isAix) { | |||||
| if (IS_AIX) { | |||||
| // On IBM's JDK 1.2 the directory layout is different, 1.3 follows | // On IBM's JDK 1.2 the directory layout is different, 1.3 follows | ||||
| // Sun's layout. | // Sun's layout. | ||||
| jExecutable = findInDir(javaHome + "/sh", command); | |||||
| jExecutable = findInDir(JAVA_HOME + "/sh", command); | |||||
| } | } | ||||
| if (jExecutable == null) { | if (jExecutable == null) { | ||||
| jExecutable = findInDir(javaHome + "/bin", command); | |||||
| jExecutable = findInDir(JAVA_HOME + "/bin", command); | |||||
| } | } | ||||
| if (jExecutable != null) { | if (jExecutable != null) { | ||||
| @@ -199,11 +200,12 @@ public class JavaEnvUtils { | |||||
| * | * | ||||
| * <p>You typically find them in <code>JAVA_HOME/bin</code> if | * <p>You typically find them in <code>JAVA_HOME/bin</code> if | ||||
| * <code>JAVA_HOME</code> points to your JDK installation.</p> | * <code>JAVA_HOME</code> points to your JDK installation.</p> | ||||
| * | |||||
| * @param command the java executable to find. | |||||
| * @return the path to the command. | |||||
| * @since Ant 1.5 | * @since Ant 1.5 | ||||
| */ | */ | ||||
| public static String getJdkExecutable(String command) { | public static String getJdkExecutable(String command) { | ||||
| if (isNetware) { | |||||
| if (IS_NETWARE) { | |||||
| // Extrapolating from: | // Extrapolating from: | ||||
| // "NetWare may have a "java" in that directory, but 99% of | // "NetWare may have a "java" in that directory, but 99% of | ||||
| // the time, you don't want to execute it" -- Jeff Tulley | // the time, you don't want to execute it" -- Jeff Tulley | ||||
| @@ -213,14 +215,14 @@ public class JavaEnvUtils { | |||||
| File jExecutable = null; | File jExecutable = null; | ||||
| if (isAix) { | |||||
| if (IS_AIX) { | |||||
| // On IBM's JDK 1.2 the directory layout is different, 1.3 follows | // On IBM's JDK 1.2 the directory layout is different, 1.3 follows | ||||
| // Sun's layout. | // Sun's layout. | ||||
| jExecutable = findInDir(javaHome + "/../sh", command); | |||||
| jExecutable = findInDir(JAVA_HOME + "/../sh", command); | |||||
| } | } | ||||
| if (jExecutable == null) { | if (jExecutable == null) { | ||||
| jExecutable = findInDir(javaHome + "/../bin", command); | |||||
| jExecutable = findInDir(JAVA_HOME + "/../bin", command); | |||||
| } | } | ||||
| if (jExecutable != null) { | if (jExecutable != null) { | ||||
| @@ -241,7 +243,7 @@ public class JavaEnvUtils { | |||||
| private static String addExtension(String command) { | private static String addExtension(String command) { | ||||
| // This is the most common extension case - exe for windows and OS/2, | // This is the most common extension case - exe for windows and OS/2, | ||||
| // nothing for *nix. | // nothing for *nix. | ||||
| return command + (isDos ? ".exe" : ""); | |||||
| return command + (IS_DOS ? ".exe" : ""); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -263,7 +265,7 @@ public class JavaEnvUtils { | |||||
| /** | /** | ||||
| * demand creation of the package list. | * demand creation of the package list. | ||||
| * When you add a new package, add a new test below | |||||
| * When you add a new package, add a new test below. | |||||
| */ | */ | ||||
| private static void buildJrePackages() { | private static void buildJrePackages() { | ||||
| @@ -307,6 +309,7 @@ public class JavaEnvUtils { | |||||
| /** | /** | ||||
| * Testing helper method; kept here for unification of changes. | * Testing helper method; kept here for unification of changes. | ||||
| * @return a list of test classes depending on the java version. | |||||
| */ | */ | ||||
| public static Vector getJrePackageTestCases() { | public static Vector getJrePackageTestCases() { | ||||
| Vector tests = new Vector(); | Vector tests = new Vector(); | ||||
| @@ -351,7 +354,7 @@ public class JavaEnvUtils { | |||||
| /** | /** | ||||
| * get a vector of strings of packages built into | * get a vector of strings of packages built into | ||||
| * that platforms runtime jar(s) | * that platforms runtime jar(s) | ||||
| * @return list of packages | |||||
| * @return list of packages. | |||||
| */ | */ | ||||
| public static Vector getJrePackages() { | public static Vector getJrePackages() { | ||||
| if (jrePackages == null) { | if (jrePackages == null) { | ||||
| @@ -365,9 +368,9 @@ public class JavaEnvUtils { | |||||
| * Writes the command into a temporary DCL script and returns the | * Writes the command into a temporary DCL script and returns the | ||||
| * corresponding File object. | * corresponding File object. | ||||
| * It is the job of the caller to delete the file on exit. | * It is the job of the caller to delete the file on exit. | ||||
| * @param cmd | |||||
| * @return | |||||
| * @throws IOException | |||||
| * @param cmd the command. | |||||
| * @return the file containing the command. | |||||
| * @throws IOException if there is an error writing to the file. | |||||
| */ | */ | ||||
| public static File createVmsJavaOptionFile(String[] cmd) | public static File createVmsJavaOptionFile(String[] cmd) | ||||
| throws IOException { | throws IOException { | ||||
| @@ -1,5 +1,5 @@ | |||||
| /* | /* | ||||
| * Copyright 2003-2004 The Apache Software Foundation | |||||
| * Copyright 2003-2005 The Apache Software Foundation | |||||
| * | * | ||||
| * Licensed under the Apache License, Version 2.0 (the "License"); | * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| * you may not use this file except in compliance with the License. | * you may not use this file except in compliance with the License. | ||||
| @@ -37,13 +37,20 @@ import java.io.InputStream; | |||||
| */ | */ | ||||
| public class KeepAliveInputStream extends FilterInputStream { | public class KeepAliveInputStream extends FilterInputStream { | ||||
| /** | |||||
| * Constructor of KeepAliveInputStream. | |||||
| * | |||||
| * @param in an InputStream value, it should be standard input. | |||||
| */ | |||||
| public KeepAliveInputStream(InputStream in) { | public KeepAliveInputStream(InputStream in) { | ||||
| super(in); | super(in); | ||||
| } | } | ||||
| /** this method does nothing */ | |||||
| /** | |||||
| * This method does nothing. | |||||
| * @throws IOException as we are overridding FilterInputStream. | |||||
| */ | |||||
| public void close() throws IOException { | public void close() throws IOException { | ||||
| // | |||||
| // do not close the stream | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,5 +1,5 @@ | |||||
| /* | /* | ||||
| * Copyright 2002,2004 The Apache Software Foundation | |||||
| * Copyright 2002,2004-2005 The Apache Software Foundation | |||||
| * | * | ||||
| * Licensed under the Apache License, Version 2.0 (the "License"); | * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| * you may not use this file except in compliance with the License. | * you may not use this file except in compliance with the License. | ||||
| @@ -36,13 +36,20 @@ import java.io.OutputStream; | |||||
| */ | */ | ||||
| public class KeepAliveOutputStream extends FilterOutputStream { | public class KeepAliveOutputStream extends FilterOutputStream { | ||||
| /** | |||||
| * Constructor of KeepAliveOutputStream. | |||||
| * | |||||
| * @param out an OutputStream value, it shoudl be standard output. | |||||
| */ | |||||
| public KeepAliveOutputStream(OutputStream out) { | public KeepAliveOutputStream(OutputStream out) { | ||||
| super(out); | super(out); | ||||
| } | } | ||||
| /** this method does nothing */ | |||||
| /** | |||||
| * This method does nothing. | |||||
| * @throws IOException as we are overridding FilterOutputStream. | |||||
| */ | |||||
| public void close() throws IOException { | public void close() throws IOException { | ||||
| // | |||||
| // do not close the stream | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,5 +1,5 @@ | |||||
| /* | /* | ||||
| * Copyright 2004 The Apache Software Foundation | |||||
| * Copyright 2004-2005 The Apache Software Foundation | |||||
| * | * | ||||
| * Licensed under the Apache License, Version 2.0 (the "License"); | * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| * you may not use this file except in compliance with the License. | * you may not use this file except in compliance with the License. | ||||
| @@ -42,6 +42,7 @@ public class LeadPipeInputStream extends PipedInputStream { | |||||
| * Construct a new <CODE>LeadPipeInputStream</CODE> to pull | * Construct a new <CODE>LeadPipeInputStream</CODE> to pull | ||||
| * from the specified <CODE>PipedOutputStream</CODE>. | * from the specified <CODE>PipedOutputStream</CODE>. | ||||
| * @param src the <CODE>PipedOutputStream</CODE> source. | * @param src the <CODE>PipedOutputStream</CODE> source. | ||||
| * @throws IOException if unable to construct the stream. | |||||
| */ | */ | ||||
| public LeadPipeInputStream(PipedOutputStream src) throws IOException { | public LeadPipeInputStream(PipedOutputStream src) throws IOException { | ||||
| super(src); | super(src); | ||||
| @@ -1,5 +1,5 @@ | |||||
| /* | /* | ||||
| * Copyright 2000,2004 The Apache Software Foundation | |||||
| * Copyright 2000,2004-2005 The Apache Software Foundation | |||||
| * | * | ||||
| * Licensed under the Apache License, Version 2.0 (the "License"); | * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| * you may not use this file except in compliance with the License. | * you may not use this file except in compliance with the License. | ||||
| @@ -30,12 +30,14 @@ public class MergingMapper implements FileNameMapper { | |||||
| /** | /** | ||||
| * Ignored. | * Ignored. | ||||
| * @param from ignored. | |||||
| */ | */ | ||||
| public void setFrom(String from) { | public void setFrom(String from) { | ||||
| } | } | ||||
| /** | /** | ||||
| * Sets the name of the merged file. | * Sets the name of the merged file. | ||||
| * @param to the name of the merged file. | |||||
| */ | */ | ||||
| public void setTo(String to) { | public void setTo(String to) { | ||||
| mergedFile = new String[] {to}; | mergedFile = new String[] {to}; | ||||
| @@ -43,6 +45,8 @@ public class MergingMapper implements FileNameMapper { | |||||
| /** | /** | ||||
| * Returns an one-element array containing the file name set via setTo. | * Returns an one-element array containing the file name set via setTo. | ||||
| * @param sourceFileName ignored. | |||||
| * @return a one-element array containing the merged filename. | |||||
| */ | */ | ||||
| public String[] mapFileName(String sourceFileName) { | public String[] mapFileName(String sourceFileName) { | ||||
| return mergedFile; | return mergedFile; | ||||