Browse Source

checkstyle

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@475987 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Reilly 18 years ago
parent
commit
b8244eaa8f
5 changed files with 102 additions and 9 deletions
  1. +1
    -1
      src/main/org/apache/tools/ant/filters/util/JavaClassHelper.java
  2. +27
    -0
      src/main/org/apache/tools/ant/taskdefs/Ant.java
  3. +27
    -5
      src/main/org/apache/tools/ant/taskdefs/CallTarget.java
  4. +44
    -3
      src/main/org/apache/tools/ant/taskdefs/FixCRLF.java
  5. +3
    -0
      src/main/org/apache/tools/ant/taskdefs/Zip.java

+ 1
- 1
src/main/org/apache/tools/ant/filters/util/JavaClassHelper.java View File

@@ -24,12 +24,12 @@ import org.apache.bcel.classfile.ConstantValue;
import org.apache.bcel.classfile.Field; import org.apache.bcel.classfile.Field;
import org.apache.bcel.classfile.JavaClass; import org.apache.bcel.classfile.JavaClass;


// CheckStyle:HideUtilityClassConstructorCheck OFF - bc
/** /**
* Helper class that filters constants from a Java Class * Helper class that filters constants from a Java Class
* *
*/ */
public final class JavaClassHelper { public final class JavaClassHelper {

/** System specific line separator. */ /** System specific line separator. */
private static final String LS = System.getProperty("line.separator"); private static final String LS = System.getProperty("line.separator");




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

@@ -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) * @see Task#handleOutput(String)
* @since Ant 1.5 * @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) * @see Task#handleInput(byte[], int, int)
* @since Ant 1.6 * @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) * @see Task#handleFlush(String)
* @since Ant 1.5.2 * @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) * @see Task#handleErrorOutput(String)
* @since Ant 1.5 * @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) * @see Task#handleErrorFlush(String)
* @since Ant 1.5.2 * @since Ant 1.5.2
*/ */


+ 27
- 5
src/main/org/apache/tools/ant/taskdefs/CallTarget.java View File

@@ -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) * @see Task#handleOutput(String)
*
* @since Ant 1.5 * @since Ant 1.5
*/ */
public void handleOutput(String output) { 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 * @since Ant 1.6
*/ */
public int handleInput(byte[] buffer, int offset, int length) 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) * @see Task#handleFlush(String)
*
* @since Ant 1.5.2 * @since Ant 1.5.2
*/ */
public void handleFlush(String output) { 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 * @since Ant 1.5
*/ */
public void handleErrorOutput(String output) { 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) * @see Task#handleErrorFlush(String)
*
* @since Ant 1.5.2 * @since Ant 1.5.2
*/ */
public void handleErrorFlush(String output) { public void handleErrorFlush(String output) {


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

@@ -83,6 +83,7 @@ import org.apache.tools.ant.util.FileUtils;


public class FixCRLF extends MatchingTask implements ChainableReader { public class FixCRLF extends MatchingTask implements ChainableReader {


/** error string for using srcdir and file */
public static final String ERROR_FILE_AND_SRCDIR public static final String ERROR_FILE_AND_SRCDIR
= "srcdir and file are mutually exclusive"; = "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 { protected class OneLiner implements Enumeration {
private static final int UNDEF = -1; private static final int UNDEF = -1;
private static final int NOTJAVA = 0; private static final int NOTJAVA = 0;
@@ -389,6 +394,11 @@ public class FixCRLF extends MatchingTask implements ChainableReader {
private boolean reachedEof = false; private boolean reachedEof = false;
private File srcFile; private File srcFile;


/**
* Constructor.
* @param srcFile the file to read.
* @throws BuildException if there is an error.
*/
public OneLiner(File srcFile) public OneLiner(File srcFile)
throws BuildException { throws BuildException {
this.srcFile = srcFile; 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() protected void nextLine()
throws BuildException { throws BuildException {
int ch = -1; int ch = -1;
@@ -433,9 +447,11 @@ public class FixCRLF extends MatchingTask implements ChainableReader {
++eolcount; ++eolcount;
eolStr.append('\r'); eolStr.append('\r');
reader.mark(2); reader.mark(2);
switch ((ch = reader.read())) {
ch = reader.read();
switch (ch) {
case '\r': case '\r':
if ((char) (ch = reader.read()) == '\n') {
ch = reader.read();
if ((char) (ch) == '\n') {
eolcount += 2; eolcount += 2;
eolStr.append("\r\n"); eolStr.append("\r\n");
} else { } else {
@@ -460,7 +476,8 @@ public class FixCRLF extends MatchingTask implements ChainableReader {
++eolcount; ++eolcount;
eolStr.append('\n'); eolStr.append('\n');
break; break;

default:
// Fall tru
} // end of switch ((char) ch) } // end of switch ((char) ch)


// if at eolcount == 0 and trailing characters of string // 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() { public String getEofStr() {
return eofStr.substring(0); return eofStr.substring(0);
} }


/**
* get the state.
* @return the state.
*/
public int getState() { public int getState() {
return state; return state;
} }


/**
* Set the state.
* @param state the value to use.
*/
public void setState(int state) { public void setState(int state) {
this.state = state; this.state = state;
} }


/**
* @return true if there is more elements.
*/
public boolean hasMoreElements() { public boolean hasMoreElements() {
return !reachedEof; return !reachedEof;
} }


/**
* get the next element.
* @return the next element.
* @throws NoSuchElementException if there is no more.
*/
public Object nextElement() public Object nextElement()
throws NoSuchElementException { throws NoSuchElementException {
if (!hasMoreElements()) { if (!hasMoreElements()) {
@@ -517,6 +554,10 @@ public class FixCRLF extends MatchingTask implements ChainableReader {
return tmpLine; return tmpLine;
} }


/**
* Close the reader.
* @throws IOException if there is an error.
*/
public void close() throws IOException { public void close() throws IOException {
if (reader != null) { if (reader != null) {
reader.close(); reader.close();


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

@@ -66,6 +66,7 @@ import org.apache.tools.zip.ZipOutputStream;
* @ant.task category="packaging" * @ant.task category="packaging"
*/ */
public class Zip extends MatchingTask { public class Zip extends MatchingTask {
// CheckStyle:VisibilityModifier OFF - bc


protected File zipFile; protected File zipFile;
// use to scan own archive // use to scan own archive
@@ -94,6 +95,8 @@ public class Zip extends MatchingTask {


private static final FileUtils FILE_UTILS = FileUtils.getFileUtils(); private static final FileUtils FILE_UTILS = FileUtils.getFileUtils();


// CheckStyle:VisibilityModifier ON

/** /**
* true when we are adding new files into the Zip file, as opposed * true when we are adding new files into the Zip file, as opposed
* to adding back the unchanged files * to adding back the unchanged files


Loading…
Cancel
Save