use isEmpty
diff --git a/src/main/java/org/apache/easyant/core/EasyAntEngine.java b/src/main/java/org/apache/easyant/core/EasyAntEngine.java
index 537fad7..1ea1199 100755
--- a/src/main/java/org/apache/easyant/core/EasyAntEngine.java
+++ b/src/main/java/org/apache/easyant/core/EasyAntEngine.java
@@ -24,8 +24,8 @@
import org.apache.easyant.core.descriptor.PluginDescriptor;
import org.apache.easyant.core.ivy.InheritableScope;
import org.apache.easyant.core.ivy.IvyInstanceHelper;
-import org.apache.easyant.core.services.PluginService;
import org.apache.easyant.core.services.DefaultPluginService;
+import org.apache.easyant.core.services.PluginService;
import org.apache.easyant.tasks.ConfigureBuildScopedRepository;
import org.apache.easyant.tasks.Import;
import org.apache.easyant.tasks.LoadModule;
@@ -396,7 +396,7 @@
configurePluginService(project, easyantIvySettings);
// Profile
- if (configuration.getActiveBuildConfigurations().size() != 0) {
+ if (!configuration.getActiveBuildConfigurations().isEmpty()) {
String buildConfigurations = null;
for (String conf : configuration.getActiveBuildConfigurations()) {
if (buildConfigurations == null) {
@@ -456,7 +456,7 @@
}
public void loadSystemPlugins(Project project, boolean isRootProject) {
- if (isRootProject && configuration.getSystemPlugins().size() > 0) {
+ if (isRootProject && !configuration.getSystemPlugins().isEmpty()) {
project.log("Loading System Plugins...");
}
for (PluginDescriptor systemPlugin : configuration.getSystemPlugins()) {
diff --git a/src/main/java/org/apache/easyant/core/EasyAntMain.java b/src/main/java/org/apache/easyant/core/EasyAntMain.java
index cd818b8..8a6db9d 100755
--- a/src/main/java/org/apache/easyant/core/EasyAntMain.java
+++ b/src/main/java/org/apache/easyant/core/EasyAntMain.java
@@ -17,48 +17,18 @@
*/
package org.apache.easyant.core;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.PrintStream;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-
-import org.apache.commons.cli.CommandLine;
-import org.apache.commons.cli.CommandLineParser;
-import org.apache.commons.cli.GnuParser;
-import org.apache.commons.cli.HelpFormatter;
-import org.apache.commons.cli.Option;
-import org.apache.commons.cli.OptionBuilder;
-import org.apache.commons.cli.Options;
-import org.apache.commons.cli.ParseException;
+import org.apache.commons.cli.*;
import org.apache.easyant.core.ant.ProjectUtils;
import org.apache.easyant.core.configuration.EasyAntConfiguration;
import org.apache.easyant.core.configuration.EasyantConfigurationFactory;
-import org.apache.easyant.man.Describe;
-import org.apache.easyant.man.EasyantOption;
-import org.apache.easyant.man.ListExtensionPoints;
-import org.apache.easyant.man.ListParameters;
-import org.apache.easyant.man.ListPlugins;
-import org.apache.easyant.man.ListProps;
-import org.apache.easyant.man.ListTargets;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Diagnostics;
-import org.apache.tools.ant.ExitStatusException;
-import org.apache.tools.ant.ExtensionPoint;
-import org.apache.tools.ant.Main;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.Target;
+import org.apache.easyant.man.*;
+import org.apache.tools.ant.*;
import org.apache.tools.ant.launch.AntMain;
import org.apache.tools.ant.util.FileUtils;
+import java.io.*;
+import java.util.*;
+
/**
* Command line entry point into EasyAnt. This class is entered via the canonical `public static void main` entry point
* and reads the command line arguments. It then assembles and executes an Ant project.
@@ -73,6 +43,7 @@
*/
private static final Set<String> LAUNCH_COMMANDS = new HashSet<String>();
private boolean isLogFileUsed;
+
static {
LAUNCH_COMMANDS.add("-lib");
LAUNCH_COMMANDS.add("-cp");
@@ -81,6 +52,7 @@
LAUNCH_COMMANDS.add("-nouserlib");
LAUNCH_COMMANDS.add("-main");
}
+
private EasyAntConfiguration easyAntConfiguration;
private boolean projectHelp;
@@ -94,9 +66,8 @@
/**
* Prints the message of the Throwable if it (the message) is not <code>null</code>.
- *
- * @param t
- * Throwable to print the message of. Must not be <code>null</code>.
+ *
+ * @param t Throwable to print the message of. Must not be <code>null</code>.
*/
private static void printMessage(Throwable t) {
String message = t.getMessage();
@@ -108,15 +79,12 @@
/**
* Creates a new instance of this class using the arguments specified, gives it any extra user properties which have
* been specified, and then runs the build using the classloader provided.
- *
- * @param args
- * Command line arguments. Must not be <code>null</code>.
- * @param additionalUserProperties
- * Any extra properties to use in this build. May be <code>null</code>, which is the equivalent to
- * passing in an empty set of properties.
- * @param coreLoader
- * Classloader used for core classes. May be <code>null</code> in which case the system classloader is
- * used.
+ *
+ * @param args Command line arguments. Must not be <code>null</code>.
+ * @param additionalUserProperties Any extra properties to use in this build. May be <code>null</code>, which is the equivalent to
+ * passing in an empty set of properties.
+ * @param coreLoader Classloader used for core classes. May be <code>null</code> in which case the system classloader is
+ * used.
*/
public static void start(String[] args, Properties additionalUserProperties, ClassLoader coreLoader) {
EasyAntMain m = new EasyAntMain();
@@ -125,14 +93,10 @@
/**
* Start Ant
- *
- * @param args
- * command line args
- * @param additionalUserProperties
- * properties to set beyond those that may be specified on the args list
- * @param coreLoader
- * - not used
- *
+ *
+ * @param args command line args
+ * @param additionalUserProperties properties to set beyond those that may be specified on the args list
+ * @param coreLoader - not used
* @since Ant 1.6
*/
public void startAnt(String[] args, Properties additionalUserProperties, ClassLoader coreLoader) {
@@ -188,9 +152,8 @@
/**
* This operation is expected to call {@link System#exit(int)}, which is what the base version does. However, it is
* possible to do something else.
- *
- * @param exitCode
- * code to exit with
+ *
+ * @param exitCode code to exit with
*/
protected void exit(int exitCode) {
System.exit(exitCode);
@@ -198,7 +161,7 @@
/**
* Close logfiles, if we have been writing to them.
- *
+ *
* @since Ant 1.6
*/
private void handleLogfile() {
@@ -211,9 +174,8 @@
/**
* Command line entry point. This method kicks off the building of a project object and executes a build using
* either a given target or the default target.
- *
- * @param args
- * Command line arguments. Must not be <code>null</code>.
+ *
+ * @param args Command line arguments. Must not be <code>null</code>.
*/
public static void main(String[] args) {
start(args, null, null);
@@ -229,7 +191,7 @@
/**
* Process command line arguments. When ant is started from Launcher, launcher-only arguments do not get passed
* through to this routine.
- *
+ *
* @since Ant 1.6
*/
private void processArgs(CommandLine line) {
@@ -372,7 +334,7 @@
if (line.hasOption("autoproxy")) {
easyAntConfiguration.setProxy(true);
}
- if (line.getArgList().size() > 0) {
+ if (!line.getArgList().isEmpty()) {
for (Object o : line.getArgList()) {
String target = (String) o;
easyAntConfiguration.getTargets().add(target);
@@ -395,7 +357,9 @@
// other methods
// --------------------------------------------------------
- /** Load the property files specified by -propertyfile */
+ /**
+ * Load the property files specified by -propertyfile
+ */
private void loadPropertyFiles() {
for (String filename : propertyFiles) {
Properties props = new Properties();
@@ -423,9 +387,8 @@
/**
* Executes the build. If the constructor for this instance failed (e.g. returned after issuing a warning), this
* method returns immediately.
- *
- * @exception BuildException
- * if the build fails
+ *
+ * @throws BuildException if the build fails
*/
private void runBuild(CommandLine line) throws BuildException {
if (!readyToRun) {
@@ -456,9 +419,8 @@
/**
* Prints the description of a project (if there is one) to <code>System.out</code>.
- *
- * @param project
- * The project to display a description of. Must not be <code>null</code>.
+ *
+ * @param project The project to display a description of. Must not be <code>null</code>.
*/
protected void printDescription(Project project) {
if (project.getDescription() != null) {
@@ -468,12 +430,9 @@
/**
* Searches for the correct place to insert a name into a list so as to keep the list sorted alphabetically.
- *
- * @param names
- * The current list of names. Must not be <code>null</code>.
- * @param name
- * The name to find a place for. Must not be <code>null</code>.
- *
+ *
+ * @param names The current list of names. Must not be <code>null</code>.
+ * @param name The name to find a place for. Must not be <code>null</code>.
* @return the correct place in the list for the given name
*/
private static int findTargetPosition(List<String> names, String name) {
@@ -488,23 +447,17 @@
/**
* Writes a formatted list of target names to <code>System.out</code> with an optional description.
- *
- *
- * @param project
- * the project instance.
- * @param names
- * The names to be printed. Must not be <code>null</code>.
- * @param descriptions
- * The associated target descriptions. May be <code>null</code>, in which case no descriptions are
- * displayed. If non- <code>null</code>, this should have as many elements as <code>names</code>.
- * @param heading
- * The heading to display. Should not be <code>null</code>.
- * @param maxlen
- * The maximum length of the names of the targets. If descriptions are given, they are padded to this
- * position so they line up (so long as the names really <i>are</i> shorter than this).
+ *
+ * @param project the project instance.
+ * @param names The names to be printed. Must not be <code>null</code>.
+ * @param descriptions The associated target descriptions. May be <code>null</code>, in which case no descriptions are
+ * displayed. If non- <code>null</code>, this should have as many elements as <code>names</code>.
+ * @param heading The heading to display. Should not be <code>null</code>.
+ * @param maxlen The maximum length of the names of the targets. If descriptions are given, they are padded to this
+ * position so they line up (so long as the names really <i>are</i> shorter than this).
*/
private static void printTargets(Project project, List<String> names, List<String> descriptions, String heading,
- int maxlen) {
+ int maxlen) {
if (!names.isEmpty()) {
// now, start printing the targets and their descriptions
String lSep = System.getProperty("line.separator");
@@ -527,11 +480,9 @@
/**
* Prints a list of all targets in the specified project to <code>System.out</code>, optionally including
* subtargets.
- *
- * @param project
- * The project to display a description of. Must not be <code>null</code>.
- * @param printSubTargets
- * Whether or not subtarget names should also be printed.
+ *
+ * @param project The project to display a description of. Must not be <code>null</code>.
+ * @param printSubTargets Whether or not subtarget names should also be printed.
*/
protected static void printTargets(Project project, boolean printSubTargets) {
// find the target with the longest name
@@ -576,7 +527,7 @@
printTargets(project, topNames, topDescriptions, "Main targets:", maxLength);
// if there were no main targets, we list all subtargets
// as it means nothing has a description
- if (topNames.size() == 0) {
+ if (topNames.isEmpty()) {
printSubTargets = true;
}
if (printSubTargets) {
@@ -700,9 +651,8 @@
/**
* Prints the EasyAnt version information to <code>System.out</code>.
- *
- * @exception BuildException
- * if the version information is unavailable
+ *
+ * @throws BuildException if the version information is unavailable
*/
private static void printVersion() throws BuildException {
System.out.println(EasyAntEngine.getEasyAntVersion());
@@ -717,11 +667,9 @@
/**
* Returns the Ant version information, if available. Once the information has been loaded once, it's cached and
* returned from the cache on future calls.
- *
+ *
* @return the Ant version information as a String (always non- <code>null</code>)
- *
- * @exception BuildException
- * if the version information is unavailable
+ * @throws BuildException if the version information is unavailable
*/
public static synchronized String getAntVersion() throws BuildException {
if (antVersion == null) {
diff --git a/src/main/java/org/apache/easyant/core/ant/MetaBuildExecutor.java b/src/main/java/org/apache/easyant/core/ant/MetaBuildExecutor.java
index 7a68aa5..aa38d7a 100644
--- a/src/main/java/org/apache/easyant/core/ant/MetaBuildExecutor.java
+++ b/src/main/java/org/apache/easyant/core/ant/MetaBuildExecutor.java
@@ -17,10 +17,6 @@
*/
package org.apache.easyant.core.ant;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
import org.apache.easyant.core.EasyAntConstants;
import org.apache.easyant.core.EasyAntMagicNames;
import org.apache.easyant.tasks.SubModule;
@@ -31,6 +27,10 @@
import org.apache.tools.ant.types.Reference;
import org.apache.tools.ant.util.StringUtils;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
/**
* Recursively executes build targets on sub-modules for a multi-module project.
*/
@@ -103,7 +103,7 @@
// print all sub modules and order in which they will
// be executed
String sortedModules = project.getProperty("ivy.sorted.modules");
- if (sortedModules != null && sortedModules.length() > 0) {
+ if (sortedModules != null && !sortedModules.isEmpty()) {
StringBuilder sb = new StringBuilder();
sb.append(DEMARKER).append(StringUtils.LINE_SEP);
sb.append("Build Order for Sub Modules").append(StringUtils.LINE_SEP);
diff --git a/src/main/java/org/apache/easyant/core/ant/helper/EasyAntProjectHelper.java b/src/main/java/org/apache/easyant/core/ant/helper/EasyAntProjectHelper.java
index 7afb585..2750656 100644
--- a/src/main/java/org/apache/easyant/core/ant/helper/EasyAntProjectHelper.java
+++ b/src/main/java/org/apache/easyant/core/ant/helper/EasyAntProjectHelper.java
@@ -17,25 +17,19 @@
*/
package org.apache.easyant.core.ant.helper;
-import java.util.Map;
-
import org.apache.easyant.core.ant.Phase;
import org.apache.easyant.core.ant.ProjectUtils;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.ExtensionPoint;
-import org.apache.tools.ant.Location;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.ProjectHelper;
-import org.apache.tools.ant.Target;
+import org.apache.tools.ant.*;
import org.apache.tools.ant.helper.AntXMLContext;
import org.apache.tools.ant.helper.ProjectHelper2;
import org.apache.tools.ant.types.Resource;
import org.xml.sax.Attributes;
import org.xml.sax.SAXParseException;
+import java.util.Map;
+
/**
* This class is the custom project helper used by easyant introducing support for phase concept
- *
*/
public class EasyAntProjectHelper extends ProjectHelper2 {
@@ -58,22 +52,15 @@
/**
* Handles the start of a top-level element within the project. An appropriate handler is created and
* initialised with the details of the element.
- *
- * @param uri
- * The namespace URI for this element.
- * @param name
- * The name of the element being started. Will not be <code>null</code>.
- * @param qname
- * The qualified name for this element.
- * @param attrs
- * Attributes of the element being started. Will not be <code>null</code>.
- * @param context
- * The context for this element.
+ *
+ * @param uri The namespace URI for this element.
+ * @param name The name of the element being started. Will not be <code>null</code>.
+ * @param qname The qualified name for this element.
+ * @param attrs Attributes of the element being started. Will not be <code>null</code>.
+ * @param context The context for this element.
* @return a target or an element handler.
- *
- * @exception org.xml.sax.SAXParseException
- * if the tag given is not <code>"taskdef"</code>, <code>"typedef"</code>,
- * <code>"property"</code>, <code>"target"</code>, <code>"phase"</code> or a data type definition
+ * @throws org.xml.sax.SAXParseException if the tag given is not <code>"taskdef"</code>, <code>"typedef"</code>,
+ * <code>"property"</code>, <code>"target"</code>, <code>"phase"</code> or a data type definition
*/
public AntHandler onStartChild(String uri, String name, String qname, Attributes attrs, AntXMLContext context)
throws SAXParseException {
@@ -92,21 +79,14 @@
* Initialisation routine called after handler creation with the element name and attributes. The attributes
* which this handler can deal with are: <code>"name"</code>, <code>"depends"</code>, <code>"if"</code>,
* <code>"unless"</code>, <code>"id"</code> and <code>"description"</code>.
- *
- * @param uri
- * The namespace URI for this element.
- * @param tag
- * Name of the element which caused this handler to be created. Should not be <code>null</code>.
- * Ignored in this implementation.
- * @param qname
- * The qualified name for this element.
- * @param attrs
- * Attributes of the element which caused this handler to be created. Must not be <code>null</code>.
- * @param context
- * The current context.
- *
- * @exception SAXParseException
- * if an unexpected attribute is encountered or if the <code>"name"</code> attribute is missing.
+ *
+ * @param uri The namespace URI for this element.
+ * @param tag Name of the element which caused this handler to be created. Should not be <code>null</code>.
+ * Ignored in this implementation.
+ * @param qname The qualified name for this element.
+ * @param attrs Attributes of the element which caused this handler to be created. Must not be <code>null</code>.
+ * @param context The current context.
+ * @throws SAXParseException if an unexpected attribute is encountered or if the <code>"name"</code> attribute is missing.
*/
public void onStartElement(String uri, String tag, String qname, Attributes attrs, AntXMLContext context)
throws SAXParseException {
@@ -208,7 +188,7 @@
usedTarget = true;
}
- if (depends.length() > 0) {
+ if (!depends.isEmpty()) {
if (!isInIncludeMode) {
target.setDepends(depends);
} else {
diff --git a/src/main/java/org/apache/easyant/man/ListParameters.java b/src/main/java/org/apache/easyant/man/ListParameters.java
index af5c88b..17ccb86 100644
--- a/src/main/java/org/apache/easyant/man/ListParameters.java
+++ b/src/main/java/org/apache/easyant/man/ListParameters.java
@@ -17,11 +17,11 @@
*/
package org.apache.easyant.man;
-import java.util.List;
-
import org.apache.easyant.core.report.ImportedModuleReport;
import org.apache.easyant.core.report.ParameterReport;
+import java.util.List;
+
/**
* Lists all parameters (deep search - includes all imported modules) available in the specified build module.
*/
@@ -48,7 +48,7 @@
getProject().log(LINE_SEP + "No plugin specified. Listing all parameters available in the project.");
List<ParameterReport> parameterReports = getEareport().getParameterReports();
- if (parameterReports.size() > 0) {
+ if (!parameterReports.isEmpty()) {
printParameters(parameterReports);
} else {
@@ -64,7 +64,7 @@
getProject().log("\tNo Module / Plugin found by given name: " + plugin);
} else {
List<ParameterReport> parameterReports = moduleRep.getEasyantReport().getParameterReports();
- if (parameterReports.size() > 0) {
+ if (!parameterReports.isEmpty()) {
printParameters(parameterReports);
} else {
getProject().log(LINE_SEP + "No parameter found in the plugin: " + plugin);
diff --git a/src/main/java/org/apache/easyant/man/ListProps.java b/src/main/java/org/apache/easyant/man/ListProps.java
index 6c66626..1ad0881 100644
--- a/src/main/java/org/apache/easyant/man/ListProps.java
+++ b/src/main/java/org/apache/easyant/man/ListProps.java
@@ -17,12 +17,12 @@
*/
package org.apache.easyant.man;
-import java.util.Map;
-import java.util.Map.Entry;
-
import org.apache.easyant.core.descriptor.PropertyDescriptor;
import org.apache.easyant.core.report.ImportedModuleReport;
+import java.util.Map;
+import java.util.Map.Entry;
+
/**
* Lists all properties (deep search - includes all imported modules) available in the specified build module.
*/
@@ -50,7 +50,7 @@
getProject().log(LINE_SEP + "No plugin specified. Listing all properties available in the project.");
Map<String, PropertyDescriptor> allProjectProps = getEareport().getPropertyDescriptors();
- if (allProjectProps.size() > 0) {
+ if (!allProjectProps.isEmpty()) {
printProperties(allProjectProps);
} else {
@@ -67,7 +67,7 @@
} else {
Map<String, PropertyDescriptor> allprops = moduleRep.getEasyantReport().getPropertyDescriptors();
- if (allprops.size() > 0) {
+ if (!allprops.isEmpty()) {
printProperties(allprops);
} else {
getProject().log(LINE_SEP + "No property found in the plugin: " + plugin);
diff --git a/src/main/java/org/apache/easyant/tasks/CheckResolver.java b/src/main/java/org/apache/easyant/tasks/CheckResolver.java
index 659d1bf..008c016 100644
--- a/src/main/java/org/apache/easyant/tasks/CheckResolver.java
+++ b/src/main/java/org/apache/easyant/tasks/CheckResolver.java
@@ -22,7 +22,6 @@
/**
* This task is responsible of checking existance of a resolver in a given ivy instance
- *
*/
public class CheckResolver extends IvyTask {
@@ -59,7 +58,7 @@
/**
* Get property resolver name to check
- *
+ *
* @return the property name representing the resolver
*/
public String getResolver() {
@@ -68,9 +67,8 @@
/**
* Set the property resolver name to check
- *
- * @param resolver
- * a property name representing the resolver
+ *
+ * @param resolver a property name representing the resolver
*/
public void setResolver(String resolver) {
this.resolver = resolver;
@@ -78,7 +76,7 @@
/**
* Get a description to the property / path / extension-point
- *
+ *
* @return the description
*/
public String getDescription() {
@@ -87,9 +85,8 @@
/**
* set a description to the property / path / extension-point
- *
- * @param description
- * the description
+ *
+ * @param description the description
*/
public void setDescription(String description) {
this.description = description;
@@ -97,11 +94,11 @@
/**
* Appends CDATA text inside the Ant task to description
- *
+ *
* @see #setDescription(String)
*/
public void addText(String descriptionText) {
- if (descriptionText.trim().length() > 0) {
+ if (!descriptionText.trim().isEmpty()) {
descriptionText = getProject().replaceProperties(descriptionText);
if (getDescription() == null) {
setDescription(descriptionText);
diff --git a/src/main/java/org/apache/easyant/tasks/CoreRevisionCheckerTask.java b/src/main/java/org/apache/easyant/tasks/CoreRevisionCheckerTask.java
index c3c49c7..8feee25 100644
--- a/src/main/java/org/apache/easyant/tasks/CoreRevisionCheckerTask.java
+++ b/src/main/java/org/apache/easyant/tasks/CoreRevisionCheckerTask.java
@@ -17,15 +17,15 @@
*/
package org.apache.easyant.tasks;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Properties;
-
import org.apache.easyant.core.EasyAntMagicNames;
import org.apache.ivy.core.module.id.ModuleRevisionId;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
/**
* <p>
* The core-version task is used to define the compatibility between core and modules.
@@ -54,11 +54,11 @@
/**
* Appends CDATA text inside the Ant task to the error message used if the revision check fails.
- *
+ *
* @see #setMessage(String)
*/
public void addText(String messageText) {
- if (messageText.trim().length() > 0) {
+ if (!messageText.trim().isEmpty()) {
messageText = getProject().replaceProperties(messageText);
if (this.message == null) {
this.message = messageText;
@@ -70,7 +70,7 @@
/**
* Get the requiredRevision
- *
+ *
* @return a string that represent the required revision
*/
public String getRequiredRevision() {
@@ -79,9 +79,8 @@
/**
* Set the requiredRevision
- *
- * @param requiredRevision
- * a string that represent the required revision
+ *
+ * @param requiredRevision a string that represent the required revision
*/
public void setRequiredRevision(String requiredRevision) {
this.requiredRevision = requiredRevision;
diff --git a/src/main/java/org/apache/easyant/tasks/IvyDependencyUpdateChecker.java b/src/main/java/org/apache/easyant/tasks/IvyDependencyUpdateChecker.java
index f3d21ad..a3e97ba 100644
--- a/src/main/java/org/apache/easyant/tasks/IvyDependencyUpdateChecker.java
+++ b/src/main/java/org/apache/easyant/tasks/IvyDependencyUpdateChecker.java
@@ -17,11 +17,6 @@
*/
package org.apache.easyant.tasks;
-import java.io.IOException;
-import java.text.ParseException;
-import java.util.ArrayList;
-import java.util.List;
-
import org.apache.ivy.ant.IvyPostResolveTask;
import org.apache.ivy.core.module.descriptor.Configuration;
import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor;
@@ -33,9 +28,13 @@
import org.apache.ivy.core.resolve.ResolveOptions;
import org.apache.tools.ant.BuildException;
+import java.io.IOException;
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.List;
+
/**
* Backport of IvyDependencyUpdateChecker until a new version of ivy will be released
- *
*/
public class IvyDependencyUpdateChecker extends IvyPostResolveTask {
@@ -138,7 +137,7 @@
}
}
- if (listOfMissingDependencyOnLatest.size() > 0) {
+ if (!listOfMissingDependencyOnLatest.isEmpty()) {
log("List of missing dependency on latest resolve :");
for (Object aListOfMissingDependencyOnLatest : listOfMissingDependencyOnLatest) {
ModuleRevisionId moduleRevisionId = (ModuleRevisionId) aListOfMissingDependencyOnLatest;
@@ -163,7 +162,7 @@
listOfNewDependencyOnLatest.add(latest.getId());
}
}
- if (listOfNewDependencyOnLatest.size() > 0) {
+ if (!listOfNewDependencyOnLatest.isEmpty()) {
log("List of new dependency on latest resolve :");
for (Object aListOfNewDependencyOnLatest : listOfNewDependencyOnLatest) {
ModuleRevisionId moduleRevisionId = (ModuleRevisionId) aListOfNewDependencyOnLatest;
diff --git a/src/main/java/org/apache/easyant/tasks/LoadModule.java b/src/main/java/org/apache/easyant/tasks/LoadModule.java
index ff6ef5a..78c51af 100644
--- a/src/main/java/org/apache/easyant/tasks/LoadModule.java
+++ b/src/main/java/org/apache/easyant/tasks/LoadModule.java
@@ -17,21 +17,10 @@
*/
package org.apache.easyant.tasks;
-import java.io.File;
-import java.net.MalformedURLException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
import org.apache.easyant.core.BuildConfigurationHelper;
import org.apache.easyant.core.EasyAntConstants;
import org.apache.easyant.core.EasyAntMagicNames;
-import org.apache.easyant.core.descriptor.AdvancedInheritableItem;
-import org.apache.easyant.core.descriptor.ConfigureProjectDescriptor;
-import org.apache.easyant.core.descriptor.EasyAntModuleDescriptor;
-import org.apache.easyant.core.descriptor.ExtensionPointMappingDescriptor;
-import org.apache.easyant.core.descriptor.PluginDescriptor;
-import org.apache.easyant.core.descriptor.PropertyDescriptor;
+import org.apache.easyant.core.descriptor.*;
import org.apache.easyant.core.ivy.InheritableScope;
import org.apache.easyant.core.ivy.IvyInstanceHelper;
import org.apache.easyant.core.parser.DefaultEasyAntXmlModuleDescriptorParser;
@@ -51,6 +40,12 @@
import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.ImportTask;
+import java.io.File;
+import java.net.MalformedURLException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
/**
* This task is the main class, used to parse module.ivy and execute the all the statement behind the easyant tag.
*/
@@ -63,7 +58,7 @@
/**
* Get the file name that will be loaded
- *
+ *
* @return a file that represents a module descriptor
*/
public File getBuildModule() {
@@ -72,9 +67,8 @@
/**
* set the file name that will be loaded
- *
- * @param file
- * represents a module descriptor
+ *
+ * @param file represents a module descriptor
*/
public void setBuildModule(File file) {
this.buildModule = file;
@@ -94,7 +88,7 @@
/**
* Set the classname of the easyant parser you want to use
- *
+ *
* @param easyAntMDParserClassName
*/
public void setEasyAntMDParserClassName(String easyAntMDParserClassName) {
@@ -164,7 +158,6 @@
/**
* Configure project offline repository If offline mode is enabled, it will acts as dictator resolver
- *
*/
private void configureProjectOfflineResolver() {
if (EasyAntMagicNames.EASYANT_IVY_INSTANCE.equals(IvyInstanceHelper.getProjectIvyInstanceName(getProject()))) {
@@ -186,7 +179,7 @@
}
/**
- *
+ *
*/
private void configureProjectIvyinstance(String projectIvyInstanceName) {
IvyConfigure projectIvyInstance = new IvyConfigure();
@@ -402,11 +395,9 @@
/**
* Check if an inheritable item can be inherited by verifying {@link InheritableScope}
- *
- * @param inheritableItem
- * a given {@link AdvancedInheritableItem}
- * @param currentModule
- * current module
+ *
+ * @param inheritableItem a given {@link AdvancedInheritableItem}
+ * @param currentModule current module
* @return true if item can be inherited
*/
private boolean canInherit(AdvancedInheritableItem inheritableItem, ModuleRevisionId currentModule) {
@@ -441,7 +432,7 @@
log("removing unused configuration " + conf, Project.MSG_DEBUG);
}
}
- if (mainConfsList.size() > 0) {
+ if (!mainConfsList.isEmpty()) {
String mainConfs = StringUtils.join(mainConfsList.toArray(new String[mainConfsList.size()]), ",");
log("updating main.confs with active profile for current project :" + mainConfs, Project.MSG_DEBUG);
getProject().setProperty(EasyAntMagicNames.MAIN_CONFS, mainConfs);
@@ -487,7 +478,7 @@
/**
* @return true if this module should use a build-scoped repository and cache to find artifacts generated by other
- * modules in the same build.
+ * modules in the same build.
*/
private boolean shouldUseBuildRepository() {
// if a value has been provided by task attribute, return it
diff --git a/src/main/java/org/apache/easyant/tasks/ParameterTask.java b/src/main/java/org/apache/easyant/tasks/ParameterTask.java
index 713ff05..7a5dd51 100644
--- a/src/main/java/org/apache/easyant/tasks/ParameterTask.java
+++ b/src/main/java/org/apache/easyant/tasks/ParameterTask.java
@@ -17,9 +17,6 @@
*/
package org.apache.easyant.tasks;
-import java.util.ArrayList;
-import java.util.List;
-
import org.apache.easyant.core.EasyAntMagicNames;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
@@ -27,14 +24,16 @@
import org.apache.tools.ant.taskdefs.Property;
import org.apache.tools.ant.types.Path;
+import java.util.ArrayList;
+import java.util.List;
+
/**
* parameter tasks is used to :
- *
+ * <p/>
* document properties / paths check if properties /paths are required set default values if properties are not set
- *
+ * <p/>
* This could be usefull in precondition of each modules, to check if property/path are set. And much more usefull to
* document our modules.
- *
*/
public class ParameterTask extends Task {
private String property;
@@ -48,7 +47,7 @@
/**
* Get a description to the property / path
- *
+ *
* @return the description
*/
public String getDescription() {
@@ -57,9 +56,8 @@
/**
* set a description to the property / path
- *
- * @param description
- * the description
+ *
+ * @param description the description
*/
public void setDescription(String description) {
this.description = description;
@@ -67,11 +65,11 @@
/**
* Appends CDATA text inside the Ant task to description
- *
+ *
* @see #setDescription(String)
*/
public void addText(String descriptionText) {
- if (descriptionText.trim().length() > 0) {
+ if (!descriptionText.trim().isEmpty()) {
descriptionText = getProject().replaceProperties(descriptionText);
if (getDescription() == null) {
setDescription(descriptionText);
@@ -83,7 +81,7 @@
/**
* Get the property name to check
- *
+ *
* @return a property name
*/
public String getProperty() {
@@ -92,9 +90,8 @@
/**
* Set the property name to check
- *
- * @param property
- * a property name
+ *
+ * @param property a property name
*/
public void setProperty(String property) {
this.property = property;
@@ -102,7 +99,7 @@
/**
* Get the path to check
- *
+ *
* @return a pathId
*/
public String getPath() {
@@ -111,7 +108,7 @@
/**
* Set the path to check
- *
+ *
* @param path
*/
public void setPath(String path) {
@@ -120,7 +117,7 @@
/**
* Get the default value (only available for property)
- *
+ *
* @return a string that represents the default value
*/
public String getDefault() {
@@ -129,9 +126,8 @@
/**
* Set the default value (only available for property)
- *
- * @param defaultValue
- * a string that represents the default value
+ *
+ * @param defaultValue a string that represents the default value
*/
public void setDefault(String defaultValue) {
this.defaultValue = defaultValue;
@@ -139,7 +135,7 @@
/**
* Is the refererenced property / path required?
- *
+ *
* @return
*/
public boolean isRequired() {
@@ -153,7 +149,7 @@
/**
* specify if the property / path is mandatory
- *
+ *
* @param required
*/
public void setRequired(boolean required) {
@@ -162,7 +158,7 @@
/**
* Get list of possible values of a property
- *
+ *
* @return a list of values
*/
public List<String> getPossibleValues() {
@@ -171,9 +167,8 @@
/**
* Set list of possible values of a property
- *
- * @param possibleValuesAsString
- * a comma separated list of values
+ *
+ * @param possibleValuesAsString a comma separated list of values
*/
public void setPossibleValues(String possibleValuesAsString) {
if (possibleValuesAsString != null) {