peterreilly 2003/07/25 01:28:22 Modified: src/main/org/apache/tools/ant/taskdefs/condition And.java Condition.java ConditionBase.java Contains.java Equals.java Http.java IsFalse.java IsReference.java IsSet.java IsTrue.java Or.java Os.java Socket.java Log: checkstyle Revision Changes Path 1.8 +6 -2 ant/src/main/org/apache/tools/ant/taskdefs/condition/And.java Index: And.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/condition/And.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- And.java 19 Jul 2003 08:11:02 -0000 1.7 +++ And.java 25 Jul 2003 08:28:21 -0000 1.8 @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2001-2002 The Apache Software Foundation. All rights + * Copyright (c) 2001-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -69,6 +69,10 @@ */ public class And extends ConditionBase implements Condition { + /** + * @return true if all the contained conditions evaluates to true + * @exception BuildException if an error occurs + */ public boolean eval() throws BuildException { Enumeration enum = getConditions(); while (enum.hasMoreElements()) { 1.6 +4 -2 ant/src/main/org/apache/tools/ant/taskdefs/condition/Condition.java Index: Condition.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/condition/Condition.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- Condition.java 7 Mar 2003 11:23:05 -0000 1.5 +++ Condition.java 25 Jul 2003 08:28:21 -0000 1.6 @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2001 The Apache Software Foundation. All rights + * Copyright (c) 2001,2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -65,6 +65,8 @@ public interface Condition { /** * Is this condition true? + * @return true if the condition is true + * @exception BuildException if an error occurs */ boolean eval() throws BuildException; } 1.21 +20 -2 ant/src/main/org/apache/tools/ant/taskdefs/condition/ConditionBase.java Index: ConditionBase.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/condition/ConditionBase.java,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- ConditionBase.java 17 Jul 2003 14:17:00 -0000 1.20 +++ ConditionBase.java 25 Jul 2003 08:28:21 -0000 1.21 @@ -76,6 +76,7 @@ /** * Count the conditions. * + * @return the number of conditions in the container * @since 1.1 */ protected int countConditions() { @@ -85,6 +86,7 @@ /** * Iterate through all conditions. * + * @return an enumeration to use for iteration * @since 1.1 */ protected final Enumeration getConditions() { @@ -93,7 +95,7 @@ /** * Add an <available> condition. - * + * @param a an available condition * @since 1.1 */ public void addAvailable(Available a) { @@ -103,6 +105,7 @@ /** * Add an <checksum> condition. * + * @param c a Checksum condition * @since 1.4, Ant 1.5 */ public void addChecksum(Checksum c) { @@ -112,6 +115,7 @@ /** * Add an <uptodate> condition. * + * @param u an UpToDate condition * @since 1.1 */ public void addUptodate(UpToDate u) { @@ -121,6 +125,7 @@ /** * Add an <not> condition "container". * + * @param n a Not condition * @since 1.1 */ public void addNot(Not n) { @@ -130,6 +135,7 @@ /** * Add an <and> condition "container". * + * @param a an And condition * @since 1.1 */ public void addAnd(And a) { @@ -139,6 +145,7 @@ /** * Add an <or> condition "container". * + * @param o an Or condition * @since 1.1 */ public void addOr(Or o) { @@ -148,6 +155,7 @@ /** * Add an <equals> condition. * + * @param e an Equals condition * @since 1.1 */ public void addEquals(Equals e) { @@ -157,6 +165,7 @@ /** * Add an <os> condition. * + * @param o an Os condition * @since 1.1 */ public void addOs(Os o) { @@ -166,6 +175,7 @@ /** * Add an <isset> condition. * + * @param i an IsSet condition * @since Ant 1.5 */ public void addIsSet(IsSet i) { @@ -175,6 +185,7 @@ /** * Add an <http> condition. * + * @param h an Http condition * @since Ant 1.5 */ public void addHttp(Http h) { @@ -184,6 +195,7 @@ /** * Add a <socket> condition. * + * @param s a Socket condition * @since Ant 1.5 */ public void addSocket(Socket s) { @@ -193,6 +205,7 @@ /** * Add a <filesmatch> condition. * + * @param test a FilesMatch condition * @since Ant 1.5 */ public void addFilesMatch(FilesMatch test) { @@ -202,6 +215,7 @@ /** * Add a <contains> condition. * + * @param test a Contains condition * @since Ant 1.5 */ public void addContains(Contains test) { @@ -211,6 +225,7 @@ /** * Add a <istrue> condition. * + * @param test an IsTrue condition * @since Ant 1.5 */ public void addIsTrue(IsTrue test) { @@ -220,6 +235,7 @@ /** * Add a <isfalse> condition. * + * @param test an IsFalse condition * @since Ant 1.5 */ public void addIsFalse(IsFalse test) { @@ -229,6 +245,7 @@ /** * Add an <isreference> condition. * + * @param i an IsReference condition * @since Ant 1.6 */ public void addIsReference(IsReference i) { @@ -237,6 +254,7 @@ /** * Add an arbitary condition + * @param c a condition * @since Ant 1.6 */ public void add(Condition c) { 1.6 +15 -13 ant/src/main/org/apache/tools/ant/taskdefs/condition/Contains.java Index: Contains.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/condition/Contains.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- Contains.java 19 Jul 2003 08:11:02 -0000 1.5 +++ Contains.java 25 Jul 2003 08:28:21 -0000 1.6 @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2002 The Apache Software Foundation. All rights + * Copyright (c) 2002-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -71,33 +71,35 @@ /** * The string to search in. - * - * @since 1.1, Ant 1.5 + * @param string the string to search in + * @since Ant 1.5 */ - public void setString(String a1) { - string = a1; + public void setString(String string) { + this.string = string; } /** * The string to search for. - * - * @since 1.1, Ant 1.5 + * @param subString the string to search for + * @since Ant 1.5 */ - public void setSubstring(String a2) { - subString = a2; + public void setSubstring(String subString) { + this.subString = subString; } /** * Whether to search ignoring case or not. - * - * @since 1.1, Ant 1.5 + * @param b if true, ignore case + * @since Ant 1.5 */ public void setCasesensitive(boolean b) { caseSensitive = b; } /** - * @since 1.1, Ant 1.5 + * @since Ant 1.5 + * @return true if the substring is within the string + * @exception BuildException if the attributes are not set correctly */ public boolean eval() throws BuildException { if (string == null || subString == null) { 1.9 +21 -6 ant/src/main/org/apache/tools/ant/taskdefs/condition/Equals.java Index: Equals.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/condition/Equals.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- Equals.java 19 Jul 2003 08:11:02 -0000 1.8 +++ Equals.java 25 Jul 2003 08:28:21 -0000 1.9 @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2001-2002 The Apache Software Foundation. All rights + * Copyright (c) 2001-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -69,18 +69,28 @@ private boolean trim = false; private boolean caseSensitive = true; + /** + * Set the first string + * + * @param a1 the first string + */ public void setArg1(String a1) { arg1 = a1; } + /** + * Set the second string + * + * @param a2 the second string + */ public void setArg2(String a2) { arg2 = a2; } /** * Should we want to trim the arguments before comparing them? - * - * @since Revision: 1.3, Ant 1.5 + * @param b if true trim the arguments + * @since Ant 1.5 */ public void setTrim(boolean b) { trim = b; @@ -88,13 +98,18 @@ /** * Should the comparison be case sensitive? - * - * @since Revision: 1.3, Ant 1.5 + * @param b if true use a case sensitive comparision (this is the + * default) + * @since Ant 1.5 */ public void setCasesensitive(boolean b) { caseSensitive = b; } + /** + * @return true if the two strings are equal + * @exception BuildException if the attributes are not set correctly + */ public boolean eval() throws BuildException { if (arg1 == null || arg2 == null) { throw new BuildException("both arg1 and arg2 are required in " 1.9 +16 -1 ant/src/main/org/apache/tools/ant/taskdefs/condition/Http.java Index: Http.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/condition/Http.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- Http.java 19 Jul 2003 08:11:02 -0000 1.8 +++ Http.java 25 Jul 2003 08:28:21 -0000 1.9 @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2001-2002 The Apache Software Foundation. All rights + * Copyright (c) 2001-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -72,16 +72,31 @@ public class Http extends ProjectComponent implements Condition { private String spec = null; + /** + * Set the url attribute + * + * @param url the url of the request + */ public void setUrl(String url) { spec = url; } private int errorsBeginAt = 400; + /** + * Set the errorsBeginAt attribute + * + * @param errorsBeginAt number at which errors begin at, default is + * 400 + */ public void setErrorsBeginAt(int errorsBeginAt) { this.errorsBeginAt = errorsBeginAt; } + /** + * @return true if the HTTP request succeeds + * @exception BuildException if an error occurs + */ public boolean eval() throws BuildException { if (spec == null) { throw new BuildException("No url specified in http condition"); 1.5 +4 -3 ant/src/main/org/apache/tools/ant/taskdefs/condition/IsFalse.java Index: IsFalse.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/condition/IsFalse.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- IsFalse.java 19 Jul 2003 08:11:02 -0000 1.4 +++ IsFalse.java 25 Jul 2003 08:28:21 -0000 1.5 @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2002 The Apache Software Foundation. All rights + * Copyright (c) 2002-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -71,13 +71,14 @@ /** * set the value to be tested; let ant eval it to true/false + * @param value the value to test */ public void setValue(boolean value) { - this.value = new Boolean(value); + this.value = value ? Boolean.TRUE : Boolean.FALSE; } /** - * return the inverted value; + * @return the inverted value; * @throws BuildException if someone forgot to spec a value */ public boolean eval() throws BuildException { 1.5 +17 -2 ant/src/main/org/apache/tools/ant/taskdefs/condition/IsReference.java Index: IsReference.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/condition/IsReference.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- IsReference.java 19 Jul 2003 08:11:02 -0000 1.4 +++ IsReference.java 25 Jul 2003 08:28:21 -0000 1.5 @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2002 The Apache Software Foundation. All rights + * Copyright (c) 2002-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -71,14 +71,29 @@ private Reference ref; private String type; + /** + * Set the refid attribute. + * + * @param r a Reference value + */ public void setRefid(Reference r) { ref = r; } + /** + * Set the type attribute. This is optional attribute. + * + * @param type an ant component type name + */ public void setType(String type) { this.type = type; } + /** + * @return true if the reference exists and if type is set, if + * the reference is the same type + * @exception BuildException if an error occurs + */ public boolean eval() throws BuildException { if (ref == null) { throw new BuildException("No reference specified for isreference " 1.7 +11 -2 ant/src/main/org/apache/tools/ant/taskdefs/condition/IsSet.java Index: IsSet.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/condition/IsSet.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- IsSet.java 19 Jul 2003 08:11:02 -0000 1.6 +++ IsSet.java 25 Jul 2003 08:28:21 -0000 1.7 @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2001-2002 The Apache Software Foundation. All rights + * Copyright (c) 2001-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -67,10 +67,19 @@ public class IsSet extends ProjectComponent implements Condition { private String property; + /** + * Set the property attribute + * + * @param p the property name + */ public void setProperty(String p) { property = p; } + /** + * @return true if the property exists + * @exception BuildException if the property attribute is not set + */ public boolean eval() throws BuildException { if (property == null) { throw new BuildException("No property specified for isset " 1.5 +4 -3 ant/src/main/org/apache/tools/ant/taskdefs/condition/IsTrue.java Index: IsTrue.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/condition/IsTrue.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- IsTrue.java 19 Jul 2003 08:11:02 -0000 1.4 +++ IsTrue.java 25 Jul 2003 08:28:21 -0000 1.5 @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2002 The Apache Software Foundation. All rights + * Copyright (c) 2002-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -71,13 +71,14 @@ /** * set the value to be tested; let ant eval it to true/false + * @param value the value to test */ public void setValue(boolean value) { - this.value = new Boolean(value); + this.value = value ? Boolean.TRUE : Boolean.FALSE; } /** - * return the value; + * @return the value * @throws BuildException if someone forgot to spec a value */ public boolean eval() throws BuildException { 1.8 +6 -2 ant/src/main/org/apache/tools/ant/taskdefs/condition/Or.java Index: Or.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/condition/Or.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- Or.java 19 Jul 2003 08:11:02 -0000 1.7 +++ Or.java 25 Jul 2003 08:28:21 -0000 1.8 @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2001-2002 The Apache Software Foundation. All rights + * Copyright (c) 2001-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -69,6 +69,10 @@ */ public class Or extends ConditionBase implements Condition { + /** + * @return true if any of the contained conditions evaluate to true + * @exception BuildException if an error occurs + */ public boolean eval() throws BuildException { Enumeration enum = getConditions(); while (enum.hasMoreElements()) { 1.30 +43 -26 ant/src/main/org/apache/tools/ant/taskdefs/condition/Os.java Index: Os.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/condition/Os.java,v retrieving revision 1.29 retrieving revision 1.30 diff -u -r1.29 -r1.30 --- Os.java 21 Jul 2003 09:13:37 -0000 1.29 +++ Os.java 25 Jul 2003 08:28:21 -0000 1.30 @@ -66,22 +66,32 @@ * @version $Revision$ */ public class Os implements Condition { - private static final String osName = + private static final String OS_NAME = System.getProperty("os.name").toLowerCase(Locale.US); - private static final String osArch = + private static final String OS_ARCH = System.getProperty("os.arch").toLowerCase(Locale.US); - private static final String osVersion = + private static final String OS_VERSION = System.getProperty("os.version").toLowerCase(Locale.US); - private static final String pathSep = System.getProperty("path.separator"); + private static final String PATH_SEP = + System.getProperty("path.separator"); private String family; private String name; private String version; private String arch; + /** + * Default constructor + * + */ public Os() { } + /** + * Constructor that sets the family attribute + * + * @param family a String value + */ public Os(String family) { setFamily(family); } @@ -147,7 +157,8 @@ /** * Determines if the OS on which Ant is executing matches the * given OS family. - * + * @param family the family to check for + * @return true if the OS matches * @since 1.5 */ public static boolean isFamily(String family) { @@ -158,6 +169,8 @@ * Determines if the OS on which Ant is executing matches the * given OS name. * + * @param name the OS name to check for + * @return true if the OS matches * @since 1.7 */ public static boolean isName(String name) { @@ -168,6 +181,8 @@ * Determines if the OS on which Ant is executing matches the * given OS architecture. * + * @param arch the OS architecture to check for + * @return true if the OS matches * @since 1.7 */ public static boolean isArch(String arch) { @@ -178,6 +193,8 @@ * Determines if the OS on which Ant is executing matches the * given OS version. * + * @param version the OS version to check for + * @return true if the OS matches * @since 1.7 */ public static boolean isVersion(String version) { @@ -192,7 +209,7 @@ * @param name The OS name * @param arch The OS architecture * @param version The OS version - * + * @return true if the OS matches * @since 1.7 */ public static boolean isOs(String family, String name, String arch, @@ -209,34 +226,34 @@ if (family != null) { if (family.equals("windows")) { - isFamily = osName.indexOf("windows") > -1; + isFamily = OS_NAME.indexOf("windows") > -1; } else if (family.equals("os/2")) { - isFamily = osName.indexOf("os/2") > -1; + isFamily = OS_NAME.indexOf("os/2") > -1; } else if (family.equals("netware")) { - isFamily = osName.indexOf("netware") > -1; + isFamily = OS_NAME.indexOf("netware") > -1; } else if (family.equals("dos")) { - isFamily = pathSep.equals(";") && !isFamily("netware"); + isFamily = PATH_SEP.equals(";") && !isFamily("netware"); } else if (family.equals("mac")) { - isFamily = osName.indexOf("mac") > -1; + isFamily = OS_NAME.indexOf("mac") > -1; } else if (family.equals("tandem")) { - isFamily = osName.indexOf("nonstop_kernel") > -1; + isFamily = OS_NAME.indexOf("nonstop_kernel") > -1; } else if (family.equals("unix")) { - isFamily = pathSep.equals(":") + isFamily = PATH_SEP.equals(":") && !isFamily("openvms") - && (!isFamily("mac") || osName.endsWith("x")); + && (!isFamily("mac") || OS_NAME.endsWith("x")); } else if (family.equals("win9x")) { isFamily = isFamily("windows") - && (osName.indexOf("95") >= 0 - || osName.indexOf("98") >= 0 - || osName.indexOf("me") >= 0 - || osName.indexOf("ce") >= 0); + && (OS_NAME.indexOf("95") >= 0 + || OS_NAME.indexOf("98") >= 0 + || OS_NAME.indexOf("me") >= 0 + || OS_NAME.indexOf("ce") >= 0); } else if (family.equals("z/os")) { - isFamily = osName.indexOf("z/os") > -1 - || osName.indexOf("os/390") > -1; + isFamily = OS_NAME.indexOf("z/os") > -1 + || OS_NAME.indexOf("os/390") > -1; } else if (family.equals("os/400")) { - isFamily = osName.indexOf("os/400") > -1; + isFamily = OS_NAME.indexOf("os/400") > -1; } else if (family.equals("openvms")) { - isFamily = osName.indexOf("openvms") > -1; + isFamily = OS_NAME.indexOf("openvms") > -1; } else { throw new BuildException( "Don\'t know how to detect os family \"" @@ -244,13 +261,13 @@ } } if (name != null) { - isName = name.equals(osName); + isName = name.equals(OS_NAME); } if (arch != null) { - isArch = arch.equals(osArch); + isArch = arch.equals(OS_ARCH); } if (version != null) { - isVersion = version.equals(osVersion); + isVersion = version.equals(OS_VERSION); } retValue = isFamily && isName && isArch && isVersion; } 1.7 +16 -2 ant/src/main/org/apache/tools/ant/taskdefs/condition/Socket.java Index: Socket.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/condition/Socket.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- Socket.java 19 Jul 2003 08:11:02 -0000 1.6 +++ Socket.java 25 Jul 2003 08:28:21 -0000 1.7 @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2001-2002 The Apache Software Foundation. All rights + * Copyright (c) 2001-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -60,7 +60,7 @@ import org.apache.tools.ant.ProjectComponent; /** - * Condition to wait for a TCP/IP socket to have a listener. Its attribute(s) are: + * Condition to wait for a TCP/IP socket to have a listener. Its attributes are: * server - the name of the server. * port - the port number of the socket. * @@ -71,14 +71,28 @@ private String server = null; private int port = 0; + /** + * Set the server attribute + * + * @param server the server name + */ public void setServer(String server) { this.server = server; } + /** + * Set the port attribute + * + * @param port the port number of the socket + */ public void setPort(int port) { this.port = port; } + /** + * @return true if a socket can be created + * @exception BuildException if the attributes are not set + */ public boolean eval() throws BuildException { if (server == null) { throw new BuildException("No server specified in socket "
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]