- unnecessary nesting (if/else with early return)
- <CODE> -> <code> javadoc
- extra lines removed
Index: Http.java
===================================================================
RCS file: 
/home/cvspublic/ant/src/main/org/apache/tools/ant/taskdefs/condition/Http.java,v
retrieving revision 1.13
diff -u -r1.13 Http.java
--- Http.java   9 Mar 2004 16:48:13 -0000       1.13
+++ Http.java   28 Feb 2005 08:41:16 -0000
@@ -36,7 +36,6 @@
 
     /**
      * Set the url attribute
-     *
      * @param url the url of the request
      */
     public void setUrl(String url) {
@@ -47,7 +46,6 @@
 
     /**
      * Set the errorsBeginAt attribute
-     *
      * @param errorsBeginAt number at which errors begin at, default is
      *                      400
      */
@@ -75,9 +73,8 @@
                         Project.MSG_VERBOSE);
                     if (code > 0 && code < errorsBeginAt) {
                         return true;
-                    } else {
-                        return false;
-                    }
+                    } 
+                    return false;
                 }
             } catch (java.io.IOException e) {
                 return false;
@@ -87,4 +84,4 @@
         }
         return true;
     }
-}
+}
\ No newline at end of file
Index: IsSigned.java
===================================================================
RCS file: 
/home/cvspublic/ant/src/main/org/apache/tools/ant/taskdefs/condition/IsSigned.java,v
retrieving revision 1.3
diff -u -r1.3 IsSigned.java
--- IsSigned.java       23 Nov 2004 10:40:14 -0000      1.3
+++ IsSigned.java       28 Feb 2005 08:41:16 -0000
@@ -16,14 +16,15 @@
  */
 package org.apache.tools.ant.taskdefs.condition;
 
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.types.DataType;
 import java.io.File;
 import java.io.IOException;
+import java.util.Enumeration;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipFile;
-import java.util.Enumeration;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.types.DataType;
 
 /**
  * Checks whether a jarfile is signed: if the name of the
@@ -37,12 +38,11 @@
     private static final String SIG_END = ".SF";
 
     private String name;
-    private File   file;
+    private File file;
 
    /**
      * The jarfile that is to be tested for the presence
      * of a signature.
-     *
      * @param file jarfile to be tested.
      */
     public void setFile(File file) {
@@ -51,7 +51,6 @@
 
    /**
      * The signature name to check jarfile for.
-     *
      * @param name signature to look for.
      */
     public void setName(String name) {
@@ -59,8 +58,8 @@
     }
 
     /**
-     * Returns <CODE>true</code> if the file exists and is signed with
-     * the signature specified, or, if <CODE>name</code> wasn't
+     * Returns <code>true</code> if the file exists and is signed with
+     * the signature specified, or, if <code>name</code> wasn't
      * specified, if the file contains a signature.
      * @return true if the file is signed.
      */
@@ -79,20 +78,19 @@
                     }
                 }
                 return false;
-            } else {
-                boolean shortSig = jarFile.getEntry(SIG_START
-                                                    + name.toUpperCase()
-                                                    + SIG_END) != null;
-                boolean longSig = false;
-                if (name.length() > 8) {
-                    longSig =
-                        jarFile.getEntry(SIG_START
-                                         + name.substring(0, 8).toUpperCase()
-                                         + SIG_END) != null;
-                }
-
-                return shortSig || longSig;
+            } 
+            boolean shortSig = jarFile.getEntry(SIG_START
+                       + name.toUpperCase()
+                       + SIG_END) != null;
+            boolean longSig = false;
+            if (name.length() > 8) {
+               longSig =
+                       jarFile.getEntry(SIG_START
+                                       + name.substring(0, 8).toUpperCase()
+                                       + SIG_END) != null;
             }
+            
+            return shortSig || longSig;
         } finally {
             if (jarFile != null) {
                 try {
@@ -105,8 +103,8 @@
     }
 
     /**
-     * Returns <CODE>true</code> if the file exists and is signed with
-     * the signature specified, or, if <CODE>name</code> wasn't
+     * Returns <code>true</code> if the file exists and is signed with
+     * the signature specified, or, if <code>name</code> wasn't
      * specified, if the file contains a signature.
      * @return true if the file is signed.
      */
@@ -134,4 +132,4 @@
         }
         return r;
     }
