| @@ -1167,7 +1167,6 @@ public class PropertyHelper implements GetProperty { | |||||
| */ | */ | ||||
| private static boolean nullOrEmpty(Object value) { | private static boolean nullOrEmpty(Object value) { | ||||
| return value == null || "".equals(value); | return value == null || "".equals(value); | ||||
| } | } | ||||
| /** | /** | ||||
| @@ -34,6 +34,6 @@ public class IfBlankAttribute extends BaseIfAttribute { | |||||
| * {@inheritDoc} | * {@inheritDoc} | ||||
| */ | */ | ||||
| public boolean isEnabled(UnknownElement el, String value) { | public boolean isEnabled(UnknownElement el, String value) { | ||||
| return convertResult((value == null || "".equals(value))); | |||||
| return convertResult(value == null || value.isEmpty()); | |||||
| } | } | ||||
| } | } | ||||
| @@ -344,7 +344,7 @@ public class Launcher { | |||||
| if (antLibDirProperty != null) { | if (antLibDirProperty != null) { | ||||
| antLibDir = new File(antLibDirProperty); | antLibDir = new File(antLibDirProperty); | ||||
| } | } | ||||
| if ((antLibDir == null) || !antLibDir.exists()) { | |||||
| if (antLibDir == null || !antLibDir.exists()) { | |||||
| antLibDir = antLauncherDir; | antLibDir = antLauncherDir; | ||||
| setProperty(ANTLIBDIR_PROPERTY, antLibDir.getAbsolutePath()); | setProperty(ANTLIBDIR_PROPERTY, antLibDir.getAbsolutePath()); | ||||
| } | } | ||||
| @@ -247,7 +247,7 @@ public final class Locator { | |||||
| int posi = cwd.indexOf(':'); | int posi = cwd.indexOf(':'); | ||||
| boolean pathStartsWithFileSeparator = path.startsWith(File.separator); | boolean pathStartsWithFileSeparator = path.startsWith(File.separator); | ||||
| boolean pathStartsWithUNC = path.startsWith("" + File.separator + File.separator); | boolean pathStartsWithUNC = path.startsWith("" + File.separator + File.separator); | ||||
| if ((posi > 0) && pathStartsWithFileSeparator && !pathStartsWithUNC) { | |||||
| if (posi > 0 && pathStartsWithFileSeparator && !pathStartsWithUNC) { | |||||
| path = cwd.substring(0, posi + 1) + path; | path = cwd.substring(0, posi + 1) + path; | ||||
| } | } | ||||
| } catch (UnsupportedEncodingException exc) { | } catch (UnsupportedEncodingException exc) { | ||||
| @@ -470,6 +470,7 @@ public final class Locator { | |||||
| * @exception MalformedURLException if the URLs for the files cannot be | * @exception MalformedURLException if the URLs for the files cannot be | ||||
| * formed. | * formed. | ||||
| */ | */ | ||||
| @SuppressWarnings("deprecated") | |||||
| public static URL[] getLocationURLs(File location, | public static URL[] getLocationURLs(File location, | ||||
| final String... extensions) | final String... extensions) | ||||
| throws MalformedURLException { | throws MalformedURLException { | ||||
| @@ -468,7 +468,7 @@ public class FixCRLF extends MatchingTask implements ChainableReader { | |||||
| switch (ch) { | switch (ch) { | ||||
| case '\r': | case '\r': | ||||
| ch = reader.read(); | ch = reader.read(); | ||||
| if ((char) (ch) == '\n') { | |||||
| if ((char) ch == '\n') { | |||||
| eolcount += 2; | eolcount += 2; | ||||
| eolStr.append("\r\n"); | eolStr.append("\r\n"); | ||||
| } else { | } else { | ||||
| @@ -515,7 +515,7 @@ public class Property extends Task { | |||||
| loadEnvironment(env); | loadEnvironment(env); | ||||
| } | } | ||||
| if ((name != null) && (ref != null)) { | |||||
| if (name != null && ref != null) { | |||||
| try { | try { | ||||
| addProperty(name, | addProperty(name, | ||||
| ref.getReferencedObject(getProject()).toString()); | ref.getReferencedObject(getProject()).toString()); | ||||
| @@ -585,7 +585,7 @@ public class Redirector { | |||||
| } | } | ||||
| if ((outputFilterChains != null && outputFilterChains.size() > 0) | if ((outputFilterChains != null && outputFilterChains.size() > 0) | ||||
| || !(outputEncoding.equalsIgnoreCase(inputEncoding))) { | |||||
| || !outputEncoding.equalsIgnoreCase(inputEncoding)) { | |||||
| try { | try { | ||||
| final LeadPipeInputStream snk = new LeadPipeInputStream(); | final LeadPipeInputStream snk = new LeadPipeInputStream(); | ||||
| snk.setManagingComponent(managingTask); | snk.setManagingComponent(managingTask); | ||||
| @@ -627,7 +627,7 @@ public class Redirector { | |||||
| } | } | ||||
| if ((errorFilterChains != null && errorFilterChains.size() > 0) | if ((errorFilterChains != null && errorFilterChains.size() > 0) | ||||
| || !(errorEncoding.equalsIgnoreCase(inputEncoding))) { | |||||
| || !errorEncoding.equalsIgnoreCase(inputEncoding)) { | |||||
| try { | try { | ||||
| final LeadPipeInputStream snk = new LeadPipeInputStream(); | final LeadPipeInputStream snk = new LeadPipeInputStream(); | ||||
| snk.setManagingComponent(managingTask); | snk.setManagingComponent(managingTask); | ||||
| @@ -155,12 +155,12 @@ public class Replace extends MatchingTask { | |||||
| } | } | ||||
| //value and property are mutually exclusive attributes | //value and property are mutually exclusive attributes | ||||
| if ((value != null) && (property != null)) { | |||||
| if (value != null && property != null) { | |||||
| throw new BuildException( | throw new BuildException( | ||||
| "Either value or property can be specified, but a replacefilter element cannot have both."); | "Either value or property can be specified, but a replacefilter element cannot have both."); | ||||
| } | } | ||||
| if ((property != null)) { | |||||
| if (property != null) { | |||||
| //the property attribute must have access to a property file | //the property attribute must have access to a property file | ||||
| if (propertyResource == null) { | if (propertyResource == null) { | ||||
| throw new BuildException( | throw new BuildException( | ||||
| @@ -305,7 +305,7 @@ public class Replace extends MatchingTask { | |||||
| String t = getToken(); | String t = getToken(); | ||||
| if (inputBuffer.length() > t.length()) { | if (inputBuffer.length() > t.length()) { | ||||
| int pos = replace(); | int pos = replace(); | ||||
| pos = Math.max((inputBuffer.length() - t.length()), pos); | |||||
| pos = Math.max(inputBuffer.length() - t.length(), pos); | |||||
| outputBuffer.append(inputBuffer.substring(0, pos)); | outputBuffer.append(inputBuffer.substring(0, pos)); | ||||
| inputBuffer.delete(0, pos); | inputBuffer.delete(0, pos); | ||||
| return true; | return true; | ||||
| @@ -404,7 +404,7 @@ public class ReplaceRegExp extends Task { | |||||
| linebuf = new StringBuilder(); | linebuf = new StringBuilder(); | ||||
| } else { // any other char | } else { // any other char | ||||
| if ((hasCR) || (c < 0)) { | |||||
| if (hasCR || c < 0) { | |||||
| // Mac-style linebreak or EOF (or both) | // Mac-style linebreak or EOF (or both) | ||||
| changes |= replaceAndWrite(linebuf.toString(), | changes |= replaceAndWrite(linebuf.toString(), | ||||
| w, options); | w, options); | ||||
| @@ -219,7 +219,7 @@ public class CCCheckout extends ClearCase { | |||||
| String result = runS(cmdl); | String result = runS(cmdl); | ||||
| return (result != null && result.length() > 0); | |||||
| return result != null && !result.isEmpty(); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -884,7 +884,7 @@ public class GenericDeploymentTool implements EJBDeploymentTool { | |||||
| */ | */ | ||||
| @Override | @Override | ||||
| public void validateConfigured() throws BuildException { | public void validateConfigured() throws BuildException { | ||||
| if ((destDir == null) || (!destDir.isDirectory())) { | |||||
| if (destDir == null || !destDir.isDirectory()) { | |||||
| throw new BuildException( | throw new BuildException( | ||||
| "A valid destination directory must be specified using the \"destdir\" attribute.", | "A valid destination directory must be specified using the \"destdir\" attribute.", | ||||
| getLocation()); | getLocation()); | ||||
| @@ -211,12 +211,12 @@ public class IPlanetDeploymentTool extends GenericDeploymentTool { | |||||
| File iasDescriptor = new File(getConfig().descriptorDir, | File iasDescriptor = new File(getConfig().descriptorDir, | ||||
| getIasDescriptorName()); | getIasDescriptorName()); | ||||
| if ((!iasDescriptor.exists()) || (!iasDescriptor.isFile())) { | |||||
| if (!iasDescriptor.exists() || !iasDescriptor.isFile()) { | |||||
| throw new BuildException("The iAS-specific EJB descriptor (" | throw new BuildException("The iAS-specific EJB descriptor (" | ||||
| + iasDescriptor + ") was not found.", getLocation()); | + iasDescriptor + ") was not found.", getLocation()); | ||||
| } | } | ||||
| if ((iashome != null) && (!iashome.isDirectory())) { | |||||
| if (iashome != null && !iashome.isDirectory()) { | |||||
| throw new BuildException( | throw new BuildException( | ||||
| "If \"iashome\" is specified, it must be a valid directory (it was set to " | "If \"iashome\" is specified, it must be a valid directory (it was set to " | ||||
| + iashome + ").", | + iashome + ").", | ||||
| @@ -253,7 +253,7 @@ public class IPlanetEjbc { | |||||
| boolean retainSource = false; | boolean retainSource = false; | ||||
| IPlanetEjbc ejbc; | IPlanetEjbc ejbc; | ||||
| if ((args.length < MIN_NUM_ARGS) || (args.length > MAX_NUM_ARGS)) { | |||||
| if (args.length < MIN_NUM_ARGS || args.length > MAX_NUM_ARGS) { | |||||
| usage(); | usage(); | ||||
| return; | return; | ||||
| } | } | ||||
| @@ -663,7 +663,7 @@ public class IPlanetEjbc { | |||||
| */ | */ | ||||
| public void registerDTD(String publicID, String location) { | public void registerDTD(String publicID, String location) { | ||||
| log("Registering: " + location); | log("Registering: " + location); | ||||
| if ((publicID == null) || (location == null)) { | |||||
| if (publicID == null || location == null) { | |||||
| return; | return; | ||||
| } | } | ||||
| @@ -742,7 +742,7 @@ public class IPlanetEjbc { | |||||
| iasDescriptor = true; | iasDescriptor = true; | ||||
| } | } | ||||
| if (("session".equals(name)) || ("entity".equals(name))) { | |||||
| if ("session".equals(name) || "entity".equals(name)) { | |||||
| ejbType = name; | ejbType = name; | ||||
| } | } | ||||
| } | } | ||||
| @@ -1033,20 +1033,20 @@ public class IPlanetEjbc { | |||||
| + " EJB."); | + " EJB."); | ||||
| } | } | ||||
| if ((!beantype.equals(ENTITY_BEAN)) | |||||
| && (!beantype.equals(STATELESS_SESSION)) | |||||
| && (!beantype.equals(STATEFUL_SESSION))) { | |||||
| if (!beantype.equals(ENTITY_BEAN) | |||||
| && !beantype.equals(STATELESS_SESSION) | |||||
| && !beantype.equals(STATEFUL_SESSION)) { | |||||
| throw new EjbcException("The beantype found (" + beantype | throw new EjbcException("The beantype found (" + beantype | ||||
| + ") isn't valid in the " + name + " EJB."); | + ") isn't valid in the " + name + " EJB."); | ||||
| } | } | ||||
| if (cmp && (!beantype.equals(ENTITY_BEAN))) { | |||||
| if (cmp && !beantype.equals(ENTITY_BEAN)) { | |||||
| System.out.println( | System.out.println( | ||||
| "CMP stubs and skeletons may not be generated for a Session Bean -- the \"cmp\" attribute will be ignoredfor the " | "CMP stubs and skeletons may not be generated for a Session Bean -- the \"cmp\" attribute will be ignoredfor the " | ||||
| + name + " EJB."); | + name + " EJB."); | ||||
| } | } | ||||
| if (hasession && (!beantype.equals(STATEFUL_SESSION))) { | |||||
| if (hasession && !beantype.equals(STATEFUL_SESSION)) { | |||||
| System.out.println( | System.out.println( | ||||
| "Highly available stubs and skeletons may only be generated for a Stateful Session Bean" | "Highly available stubs and skeletons may only be generated for a Stateful Session Bean" | ||||
| + "-- the \"hasession\" attribute will be ignored for the " | + "-- the \"hasession\" attribute will be ignored for the " | ||||
| @@ -207,7 +207,7 @@ public class IPlanetEjbcTask extends Task { | |||||
| "The standard EJB descriptor must be specified using the \"ejbdescriptor\" attribute."; | "The standard EJB descriptor must be specified using the \"ejbdescriptor\" attribute."; | ||||
| throw new BuildException(msg, getLocation()); | throw new BuildException(msg, getLocation()); | ||||
| } | } | ||||
| if ((!ejbdescriptor.exists()) || (!ejbdescriptor.isFile())) { | |||||
| if (!ejbdescriptor.exists() || !ejbdescriptor.isFile()) { | |||||
| String msg = "The standard EJB descriptor (" + ejbdescriptor | String msg = "The standard EJB descriptor (" + ejbdescriptor | ||||
| + ") was not found or isn't a file."; | + ") was not found or isn't a file."; | ||||
| throw new BuildException(msg, getLocation()); | throw new BuildException(msg, getLocation()); | ||||
| @@ -218,7 +218,7 @@ public class IPlanetEjbcTask extends Task { | |||||
| "The iAS-speific XML descriptor must be specified using the \"iasdescriptor\" attribute."; | "The iAS-speific XML descriptor must be specified using the \"iasdescriptor\" attribute."; | ||||
| throw new BuildException(msg, getLocation()); | throw new BuildException(msg, getLocation()); | ||||
| } | } | ||||
| if ((!iasdescriptor.exists()) || (!iasdescriptor.isFile())) { | |||||
| if (!iasdescriptor.exists() || !iasdescriptor.isFile()) { | |||||
| String msg = "The iAS-specific XML descriptor (" + iasdescriptor | String msg = "The iAS-specific XML descriptor (" + iasdescriptor | ||||
| + ") was not found or isn't a file."; | + ") was not found or isn't a file."; | ||||
| throw new BuildException(msg, getLocation()); | throw new BuildException(msg, getLocation()); | ||||
| @@ -229,13 +229,13 @@ public class IPlanetEjbcTask extends Task { | |||||
| "The destination directory must be specified using the \"dest\" attribute."; | "The destination directory must be specified using the \"dest\" attribute."; | ||||
| throw new BuildException(msg, getLocation()); | throw new BuildException(msg, getLocation()); | ||||
| } | } | ||||
| if ((!dest.exists()) || (!dest.isDirectory())) { | |||||
| if (!dest.exists() || !dest.isDirectory()) { | |||||
| String msg = "The destination directory (" + dest | String msg = "The destination directory (" + dest | ||||
| + ") was not found or isn't a directory."; | + ") was not found or isn't a directory."; | ||||
| throw new BuildException(msg, getLocation()); | throw new BuildException(msg, getLocation()); | ||||
| } | } | ||||
| if ((iashome != null) && (!iashome.isDirectory())) { | |||||
| if (iashome != null && !iashome.isDirectory()) { | |||||
| String msg = | String msg = | ||||
| "If \"iashome\" is specified, it must be a valid directory (it was set to " | "If \"iashome\" is specified, it must be a valid directory (it was set to " | ||||
| + iashome + ")."; | + iashome + ")."; | ||||
| @@ -713,8 +713,8 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool { | |||||
| JarEntry genericEntry = genericEntries.get(filepath); | JarEntry genericEntry = genericEntries.get(filepath); | ||||
| JarEntry wlEntry = wlEntries.get(filepath); | JarEntry wlEntry = wlEntries.get(filepath); | ||||
| if ((genericEntry.getCrc() != wlEntry.getCrc()) | |||||
| || (genericEntry.getSize() != wlEntry.getSize())) { | |||||
| if (genericEntry.getCrc() != wlEntry.getCrc() | |||||
| || genericEntry.getSize() != wlEntry.getSize()) { | |||||
| if (genericEntry.getName().endsWith(".class")) { | if (genericEntry.getName().endsWith(".class")) { | ||||
| //File are different see if its an object or an interface | //File are different see if its an object or an interface | ||||
| @@ -696,8 +696,8 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool { | |||||
| JarEntry genericEntry = genericEntries.get(filepath); | JarEntry genericEntry = genericEntries.get(filepath); | ||||
| JarEntry wasEntry = wasEntries.get(filepath); | JarEntry wasEntry = wasEntries.get(filepath); | ||||
| if ((genericEntry.getCrc() != wasEntry.getCrc()) | |||||
| || (genericEntry.getSize() != wasEntry.getSize())) { | |||||
| if (genericEntry.getCrc() != wasEntry.getCrc() | |||||
| || genericEntry.getSize() != wasEntry.getSize()) { | |||||
| if (genericEntry.getName().endsWith(".class")) { | if (genericEntry.getName().endsWith(".class")) { | ||||
| //File are different see if its an object or an interface | //File are different see if its an object or an interface | ||||
| @@ -88,7 +88,7 @@ public class WebLogicHotDeploymentTool extends AbstractHotDeploymentTool | |||||
| String action = getTask().getAction(); | String action = getTask().getAction(); | ||||
| // check that the password has been set | // check that the password has been set | ||||
| if ((getPassword() == null)) { | |||||
| if (getPassword() == null) { | |||||
| throw new BuildException("The password attribute must be set."); | throw new BuildException("The password attribute must be set."); | ||||
| } | } | ||||
| @@ -191,7 +191,7 @@ public class JJDoc extends Task { | |||||
| suffix = DEFAULT_SUFFIX_TEXT; | suffix = DEFAULT_SUFFIX_TEXT; | ||||
| } | } | ||||
| if ((optionalOutputFile == null) || optionalOutputFile.isEmpty()) { | |||||
| if (optionalOutputFile == null || optionalOutputFile.isEmpty()) { | |||||
| int filePos = javaccFile.lastIndexOf('/'); | int filePos = javaccFile.lastIndexOf('/'); | ||||
| if (filePos >= 0) { | if (filePos >= 0) { | ||||
| @@ -302,7 +302,7 @@ public class JJTree extends Task { | |||||
| outputDir); | outputDir); | ||||
| String jjtreeFile = destFile.getAbsolutePath().replace('\\', '/'); | String jjtreeFile = destFile.getAbsolutePath().replace('\\', '/'); | ||||
| if ((optionalOutputFile == null) || optionalOutputFile.isEmpty()) { | |||||
| if (optionalOutputFile == null || optionalOutputFile.isEmpty()) { | |||||
| int filePos = jjtreeFile.lastIndexOf('/'); | int filePos = jjtreeFile.lastIndexOf('/'); | ||||
| if (filePos >= 0) { | if (filePos >= 0) { | ||||
| @@ -325,7 +325,7 @@ public class JJTree extends Task { | |||||
| } | } | ||||
| } | } | ||||
| if ((outputDir == null) || outputDir.isEmpty()) { | |||||
| if (outputDir == null || outputDir.isEmpty()) { | |||||
| outputDir = getDefaultOutputDirectory(); | outputDir = getDefaultOutputDirectory(); | ||||
| } | } | ||||
| @@ -350,7 +350,7 @@ public class JJTree extends Task { | |||||
| return null; | return null; | ||||
| } | } | ||||
| if ((outputDir == null) | |||||
| if (outputDir == null | |||||
| && (destFile.startsWith("/") || destFile.startsWith("\\"))) { | && (destFile.startsWith("/") || destFile.startsWith("\\"))) { | ||||
| String relativeOutputFile = makeOutputFileRelative(destFile); | String relativeOutputFile = makeOutputFileRelative(destFile); | ||||
| setOutputfile(relativeOutputFile); | setOutputfile(relativeOutputFile); | ||||
| @@ -2168,7 +2168,7 @@ public class JUnitTask extends Task { | |||||
| if (test.shouldRun(getProject())) { | if (test.shouldRun(getProject())) { | ||||
| /* with multi-threaded runs need to defer execution of even */ | /* with multi-threaded runs need to defer execution of even */ | ||||
| /* individual tests so the threads can pick tests off the queue. */ | /* individual tests so the threads can pick tests off the queue. */ | ||||
| if ((runIndividual || !test.getFork()) && (threads == 1)) { | |||||
| if ((runIndividual || !test.getFork()) && threads == 1) { | |||||
| execute(test, 0); | execute(test, 0); | ||||
| } else { | } else { | ||||
| testConfigurations | testConfigurations | ||||
| @@ -221,7 +221,7 @@ public class JUnitTest extends BaseTest implements Cloneable { | |||||
| * @since 1.8.2 | * @since 1.8.2 | ||||
| */ | */ | ||||
| String getMethodsString() { | String getMethodsString() { | ||||
| if ((methodsList == null) && methodsSpecified) { | |||||
| if (methodsList == null && methodsSpecified) { | |||||
| if (methods.length == 0) { | if (methods.length == 0) { | ||||
| methodsList = ""; | methodsList = ""; | ||||
| } else if (methods.length == 1) { | } else if (methods.length == 1) { | ||||
| @@ -246,7 +246,7 @@ public class JUnitTest extends BaseTest implements Cloneable { | |||||
| * @since 1.8.2 | * @since 1.8.2 | ||||
| */ | */ | ||||
| void resolveMethods() { | void resolveMethods() { | ||||
| if ((methods == null) && methodsSpecified) { | |||||
| if (methods == null && methodsSpecified) { | |||||
| try { | try { | ||||
| methods = parseTestMethodNamesList(methodsList); | methods = parseTestMethodNamesList(methodsList); | ||||
| } catch (IllegalArgumentException ex) { | } catch (IllegalArgumentException ex) { | ||||
| @@ -1708,7 +1708,7 @@ public class FTP extends Task implements FTPTaskConfig { | |||||
| throw new BuildException("password attribute must be set!"); | throw new BuildException("password attribute must be set!"); | ||||
| } | } | ||||
| if ((action == LIST_FILES) && (listing == null)) { | |||||
| if (action == LIST_FILES && listing == null) { | |||||
| throw new BuildException( | throw new BuildException( | ||||
| "listing attribute must be set for list action!"); | "listing attribute must be set for list action!"); | ||||
| } | } | ||||
| @@ -1783,12 +1783,12 @@ public class FTP extends Task implements FTPTaskConfig { | |||||
| } | } | ||||
| String dir = null; | String dir = null; | ||||
| if ((ds.getBasedir() == null) | |||||
| && ((action == SEND_FILES) || (action == GET_FILES))) { | |||||
| if (ds.getBasedir() == null | |||||
| && (action == SEND_FILES || action == GET_FILES)) { | |||||
| throw new BuildException( | throw new BuildException( | ||||
| "the dir attribute must be set for send and get actions"); | "the dir attribute must be set for send and get actions"); | ||||
| } | } | ||||
| if ((action == SEND_FILES) || (action == GET_FILES)) { | |||||
| if (action == SEND_FILES || action == GET_FILES) { | |||||
| dir = ds.getBasedir().getAbsolutePath(); | dir = ds.getBasedir().getAbsolutePath(); | ||||
| } | } | ||||
| @@ -744,7 +744,7 @@ public class FTPTask extends Task implements FTPTaskConfig { | |||||
| throw new BuildException("password attribute must be set!"); | throw new BuildException("password attribute must be set!"); | ||||
| } | } | ||||
| if ((action == LIST_FILES) && (listing == null)) { | |||||
| if (action == LIST_FILES && listing == null) { | |||||
| throw new BuildException( | throw new BuildException( | ||||
| "listing attribute must be set for list action!"); | "listing attribute must be set for list action!"); | ||||
| } | } | ||||
| @@ -1158,15 +1158,13 @@ public class FTPTaskMirrorImpl implements FTPTaskMirror { | |||||
| dsfiles = ds.getIncludedFiles(); | dsfiles = ds.getIncludedFiles(); | ||||
| } | } | ||||
| if ((ds.getBasedir() == null) | |||||
| && ((task.getAction() == FTPTask.SEND_FILES) | |||||
| || (task.getAction() == FTPTask.GET_FILES))) { | |||||
| if (ds.getBasedir() == null | |||||
| && (task.getAction() == FTPTask.SEND_FILES || task.getAction() == FTPTask.GET_FILES)) { | |||||
| throw new BuildException( | throw new BuildException( | ||||
| "the dir attribute must be set for send and get actions"); | "the dir attribute must be set for send and get actions"); | ||||
| } | } | ||||
| String dir = null; | String dir = null; | ||||
| if ((task.getAction() == FTPTask.SEND_FILES) | |||||
| || (task.getAction() == FTPTask.GET_FILES)) { | |||||
| if (task.getAction() == FTPTask.SEND_FILES || task.getAction() == FTPTask.GET_FILES) { | |||||
| dir = ds.getBasedir().getAbsolutePath(); | dir = ds.getBasedir().getAbsolutePath(); | ||||
| } | } | ||||
| @@ -70,7 +70,7 @@ public class FileList extends DataType implements ResourceCollection { | |||||
| */ | */ | ||||
| @Override | @Override | ||||
| public void setRefid(Reference r) throws BuildException { | public void setRefid(Reference r) throws BuildException { | ||||
| if ((dir != null) || (!filenames.isEmpty())) { | |||||
| if (dir != null || !filenames.isEmpty()) { | |||||
| throw tooManyAttributes(); | throw tooManyAttributes(); | ||||
| } | } | ||||
| super.setRefid(r); | super.setRefid(r); | ||||
| @@ -159,7 +159,7 @@ public class PatternSet extends DataType implements Cloneable { | |||||
| } else { | } else { | ||||
| buf.append(name); | buf.append(name); | ||||
| } | } | ||||
| if ((ifCond != null) || (unlessCond != null)) { | |||||
| if (ifCond != null || unlessCond != null) { | |||||
| buf.append(":"); | buf.append(":"); | ||||
| String connector = ""; | String connector = ""; | ||||
| @@ -435,7 +435,7 @@ public class XMLCatalog extends DataType | |||||
| } else { | } else { | ||||
| baseURL = new URL(base); | baseURL = new URL(base); | ||||
| } | } | ||||
| URL url = (uri.length() == 0 ? baseURL : new URL(baseURL, uri)); | |||||
| URL url = uri.isEmpty() ? baseURL : new URL(baseURL, uri); | |||||
| source.setInputSource(new InputSource(url.toString())); | source.setInputSource(new InputSource(url.toString())); | ||||
| } catch (MalformedURLException ex) { | } catch (MalformedURLException ex) { | ||||
| // At this point we are probably in failure mode, but | // At this point we are probably in failure mode, but | ||||
| @@ -117,7 +117,7 @@ public class DigestAlgorithm implements Algorithm { | |||||
| return; | return; | ||||
| } | } | ||||
| if ((provider != null) && !"".equals(provider) && !"null".equals(provider)) { | |||||
| if (provider != null && !provider.isEmpty() && !"null".equals(provider)) { | |||||
| try { | try { | ||||
| messageDigest = MessageDigest.getInstance(algorithm, provider); | messageDigest = MessageDigest.getInstance(algorithm, provider); | ||||
| } catch (NoSuchAlgorithmException | NoSuchProviderException e) { | } catch (NoSuchAlgorithmException | NoSuchProviderException e) { | ||||
| @@ -130,7 +130,7 @@ public class PropertiesfileCache implements Cache { | |||||
| */ | */ | ||||
| @Override | @Override | ||||
| public void load() { | public void load() { | ||||
| if ((cachefile != null) && cachefile.isFile() && cachefile.canRead()) { | |||||
| if (cachefile != null && cachefile.isFile() && cachefile.canRead()) { | |||||
| try (BufferedInputStream bis = new BufferedInputStream( | try (BufferedInputStream bis = new BufferedInputStream( | ||||
| Files.newInputStream(cachefile.toPath()))) { | Files.newInputStream(cachefile.toPath()))) { | ||||
| cache.load(bis); | cache.load(bis); | ||||
| @@ -155,7 +155,7 @@ public class PropertiesfileCache implements Cache { | |||||
| if (!cacheDirty) { | if (!cacheDirty) { | ||||
| return; | return; | ||||
| } | } | ||||
| if ((cachefile != null) && cache.propertyNames().hasMoreElements()) { | |||||
| if (cachefile != null && cache.propertyNames().hasMoreElements()) { | |||||
| try (BufferedOutputStream bos = new BufferedOutputStream( | try (BufferedOutputStream bos = new BufferedOutputStream( | ||||
| Files.newOutputStream(cachefile.toPath()))) { | Files.newOutputStream(cachefile.toPath()))) { | ||||
| cache.store(bos, null); | cache.store(bos, null); | ||||
| @@ -666,7 +666,7 @@ public class FileUtils { | |||||
| filename = filename.replace('/', sep).replace('\\', sep); | filename = filename.replace('/', sep).replace('\\', sep); | ||||
| char c = filename.charAt(0); | char c = filename.charAt(0); | ||||
| if (!ON_DOS && !ON_NETWARE) { | if (!ON_DOS && !ON_NETWARE) { | ||||
| return (c == sep); | |||||
| return c == sep; | |||||
| } | } | ||||
| if (c == sep) { | if (c == sep) { | ||||
| // CheckStyle:MagicNumber OFF | // CheckStyle:MagicNumber OFF | ||||
| @@ -53,7 +53,7 @@ public abstract class LineOrientedOutputStream extends OutputStream { | |||||
| @Override | @Override | ||||
| public final void write(int cc) throws IOException { | public final void write(int cc) throws IOException { | ||||
| final byte c = (byte) cc; | final byte c = (byte) cc; | ||||
| if ((c == LF) || (c == CR)) { | |||||
| if (c == LF || c == CR) { | |||||
| if (!skip) { | if (!skip) { | ||||
| processBuffer(); | processBuffer(); | ||||
| } | } | ||||
| @@ -110,7 +110,7 @@ public class DependencyVisitor extends EmptyVisitor { | |||||
| } | } | ||||
| // Check to see if it's an inner class 'com.company.Class$Inner' | // Check to see if it's an inner class 'com.company.Class$Inner' | ||||
| // CheckStyle:MagicNumber OFF | // CheckStyle:MagicNumber OFF | ||||
| if ((start > 0x40) && (start < 0x5B)) { | |||||
| if (start > 0x40 && start < 0x5B) { | |||||
| // first letter of the previous segment of the class name 'Class' | // first letter of the previous segment of the class name 'Class' | ||||
| // is upper case ascii. so according to the spec it's an inner class | // is upper case ascii. so according to the spec it's an inner class | ||||
| classname = classname.substring(0, index) + "$" | classname = classname.substring(0, index) + "$" | ||||
| @@ -288,7 +288,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants { | |||||
| } | } | ||||
| int blockSize = this.in.read(); | int blockSize = this.in.read(); | ||||
| if ((blockSize < '1') || (blockSize > '9')) { | |||||
| if (blockSize < '1' || blockSize > '9') { | |||||
| throw new IOException("Stream is not BZip2 formatted: illegal " | throw new IOException("Stream is not BZip2 formatted: illegal " | ||||
| + "blocksize " + (char) blockSize); | + "blocksize " + (char) blockSize); | ||||
| } | } | ||||
| @@ -662,7 +662,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants { | |||||
| int minLens_zt = minLens[zt]; | int minLens_zt = minLens[zt]; | ||||
| while (nextSym != eob) { | while (nextSym != eob) { | ||||
| if ((nextSym == RUNA) || (nextSym == RUNB)) { | |||||
| if (nextSym == RUNA || nextSym == RUNB) { | |||||
| int s = -1; | int s = -1; | ||||
| for (int n = 1; true; n <<= 1) { | for (int n = 1; true; n <<= 1) { | ||||
| @@ -855,7 +855,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants { | |||||
| tt[cftab[ll8[i] & 0xff]++] = i; | tt[cftab[ll8[i] & 0xff]++] = i; | ||||
| } | } | ||||
| if ((this.origPtr < 0) || (this.origPtr >= tt.length)) { | |||||
| if (this.origPtr < 0 || this.origPtr >= tt.length) { | |||||
| throw new IOException("stream corrupted"); | throw new IOException("stream corrupted"); | ||||
| } | } | ||||
| @@ -1039,7 +1039,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants { | |||||
| // it can happen, if the compressor mixed small and large | // it can happen, if the compressor mixed small and large | ||||
| // blocks. Normally only the last block will be smaller | // blocks. Normally only the last block will be smaller | ||||
| // than others. | // than others. | ||||
| if ((ttShadow == null) || (ttShadow.length < length)) { | |||||
| if (ttShadow == null || ttShadow.length < length) { | |||||
| this.tt = ttShadow = new int[length]; | this.tt = ttShadow = new int[length]; | ||||
| } | } | ||||
| @@ -1008,18 +1008,17 @@ public class CBZip2OutputStream extends OutputStream | |||||
| int ge = gs - 1; | int ge = gs - 1; | ||||
| int aFreq = 0; | int aFreq = 0; | ||||
| for (final int a = alphaSize - 1; (aFreq < tFreq) && (ge < a);) { | |||||
| while (aFreq < tFreq && ge < alphaSize - 1) { | |||||
| aFreq += mtfFreq[++ge]; | aFreq += mtfFreq[++ge]; | ||||
| } | } | ||||
| if ((ge > gs) && (nPart != nGroups) && (nPart != 1) | |||||
| && (((nGroups - nPart) & 1) != 0)) { | |||||
| if (ge > gs && nPart != nGroups && nPart != 1 && (nGroups - nPart & 1) != 0) { | |||||
| aFreq -= mtfFreq[ge--]; | aFreq -= mtfFreq[ge--]; | ||||
| } | } | ||||
| final byte[] len_np = len[nPart - 1]; | final byte[] len_np = len[nPart - 1]; | ||||
| for (int v = alphaSize; --v >= 0;) { | for (int v = alphaSize; --v >= 0;) { | ||||
| if ((v >= gs) && (v <= ge)) { | |||||
| if (v >= gs && v <= ge) { | |||||
| len_np[v] = LESSER_ICOST; | len_np[v] = LESSER_ICOST; | ||||
| } else { | } else { | ||||
| len_np[v] = GREATER_ICOST; | len_np[v] = GREATER_ICOST; | ||||
| @@ -402,7 +402,7 @@ public abstract class BuildFileTest extends TestCase { | |||||
| executeTarget(target); | executeTarget(target); | ||||
| } catch (BuildException ex) { | } catch (BuildException ex) { | ||||
| buildException = ex; | buildException = ex; | ||||
| if ((null != msg) && (!ex.getMessage().equals(msg))) { | |||||
| if (null != msg && !ex.getMessage().equals(msg)) { | |||||
| fail("Should throw BuildException because '" + cause | fail("Should throw BuildException because '" + cause | ||||
| + "' with message '" + msg | + "' with message '" + msg | ||||
| + "' (actual message '" + ex.getMessage() + "' instead)"); | + "' (actual message '" + ex.getMessage() + "' instead)"); | ||||
| @@ -100,7 +100,7 @@ public class ParallelTest { | |||||
| int firstPipe = s.indexOf('|', start); | int firstPipe = s.indexOf('|', start); | ||||
| int beginSlash = s.indexOf('/', firstPipe); | int beginSlash = s.indexOf('/', firstPipe); | ||||
| int lastPipe = s.indexOf('|', beginSlash); | int lastPipe = s.indexOf('|', beginSlash); | ||||
| if ((firstPipe == -1) || (beginSlash == -1) || (lastPipe == -1)) { | |||||
| if (firstPipe == -1 || beginSlash == -1 || lastPipe == -1) { | |||||
| return -1; | return -1; | ||||
| } | } | ||||