git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@475987 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -24,12 +24,12 @@ import org.apache.bcel.classfile.ConstantValue; | |||
| import org.apache.bcel.classfile.Field; | |||
| import org.apache.bcel.classfile.JavaClass; | |||
| // CheckStyle:HideUtilityClassConstructorCheck OFF - bc | |||
| /** | |||
| * Helper class that filters constants from a Java Class | |||
| * | |||
| */ | |||
| public final class JavaClassHelper { | |||
| /** System specific line separator. */ | |||
| private static final String LS = System.getProperty("line.separator"); | |||
| @@ -215,6 +215,10 @@ public class Ant extends Task { | |||
| } | |||
| /** | |||
| * Handles output. | |||
| * Send it the the new project if is present, otherwise | |||
| * call the super class. | |||
| * @param outputToHandle The string output to output. | |||
| * @see Task#handleOutput(String) | |||
| * @since Ant 1.5 | |||
| */ | |||
| @@ -227,6 +231,16 @@ public class Ant extends Task { | |||
| } | |||
| /** | |||
| * Handles input. | |||
| * Deleate to the created project, if present, otherwise | |||
| * call the super class. | |||
| * @param buffer the buffer into which data is to be read. | |||
| * @param offset the offset into the buffer at which data is stored. | |||
| * @param length the amount of data to read. | |||
| * | |||
| * @return the number of bytes read. | |||
| * | |||
| * @exception IOException if the data cannot be read. | |||
| * @see Task#handleInput(byte[], int, int) | |||
| * @since Ant 1.6 | |||
| */ | |||
| @@ -239,6 +253,10 @@ public class Ant extends Task { | |||
| } | |||
| /** | |||
| * Handles output. | |||
| * Send it the the new project if is present, otherwise | |||
| * call the super class. | |||
| * @param toFlush The string to output. | |||
| * @see Task#handleFlush(String) | |||
| * @since Ant 1.5.2 | |||
| */ | |||
| @@ -251,6 +269,11 @@ public class Ant extends Task { | |||
| } | |||
| /** | |||
| * Handle error output. | |||
| * Send it the the new project if is present, otherwise | |||
| * call the super class. | |||
| * @param errorOutputToHandle The string to output. | |||
| * | |||
| * @see Task#handleErrorOutput(String) | |||
| * @since Ant 1.5 | |||
| */ | |||
| @@ -263,6 +286,10 @@ public class Ant extends Task { | |||
| } | |||
| /** | |||
| * Handle error output. | |||
| * Send it the the new project if is present, otherwise | |||
| * call the super class. | |||
| * @param errorOutputToFlush The string to output. | |||
| * @see Task#handleErrorFlush(String) | |||
| * @since Ant 1.5.2 | |||
| */ | |||
| @@ -167,8 +167,11 @@ public class CallTarget extends Task { | |||
| } | |||
| /** | |||
| * Handles output. | |||
| * Send it the the new project if is present, otherwise | |||
| * call the super class. | |||
| * @param output The string output to output. | |||
| * @see Task#handleOutput(String) | |||
| * | |||
| * @since Ant 1.5 | |||
| */ | |||
| public void handleOutput(String output) { | |||
| @@ -180,8 +183,17 @@ public class CallTarget extends Task { | |||
| } | |||
| /** | |||
| * @see Task#handleInput(byte[], int, int) | |||
| * Handles input. | |||
| * Deleate to the created project, if present, otherwise | |||
| * call the super class. | |||
| * @param buffer the buffer into which data is to be read. | |||
| * @param offset the offset into the buffer at which data is stored. | |||
| * @param length the amount of data to read. | |||
| * | |||
| * @return the number of bytes read. | |||
| * | |||
| * @exception IOException if the data cannot be read. | |||
| * @see Task#handleInput(byte[], int, int) | |||
| * @since Ant 1.6 | |||
| */ | |||
| public int handleInput(byte[] buffer, int offset, int length) | |||
| @@ -193,8 +205,11 @@ public class CallTarget extends Task { | |||
| } | |||
| /** | |||
| * Handles output. | |||
| * Send it the the new project if is present, otherwise | |||
| * call the super class. | |||
| * @param output The string to output. | |||
| * @see Task#handleFlush(String) | |||
| * | |||
| * @since Ant 1.5.2 | |||
| */ | |||
| public void handleFlush(String output) { | |||
| @@ -206,8 +221,12 @@ public class CallTarget extends Task { | |||
| } | |||
| /** | |||
| * @see Task#handleErrorOutput(String) | |||
| * Handle error output. | |||
| * Send it the the new project if is present, otherwise | |||
| * call the super class. | |||
| * @param output The string to output. | |||
| * | |||
| * @see Task#handleErrorOutput(String) | |||
| * @since Ant 1.5 | |||
| */ | |||
| public void handleErrorOutput(String output) { | |||
| @@ -219,8 +238,11 @@ public class CallTarget extends Task { | |||
| } | |||
| /** | |||
| * Handle error output. | |||
| * Send it the the new project if is present, otherwise | |||
| * call the super class. | |||
| * @param output The string to output. | |||
| * @see Task#handleErrorFlush(String) | |||
| * | |||
| * @since Ant 1.5.2 | |||
| */ | |||
| public void handleErrorFlush(String output) { | |||
| @@ -83,6 +83,7 @@ import org.apache.tools.ant.util.FileUtils; | |||
| public class FixCRLF extends MatchingTask implements ChainableReader { | |||
| /** error string for using srcdir and file */ | |||
| public static final String ERROR_FILE_AND_SRCDIR | |||
| = "srcdir and file are mutually exclusive"; | |||
| @@ -371,6 +372,10 @@ public class FixCRLF extends MatchingTask implements ChainableReader { | |||
| } | |||
| } | |||
| /** | |||
| * Deprecated, the functionality has been moved to filters.FixCrLfFilter. | |||
| * @deprecated since 1.7.0. | |||
| */ | |||
| protected class OneLiner implements Enumeration { | |||
| private static final int UNDEF = -1; | |||
| private static final int NOTJAVA = 0; | |||
| @@ -389,6 +394,11 @@ public class FixCRLF extends MatchingTask implements ChainableReader { | |||
| private boolean reachedEof = false; | |||
| private File srcFile; | |||
| /** | |||
| * Constructor. | |||
| * @param srcFile the file to read. | |||
| * @throws BuildException if there is an error. | |||
| */ | |||
| public OneLiner(File srcFile) | |||
| throws BuildException { | |||
| this.srcFile = srcFile; | |||
| @@ -405,6 +415,10 @@ public class FixCRLF extends MatchingTask implements ChainableReader { | |||
| } | |||
| } | |||
| /** | |||
| * Move to the next line. | |||
| * @throws BuildException if there is an error. | |||
| */ | |||
| protected void nextLine() | |||
| throws BuildException { | |||
| int ch = -1; | |||
| @@ -433,9 +447,11 @@ public class FixCRLF extends MatchingTask implements ChainableReader { | |||
| ++eolcount; | |||
| eolStr.append('\r'); | |||
| reader.mark(2); | |||
| switch ((ch = reader.read())) { | |||
| ch = reader.read(); | |||
| switch (ch) { | |||
| case '\r': | |||
| if ((char) (ch = reader.read()) == '\n') { | |||
| ch = reader.read(); | |||
| if ((char) (ch) == '\n') { | |||
| eolcount += 2; | |||
| eolStr.append("\r\n"); | |||
| } else { | |||
| @@ -460,7 +476,8 @@ public class FixCRLF extends MatchingTask implements ChainableReader { | |||
| ++eolcount; | |||
| eolStr.append('\n'); | |||
| break; | |||
| default: | |||
| // Fall tru | |||
| } // end of switch ((char) ch) | |||
| // if at eolcount == 0 and trailing characters of string | |||
| @@ -490,22 +507,42 @@ public class FixCRLF extends MatchingTask implements ChainableReader { | |||
| } | |||
| } | |||
| /** | |||
| * get the eof string. | |||
| * @return the eof string. | |||
| */ | |||
| public String getEofStr() { | |||
| return eofStr.substring(0); | |||
| } | |||
| /** | |||
| * get the state. | |||
| * @return the state. | |||
| */ | |||
| public int getState() { | |||
| return state; | |||
| } | |||
| /** | |||
| * Set the state. | |||
| * @param state the value to use. | |||
| */ | |||
| public void setState(int state) { | |||
| this.state = state; | |||
| } | |||
| /** | |||
| * @return true if there is more elements. | |||
| */ | |||
| public boolean hasMoreElements() { | |||
| return !reachedEof; | |||
| } | |||
| /** | |||
| * get the next element. | |||
| * @return the next element. | |||
| * @throws NoSuchElementException if there is no more. | |||
| */ | |||
| public Object nextElement() | |||
| throws NoSuchElementException { | |||
| if (!hasMoreElements()) { | |||
| @@ -517,6 +554,10 @@ public class FixCRLF extends MatchingTask implements ChainableReader { | |||
| return tmpLine; | |||
| } | |||
| /** | |||
| * Close the reader. | |||
| * @throws IOException if there is an error. | |||
| */ | |||
| public void close() throws IOException { | |||
| if (reader != null) { | |||
| reader.close(); | |||
| @@ -66,6 +66,7 @@ import org.apache.tools.zip.ZipOutputStream; | |||
| * @ant.task category="packaging" | |||
| */ | |||
| public class Zip extends MatchingTask { | |||
| // CheckStyle:VisibilityModifier OFF - bc | |||
| protected File zipFile; | |||
| // use to scan own archive | |||
| @@ -94,6 +95,8 @@ public class Zip extends MatchingTask { | |||
| private static final FileUtils FILE_UTILS = FileUtils.getFileUtils(); | |||
| // CheckStyle:VisibilityModifier ON | |||
| /** | |||
| * true when we are adding new files into the Zip file, as opposed | |||
| * to adding back the unchanged files | |||