-}
+}
\ No newline at end of file
Index: Os.java
===================================================================
RCS file: 
/home/cvspublic/ant/src/main/org/apache/tools/ant/taskdefs/condition/Os.java,v
retrieving revision 1.34
diff -u -r1.34 Os.java
--- Os.java     9 Mar 2004 16:48:13 -0000       1.34
+++ Os.java     28 Feb 2005 08:41:17 -0000
@@ -18,6 +18,7 @@
 package org.apache.tools.ant.taskdefs.condition;
 
 import java.util.Locale;
+
 import org.apache.tools.ant.BuildException;
 
 /**
@@ -46,11 +47,11 @@
      *
      */
     public Os() {
+       //default
     }
 
     /**
      * Constructor that sets the family attribute
-     *
      * @param family a String value
      */
     public Os(String family) {
@@ -234,4 +235,4 @@
         }
         return retValue;
     }
-}
+}
\ No newline at end of file
Index: ParserSupports.java
===================================================================
RCS file: 
/home/cvspublic/ant/src/main/org/apache/tools/ant/taskdefs/condition/ParserSupports.java,v
retrieving revision 1.1
diff -u -r1.1 ParserSupports.java
--- ParserSupports.java 25 Feb 2005 11:32:35 -0000      1.1
+++ ParserSupports.java 28 Feb 2005 08:41:17 -0000
@@ -16,16 +16,17 @@
  */
 package org.apache.tools.ant.taskdefs.condition;
 
-import org.apache.tools.ant.ProjectComponent;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Project;
+import org.apache.tools.ant.ProjectComponent;
 import org.apache.tools.ant.util.JAXPUtils;
-import org.xml.sax.XMLReader;
+
 import org.xml.sax.SAXNotRecognizedException;
 import org.xml.sax.SAXNotSupportedException;
+import org.xml.sax.XMLReader;
 
 /**
- * test for the XML parser supporting a particular feature
+ * Test for the XML parser supporting a particular feature
  * @since Ant 1.7
  */
 public class ParserSupports extends ProjectComponent implements Condition {
@@ -47,7 +48,6 @@
 
     /**
      * Feature to probe for.
-     *
      * @param feature
      */
     public void setFeature(String feature) {
@@ -71,33 +71,30 @@
         this.value = value;
     }
 
-
-
     /**
-     * validate the args, then try to set the feature or property
+     * Validate the args, then try to set the feature or property
      * @return
      * @throws BuildException
      */
     public boolean eval() throws BuildException {
-        if(feature!=null && property!=null) {
+        if(feature != null && property != null) {
             throw new BuildException(ERROR_BOTH_ATTRIBUTES);
         }
-        if(feature==null && property==null) {
+        if(feature == null && property == null) {
             throw new BuildException(ERROR_NO_ATTRIBUTES);
         }
         //pick a value that is good for everything
-        if(feature!=null) {
+        if(feature != null) {
             return evalFeature();
-        } else {
-            if(value==null) {
-                throw new BuildException(ERROR_NO_VALUE);
-            }
-            return evalProperty();
         }
+        if(value == null) {
+               throw new BuildException(ERROR_NO_VALUE);
+        }
+        return evalProperty();
     }
 
     /**
-     * get our reader
+     * Get our reader
      * @return a reader
      */
     private XMLReader getReader() {
@@ -106,7 +103,7 @@
     }
 
     /**
-     * set a feature
+     * Set a feature
      * @return true if the feature could be set
      */
     public boolean evalFeature() {
@@ -116,7 +113,7 @@
         }
         boolean v= Project.toBoolean(value);
         try {
-            reader.setFeature(feature,v);
+            reader.setFeature(feature, v);
         } catch (SAXNotRecognizedException e) {
             log(FEATURE+NOT_RECOGNIZED+feature,Project.MSG_VERBOSE);
             return false;
@@ -128,8 +125,7 @@
     }
 
     /**
-     * set a feature
-     *
+     * Set a property
      * @return true if the feature could be set
      */
     public boolean evalProperty() {
@@ -145,6 +141,4 @@
         }
         return true;
     }
-
-
-}
+}
\ No newline at end of file

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to