| @@ -307,11 +307,11 @@ public class AntTypeDefinition { | |||||
| // DataType can have a "no arg" constructor or take a single | // DataType can have a "no arg" constructor or take a single | ||||
| // Project argument. | // Project argument. | ||||
| try { | try { | ||||
| ctor = newclass.getConstructor(new Class[0]); | |||||
| ctor = newclass.getConstructor(); | |||||
| noArg = true; | noArg = true; | ||||
| } catch (NoSuchMethodException nse) { | } catch (NoSuchMethodException nse) { | ||||
| //can throw the same exception, if there is no this(Project) ctor. | //can throw the same exception, if there is no this(Project) ctor. | ||||
| ctor = newclass.getConstructor(new Class[] {Project.class}); | |||||
| ctor = newclass.getConstructor(Project.class); | |||||
| noArg = false; | noArg = false; | ||||
| } | } | ||||
| //now we instantiate | //now we instantiate | ||||
| @@ -750,7 +750,7 @@ public class ComponentHelper { | |||||
| */ | */ | ||||
| public void exitAntLib() { | public void exitAntLib() { | ||||
| antLibStack.pop(); | antLibStack.pop(); | ||||
| antLibCurrentUri = (antLibStack.isEmpty()) ? null : (String) antLibStack.peek(); | |||||
| antLibCurrentUri = (antLibStack.isEmpty()) ? null : antLibStack.peek(); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -18,7 +18,6 @@ | |||||
| package org.apache.tools.ant; | package org.apache.tools.ant; | ||||
| import java.io.File; | import java.io.File; | ||||
| import java.io.FilenameFilter; | |||||
| import java.io.IOException; | import java.io.IOException; | ||||
| import java.io.InputStream; | import java.io.InputStream; | ||||
| import java.io.OutputStream; | import java.io.OutputStream; | ||||
| @@ -122,8 +121,7 @@ public final class Diagnostics { | |||||
| * @return array of files (or null for no such directory) | * @return array of files (or null for no such directory) | ||||
| */ | */ | ||||
| private static File[] listJarFiles(File libDir) { | private static File[] listJarFiles(File libDir) { | ||||
| return libDir | |||||
| .listFiles((FilenameFilter) (dir, name) -> name.endsWith(".jar")); | |||||
| return libDir.listFiles((dir, name) -> name.endsWith(".jar")); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -451,7 +449,7 @@ public final class Diagnostics { | |||||
| try { | try { | ||||
| Class<?> which = Class.forName("org.apache.env.Which"); | Class<?> which = Class.forName("org.apache.env.Which"); | ||||
| Method method = which.getMethod( | Method method = which.getMethod( | ||||
| "main", new Class[] {String[].class}); | |||||
| "main", String[].class); | |||||
| method.invoke(null, new Object[]{new String[]{}}); | method.invoke(null, new Object[]{new String[]{}}); | ||||
| } catch (ClassNotFoundException e) { | } catch (ClassNotFoundException e) { | ||||
| out.println("Not available."); | out.println("Not available."); | ||||
| @@ -616,9 +616,7 @@ public class DirectoryScanner | |||||
| public static void resetDefaultExcludes() { | public static void resetDefaultExcludes() { | ||||
| synchronized (defaultExcludes) { | synchronized (defaultExcludes) { | ||||
| defaultExcludes.clear(); | defaultExcludes.clear(); | ||||
| for (String element : DEFAULTEXCLUDES) { | |||||
| defaultExcludes.add(element); | |||||
| } | |||||
| Collections.addAll(defaultExcludes, DEFAULTEXCLUDES); | |||||
| } | } | ||||
| } | } | ||||
| @@ -1046,16 +1044,11 @@ public class DirectoryScanner | |||||
| private boolean shouldSkipPattern(final String pattern) { | private boolean shouldSkipPattern(final String pattern) { | ||||
| if (FileUtils.isAbsolutePath(pattern)) { | if (FileUtils.isAbsolutePath(pattern)) { | ||||
| //skip abs. paths not under basedir, if set: | //skip abs. paths not under basedir, if set: | ||||
| if (!(basedir == null || SelectorUtils.matchPatternStart(pattern, | |||||
| basedir.getAbsolutePath(), | |||||
| isCaseSensitive()))) { | |||||
| return true; | |||||
| } | |||||
| } else if (basedir == null) { | |||||
| //skip non-abs. paths if basedir == null: | |||||
| return true; | |||||
| return !(basedir == null || SelectorUtils.matchPatternStart(pattern, | |||||
| basedir.getAbsolutePath(), isCaseSensitive())); | |||||
| } | } | ||||
| return false; | |||||
| return basedir == null; | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -1823,9 +1816,9 @@ public class DirectoryScanner | |||||
| final String target = f.getCanonicalPath(); | final String target = f.getCanonicalPath(); | ||||
| files.add(target); | files.add(target); | ||||
| String relPath = ""; | |||||
| StringBuilder relPath = new StringBuilder(); | |||||
| for (final String dir : directoryNamesFollowed) { | for (final String dir : directoryNamesFollowed) { | ||||
| relPath += "../"; | |||||
| relPath.append("../"); | |||||
| if (dirName.equals(dir)) { | if (dirName.equals(dir)) { | ||||
| f = FILE_UTILS.resolveFile(parent, relPath + dir); | f = FILE_UTILS.resolveFile(parent, relPath + dir); | ||||
| files.add(f.getCanonicalPath()); | files.add(f.getCanonicalPath()); | ||||
| @@ -307,13 +307,8 @@ public final class IntrospectionHelper { | |||||
| * @return true if the given set method is to be hidden. | * @return true if the given set method is to be hidden. | ||||
| */ | */ | ||||
| private boolean isHiddenSetMethod(final String name, final Class<?> type) { | private boolean isHiddenSetMethod(final String name, final Class<?> type) { | ||||
| if ("setLocation".equals(name) && Location.class.equals(type)) { | |||||
| return true; | |||||
| } | |||||
| if ("setTaskType".equals(name) && String.class.equals(type)) { | |||||
| return true; | |||||
| } | |||||
| return false; | |||||
| return "setLocation".equals(name) && Location.class.equals(type) | |||||
| || "setTaskType".equals(name) && String.class.equals(type); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -472,7 +467,7 @@ public final class IntrospectionHelper { | |||||
| + " doesn't support nested text data (\"" + condenseText(text) + "\")."); | + " doesn't support nested text data (\"" + condenseText(text) + "\")."); | ||||
| } | } | ||||
| try { | try { | ||||
| addText.invoke(element, new Object[] {text}); | |||||
| addText.invoke(element, text); | |||||
| } catch (final IllegalAccessException ie) { | } catch (final IllegalAccessException ie) { | ||||
| // impossible as getMethods should only return public methods | // impossible as getMethods should only return public methods | ||||
| throw new BuildException(ie); | throw new BuildException(ie); | ||||
| @@ -955,7 +950,7 @@ public final class IntrospectionHelper { | |||||
| */ | */ | ||||
| public Map<String, Class<?>> getAttributeMap() { | public Map<String, Class<?>> getAttributeMap() { | ||||
| return attributeTypes.isEmpty() | return attributeTypes.isEmpty() | ||||
| ? Collections.<String, Class<?>> emptyMap() : Collections.unmodifiableMap(attributeTypes); | |||||
| ? Collections.emptyMap() : Collections.unmodifiableMap(attributeTypes); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -980,7 +975,7 @@ public final class IntrospectionHelper { | |||||
| */ | */ | ||||
| public Map<String, Class<?>> getNestedElementMap() { | public Map<String, Class<?>> getNestedElementMap() { | ||||
| return nestedTypes.isEmpty() | return nestedTypes.isEmpty() | ||||
| ? Collections.<String, Class<?>> emptyMap() : Collections.unmodifiableMap(nestedTypes); | |||||
| ? Collections.emptyMap() : Collections.unmodifiableMap(nestedTypes); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -1002,7 +997,7 @@ public final class IntrospectionHelper { | |||||
| */ | */ | ||||
| public List<Method> getExtensionPoints() { | public List<Method> getExtensionPoints() { | ||||
| return addTypeMethods.isEmpty() | return addTypeMethods.isEmpty() | ||||
| ? Collections.<Method> emptyList() : Collections.unmodifiableList(addTypeMethods); | |||||
| ? Collections.emptyList() : Collections.unmodifiableList(addTypeMethods); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -1078,7 +1073,7 @@ public final class IntrospectionHelper { | |||||
| throw new BuildException("The value \"\" is not a " | throw new BuildException("The value \"\" is not a " | ||||
| + "legal value for attribute \"" + attrName + "\""); | + "legal value for attribute \"" + attrName + "\""); | ||||
| } | } | ||||
| m.invoke(parent, (Object[]) new Character[] {new Character(value.charAt(0))}); | |||||
| m.invoke(parent, (Object[]) new Character[] {value.charAt(0)}); | |||||
| } | } | ||||
| }; | }; | ||||
| } | } | ||||
| @@ -1100,7 +1095,7 @@ public final class IntrospectionHelper { | |||||
| public void set(final Project p, final Object parent, final String value) | public void set(final Project p, final Object parent, final String value) | ||||
| throws InvocationTargetException, IllegalAccessException, BuildException { | throws InvocationTargetException, IllegalAccessException, BuildException { | ||||
| try { | try { | ||||
| m.invoke(parent, new Object[] {Class.forName(value)}); | |||||
| m.invoke(parent, Class.forName(value)); | |||||
| } catch (final ClassNotFoundException ce) { | } catch (final ClassNotFoundException ce) { | ||||
| throw new BuildException(ce); | throw new BuildException(ce); | ||||
| } | } | ||||
| @@ -1113,7 +1108,7 @@ public final class IntrospectionHelper { | |||||
| @Override | @Override | ||||
| public void set(final Project p, final Object parent, final String value) | public void set(final Project p, final Object parent, final String value) | ||||
| throws InvocationTargetException, IllegalAccessException { | throws InvocationTargetException, IllegalAccessException { | ||||
| m.invoke(parent, new Object[] {p.resolveFile(value)}); | |||||
| m.invoke(parent, p.resolveFile(value)); | |||||
| } | } | ||||
| }; | }; | ||||
| } | } | ||||
| @@ -1122,7 +1117,7 @@ public final class IntrospectionHelper { | |||||
| return new AttributeSetter(m, arg) { | return new AttributeSetter(m, arg) { | ||||
| @Override | @Override | ||||
| public void set(final Project p, final Object parent, final String value) throws InvocationTargetException, IllegalAccessException { | public void set(final Project p, final Object parent, final String value) throws InvocationTargetException, IllegalAccessException { | ||||
| m.invoke(parent, new Object[] { p.resolveFile(value).toPath() }); | |||||
| m.invoke(parent, p.resolveFile(value).toPath()); | |||||
| } | } | ||||
| }; | }; | ||||
| } | } | ||||
| @@ -1133,7 +1128,7 @@ public final class IntrospectionHelper { | |||||
| @Override | @Override | ||||
| void set(final Project p, final Object parent, final String value) throws InvocationTargetException, | void set(final Project p, final Object parent, final String value) throws InvocationTargetException, | ||||
| IllegalAccessException, BuildException { | IllegalAccessException, BuildException { | ||||
| m.invoke(parent, new Object[] {new FileResource(p, p.resolveFile(value))}); | |||||
| m.invoke(parent, new FileResource(p, p.resolveFile(value))); | |||||
| } | } | ||||
| }; | }; | ||||
| } | } | ||||
| @@ -1146,7 +1141,7 @@ public final class IntrospectionHelper { | |||||
| try { | try { | ||||
| final EnumeratedAttribute ea = (EnumeratedAttribute) reflectedArg.newInstance(); | final EnumeratedAttribute ea = (EnumeratedAttribute) reflectedArg.newInstance(); | ||||
| ea.setValue(value); | ea.setValue(value); | ||||
| m.invoke(parent, new Object[] {ea}); | |||||
| m.invoke(parent, ea); | |||||
| } catch (final InstantiationException ie) { | } catch (final InstantiationException ie) { | ||||
| throw new BuildException(ie); | throw new BuildException(ie); | ||||
| } | } | ||||
| @@ -1165,8 +1160,7 @@ public final class IntrospectionHelper { | |||||
| public void set(final Project p, final Object parent, final String value) | public void set(final Project p, final Object parent, final String value) | ||||
| throws InvocationTargetException, IllegalAccessException, BuildException { | throws InvocationTargetException, IllegalAccessException, BuildException { | ||||
| try { | try { | ||||
| m.invoke(parent, new Object[] { | |||||
| new Long(StringUtils.parseHumanSizes(value)) }); | |||||
| m.invoke(parent, StringUtils.parseHumanSizes(value)); | |||||
| } catch (final NumberFormatException e) { | } catch (final NumberFormatException e) { | ||||
| throw new BuildException("Can't assign non-numeric" | throw new BuildException("Can't assign non-numeric" | ||||
| + " value '" + value + "' to" | + " value '" + value + "' to" | ||||
| @@ -1216,7 +1210,7 @@ public final class IntrospectionHelper { | |||||
| if (p != null) { | if (p != null) { | ||||
| p.setProjectReference(attribute); | p.setProjectReference(attribute); | ||||
| } | } | ||||
| m.invoke(parent, new Object[] {attribute}); | |||||
| m.invoke(parent, attribute); | |||||
| } catch (final InvocationTargetException e) { | } catch (final InvocationTargetException e) { | ||||
| final Throwable cause = e.getCause(); | final Throwable cause = e.getCause(); | ||||
| if (cause instanceof IllegalArgumentException) { | if (cause instanceof IllegalArgumentException) { | ||||
| @@ -1434,7 +1428,7 @@ public final class IntrospectionHelper { | |||||
| @Override | @Override | ||||
| Object create(final Project project, final Object parent, final Object ignore) | Object create(final Project project, final Object parent, final Object ignore) | ||||
| throws InvocationTargetException, IllegalAccessException { | throws InvocationTargetException, IllegalAccessException { | ||||
| return getMethod().invoke(parent, new Object[] {}); | |||||
| return getMethod().invoke(parent); | |||||
| } | } | ||||
| } | } | ||||
| @@ -1485,7 +1479,7 @@ public final class IntrospectionHelper { | |||||
| private void istore(final Object parent, final Object child) | private void istore(final Object parent, final Object child) | ||||
| throws InvocationTargetException, IllegalAccessException, InstantiationException { | throws InvocationTargetException, IllegalAccessException, InstantiationException { | ||||
| getMethod().invoke(parent, new Object[] {child}); | |||||
| getMethod().invoke(parent, child); | |||||
| } | } | ||||
| } | } | ||||
| @@ -1514,7 +1508,7 @@ public final class IntrospectionHelper { | |||||
| useType = PRIMITIVE_TYPE_MAP.get(type); | useType = PRIMITIVE_TYPE_MAP.get(type); | ||||
| } | } | ||||
| if (value == null || useType.isInstance(value)) { | if (value == null || useType.isInstance(value)) { | ||||
| method.invoke(parent, new Object[] {value}); | |||||
| method.invoke(parent, value); | |||||
| return; | return; | ||||
| } | } | ||||
| } | } | ||||
| @@ -1578,7 +1572,7 @@ public final class IntrospectionHelper { | |||||
| Object create(final Project project, final Object parent, final Object ignore) | Object create(final Project project, final Object parent, final Object ignore) | ||||
| throws InvocationTargetException, IllegalAccessException { | throws InvocationTargetException, IllegalAccessException { | ||||
| if (!getMethod().getName().endsWith("Configured")) { | if (!getMethod().getName().endsWith("Configured")) { | ||||
| getMethod().invoke(parent, new Object[] {realObject}); | |||||
| getMethod().invoke(parent, realObject); | |||||
| } | } | ||||
| return nestedObject; | return nestedObject; | ||||
| } | } | ||||
| @@ -1592,7 +1586,7 @@ public final class IntrospectionHelper { | |||||
| void store(final Object parent, final Object child) throws InvocationTargetException, | void store(final Object parent, final Object child) throws InvocationTargetException, | ||||
| IllegalAccessException, InstantiationException { | IllegalAccessException, InstantiationException { | ||||
| if (getMethod().getName().endsWith("Configured")) { | if (getMethod().getName().endsWith("Configured")) { | ||||
| getMethod().invoke(parent, new Object[] {realObject}); | |||||
| getMethod().invoke(parent, realObject); | |||||
| } | } | ||||
| } | } | ||||
| }; | }; | ||||
| @@ -632,8 +632,8 @@ public class Main implements AntMain { | |||||
| + args[pos]); | + args[pos]); | ||||
| } | } | ||||
| if (threadPriority.intValue() < Thread.MIN_PRIORITY | |||||
| || threadPriority.intValue() > Thread.MAX_PRIORITY) { | |||||
| if (threadPriority < Thread.MIN_PRIORITY | |||||
| || threadPriority > Thread.MAX_PRIORITY) { | |||||
| throw new BuildException( | throw new BuildException( | ||||
| "Niceness value is out of the range 1-10"); | "Niceness value is out of the range 1-10"); | ||||
| } | } | ||||
| @@ -798,7 +798,7 @@ public class Main implements AntMain { | |||||
| try { | try { | ||||
| project.log("Setting Ant's thread priority to " | project.log("Setting Ant's thread priority to " | ||||
| + threadPriority, Project.MSG_VERBOSE); | + threadPriority, Project.MSG_VERBOSE); | ||||
| Thread.currentThread().setPriority(threadPriority.intValue()); | |||||
| Thread.currentThread().setPriority(threadPriority); | |||||
| } catch (final SecurityException swallowed) { | } catch (final SecurityException swallowed) { | ||||
| //we cannot set the priority here. | //we cannot set the priority here. | ||||
| project.log("A security manager refused to set the -nice value"); | project.log("A security manager refused to set the -nice value"); | ||||
| @@ -941,7 +941,7 @@ public class Main implements AntMain { | |||||
| for (int i = 0; i < count; i++) { | for (int i = 0; i < count; i++) { | ||||
| final String className = listeners.elementAt(i); | final String className = listeners.elementAt(i); | ||||
| final BuildListener listener = | final BuildListener listener = | ||||
| (BuildListener) ClasspathUtils.newInstance(className, | |||||
| ClasspathUtils.newInstance(className, | |||||
| Main.class.getClassLoader(), BuildListener.class); | Main.class.getClassLoader(), BuildListener.class); | ||||
| project.setProjectReference(listener); | project.setProjectReference(listener); | ||||
| @@ -962,7 +962,7 @@ public class Main implements AntMain { | |||||
| if (inputHandlerClassname == null) { | if (inputHandlerClassname == null) { | ||||
| handler = new DefaultInputHandler(); | handler = new DefaultInputHandler(); | ||||
| } else { | } else { | ||||
| handler = (InputHandler) ClasspathUtils.newInstance( | |||||
| handler = ClasspathUtils.newInstance( | |||||
| inputHandlerClassname, Main.class.getClassLoader(), | inputHandlerClassname, Main.class.getClassLoader(), | ||||
| InputHandler.class); | InputHandler.class); | ||||
| project.setProjectReference(handler); | project.setProjectReference(handler); | ||||
| @@ -984,7 +984,7 @@ public class Main implements AntMain { | |||||
| emacsMode = true; | emacsMode = true; | ||||
| } else if (loggerClassname != null) { | } else if (loggerClassname != null) { | ||||
| try { | try { | ||||
| logger = (BuildLogger) ClasspathUtils.newInstance( | |||||
| logger = ClasspathUtils.newInstance( | |||||
| loggerClassname, Main.class.getClassLoader(), | loggerClassname, Main.class.getClassLoader(), | ||||
| BuildLogger.class); | BuildLogger.class); | ||||
| } catch (final BuildException e) { | } catch (final BuildException e) { | ||||
| @@ -1088,13 +1088,10 @@ public class Main implements AntMain { | |||||
| props.load(in); | props.load(in); | ||||
| in.close(); | in.close(); | ||||
| shortAntVersion = props.getProperty("VERSION"); | shortAntVersion = props.getProperty("VERSION"); | ||||
| final StringBuffer msg = new StringBuffer(); | |||||
| msg.append("Apache Ant(TM) version "); | |||||
| msg.append(shortAntVersion); | |||||
| msg.append(" compiled on "); | |||||
| msg.append(props.getProperty("DATE")); | |||||
| antVersion = msg.toString(); | |||||
| antVersion = "Apache Ant(TM) version " + | |||||
| shortAntVersion + | |||||
| " compiled on " + | |||||
| props.getProperty("DATE"); | |||||
| } catch (final IOException ioe) { | } catch (final IOException ioe) { | ||||
| throw new BuildException("Could not load the version information:" | throw new BuildException("Could not load the version information:" | ||||
| + ioe.getMessage()); | + ioe.getMessage()); | ||||
| @@ -439,9 +439,7 @@ public class Project implements ResourceFactory { | |||||
| public Vector<BuildListener> getBuildListeners() { | public Vector<BuildListener> getBuildListeners() { | ||||
| synchronized (listenersLock) { | synchronized (listenersLock) { | ||||
| final Vector<BuildListener> r = new Vector<>(listeners.length); | final Vector<BuildListener> r = new Vector<>(listeners.length); | ||||
| for (BuildListener listener : listeners) { | |||||
| r.add(listener); | |||||
| } | |||||
| Collections.addAll(r, listeners); | |||||
| return r; | return r; | ||||
| } | } | ||||
| } | } | ||||
| @@ -264,7 +264,7 @@ public class ProjectHelper { | |||||
| * @since Ant 1.8.0 | * @since Ant 1.8.0 | ||||
| */ | */ | ||||
| public static void setInIncludeMode(boolean includeMode) { | public static void setInIncludeMode(boolean includeMode) { | ||||
| inIncludeMode.set(Boolean.valueOf(includeMode)); | |||||
| inIncludeMode.set(includeMode); | |||||
| } | } | ||||
| // -------------------- Parse method -------------------- | // -------------------- Parse method -------------------- | ||||
| @@ -381,8 +381,7 @@ public class PropertyHelper implements GetProperty { | |||||
| public static synchronized PropertyHelper getPropertyHelper(Project project) { | public static synchronized PropertyHelper getPropertyHelper(Project project) { | ||||
| PropertyHelper helper = null; | PropertyHelper helper = null; | ||||
| if (project != null) { | if (project != null) { | ||||
| helper = (PropertyHelper) project.getReference(MagicNames | |||||
| .REFID_PROPERTY_HELPER); | |||||
| helper = project.getReference(MagicNames.REFID_PROPERTY_HELPER); | |||||
| } | } | ||||
| if (helper != null) { | if (helper != null) { | ||||
| return helper; | return helper; | ||||
| @@ -440,11 +439,8 @@ public class PropertyHelper implements GetProperty { | |||||
| boolean inherited, boolean user, | boolean inherited, boolean user, | ||||
| boolean isNew) { | boolean isNew) { | ||||
| if (getNext() != null) { | if (getNext() != null) { | ||||
| boolean subst = getNext().setPropertyHook(ns, name, value, inherited, user, isNew); | |||||
| // If next has handled the property | // If next has handled the property | ||||
| if (subst) { | |||||
| return true; | |||||
| } | |||||
| return getNext().setPropertyHook(ns, name, value, inherited, user, isNew); | |||||
| } | } | ||||
| return false; | return false; | ||||
| } | } | ||||
| @@ -1118,7 +1114,7 @@ public class PropertyHelper implements GetProperty { | |||||
| protected <D extends Delegate> List<D> getDelegates(Class<D> type) { | protected <D extends Delegate> List<D> getDelegates(Class<D> type) { | ||||
| @SuppressWarnings("unchecked") | @SuppressWarnings("unchecked") | ||||
| final List<D> result = (List<D>) delegates.get(type); | final List<D> result = (List<D>) delegates.get(type); | ||||
| return result == null ? Collections.<D> emptyList() : result; | |||||
| return result == null ? Collections.emptyList() : result; | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -1193,7 +1189,7 @@ public class PropertyHelper implements GetProperty { | |||||
| private boolean evalAsBooleanOrPropertyName(Object value) { | private boolean evalAsBooleanOrPropertyName(Object value) { | ||||
| Boolean b = toBoolean(value); | Boolean b = toBoolean(value); | ||||
| if (b != null) { | if (b != null) { | ||||
| return b.booleanValue(); | |||||
| return b; | |||||
| } | } | ||||
| return getProperty(String.valueOf(value)) != null; | return getProperty(String.valueOf(value)) != null; | ||||
| } | } | ||||
| @@ -503,8 +503,7 @@ public class UnknownElement extends Task { | |||||
| * @return the name to use in logging messages. | * @return the name to use in logging messages. | ||||
| */ | */ | ||||
| public String getTaskName() { | public String getTaskName() { | ||||
| return realThing == null | |||||
| || !(realThing instanceof Task) ? super.getTaskName() | |||||
| return !(realThing instanceof Task) ? super.getTaskName() | |||||
| : ((Task) realThing).getTaskName(); | : ((Task) realThing).getTaskName(); | ||||
| } | } | ||||
| @@ -643,7 +642,7 @@ public class UnknownElement extends Task { | |||||
| } | } | ||||
| for (int i = 0; i < childrenSize; ++i) { | for (int i = 0; i < childrenSize; ++i) { | ||||
| // children cannot be null childrenSize would have been 0 | // children cannot be null childrenSize would have been 0 | ||||
| UnknownElement child = (UnknownElement) children.get(i); //NOSONAR | |||||
| UnknownElement child = children.get(i); //NOSONAR | |||||
| if (!child.similar(other.children.get(i))) { | if (!child.similar(other.children.get(i))) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| @@ -58,7 +58,7 @@ public abstract class BaseIfAttribute | |||||
| * @return val if positive or !val if not. | * @return val if positive or !val if not. | ||||
| */ | */ | ||||
| protected boolean convertResult(boolean val) { | protected boolean convertResult(boolean val) { | ||||
| return positive ? val : !val; | |||||
| return positive == val; | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -43,9 +43,8 @@ public class DispatchUtils { | |||||
| } else if (task instanceof UnknownElement) { | } else if (task instanceof UnknownElement) { | ||||
| UnknownElement ue = (UnknownElement) task; | UnknownElement ue = (UnknownElement) task; | ||||
| Object realThing = ue.getRealThing(); | Object realThing = ue.getRealThing(); | ||||
| if (realThing != null | |||||
| && realThing instanceof Dispatchable | |||||
| && realThing instanceof Task) { | |||||
| if (realThing instanceof Dispatchable | |||||
| && realThing instanceof Task) { | |||||
| dispatchable = (Dispatchable) realThing; | dispatchable = (Dispatchable) realThing; | ||||
| } | } | ||||
| } | } | ||||
| @@ -59,7 +58,7 @@ public class DispatchUtils { | |||||
| mName += name.substring(1); | mName += name.substring(1); | ||||
| } | } | ||||
| final Class<? extends Dispatchable> c = dispatchable.getClass(); | final Class<? extends Dispatchable> c = dispatchable.getClass(); | ||||
| final Method actionM = c.getMethod(mName, new Class[0]); | |||||
| final Method actionM = c.getMethod(mName); | |||||
| if (actionM != null) { | if (actionM != null) { | ||||
| final Object o = actionM.invoke(dispatchable, (Object[]) null); | final Object o = actionM.invoke(dispatchable, (Object[]) null); | ||||
| if (o != null) { | if (o != null) { | ||||
| @@ -68,7 +67,7 @@ public class DispatchUtils { | |||||
| methodName = s.trim(); | methodName = s.trim(); | ||||
| Method executeM = null; | Method executeM = null; | ||||
| executeM = dispatchable.getClass().getMethod( | executeM = dispatchable.getClass().getMethod( | ||||
| methodName, new Class[0]); | |||||
| methodName); | |||||
| if (executeM == null) { | if (executeM == null) { | ||||
| throw new BuildException( | throw new BuildException( | ||||
| "No public " + methodName + "() in " | "No public " + methodName + "() in " | ||||
| @@ -273,8 +273,8 @@ public final class FixCrLfFilter extends BaseParamFilterReader implements Chaina | |||||
| in = new MaskJavaTabLiteralsFilter(in); | in = new MaskJavaTabLiteralsFilter(in); | ||||
| } | } | ||||
| // Add/Remove tabs | // Add/Remove tabs | ||||
| in = (tabs == AddAsisRemove.ADD) ? (Reader) new AddTabFilter(in, getTablength()) | |||||
| : (Reader) new RemoveTabFilter(in, getTablength()); | |||||
| in = (tabs == AddAsisRemove.ADD) ? new AddTabFilter(in, getTablength()) | |||||
| : new RemoveTabFilter(in, getTablength()); | |||||
| } | } | ||||
| // Add missing EOF character | // Add missing EOF character | ||||
| in = (ctrlz == AddAsisRemove.ADD) ? new AddEofFilter(in) : in; | in = (ctrlz == AddAsisRemove.ADD) ? new AddEofFilter(in) : in; | ||||
| @@ -117,7 +117,7 @@ public final class LineContains | |||||
| for (line = readLine(); line != null; line = readLine()) { | for (line = readLine(); line != null; line = readLine()) { | ||||
| boolean matches = true; | boolean matches = true; | ||||
| for (int i = 0; matches && i < containsSize; i++) { | for (int i = 0; matches && i < containsSize; i++) { | ||||
| String containsStr = (String) contains.elementAt(i); | |||||
| String containsStr = contains.elementAt(i); | |||||
| matches = line.contains(containsStr); | matches = line.contains(containsStr); | ||||
| } | } | ||||
| if (matches ^ isNegated()) { | if (matches ^ isNegated()) { | ||||
| @@ -116,15 +116,13 @@ public final class LineContainsRegExp | |||||
| line = line.substring(1); | line = line.substring(1); | ||||
| } | } | ||||
| } else { | } else { | ||||
| final int regexpsSize = regexps.size(); | |||||
| for (line = readLine(); line != null; line = readLine()) { | for (line = readLine(); line != null; line = readLine()) { | ||||
| boolean matches = true; | boolean matches = true; | ||||
| for (int i = 0; matches && i < regexpsSize; i++) { | |||||
| RegularExpression regexp | |||||
| = (RegularExpression) regexps.elementAt(i); | |||||
| Regexp re = regexp.getRegexp(getProject()); | |||||
| matches = re.matches(line, regexpOptions); | |||||
| for (RegularExpression regexp : regexps) { | |||||
| if (!regexp.getRegexp(getProject()).matches(line, regexpOptions)) { | |||||
| matches = false; | |||||
| break; | |||||
| } | |||||
| } | } | ||||
| if (matches ^ isNegated()) { | if (matches ^ isNegated()) { | ||||
| break; | break; | ||||
| @@ -222,7 +222,7 @@ public final class SortFilter extends BaseParamFilterReader | |||||
| } | } | ||||
| if (iterator.hasNext()) { | if (iterator.hasNext()) { | ||||
| line = (String) iterator.next(); | |||||
| line = iterator.next(); | |||||
| } else { | } else { | ||||
| line = null; | line = null; | ||||
| lines = null; | lines = null; | ||||
| @@ -317,12 +317,12 @@ public final class SortFilter extends BaseParamFilterReader | |||||
| for (Parameter param : params) { | for (Parameter param : params) { | ||||
| final String paramName = param.getName(); | final String paramName = param.getName(); | ||||
| if (REVERSE_KEY.equals(paramName)) { | if (REVERSE_KEY.equals(paramName)) { | ||||
| setReverse(Boolean.valueOf(param.getValue()).booleanValue()); | |||||
| setReverse(Boolean.valueOf(param.getValue())); | |||||
| continue; | continue; | ||||
| } | } | ||||
| if (COMPARATOR_KEY.equals(paramName)) { | if (COMPARATOR_KEY.equals(paramName)) { | ||||
| try { | try { | ||||
| String className = (String) param.getValue(); | |||||
| String className = param.getValue(); | |||||
| @SuppressWarnings("unchecked") | @SuppressWarnings("unchecked") | ||||
| final Comparator<? super String> comparatorInstance | final Comparator<? super String> comparatorInstance | ||||
| = (Comparator<? super String>) (Class.forName(className).newInstance()); | = (Comparator<? super String>) (Class.forName(className).newInstance()); | ||||
| @@ -217,7 +217,7 @@ public class AntXMLContext { | |||||
| if (wStack.size() < 1) { | if (wStack.size() < 1) { | ||||
| return null; | return null; | ||||
| } | } | ||||
| return (RuntimeConfigurable) wStack.elementAt(wStack.size() - 1); | |||||
| return wStack.elementAt(wStack.size() - 1); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -229,7 +229,7 @@ public class AntXMLContext { | |||||
| if (wStack.size() < 2) { | if (wStack.size() < 2) { | ||||
| return null; | return null; | ||||
| } | } | ||||
| return (RuntimeConfigurable) wStack.elementAt(wStack.size() - 2); | |||||
| return wStack.elementAt(wStack.size() - 2); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -394,7 +394,7 @@ public class AntXMLContext { | |||||
| if (list == null || list.isEmpty()) { | if (list == null || list.isEmpty()) { | ||||
| return null; | return null; | ||||
| } | } | ||||
| return (String) list.get(list.size() - 1); | |||||
| return list.get(list.size() - 1); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -149,7 +149,7 @@ public class ProjectHelper2 extends ProjectHelper { | |||||
| public void parse(Project project, Object source) throws BuildException { | public void parse(Project project, Object source) throws BuildException { | ||||
| getImportStack().addElement(source); | getImportStack().addElement(source); | ||||
| AntXMLContext context = null; | AntXMLContext context = null; | ||||
| context = (AntXMLContext) project.getReference(REFID_CONTEXT); | |||||
| context = project.getReference(REFID_CONTEXT); | |||||
| if (context == null) { | if (context == null) { | ||||
| context = new AntXMLContext(project); | context = new AntXMLContext(project); | ||||
| project.addReference(REFID_CONTEXT, context); | project.addReference(REFID_CONTEXT, context); | ||||
| @@ -1020,8 +1020,7 @@ public class ProjectHelper2 extends ProjectHelper { | |||||
| } | } | ||||
| if (extensionPoint != null) { | if (extensionPoint != null) { | ||||
| ProjectHelper helper = | ProjectHelper helper = | ||||
| (ProjectHelper) context.getProject(). | |||||
| getReference(ProjectHelper.PROJECTHELPER_REFERENCE); | |||||
| context.getProject().getReference(ProjectHelper.PROJECTHELPER_REFERENCE); | |||||
| for (String extPointName : Target.parseDepends(extensionPoint, name, "extensionOf")) { | for (String extPointName : Target.parseDepends(extensionPoint, name, "extensionOf")) { | ||||
| if (extensionPointMissing == null) { | if (extensionPointMissing == null) { | ||||
| extensionPointMissing = OnMissingExtensionPoint.FAIL; | extensionPointMissing = OnMissingExtensionPoint.FAIL; | ||||
| @@ -44,9 +44,9 @@ public class SecureInputHandler extends DefaultInputHandler { | |||||
| try { | try { | ||||
| Object console = ReflectUtil.invokeStatic(System.class, "console"); | Object console = ReflectUtil.invokeStatic(System.class, "console"); | ||||
| do { | do { | ||||
| char[] input = (char[]) ReflectUtil.invoke( | |||||
| char[] input = ReflectUtil.invoke( | |||||
| console, "readPassword", String.class, prompt, | console, "readPassword", String.class, prompt, | ||||
| Object[].class, (Object[]) null); | |||||
| Object[].class, null); | |||||
| request.setInput(new String(input)); | request.setInput(new String(input)); | ||||
| /* for security zero char array after retrieving value */ | /* for security zero char array after retrieving value */ | ||||
| java.util.Arrays.fill(input, ' '); | java.util.Arrays.fill(input, ' '); | ||||
| @@ -66,14 +66,13 @@ public class BindTargets extends Task { | |||||
| if (getOwningTarget() == null | if (getOwningTarget() == null | ||||
| || !"".equals(getOwningTarget().getName())) { | || !"".equals(getOwningTarget().getName())) { | ||||
| throw new BuildException( | |||||
| "bindtargets only allowed as a top-level task"); | |||||
| throw new BuildException("bindtargets only allowed as a top-level task"); | |||||
| } | } | ||||
| if (onMissingExtensionPoint == null) { | if (onMissingExtensionPoint == null) { | ||||
| onMissingExtensionPoint = OnMissingExtensionPoint.FAIL; | onMissingExtensionPoint = OnMissingExtensionPoint.FAIL; | ||||
| } | } | ||||
| final ProjectHelper helper = (ProjectHelper) getProject().getReference( | |||||
| final ProjectHelper helper = getProject().getReference( | |||||
| ProjectHelper.PROJECTHELPER_REFERENCE); | ProjectHelper.PROJECTHELPER_REFERENCE); | ||||
| for (String target : targets) { | for (String target : targets) { | ||||
| @@ -355,9 +355,7 @@ public class Concat extends Task implements ResourceCollection { | |||||
| * add a character to the lastchars buffer | * add a character to the lastchars buffer | ||||
| */ | */ | ||||
| private void addLastChar(char ch) { | private void addLastChar(char ch) { | ||||
| for (int i = lastChars.length - 2; i >= 0; --i) { | |||||
| lastChars[i] = lastChars[i + 1]; | |||||
| } | |||||
| System.arraycopy(lastChars, 1, lastChars, 0, lastChars.length - 2 + 1); | |||||
| lastChars[lastChars.length - 1] = ch; | lastChars[lastChars.length - 1] = ch; | ||||
| } | } | ||||
| @@ -40,7 +40,6 @@ import org.apache.tools.ant.types.FilterSetCollection; | |||||
| import org.apache.tools.ant.types.Mapper; | import org.apache.tools.ant.types.Mapper; | ||||
| import org.apache.tools.ant.types.Resource; | import org.apache.tools.ant.types.Resource; | ||||
| import org.apache.tools.ant.types.ResourceCollection; | import org.apache.tools.ant.types.ResourceCollection; | ||||
| import org.apache.tools.ant.types.ResourceFactory; | |||||
| import org.apache.tools.ant.types.resources.FileProvider; | import org.apache.tools.ant.types.resources.FileProvider; | ||||
| import org.apache.tools.ant.types.resources.FileResource; | import org.apache.tools.ant.types.resources.FileResource; | ||||
| import org.apache.tools.ant.util.FileNameMapper; | import org.apache.tools.ant.util.FileNameMapper; | ||||
| @@ -827,10 +826,8 @@ public class Copy extends Task { | |||||
| } | } | ||||
| toCopy = v.toArray(new Resource[v.size()]); | toCopy = v.toArray(new Resource[v.size()]); | ||||
| } else { | } else { | ||||
| toCopy = ResourceUtils.selectOutOfDateSources(this, fromResources, | |||||
| mapper, | |||||
| (ResourceFactory) name -> new FileResource(toDir, name), | |||||
| granularity); | |||||
| toCopy = ResourceUtils.selectOutOfDateSources(this, fromResources, mapper, | |||||
| name -> new FileResource(toDir, name), granularity); | |||||
| } | } | ||||
| for (Resource rc : toCopy) { | for (Resource rc : toCopy) { | ||||
| final String[] mappedFiles = mapper.mapFileName(rc.getName()); | final String[] mappedFiles = mapper.mapFileName(rc.getName()); | ||||
| @@ -180,7 +180,7 @@ public class CopyPath extends Task { | |||||
| for (String sourceFileName : sourceFiles) { | for (String sourceFileName : sourceFiles) { | ||||
| File sourceFile = new File(sourceFileName); | File sourceFile = new File(sourceFileName); | ||||
| String[] toFiles = (String[]) mapper.mapFileName(sourceFileName); | |||||
| String[] toFiles = mapper.mapFileName(sourceFileName); | |||||
| if (toFiles == null) { | if (toFiles == null) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| @@ -19,7 +19,6 @@ | |||||
| package org.apache.tools.ant.taskdefs; | package org.apache.tools.ant.taskdefs; | ||||
| import java.io.File; | import java.io.File; | ||||
| import java.io.IOException; | |||||
| import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.BuildException; | ||||
| import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
| @@ -125,7 +125,7 @@ public class ExecTask extends Task { | |||||
| */ | */ | ||||
| public void setTimeout(Integer value) { | public void setTimeout(Integer value) { | ||||
| setTimeout( | setTimeout( | ||||
| (value == null) ? null : Long.valueOf(value.intValue())); | |||||
| (value == null) ? null : (long) value); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -699,7 +699,7 @@ public class ExecTask extends Task { | |||||
| */ | */ | ||||
| protected ExecuteWatchdog createWatchdog() throws BuildException { | protected ExecuteWatchdog createWatchdog() throws BuildException { | ||||
| return (timeout == null) | return (timeout == null) | ||||
| ? null : new ExecuteWatchdog(timeout.longValue()); | |||||
| ? null : new ExecuteWatchdog(timeout); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -135,30 +135,30 @@ public class Execute { | |||||
| procEnvironment = getVMSLogicals(in); | procEnvironment = getVMSLogicals(in); | ||||
| return procEnvironment; | return procEnvironment; | ||||
| } | } | ||||
| String var = null; | |||||
| StringBuilder var = null; | |||||
| String line, lineSep = StringUtils.LINE_SEP; | String line, lineSep = StringUtils.LINE_SEP; | ||||
| while ((line = in.readLine()) != null) { | while ((line = in.readLine()) != null) { | ||||
| if (line.indexOf('=') == -1) { | if (line.indexOf('=') == -1) { | ||||
| // Chunk part of previous env var (UNIX env vars can | // Chunk part of previous env var (UNIX env vars can | ||||
| // contain embedded new lines). | // contain embedded new lines). | ||||
| if (var == null) { | if (var == null) { | ||||
| var = lineSep + line; | |||||
| var = new StringBuilder(lineSep + line); | |||||
| } else { | } else { | ||||
| var += lineSep + line; | |||||
| var.append(lineSep).append(line); | |||||
| } | } | ||||
| } else { | } else { | ||||
| // New env var...append the previous one if we have it. | // New env var...append the previous one if we have it. | ||||
| if (var != null) { | if (var != null) { | ||||
| int eq = var.indexOf('='); | |||||
| int eq = var.toString().indexOf('='); | |||||
| procEnvironment.put(var.substring(0, eq), | procEnvironment.put(var.substring(0, eq), | ||||
| var.substring(eq + 1)); | var.substring(eq + 1)); | ||||
| } | } | ||||
| var = line; | |||||
| var = new StringBuilder(line); | |||||
| } | } | ||||
| } | } | ||||
| // Since we "look ahead" before adding, there's one last env var. | // Since we "look ahead" before adding, there's one last env var. | ||||
| if (var != null) { | if (var != null) { | ||||
| int eq = var.indexOf('='); | |||||
| int eq = var.toString().indexOf('='); | |||||
| procEnvironment.put(var.substring(0, eq), var.substring(eq + 1)); | procEnvironment.put(var.substring(0, eq), var.substring(eq + 1)); | ||||
| } | } | ||||
| } catch (IOException exc) { | } catch (IOException exc) { | ||||
| @@ -142,7 +142,7 @@ public class ExecuteJava implements Runnable, TimeoutObserver { | |||||
| "Could not find %s. Make sure you have it in your classpath", | "Could not find %s. Make sure you have it in your classpath", | ||||
| classname); | classname); | ||||
| } | } | ||||
| main = target.getMethod("main", new Class[] {String[].class}); | |||||
| main = target.getMethod("main", String[].class); | |||||
| if (main == null) { | if (main == null) { | ||||
| throw new BuildException("Could not find main() method in %s", | throw new BuildException("Could not find main() method in %s", | ||||
| classname); | classname); | ||||
| @@ -164,7 +164,7 @@ public class ExecuteJava implements Runnable, TimeoutObserver { | |||||
| // main thread will still be there to let the new thread | // main thread will still be there to let the new thread | ||||
| // finish | // finish | ||||
| thread.setDaemon(true); | thread.setDaemon(true); | ||||
| Watchdog w = new Watchdog(timeout.longValue()); | |||||
| Watchdog w = new Watchdog(timeout); | |||||
| w.addTimeoutObserver(this); | w.addTimeoutObserver(this); | ||||
| synchronized (this) { | synchronized (this) { | ||||
| thread.start(); | thread.start(); | ||||
| @@ -289,7 +289,7 @@ public class ExecuteJava implements Runnable, TimeoutObserver { | |||||
| = new Execute(redirector.createHandler(), | = new Execute(redirector.createHandler(), | ||||
| timeout == null | timeout == null | ||||
| ? null | ? null | ||||
| : new ExecuteWatchdog(timeout.longValue())); | |||||
| : new ExecuteWatchdog(timeout)); | |||||
| exe.setAntRun(pc.getProject()); | exe.setAntRun(pc.getProject()); | ||||
| if (Os.isFamily("openvms")) { | if (Os.isFamily("openvms")) { | ||||
| setupCommandLineForVMS(exe, cmdl.getCommandline()); | setupCommandLineForVMS(exe, cmdl.getCommandline()); | ||||
| @@ -117,7 +117,7 @@ public class Exit extends Task { | |||||
| * @param i the <code>int</code> status | * @param i the <code>int</code> status | ||||
| */ | */ | ||||
| public void setStatus(int i) { | public void setStatus(int i) { | ||||
| status = Integer.valueOf(i); | |||||
| status = i; | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -162,7 +162,7 @@ public class Exit extends Task { | |||||
| } | } | ||||
| log("failing due to " + text, Project.MSG_DEBUG); | log("failing due to " + text, Project.MSG_DEBUG); | ||||
| throw status == null ? new BuildException(text) | throw status == null ? new BuildException(text) | ||||
| : new ExitStatusException(text, status.intValue()); | |||||
| : new ExitStatusException(text, status); | |||||
| } | } | ||||
| } | } | ||||
| @@ -297,9 +297,7 @@ public class ImportTask extends Task { | |||||
| } | } | ||||
| if (importedURL != null) { | if (importedURL != null) { | ||||
| URLProvider up = ((Resource) o).as(URLProvider.class); | URLProvider up = ((Resource) o).as(URLProvider.class); | ||||
| if (up != null && up.getURL().equals(importedURL)) { | |||||
| return true; | |||||
| } | |||||
| return up != null && up.getURL().equals(importedURL); | |||||
| } | } | ||||
| } | } | ||||
| return false; | return false; | ||||
| @@ -987,7 +987,7 @@ public class Java extends Task { | |||||
| if (timeout == null) { | if (timeout == null) { | ||||
| return null; | return null; | ||||
| } | } | ||||
| return new ExecuteWatchdog(timeout.longValue()); | |||||
| return new ExecuteWatchdog(timeout); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -826,7 +826,7 @@ public class Javac extends MatchingTask { | |||||
| * @param include if true, includes Ant's own classpath in the classpath | * @param include if true, includes Ant's own classpath in the classpath | ||||
| */ | */ | ||||
| public void setIncludeantruntime(final boolean include) { | public void setIncludeantruntime(final boolean include) { | ||||
| includeAntRuntime = Boolean.valueOf(include); | |||||
| includeAntRuntime = include; | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -834,7 +834,7 @@ public class Javac extends MatchingTask { | |||||
| * @return whether or not the ant classpath is to be included in the classpath | * @return whether or not the ant classpath is to be included in the classpath | ||||
| */ | */ | ||||
| public boolean getIncludeantruntime() { | public boolean getIncludeantruntime() { | ||||
| return includeAntRuntime != null ? includeAntRuntime.booleanValue() : true; | |||||
| return includeAntRuntime != null ? includeAntRuntime : true; | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -1459,7 +1459,7 @@ public class Javac extends MatchingTask { | |||||
| continue; | continue; | ||||
| } | } | ||||
| final String pkg = path.substring(0, path.length() - suffix.length()); | final String pkg = path.substring(0, path.length() - suffix.length()); | ||||
| packageInfos.put(pkg, Long.valueOf(f.lastModified())); | |||||
| packageInfos.put(pkg, f.lastModified()); | |||||
| } | } | ||||
| } | } | ||||
| @@ -1475,7 +1475,7 @@ public class Javac extends MatchingTask { | |||||
| final File pkgBinDir = new File(dest, pkg.replace('/', File.separatorChar)); | final File pkgBinDir = new File(dest, pkg.replace('/', File.separatorChar)); | ||||
| pkgBinDir.mkdirs(); | pkgBinDir.mkdirs(); | ||||
| final File pkgInfoClass = new File(pkgBinDir, "package-info.class"); | final File pkgInfoClass = new File(pkgBinDir, "package-info.class"); | ||||
| if (pkgInfoClass.isFile() && pkgInfoClass.lastModified() >= sourceLastMod.longValue()) { | |||||
| if (pkgInfoClass.isFile() && pkgInfoClass.lastModified() >= sourceLastMod) { | |||||
| continue; | continue; | ||||
| } | } | ||||
| log("Creating empty " + pkgInfoClass); | log("Creating empty " + pkgInfoClass); | ||||
| @@ -108,7 +108,7 @@ public class Length extends Task implements Condition { | |||||
| * @param ell the long length to compare with. | * @param ell the long length to compare with. | ||||
| */ | */ | ||||
| public synchronized void setLength(long ell) { | public synchronized void setLength(long ell) { | ||||
| length = Long.valueOf(ell); | |||||
| length = ell; | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -152,7 +152,7 @@ public class Length extends Task implements Condition { | |||||
| * @param trim <code>boolean</code>. | * @param trim <code>boolean</code>. | ||||
| */ | */ | ||||
| public synchronized void setTrim(boolean trim) { | public synchronized void setTrim(boolean trim) { | ||||
| this.trim = Boolean.valueOf(trim); | |||||
| this.trim = trim; | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -201,11 +201,11 @@ public class Length extends Task implements Condition { | |||||
| } | } | ||||
| Long ell; | Long ell; | ||||
| if (STRING.equals(mode)) { | if (STRING.equals(mode)) { | ||||
| ell = Long.valueOf(getLength(string, getTrim())); | |||||
| ell = getLength(string, getTrim()); | |||||
| } else { | } else { | ||||
| AccumHandler h = new AccumHandler(); | AccumHandler h = new AccumHandler(); | ||||
| handleResources(h); | handleResources(h); | ||||
| ell = Long.valueOf(h.getAccum()); | |||||
| ell = h.getAccum(); | |||||
| } | } | ||||
| return when.evaluate(ell.compareTo(length)); | return when.evaluate(ell.compareTo(length)); | ||||
| } | } | ||||
| @@ -427,14 +427,8 @@ public class MacroDef extends AntlibDefinition { | |||||
| } else if (!name.equals(other.name)) { | } else if (!name.equals(other.name)) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| if (defaultValue == null) { | |||||
| if (other.defaultValue != null) { | |||||
| return false; | |||||
| } | |||||
| } else if (!defaultValue.equals(other.defaultValue)) { | |||||
| return false; | |||||
| } | |||||
| return true; | |||||
| return defaultValue == null ? other.defaultValue == null | |||||
| : defaultValue.equals(other.defaultValue); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -62,9 +62,9 @@ public class Nice extends Task { | |||||
| getProject().setNewProperty(currentPriority, current); | getProject().setNewProperty(currentPriority, current); | ||||
| } | } | ||||
| //if there is a new priority, and it is different, change it | //if there is a new priority, and it is different, change it | ||||
| if (newPriority != null && priority != newPriority.intValue()) { | |||||
| if (newPriority != null && priority != newPriority) { | |||||
| try { | try { | ||||
| self.setPriority(newPriority.intValue()); | |||||
| self.setPriority(newPriority); | |||||
| } catch (SecurityException e) { | } catch (SecurityException e) { | ||||
| //catch permissions denial and keep going | //catch permissions denial and keep going | ||||
| log("Unable to set new priority -a security manager is in the way", | log("Unable to set new priority -a security manager is in the way", | ||||
| @@ -92,7 +92,7 @@ public class Nice extends Task { | |||||
| if (newPriority < Thread.MIN_PRIORITY || newPriority > Thread.MAX_PRIORITY) { | if (newPriority < Thread.MIN_PRIORITY || newPriority > Thread.MAX_PRIORITY) { | ||||
| throw new BuildException("The thread priority is out of the range 1-10"); | throw new BuildException("The thread priority is out of the range 1-10"); | ||||
| } | } | ||||
| this.newPriority = Integer.valueOf(newPriority); | |||||
| this.newPriority = newPriority; | |||||
| } | } | ||||
| } | } | ||||
| @@ -356,7 +356,7 @@ public class PathConvert extends Task { | |||||
| StringBuilder rslt = new StringBuilder(); | StringBuilder rslt = new StringBuilder(); | ||||
| ResourceCollection resources = isPreserveDuplicates() ? (ResourceCollection) path : new Union(path); | |||||
| ResourceCollection resources = isPreserveDuplicates() ? path : new Union(path); | |||||
| List<String> ret = new ArrayList<>(); | List<String> ret = new ArrayList<>(); | ||||
| FileNameMapper mapperImpl = mapper == null ? new IdentityMapper() : mapper.getImplementation(); | FileNameMapper mapperImpl = mapper == null ? new IdentityMapper() : mapper.getImplementation(); | ||||
| for (Resource r : resources) { | for (Resource r : resources) { | ||||
| @@ -157,7 +157,7 @@ public class Recorder extends Task implements SubBuildListener { | |||||
| recorder.setMessageOutputLevel(loglevel); | recorder.setMessageOutputLevel(loglevel); | ||||
| recorder.setEmacsMode(emacsMode); | recorder.setEmacsMode(emacsMode); | ||||
| if (start != null) { | if (start != null) { | ||||
| if (start.booleanValue()) { | |||||
| if (start) { | |||||
| recorder.reopenFile(); | recorder.reopenFile(); | ||||
| recorder.setRecordState(start); | recorder.setRecordState(start); | ||||
| } else { | } else { | ||||
| @@ -214,7 +214,7 @@ public class Recorder extends Task implements SubBuildListener { | |||||
| if (append == null) { | if (append == null) { | ||||
| entry.openFile(false); | entry.openFile(false); | ||||
| } else { | } else { | ||||
| entry.openFile(append.booleanValue()); | |||||
| entry.openFile(append); | |||||
| } | } | ||||
| entry.setProject(proj); | entry.setProject(proj); | ||||
| recorderEntries.put(name, entry); | recorderEntries.put(name, entry); | ||||
| @@ -85,7 +85,7 @@ public class RecorderEntry implements BuildLogger, SubBuildListener { | |||||
| public void setRecordState(Boolean state) { | public void setRecordState(Boolean state) { | ||||
| if (state != null) { | if (state != null) { | ||||
| flush(); | flush(); | ||||
| record = state.booleanValue(); | |||||
| record = state; | |||||
| } | } | ||||
| } | } | ||||
| @@ -708,9 +708,8 @@ public class Redirector { | |||||
| /** outStreams */ | /** outStreams */ | ||||
| private void outStreams() { | private void outStreams() { | ||||
| if (out != null && out.length > 0) { | if (out != null && out.length > 0) { | ||||
| final String logHead = new StringBuffer("Output ").append( | |||||
| ((appendOut) ? "appended" : "redirected")).append(" to ") | |||||
| .toString(); | |||||
| final String logHead = "Output " + | |||||
| ((appendOut) ? "appended" : "redirected") + " to "; | |||||
| outputStream = foldFiles(out, logHead, Project.MSG_VERBOSE, | outputStream = foldFiles(out, logHead, Project.MSG_VERBOSE, | ||||
| appendOut, createEmptyFilesOut); | appendOut, createEmptyFilesOut); | ||||
| } | } | ||||
| @@ -731,9 +730,8 @@ public class Redirector { | |||||
| private void errorStreams() { | private void errorStreams() { | ||||
| if (error != null && error.length > 0) { | if (error != null && error.length > 0) { | ||||
| final String logHead = new StringBuffer("Error ").append( | |||||
| ((appendErr) ? "appended" : "redirected")).append(" to ") | |||||
| .toString(); | |||||
| final String logHead = "Error " + | |||||
| ((appendErr) ? "appended" : "redirected") + " to "; | |||||
| errorStream = foldFiles(error, logHead, Project.MSG_VERBOSE, | errorStream = foldFiles(error, logHead, Project.MSG_VERBOSE, | ||||
| appendErr, createEmptyFilesErr); | appendErr, createEmptyFilesErr); | ||||
| } else if (!(logError || outputStream == null) && errorProperty == null) { | } else if (!(logError || outputStream == null) && errorProperty == null) { | ||||
| @@ -103,7 +103,7 @@ public class ResourceCount extends Task implements Condition { | |||||
| * @param c number of Resources as int. | * @param c number of Resources as int. | ||||
| */ | */ | ||||
| public void setCount(int c) { | public void setCount(int c) { | ||||
| count = Integer.valueOf(c); | |||||
| count = c; | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -91,13 +91,9 @@ public class Retry extends Task implements TaskContainer { | |||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| errorMessages.append(e.getMessage()); | errorMessages.append(e.getMessage()); | ||||
| if (i >= retryCount) { | if (i >= retryCount) { | ||||
| StringBuilder exceptionMessage = new StringBuilder(); | |||||
| exceptionMessage.append("Task [").append(nestedTask.getTaskName()); | |||||
| exceptionMessage.append("] failed after [").append(retryCount); | |||||
| exceptionMessage.append("] attempts; giving up.").append(StringUtils.LINE_SEP); | |||||
| exceptionMessage.append("Error messages:").append(StringUtils.LINE_SEP); | |||||
| exceptionMessage.append(errorMessages); | |||||
| throw new BuildException(exceptionMessage.toString(), getLocation()); | |||||
| throw new BuildException(String.format( | |||||
| "Task [%s] failed after [%d] attempts; giving up.%nError messages:%n%s", | |||||
| nestedTask.getTaskName(), retryCount, errorMessages), getLocation()); | |||||
| } | } | ||||
| String msg; | String msg; | ||||
| if (retryDelay > 0) { | if (retryDelay > 0) { | ||||
| @@ -329,14 +329,7 @@ public class SubAnt extends Task { | |||||
| if (t instanceof BuildException) { | if (t instanceof BuildException) { | ||||
| return isHardError(t.getCause()); | return isHardError(t.getCause()); | ||||
| } | } | ||||
| if (t instanceof OutOfMemoryError) { | |||||
| return true; | |||||
| } | |||||
| if (t instanceof ThreadDeath) { | |||||
| return true; | |||||
| } | |||||
| // incl. t == null | |||||
| return false; | |||||
| return t instanceof OutOfMemoryError || t instanceof ThreadDeath; | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -252,7 +252,7 @@ public class Sync extends Task { | |||||
| } | } | ||||
| Boolean ped = getExplicitPreserveEmptyDirs(); | Boolean ped = getExplicitPreserveEmptyDirs(); | ||||
| if (ped != null && ped.booleanValue() != myCopy.getIncludeEmptyDirs()) { | |||||
| if (ped != null && ped != myCopy.getIncludeEmptyDirs()) { | |||||
| FileSet fs = syncTarget.toFileSet(true); | FileSet fs = syncTarget.toFileSet(true); | ||||
| fs.setDir(toDir); | fs.setDir(toDir); | ||||
| String[] preservedDirs = | String[] preservedDirs = | ||||
| @@ -554,7 +554,7 @@ public class Sync extends Task { | |||||
| * @since Ant 1.8.0 | * @since Ant 1.8.0 | ||||
| */ | */ | ||||
| public void setPreserveEmptyDirs(boolean b) { | public void setPreserveEmptyDirs(boolean b) { | ||||
| preserveEmptyDirs = Boolean.valueOf(b); | |||||
| preserveEmptyDirs = b; | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -750,7 +750,7 @@ public class Tar extends MatchingTask { | |||||
| */ | */ | ||||
| protected TarFileSet asTarFileSet(final ArchiveFileSet archiveFileSet) { | protected TarFileSet asTarFileSet(final ArchiveFileSet archiveFileSet) { | ||||
| TarFileSet tfs; | TarFileSet tfs; | ||||
| if (archiveFileSet != null && archiveFileSet instanceof TarFileSet) { | |||||
| if (archiveFileSet instanceof TarFileSet) { | |||||
| tfs = (TarFileSet) archiveFileSet; | tfs = (TarFileSet) archiveFileSet; | ||||
| } else { | } else { | ||||
| tfs = new TarFileSet(); | tfs = new TarFileSet(); | ||||
| @@ -40,7 +40,7 @@ public class Truncate extends Task { | |||||
| private static final int BUFFER_SIZE = 1024; | private static final int BUFFER_SIZE = 1024; | ||||
| private static final Long ZERO = new Long(0L); | |||||
| private static final Long ZERO = 0L; | |||||
| private static final String NO_CHILD = "No files specified."; | private static final String NO_CHILD = "No files specified."; | ||||
| @@ -91,7 +91,7 @@ public class Truncate extends Task { | |||||
| */ | */ | ||||
| public void setLength(Long length) { | public void setLength(Long length) { | ||||
| this.length = length; | this.length = length; | ||||
| if (length != null && length.longValue() < 0) { | |||||
| if (length != null && length < 0) { | |||||
| throw new BuildException(INVALID_LENGTH + length); | throw new BuildException(INVALID_LENGTH + length); | ||||
| } | } | ||||
| } | } | ||||
| @@ -159,7 +159,7 @@ public class Truncate extends Task { | |||||
| private void process(File f) { | private void process(File f) { | ||||
| long len = f.length(); | long len = f.length(); | ||||
| long newLength = length == null | long newLength = length == null | ||||
| ? len + adjust.longValue() : length.longValue(); | |||||
| ? len + adjust : length; | |||||
| if (len == newLength) { | if (len == newLength) { | ||||
| //nothing to do! | //nothing to do! | ||||
| @@ -342,14 +342,14 @@ public class Tstamp extends Task { | |||||
| /** Constructor for Unit enumerated type. */ | /** Constructor for Unit enumerated type. */ | ||||
| public Unit() { | public Unit() { | ||||
| calendarFields.put(MILLISECOND, | calendarFields.put(MILLISECOND, | ||||
| Integer.valueOf(Calendar.MILLISECOND)); | |||||
| calendarFields.put(SECOND, Integer.valueOf(Calendar.SECOND)); | |||||
| calendarFields.put(MINUTE, Integer.valueOf(Calendar.MINUTE)); | |||||
| calendarFields.put(HOUR, Integer.valueOf(Calendar.HOUR_OF_DAY)); | |||||
| calendarFields.put(DAY, Integer.valueOf(Calendar.DATE)); | |||||
| calendarFields.put(WEEK, Integer.valueOf(Calendar.WEEK_OF_YEAR)); | |||||
| calendarFields.put(MONTH, Integer.valueOf(Calendar.MONTH)); | |||||
| calendarFields.put(YEAR, Integer.valueOf(Calendar.YEAR)); | |||||
| Calendar.MILLISECOND); | |||||
| calendarFields.put(SECOND, Calendar.SECOND); | |||||
| calendarFields.put(MINUTE, Calendar.MINUTE); | |||||
| calendarFields.put(HOUR, Calendar.HOUR_OF_DAY); | |||||
| calendarFields.put(DAY, Calendar.DATE); | |||||
| calendarFields.put(WEEK, Calendar.WEEK_OF_YEAR); | |||||
| calendarFields.put(MONTH, Calendar.MONTH); | |||||
| calendarFields.put(YEAR, Calendar.YEAR); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -358,7 +358,7 @@ public class Tstamp extends Task { | |||||
| */ | */ | ||||
| public int getCalendarField() { | public int getCalendarField() { | ||||
| String key = getValue().toLowerCase(Locale.ENGLISH); | String key = getValue().toLowerCase(Locale.ENGLISH); | ||||
| return calendarFields.get(key).intValue(); | |||||
| return calendarFields.get(key); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -244,12 +244,12 @@ public class WaitFor extends ConditionBase { | |||||
| /** Constructor the Unit enumerated type. */ | /** Constructor the Unit enumerated type. */ | ||||
| public Unit() { | public Unit() { | ||||
| timeTable.put(MILLISECOND, Long.valueOf(1L)); | |||||
| timeTable.put(SECOND, Long.valueOf(ONE_SECOND)); | |||||
| timeTable.put(MINUTE, Long.valueOf(ONE_MINUTE)); | |||||
| timeTable.put(HOUR, Long.valueOf(ONE_HOUR)); | |||||
| timeTable.put(DAY, Long.valueOf(ONE_DAY)); | |||||
| timeTable.put(WEEK, Long.valueOf(ONE_WEEK)); | |||||
| timeTable.put(MILLISECOND, 1L); | |||||
| timeTable.put(SECOND, ONE_SECOND); | |||||
| timeTable.put(MINUTE, ONE_MINUTE); | |||||
| timeTable.put(HOUR, ONE_HOUR); | |||||
| timeTable.put(DAY, ONE_DAY); | |||||
| timeTable.put(WEEK, ONE_WEEK); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -258,7 +258,7 @@ public class WaitFor extends ConditionBase { | |||||
| */ | */ | ||||
| public long getMultiplier() { | public long getMultiplier() { | ||||
| String key = getValue().toLowerCase(Locale.ENGLISH); | String key = getValue().toLowerCase(Locale.ENGLISH); | ||||
| return timeTable.get(key).longValue(); | |||||
| return timeTable.get(key); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -363,10 +363,8 @@ public class XmlProperty extends Task { | |||||
| String nodeName = attributeNode.getNodeName(); | String nodeName = attributeNode.getNodeName(); | ||||
| String attributeValue = getAttributeValue(attributeNode); | String attributeValue = getAttributeValue(attributeNode); | ||||
| Path containingPath = | |||||
| ((container != null) && (container instanceof Path)) | |||||
| ? (Path) container | |||||
| : null; | |||||
| Path containingPath = container instanceof Path | |||||
| ? (Path) container : null; | |||||
| /* | /* | ||||
| * The main conditional logic -- if the attribute | * The main conditional logic -- if the attribute | ||||
| * is somehow "special" (i.e., it has known | * is somehow "special" (i.e., it has known | ||||
| @@ -1248,11 +1248,11 @@ public class Zip extends MatchingTask { | |||||
| final File zipFile, | final File zipFile, | ||||
| final boolean needsUpdate) | final boolean needsUpdate) | ||||
| throws BuildException { | throws BuildException { | ||||
| final List<ResourceCollection> filesets = new ArrayList<>(); | |||||
| final List<FileSet> filesets = new ArrayList<>(); | |||||
| final List<ResourceCollection> rest = new ArrayList<>(); | final List<ResourceCollection> rest = new ArrayList<>(); | ||||
| for (ResourceCollection rc : rcs) { | for (ResourceCollection rc : rcs) { | ||||
| if (rc instanceof FileSet) { | if (rc instanceof FileSet) { | ||||
| filesets.add(rc); | |||||
| filesets.add((FileSet) rc); | |||||
| } else { | } else { | ||||
| rest.add(rc); | rest.add(rc); | ||||
| } | } | ||||
| @@ -1262,8 +1262,7 @@ public class Zip extends MatchingTask { | |||||
| ArchiveState as = getNonFileSetResourcesToAdd(rc, zipFile, | ArchiveState as = getNonFileSetResourcesToAdd(rc, zipFile, | ||||
| needsUpdate); | needsUpdate); | ||||
| final FileSet[] fs = filesets.toArray(new FileSet[filesets | |||||
| .size()]); | |||||
| final FileSet[] fs = filesets.toArray(new FileSet[filesets.size()]); | |||||
| final ArchiveState as2 = getResourcesToAdd(fs, zipFile, as.isOutOfDate()); | final ArchiveState as2 = getResourcesToAdd(fs, zipFile, as.isOutOfDate()); | ||||
| if (!as.isOutOfDate() && as2.isOutOfDate()) { | if (!as.isOutOfDate() && as2.isOutOfDate()) { | ||||
| /* | /* | ||||
| @@ -1498,7 +1497,7 @@ public class Zip extends MatchingTask { | |||||
| final Resource[][] initialResources = grabNonFileSetResources(rcs); | final Resource[][] initialResources = grabNonFileSetResources(rcs); | ||||
| final boolean empty = isEmpty(initialResources); | final boolean empty = isEmpty(initialResources); | ||||
| HAVE_NON_FILE_SET_RESOURCES_TO_ADD.set(Boolean.valueOf(!empty)); | |||||
| HAVE_NON_FILE_SET_RESOURCES_TO_ADD.set(!empty); | |||||
| if (empty) { | if (empty) { | ||||
| // no emptyBehavior handling since the FileSet version | // no emptyBehavior handling since the FileSet version | ||||
| // will take care of it. | // will take care of it. | ||||
| @@ -55,16 +55,12 @@ public class Javac12 extends DefaultCompilerAdapter { | |||||
| // Create an instance of the compiler, redirecting output to | // Create an instance of the compiler, redirecting output to | ||||
| // the project log | // the project log | ||||
| Class<?> c = Class.forName(CLASSIC_COMPILER_CLASSNAME); | Class<?> c = Class.forName(CLASSIC_COMPILER_CLASSNAME); | ||||
| Constructor cons = | |||||
| c.getConstructor(OutputStream.class, String.class); | |||||
| Object compiler | |||||
| = cons.newInstance(logstr, "javac"); | |||||
| Constructor cons = c.getConstructor(OutputStream.class, String.class); | |||||
| Object compiler = cons.newInstance(logstr, "javac"); | |||||
| // Call the compile() method | // Call the compile() method | ||||
| Method compile = c.getMethod("compile", String[].class); | Method compile = c.getMethod("compile", String[].class); | ||||
| Boolean ok = (Boolean) compile.invoke(compiler, | |||||
| new Object[] {cmd.getArguments()}); | |||||
| return ok.booleanValue(); | |||||
| return (Boolean) compile.invoke(compiler, new Object[] {cmd.getArguments()}); | |||||
| } catch (ClassNotFoundException ex) { | } catch (ClassNotFoundException ex) { | ||||
| throw new BuildException("Cannot use classic compiler, as it is " | throw new BuildException("Cannot use classic compiler, as it is " | ||||
| + "not available. \n" | + "not available. \n" | ||||
| @@ -54,8 +54,8 @@ public class Javac13 extends DefaultCompilerAdapter { | |||||
| Class<?> c = Class.forName("com.sun.tools.javac.Main"); | Class<?> c = Class.forName("com.sun.tools.javac.Main"); | ||||
| Object compiler = c.newInstance(); | Object compiler = c.newInstance(); | ||||
| Method compile = c.getMethod("compile", String[].class); | Method compile = c.getMethod("compile", String[].class); | ||||
| int result = ((Integer) compile.invoke(compiler, | |||||
| (Object) cmd.getArguments())).intValue(); | |||||
| int result = (Integer) compile.invoke(compiler, | |||||
| (Object) cmd.getArguments()); | |||||
| return result == MODERN_COMPILER_SUCCESS; | return result == MODERN_COMPILER_SUCCESS; | ||||
| } catch (Exception ex) { | } catch (Exception ex) { | ||||
| if (ex instanceof BuildException) { | if (ex instanceof BuildException) { | ||||
| @@ -49,7 +49,7 @@ public class HasFreeSpace implements Condition { | |||||
| //reflection to avoid bootstrap/build problems | //reflection to avoid bootstrap/build problems | ||||
| File fs = new File(partition); | File fs = new File(partition); | ||||
| ReflectWrapper w = new ReflectWrapper(fs); | ReflectWrapper w = new ReflectWrapper(fs); | ||||
| long free = w.<Long> invoke("getFreeSpace").longValue(); | |||||
| long free = w.<Long>invoke("getFreeSpace"); | |||||
| return free >= StringUtils.parseHumanSizes(needed); | return free >= StringUtils.parseHumanSizes(needed); | ||||
| } | } | ||||
| throw new BuildException( | throw new BuildException( | ||||
| @@ -113,10 +113,7 @@ public class Http extends ProjectComponent implements Condition { | |||||
| int code = http.getResponseCode(); | int code = http.getResponseCode(); | ||||
| log("Result code for " + spec + " was " + code, | log("Result code for " + spec + " was " + code, | ||||
| Project.MSG_VERBOSE); | Project.MSG_VERBOSE); | ||||
| if (code > 0 && code < errorsBeginAt) { | |||||
| return true; | |||||
| } | |||||
| return false; | |||||
| return code > 0 && code < errorsBeginAt; | |||||
| } | } | ||||
| } catch (ProtocolException pe) { | } catch (ProtocolException pe) { | ||||
| throw new BuildException("Invalid HTTP protocol: " | throw new BuildException("Invalid HTTP protocol: " | ||||
| @@ -48,7 +48,7 @@ public class IsFalse extends ProjectComponent implements Condition { | |||||
| if (value == null) { | if (value == null) { | ||||
| throw new BuildException("Nothing to test for falsehood"); | throw new BuildException("Nothing to test for falsehood"); | ||||
| } | } | ||||
| return !value.booleanValue(); | |||||
| return !value; | |||||
| } | } | ||||
| } | } | ||||
| @@ -179,8 +179,8 @@ public class IsReachable extends ProjectComponent implements Condition { | |||||
| Method reachableMethod = | Method reachableMethod = | ||||
| InetAddress.class.getMethod(METHOD_NAME, Integer.class); | InetAddress.class.getMethod(METHOD_NAME, Integer.class); | ||||
| try { | try { | ||||
| reachable = ((Boolean) reachableMethod.invoke(address, | |||||
| Integer.valueOf(timeout * SECOND))).booleanValue(); | |||||
| reachable = (Boolean) reachableMethod.invoke(address, | |||||
| timeout * SECOND); | |||||
| } catch (final IllegalAccessException e) { | } catch (final IllegalAccessException e) { | ||||
| //utterly implausible, but catered for anyway | //utterly implausible, but catered for anyway | ||||
| throw new BuildException("When calling " + reachableMethod); | throw new BuildException("When calling " + reachableMethod); | ||||
| @@ -49,7 +49,7 @@ public class IsTrue extends ProjectComponent implements Condition { | |||||
| if (value == null) { | if (value == null) { | ||||
| throw new BuildException("Nothing to test for truth"); | throw new BuildException("Nothing to test for truth"); | ||||
| } | } | ||||
| return value.booleanValue(); | |||||
| return value; | |||||
| } | } | ||||
| } | } | ||||
| @@ -165,7 +165,7 @@ public class EmailTask extends Task { | |||||
| * @param port The port to use. | * @param port The port to use. | ||||
| */ | */ | ||||
| public void setMailport(int port) { | public void setMailport(int port) { | ||||
| this.port = Integer.valueOf(port); | |||||
| this.port = port; | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -554,7 +554,7 @@ public class EmailTask extends Task { | |||||
| // pass the params to the mailer | // pass the params to the mailer | ||||
| mailer.setHost(host); | mailer.setHost(host); | ||||
| if (port != null) { | if (port != null) { | ||||
| mailer.setPort(port.intValue()); | |||||
| mailer.setPort(port); | |||||
| mailer.setPortExplicitlySpecified(true); | mailer.setPortExplicitlySpecified(true); | ||||
| } else { | } else { | ||||
| mailer.setPort(SMTP_PORT); | mailer.setPort(SMTP_PORT); | ||||
| @@ -111,8 +111,8 @@ public class MimeMailer extends Mailer { | |||||
| return type; | return type; | ||||
| } | } | ||||
| // Must be like "text/plain; charset=windows-1251" | // Must be like "text/plain; charset=windows-1251" | ||||
| return new StringBuilder(type != null ? type : "text/plain").append( | |||||
| "; charset=").append(charset).toString(); | |||||
| return (type != null ? type : "text/plain") + | |||||
| "; charset=" + charset; | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -692,14 +692,14 @@ public class PropertyFile extends Task { | |||||
| /** no arg constructor */ | /** no arg constructor */ | ||||
| public Unit() { | public Unit() { | ||||
| calendarFields.put(MILLISECOND, | calendarFields.put(MILLISECOND, | ||||
| Integer.valueOf(Calendar.MILLISECOND)); | |||||
| calendarFields.put(SECOND, Integer.valueOf(Calendar.SECOND)); | |||||
| calendarFields.put(MINUTE, Integer.valueOf(Calendar.MINUTE)); | |||||
| calendarFields.put(HOUR, Integer.valueOf(Calendar.HOUR_OF_DAY)); | |||||
| calendarFields.put(DAY, Integer.valueOf(Calendar.DATE)); | |||||
| calendarFields.put(WEEK, Integer.valueOf(Calendar.WEEK_OF_YEAR)); | |||||
| calendarFields.put(MONTH, Integer.valueOf(Calendar.MONTH)); | |||||
| calendarFields.put(YEAR, Integer.valueOf(Calendar.YEAR)); | |||||
| Calendar.MILLISECOND); | |||||
| calendarFields.put(SECOND, Calendar.SECOND); | |||||
| calendarFields.put(MINUTE, Calendar.MINUTE); | |||||
| calendarFields.put(HOUR, Calendar.HOUR_OF_DAY); | |||||
| calendarFields.put(DAY, Calendar.DATE); | |||||
| calendarFields.put(WEEK, Calendar.WEEK_OF_YEAR); | |||||
| calendarFields.put(MONTH, Calendar.MONTH); | |||||
| calendarFields.put(YEAR, Calendar.YEAR); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -707,7 +707,7 @@ public class PropertyFile extends Task { | |||||
| * @return the calendar value. | * @return the calendar value. | ||||
| */ | */ | ||||
| public int getCalendarField() { | public int getCalendarField() { | ||||
| return calendarFields.get(getValue().toLowerCase()).intValue(); | |||||
| return calendarFields.get(getValue().toLowerCase()); | |||||
| } | } | ||||
| /** {@inheritDoc}. */ | /** {@inheritDoc}. */ | ||||
| @@ -428,8 +428,7 @@ public class SchemaValidate extends XMLValidateTask { | |||||
| */ | */ | ||||
| public String getURIandLocation() throws BuildException { | public String getURIandLocation() throws BuildException { | ||||
| validateNamespace(); | validateNamespace(); | ||||
| return new StringBuilder(namespace).append(' ') | |||||
| .append(getSchemaLocationURL()).toString(); | |||||
| return namespace + ' ' + getSchemaLocationURL(); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -475,11 +474,7 @@ public class SchemaValidate extends XMLValidateTask { | |||||
| : schemaLocation.namespace != null) { | : schemaLocation.namespace != null) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| if (url != null ? !url.equals(schemaLocation.url) : schemaLocation.url != null) { | |||||
| return false; | |||||
| } | |||||
| return true; | |||||
| return url != null ? url.equals(schemaLocation.url) : schemaLocation.url == null; | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -504,12 +499,10 @@ public class SchemaValidate extends XMLValidateTask { | |||||
| */ | */ | ||||
| @Override | @Override | ||||
| public String toString() { | public String toString() { | ||||
| StringBuilder buffer = new StringBuilder(); | |||||
| buffer.append(namespace != null ? namespace : "(anonymous)"); | |||||
| buffer.append(' '); | |||||
| buffer.append(url != null ? (url + " ") : ""); | |||||
| buffer.append(file != null ? file.getAbsolutePath() : ""); | |||||
| return buffer.toString(); | |||||
| String buffer = (namespace != null ? namespace : "(anonymous)") | |||||
| + ' ' + (url != null ? (url + " ") : "") | |||||
| + (file != null ? file.getAbsolutePath() : ""); | |||||
| return buffer; | |||||
| } | } | ||||
| } //SchemaLocation | } //SchemaLocation | ||||
| } | } | ||||
| @@ -84,9 +84,7 @@ public class AntAnalyzer extends AbstractAnalyzer { | |||||
| } | } | ||||
| ClassFile classFile = new ClassFile(); | ClassFile classFile = new ClassFile(); | ||||
| classFile.read(inStream); | classFile.read(inStream); | ||||
| for (String dependency : classFile.getClassRefs()) { | |||||
| analyzedDeps.add(dependency); | |||||
| } | |||||
| analyzedDeps.addAll(classFile.getClassRefs()); | |||||
| } finally { | } finally { | ||||
| FileUtils.close(inStream); | FileUtils.close(inStream); | ||||
| FileUtils.close(zipFile); | FileUtils.close(zipFile); | ||||
| @@ -103,7 +103,7 @@ public class ConstantPool { | |||||
| if (entry instanceof Utf8CPInfo) { | if (entry instanceof Utf8CPInfo) { | ||||
| Utf8CPInfo utf8Info = (Utf8CPInfo) entry; | Utf8CPInfo utf8Info = (Utf8CPInfo) entry; | ||||
| utf8Indexes.put(utf8Info.getValue(), Integer.valueOf(index)); | |||||
| utf8Indexes.put(utf8Info.getValue(), index); | |||||
| } | } | ||||
| return index; | return index; | ||||
| @@ -145,7 +145,7 @@ public class ConstantPool { | |||||
| Integer indexInteger = utf8Indexes.get(value); | Integer indexInteger = utf8Indexes.get(value); | ||||
| if (indexInteger != null) { | if (indexInteger != null) { | ||||
| index = indexInteger.intValue(); | |||||
| index = indexInteger; | |||||
| } | } | ||||
| return index; | return index; | ||||
| @@ -43,7 +43,7 @@ public class DoubleCPInfo extends ConstantCPInfo { | |||||
| */ | */ | ||||
| @Override | @Override | ||||
| public void read(DataInputStream cpStream) throws IOException { | public void read(DataInputStream cpStream) throws IOException { | ||||
| setValue(Double.valueOf(cpStream.readDouble())); | |||||
| setValue(cpStream.readDouble()); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -41,7 +41,7 @@ public class FloatCPInfo extends ConstantCPInfo { | |||||
| */ | */ | ||||
| @Override | @Override | ||||
| public void read(DataInputStream cpStream) throws IOException { | public void read(DataInputStream cpStream) throws IOException { | ||||
| setValue(Float.valueOf(cpStream.readFloat())); | |||||
| setValue(cpStream.readFloat()); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -41,7 +41,7 @@ public class IntegerCPInfo extends ConstantCPInfo { | |||||
| */ | */ | ||||
| @Override | @Override | ||||
| public void read(DataInputStream cpStream) throws IOException { | public void read(DataInputStream cpStream) throws IOException { | ||||
| setValue(Integer.valueOf(cpStream.readInt())); | |||||
| setValue(cpStream.readInt()); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -41,7 +41,7 @@ public class LongCPInfo extends ConstantCPInfo { | |||||
| */ | */ | ||||
| @Override | @Override | ||||
| public void read(DataInputStream cpStream) throws IOException { | public void read(DataInputStream cpStream) throws IOException { | ||||
| setValue(Long.valueOf(cpStream.readLong())); | |||||
| setValue(cpStream.readLong()); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -330,19 +330,19 @@ public class IPlanetEjbc { | |||||
| private static void usage() { | private static void usage() { | ||||
| System.out.println("java org.apache.tools.ant.taskdefs.optional.ejb.IPlanetEjbc \\"); | System.out.println("java org.apache.tools.ant.taskdefs.optional.ejb.IPlanetEjbc \\"); | ||||
| System.out.println(" [OPTIONS] [EJB 1.1 descriptor] [iAS EJB descriptor]"); | System.out.println(" [OPTIONS] [EJB 1.1 descriptor] [iAS EJB descriptor]"); | ||||
| System.out.println(""); | |||||
| System.out.println(); | |||||
| System.out.println("Where OPTIONS are:"); | System.out.println("Where OPTIONS are:"); | ||||
| System.out.println(" -debug -- for additional debugging output"); | System.out.println(" -debug -- for additional debugging output"); | ||||
| System.out.println(" -keepsource -- to retain Java source files generated"); | System.out.println(" -keepsource -- to retain Java source files generated"); | ||||
| System.out.println(" -classpath [classpath] -- classpath used for compilation"); | System.out.println(" -classpath [classpath] -- classpath used for compilation"); | ||||
| System.out.println(" -d [destination directory] -- directory for compiled classes"); | System.out.println(" -d [destination directory] -- directory for compiled classes"); | ||||
| System.out.println(""); | |||||
| System.out.println(); | |||||
| System.out.println("If a classpath is not specified, the system classpath"); | System.out.println("If a classpath is not specified, the system classpath"); | ||||
| System.out.println("will be used. If a destination directory is not specified,"); | System.out.println("will be used. If a destination directory is not specified,"); | ||||
| System.out.println("the current working directory will be used (classes will"); | System.out.println("the current working directory will be used (classes will"); | ||||
| System.out.println("still be placed in subfolders which correspond to their"); | System.out.println("still be placed in subfolders which correspond to their"); | ||||
| System.out.println("package name)."); | System.out.println("package name)."); | ||||
| System.out.println(""); | |||||
| System.out.println(); | |||||
| System.out.println("The EJB home interface, remote interface, and implementation"); | System.out.println("The EJB home interface, remote interface, and implementation"); | ||||
| System.out.println("class must be found in the destination directory. In"); | System.out.println("class must be found in the destination directory. In"); | ||||
| System.out.println("addition, the destination will look for the stubs and skeletons"); | System.out.println("addition, the destination will look for the stubs and skeletons"); | ||||
| @@ -1295,21 +1295,21 @@ public class IPlanetEjbc { | |||||
| */ | */ | ||||
| @Override | @Override | ||||
| public String toString() { | public String toString() { | ||||
| String s = "EJB name: " + name | |||||
| + "\n\r home: " + home | |||||
| + "\n\r remote: " + remote | |||||
| + "\n\r impl: " + implementation | |||||
| + "\n\r primaryKey: " + primaryKey | |||||
| + "\n\r beantype: " + beantype | |||||
| + "\n\r cmp: " + cmp | |||||
| + "\n\r iiop: " + iiop | |||||
| + "\n\r hasession: " + hasession; | |||||
| StringBuilder s = new StringBuilder("EJB name: " + name | |||||
| + "\n\r home: " + home | |||||
| + "\n\r remote: " + remote | |||||
| + "\n\r impl: " + implementation | |||||
| + "\n\r primaryKey: " + primaryKey | |||||
| + "\n\r beantype: " + beantype | |||||
| + "\n\r cmp: " + cmp | |||||
| + "\n\r iiop: " + iiop | |||||
| + "\n\r hasession: " + hasession); | |||||
| for (String cmpDescriptor : cmpDescriptors) { | for (String cmpDescriptor : cmpDescriptors) { | ||||
| s += "\n\r CMP Descriptor: " + cmpDescriptor; | |||||
| s.append("\n\r CMP Descriptor: ").append(cmpDescriptor); | |||||
| } | } | ||||
| return s; | |||||
| return s.toString(); | |||||
| } | } | ||||
| } // End of EjbInfo inner class | } // End of EjbInfo inner class | ||||
| @@ -830,8 +830,7 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool { | |||||
| rebuild = true; | rebuild = true; | ||||
| } | } | ||||
| } | } | ||||
| if (genericLoader != null | |||||
| && genericLoader instanceof AntClassLoader) { | |||||
| if (genericLoader instanceof AntClassLoader) { | |||||
| @SuppressWarnings("resource") | @SuppressWarnings("resource") | ||||
| AntClassLoader loader = (AntClassLoader) genericLoader; | AntClassLoader loader = (AntClassLoader) genericLoader; | ||||
| loader.cleanup(); | loader.cleanup(); | ||||
| @@ -812,8 +812,7 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool { | |||||
| rebuild = true; | rebuild = true; | ||||
| } | } | ||||
| } | } | ||||
| if (genericLoader != null | |||||
| && genericLoader instanceof AntClassLoader) { | |||||
| if (genericLoader instanceof AntClassLoader) { | |||||
| @SuppressWarnings("resource") | @SuppressWarnings("resource") | ||||
| AntClassLoader loader = (AntClassLoader) genericLoader; | AntClassLoader loader = (AntClassLoader) genericLoader; | ||||
| loader.cleanup(); | loader.cleanup(); | ||||
| @@ -20,6 +20,7 @@ package org.apache.tools.ant.taskdefs.optional.extension; | |||||
| import java.io.File; | import java.io.File; | ||||
| import java.io.IOException; | import java.io.IOException; | ||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import java.util.Collections; | |||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.jar.JarFile; | import java.util.jar.JarFile; | ||||
| import java.util.jar.Manifest; | import java.util.jar.Manifest; | ||||
| @@ -66,9 +67,7 @@ public final class ExtensionUtil { | |||||
| final List<FileSet> fileset) | final List<FileSet> fileset) | ||||
| throws BuildException { | throws BuildException { | ||||
| if (!fileset.isEmpty()) { | if (!fileset.isEmpty()) { | ||||
| for (Extension extension : getExtensions(project, fileset)) { | |||||
| libraries.add(extension); | |||||
| } | |||||
| Collections.addAll(libraries, getExtensions(project, fileset)); | |||||
| } | } | ||||
| } | } | ||||
| @@ -332,33 +332,22 @@ public final class Specification { | |||||
| } | } | ||||
| // Available specification version must be >= required | // Available specification version must be >= required | ||||
| final DeweyDecimal otherSpecificationVersion | |||||
| = other.getSpecificationVersion(); | |||||
| if (null != specificationVersion) { | |||||
| if (null == otherSpecificationVersion | |||||
| || !isCompatible(specificationVersion, otherSpecificationVersion)) { | |||||
| return REQUIRE_SPECIFICATION_UPGRADE; | |||||
| } | |||||
| final DeweyDecimal otherSpecificationVersion = other.getSpecificationVersion(); | |||||
| if (null != specificationVersion && (null == otherSpecificationVersion | |||||
| || !isCompatible(specificationVersion, otherSpecificationVersion))) { | |||||
| return REQUIRE_SPECIFICATION_UPGRADE; | |||||
| } | } | ||||
| // Implementation Vendor ID must match | // Implementation Vendor ID must match | ||||
| final String otherImplementationVendor | |||||
| = other.getImplementationVendor(); | |||||
| if (null != implementationVendor) { | |||||
| if (null == otherImplementationVendor | |||||
| || !implementationVendor.equals(otherImplementationVendor)) { | |||||
| return REQUIRE_VENDOR_SWITCH; | |||||
| } | |||||
| if (null != implementationVendor | |||||
| && !implementationVendor.equals(other.getImplementationVendor())) { | |||||
| return REQUIRE_VENDOR_SWITCH; | |||||
| } | } | ||||
| // Implementation version must be >= required | // Implementation version must be >= required | ||||
| final String otherImplementationVersion | |||||
| = other.getImplementationVersion(); | |||||
| if (null != implementationVersion) { | |||||
| if (null == otherImplementationVersion | |||||
| || !implementationVersion.equals(otherImplementationVersion)) { | |||||
| return REQUIRE_IMPLEMENTATION_CHANGE; | |||||
| } | |||||
| if (null != implementationVersion | |||||
| && !implementationVersion.equals(other.getImplementationVersion())) { | |||||
| return REQUIRE_IMPLEMENTATION_CHANGE; | |||||
| } | } | ||||
| // This available optional package satisfies the requirements | // This available optional package satisfies the requirements | ||||
| @@ -65,7 +65,7 @@ public class JJDoc extends Task { | |||||
| * @param plainText a <code>boolean</code> value. | * @param plainText a <code>boolean</code> value. | ||||
| */ | */ | ||||
| public void setText(boolean plainText) { | public void setText(boolean plainText) { | ||||
| optionalAttrs.put(TEXT, Boolean.valueOf(plainText)); | |||||
| optionalAttrs.put(TEXT, plainText); | |||||
| this.plainText = plainText; | this.plainText = plainText; | ||||
| } | } | ||||
| @@ -74,7 +74,7 @@ public class JJDoc extends Task { | |||||
| * @param oneTable a <code>boolean</code> value. | * @param oneTable a <code>boolean</code> value. | ||||
| */ | */ | ||||
| public void setOnetable(boolean oneTable) { | public void setOnetable(boolean oneTable) { | ||||
| optionalAttrs.put(ONE_TABLE, Boolean.valueOf(oneTable)); | |||||
| optionalAttrs.put(ONE_TABLE, oneTable); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -74,7 +74,7 @@ public class JJTree extends Task { | |||||
| * @param buildNodeFiles a <code>boolean</code> value. | * @param buildNodeFiles a <code>boolean</code> value. | ||||
| */ | */ | ||||
| public void setBuildnodefiles(boolean buildNodeFiles) { | public void setBuildnodefiles(boolean buildNodeFiles) { | ||||
| optionalAttrs.put(BUILD_NODE_FILES, Boolean.valueOf(buildNodeFiles)); | |||||
| optionalAttrs.put(BUILD_NODE_FILES, buildNodeFiles); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -82,7 +82,7 @@ public class JJTree extends Task { | |||||
| * @param multi a <code>boolean</code> value. | * @param multi a <code>boolean</code> value. | ||||
| */ | */ | ||||
| public void setMulti(boolean multi) { | public void setMulti(boolean multi) { | ||||
| optionalAttrs.put(MULTI, Boolean.valueOf(multi)); | |||||
| optionalAttrs.put(MULTI, multi); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -90,7 +90,7 @@ public class JJTree extends Task { | |||||
| * @param nodeDefaultVoid a <code>boolean</code> value. | * @param nodeDefaultVoid a <code>boolean</code> value. | ||||
| */ | */ | ||||
| public void setNodedefaultvoid(boolean nodeDefaultVoid) { | public void setNodedefaultvoid(boolean nodeDefaultVoid) { | ||||
| optionalAttrs.put(NODE_DEFAULT_VOID, Boolean.valueOf(nodeDefaultVoid)); | |||||
| optionalAttrs.put(NODE_DEFAULT_VOID, nodeDefaultVoid); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -98,7 +98,7 @@ public class JJTree extends Task { | |||||
| * @param nodeFactory a <code>boolean</code> value. | * @param nodeFactory a <code>boolean</code> value. | ||||
| */ | */ | ||||
| public void setNodefactory(boolean nodeFactory) { | public void setNodefactory(boolean nodeFactory) { | ||||
| optionalAttrs.put(NODE_FACTORY, Boolean.valueOf(nodeFactory)); | |||||
| optionalAttrs.put(NODE_FACTORY, nodeFactory); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -106,7 +106,7 @@ public class JJTree extends Task { | |||||
| * @param nodeScopeHook a <code>boolean</code> value. | * @param nodeScopeHook a <code>boolean</code> value. | ||||
| */ | */ | ||||
| public void setNodescopehook(boolean nodeScopeHook) { | public void setNodescopehook(boolean nodeScopeHook) { | ||||
| optionalAttrs.put(NODE_SCOPE_HOOK, Boolean.valueOf(nodeScopeHook)); | |||||
| optionalAttrs.put(NODE_SCOPE_HOOK, nodeScopeHook); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -114,7 +114,7 @@ public class JJTree extends Task { | |||||
| * @param nodeUsesParser a <code>boolean</code> value. | * @param nodeUsesParser a <code>boolean</code> value. | ||||
| */ | */ | ||||
| public void setNodeusesparser(boolean nodeUsesParser) { | public void setNodeusesparser(boolean nodeUsesParser) { | ||||
| optionalAttrs.put(NODE_USES_PARSER, Boolean.valueOf(nodeUsesParser)); | |||||
| optionalAttrs.put(NODE_USES_PARSER, nodeUsesParser); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -122,7 +122,7 @@ public class JJTree extends Task { | |||||
| * @param staticParser a <code>boolean</code> value. | * @param staticParser a <code>boolean</code> value. | ||||
| */ | */ | ||||
| public void setStatic(boolean staticParser) { | public void setStatic(boolean staticParser) { | ||||
| optionalAttrs.put(STATIC, Boolean.valueOf(staticParser)); | |||||
| optionalAttrs.put(STATIC, staticParser); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -130,7 +130,7 @@ public class JJTree extends Task { | |||||
| * @param visitor a <code>boolean</code> value. | * @param visitor a <code>boolean</code> value. | ||||
| */ | */ | ||||
| public void setVisitor(boolean visitor) { | public void setVisitor(boolean visitor) { | ||||
| optionalAttrs.put(VISITOR, Boolean.valueOf(visitor)); | |||||
| optionalAttrs.put(VISITOR, visitor); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -111,7 +111,7 @@ public class JavaCC extends Task { | |||||
| * @param lookahead an <code>int</code> value. | * @param lookahead an <code>int</code> value. | ||||
| */ | */ | ||||
| public void setLookahead(int lookahead) { | public void setLookahead(int lookahead) { | ||||
| optionalAttrs.put(LOOKAHEAD, Integer.valueOf(lookahead)); | |||||
| optionalAttrs.put(LOOKAHEAD, lookahead); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -119,7 +119,7 @@ public class JavaCC extends Task { | |||||
| * @param choiceAmbiguityCheck an <code>int</code> value. | * @param choiceAmbiguityCheck an <code>int</code> value. | ||||
| */ | */ | ||||
| public void setChoiceambiguitycheck(int choiceAmbiguityCheck) { | public void setChoiceambiguitycheck(int choiceAmbiguityCheck) { | ||||
| optionalAttrs.put(CHOICE_AMBIGUITY_CHECK, Integer.valueOf(choiceAmbiguityCheck)); | |||||
| optionalAttrs.put(CHOICE_AMBIGUITY_CHECK, choiceAmbiguityCheck); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -127,7 +127,7 @@ public class JavaCC extends Task { | |||||
| * @param otherAmbiguityCheck an <code>int</code> value. | * @param otherAmbiguityCheck an <code>int</code> value. | ||||
| */ | */ | ||||
| public void setOtherambiguityCheck(int otherAmbiguityCheck) { | public void setOtherambiguityCheck(int otherAmbiguityCheck) { | ||||
| optionalAttrs.put(OTHER_AMBIGUITY_CHECK, Integer.valueOf(otherAmbiguityCheck)); | |||||
| optionalAttrs.put(OTHER_AMBIGUITY_CHECK, otherAmbiguityCheck); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -624,7 +624,7 @@ public class JDependTask extends Task { | |||||
| if (getTimeout() == null) { | if (getTimeout() == null) { | ||||
| return null; | return null; | ||||
| } | } | ||||
| return new ExecuteWatchdog(getTimeout().longValue()); | |||||
| return new ExecuteWatchdog(getTimeout()); | |||||
| } | } | ||||
| private Optional<Path> getWorkingPath() { | private Optional<Path> getWorkingPath() { | ||||
| @@ -64,33 +64,33 @@ class ConstantPool { | |||||
| break; | break; | ||||
| case INTEGER : | case INTEGER : | ||||
| values[i] = Integer.valueOf(data.readInt()); | |||||
| values[i] = data.readInt(); | |||||
| break; | break; | ||||
| case FLOAT : | case FLOAT : | ||||
| values[i] = Float.valueOf(data.readFloat()); | |||||
| values[i] = data.readFloat(); | |||||
| break; | break; | ||||
| case LONG : | case LONG : | ||||
| values[i] = Long.valueOf(data.readLong()); | |||||
| values[i] = data.readLong(); | |||||
| ++i; | ++i; | ||||
| break; | break; | ||||
| case DOUBLE : | case DOUBLE : | ||||
| values[i] = Double.valueOf(data.readDouble()); | |||||
| values[i] = data.readDouble(); | |||||
| ++i; | ++i; | ||||
| break; | break; | ||||
| case CLASS : | case CLASS : | ||||
| case STRING : | case STRING : | ||||
| values[i] = Integer.valueOf(data.readUnsignedShort()); | |||||
| values[i] = data.readUnsignedShort(); | |||||
| break; | break; | ||||
| case FIELDREF : | case FIELDREF : | ||||
| case METHODREF : | case METHODREF : | ||||
| case INTERFACEMETHODREF : | case INTERFACEMETHODREF : | ||||
| case NAMEANDTYPE : | case NAMEANDTYPE : | ||||
| values[i] = Integer.valueOf(data.readInt()); | |||||
| values[i] = data.readInt(); | |||||
| break; | break; | ||||
| default: | default: | ||||
| // Do nothing | // Do nothing | ||||
| @@ -129,7 +129,7 @@ public class ClassNameReader { | |||||
| /* int accessFlags = */ data.readUnsignedShort(); | /* int accessFlags = */ data.readUnsignedShort(); | ||||
| int classIndex = data.readUnsignedShort(); | int classIndex = data.readUnsignedShort(); | ||||
| Integer stringIndex = (Integer) values[classIndex]; | Integer stringIndex = (Integer) values[classIndex]; | ||||
| String className = (String) values[stringIndex.intValue()]; | |||||
| String className = (String) values[stringIndex]; | |||||
| return className; | return className; | ||||
| } | } | ||||
| @@ -307,14 +307,14 @@ public class WLJspc extends MatchingTask { | |||||
| */ | */ | ||||
| protected String replaceString(String inpString, String escapeChars, | protected String replaceString(String inpString, String escapeChars, | ||||
| String replaceChars) { | String replaceChars) { | ||||
| String localString = ""; | |||||
| StringBuilder localString = new StringBuilder(); | |||||
| StringTokenizer st = new StringTokenizer(inpString, escapeChars, true); | StringTokenizer st = new StringTokenizer(inpString, escapeChars, true); | ||||
| int numTokens = st.countTokens(); | int numTokens = st.countTokens(); | ||||
| for (int i = 0; i < numTokens; i++) { | for (int i = 0; i < numTokens; i++) { | ||||
| String test = st.nextToken(); | String test = st.nextToken(); | ||||
| test = (test.equals(escapeChars) ? replaceChars : test); | test = (test.equals(escapeChars) ? replaceChars : test); | ||||
| localString += test; | |||||
| localString.append(test); | |||||
| } | } | ||||
| return localString; | |||||
| return localString.toString(); | |||||
| } | } | ||||
| } | } | ||||
| @@ -50,15 +50,13 @@ public abstract class DefaultJspCompilerAdapter | |||||
| jspc.log("Compilation " + cmd.describeJavaCommand(), | jspc.log("Compilation " + cmd.describeJavaCommand(), | ||||
| Project.MSG_VERBOSE); | Project.MSG_VERBOSE); | ||||
| StringBuilder niceSourceList = | |||||
| new StringBuilder(compileList.size() == 1 ? "File" : "Files") | |||||
| .append(" to be compiled:").append(lSep) | |||||
| .append(compileList.stream() | |||||
| .peek(arg -> cmd.createArgument().setValue(arg)) | |||||
| .map(arg -> " " + arg) | |||||
| .collect(Collectors.joining(lSep))); | |||||
| jspc.log(niceSourceList.toString(), Project.MSG_VERBOSE); | |||||
| String niceSourceList = (compileList.size() == 1 ? "File" : "Files") + | |||||
| " to be compiled:" + lSep + | |||||
| compileList.stream() | |||||
| .peek(arg -> cmd.createArgument().setValue(arg)) | |||||
| .map(arg -> " " + arg) | |||||
| .collect(Collectors.joining(lSep)); | |||||
| jspc.log(niceSourceList, Project.MSG_VERBOSE); | |||||
| } | } | ||||
| // CheckStyle:VisibilityModifier OFF - bc | // CheckStyle:VisibilityModifier OFF - bc | ||||
| @@ -322,7 +322,7 @@ public class AggregateTransformer { | |||||
| final String suffix; | final String suffix; | ||||
| final String xsltFactoryName = xsltFactory == null ? null : xsltFactory.getName(); | final String xsltFactoryName = xsltFactory == null ? null : xsltFactory.getName(); | ||||
| if(xsltFactoryName != null && "net.sf.saxon.TransformerFactoryImpl".equals(xsltFactoryName)) { | |||||
| if ("net.sf.saxon.TransformerFactoryImpl".equals(xsltFactoryName)) { | |||||
| suffix = "-saxon.xsl"; | suffix = "-saxon.xsl"; | ||||
| } else { | } else { | ||||
| suffix = ".xsl"; | suffix = ".xsl"; | ||||
| @@ -124,9 +124,7 @@ public class BriefJUnitResultFormatter implements JUnitResultFormatter, IgnoredT | |||||
| return; // Quick return - no output do nothing. | return; // Quick return - no output do nothing. | ||||
| } | } | ||||
| try { | try { | ||||
| output | |||||
| .write(new StringBuilder("Testsuite: ").append(suite.getName()) | |||||
| .append(StringUtils.LINE_SEP).toString()); | |||||
| output.write("Testsuite: " + suite.getName() + StringUtils.LINE_SEP); | |||||
| output.flush(); | output.flush(); | ||||
| } catch (IOException ex) { | } catch (IOException ex) { | ||||
| throw new BuildException(ex); | throw new BuildException(ex); | ||||
| @@ -1643,7 +1643,7 @@ public class JUnitTask extends Task { | |||||
| if (timeout == null) { | if (timeout == null) { | ||||
| return null; | return null; | ||||
| } | } | ||||
| return new ExecuteWatchdog((long) timeout.intValue()); | |||||
| return new ExecuteWatchdog((long) timeout); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -129,7 +129,7 @@ public class JUnitTest extends BaseTest implements Cloneable { | |||||
| this.haltOnFail = haltOnFailure; | this.haltOnFail = haltOnFailure; | ||||
| this.filtertrace = filtertrace; | this.filtertrace = filtertrace; | ||||
| this.methodsSpecified = methods != null; | this.methodsSpecified = methods != null; | ||||
| this.methods = methodsSpecified ? (String[]) methods.clone() : null; | |||||
| this.methods = methodsSpecified ? methods.clone() : null; | |||||
| this.antThreadID = thread; | this.antThreadID = thread; | ||||
| } | } | ||||
| @@ -306,7 +306,7 @@ public class JUnitTestRunner implements TestListener, JUnitTaskMirror.JUnitTestR | |||||
| this.haltOnFailure = haltOnFailure; | this.haltOnFailure = haltOnFailure; | ||||
| this.showOutput = showOutput; | this.showOutput = showOutput; | ||||
| this.logTestListenerEvents = logTestListenerEvents; | this.logTestListenerEvents = logTestListenerEvents; | ||||
| this.methods = methods != null ? (String[]) methods.clone() : null; | |||||
| this.methods = methods != null ? methods.clone() : null; | |||||
| this.loader = loader; | this.loader = loader; | ||||
| } | } | ||||
| @@ -46,11 +46,11 @@ public class JUnitVersionHelper { | |||||
| static { | static { | ||||
| try { | try { | ||||
| testCaseName = TestCase.class.getMethod("getName", new Class[0]); | |||||
| testCaseName = TestCase.class.getMethod("getName"); | |||||
| } catch (NoSuchMethodException e) { | } catch (NoSuchMethodException e) { | ||||
| // pre JUnit 3.7 | // pre JUnit 3.7 | ||||
| try { | try { | ||||
| testCaseName = TestCase.class.getMethod("name", new Class[0]); | |||||
| testCaseName = TestCase.class.getMethod("name"); | |||||
| } catch (NoSuchMethodException ignored) { | } catch (NoSuchMethodException ignored) { | ||||
| // ignore | // ignore | ||||
| } | } | ||||
| @@ -105,8 +105,8 @@ public class PlainJUnitResultFormatter implements JUnitResultFormatter, IgnoredT | |||||
| return; // Quick return - no output do nothing. | return; // Quick return - no output do nothing. | ||||
| } | } | ||||
| try { | try { | ||||
| out.write(new StringBuilder("Testsuite: ").append(suite.getName()) | |||||
| .append(StringUtils.LINE_SEP).toString().getBytes()); | |||||
| out.write(("Testsuite: " + suite.getName() + | |||||
| StringUtils.LINE_SEP).getBytes()); | |||||
| out.flush(); | out.flush(); | ||||
| } catch (IOException ex) { | } catch (IOException ex) { | ||||
| throw new BuildException("Unable to write output", ex); | throw new BuildException("Unable to write output", ex); | ||||
| @@ -122,19 +122,9 @@ public class PlainJUnitResultFormatter implements JUnitResultFormatter, IgnoredT | |||||
| public void endTestSuite(JUnitTest suite) throws BuildException { | public void endTestSuite(JUnitTest suite) throws BuildException { | ||||
| boolean success = false; | boolean success = false; | ||||
| try { | try { | ||||
| StringBuilder sb = new StringBuilder("Tests run: "); | |||||
| sb.append(suite.runCount()); | |||||
| sb.append(", Failures: "); | |||||
| sb.append(suite.failureCount()); | |||||
| sb.append(", Errors: "); | |||||
| sb.append(suite.errorCount()); | |||||
| sb.append(", Skipped: "); | |||||
| sb.append(suite.skipCount()); | |||||
| sb.append(", Time elapsed: "); | |||||
| sb.append(nf.format(suite.getRunTime() / ONE_SECOND)); | |||||
| sb.append(" sec"); | |||||
| sb.append(StringUtils.LINE_SEP); | |||||
| write(sb.toString()); | |||||
| write(String.format("Tests run: %d, Failures: %d, Errors: %d, Skipped: %d, Time elapsed: %s sec%n", | |||||
| suite.runCount(), suite.failureCount(), suite.errorCount(), suite.skipCount(), | |||||
| nf.format(suite.getRunTime() / ONE_SECOND))); | |||||
| // write the err and output streams to the log | // write the err and output streams to the log | ||||
| if (systemOutput != null && systemOutput.length() > 0) { | if (systemOutput != null && systemOutput.length() > 0) { | ||||
| @@ -190,7 +180,7 @@ public class PlainJUnitResultFormatter implements JUnitResultFormatter, IgnoredT | |||||
| */ | */ | ||||
| @Override | @Override | ||||
| public void startTest(Test t) { | public void startTest(Test t) { | ||||
| testStarts.put(t, new Long(System.currentTimeMillis())); | |||||
| testStarts.put(t, System.currentTimeMillis()); | |||||
| failed.put(t, Boolean.FALSE); | failed.put(t, Boolean.FALSE); | ||||
| } | } | ||||
| @@ -214,7 +204,7 @@ public class PlainJUnitResultFormatter implements JUnitResultFormatter, IgnoredT | |||||
| // can be null if an error occurred in setUp | // can be null if an error occurred in setUp | ||||
| if (l != null) { | if (l != null) { | ||||
| seconds = | seconds = | ||||
| (System.currentTimeMillis() - l.longValue()) / ONE_SECOND; | |||||
| (System.currentTimeMillis() - l) / ONE_SECOND; | |||||
| } | } | ||||
| wri.write(" took " + nf.format(seconds) + " sec"); | wri.write(" took " + nf.format(seconds) + " sec"); | ||||
| @@ -279,10 +279,7 @@ abstract class AbstractJUnitResultFormatter implements TestResultFormatter { | |||||
| if (this.inMemoryStore != null && this.inMemoryStore.position() > 0) { | if (this.inMemoryStore != null && this.inMemoryStore.position() > 0) { | ||||
| return true; | return true; | ||||
| } | } | ||||
| if (this.usingFileStore && this.filePath != null) { | |||||
| return true; | |||||
| } | |||||
| return false; | |||||
| return this.usingFileStore && this.filePath != null; | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -108,7 +108,7 @@ public class Native2AsciiAdapterFactory { | |||||
| private static Native2AsciiAdapter resolveClassName(String className, | private static Native2AsciiAdapter resolveClassName(String className, | ||||
| ClassLoader loader) | ClassLoader loader) | ||||
| throws BuildException { | throws BuildException { | ||||
| return (Native2AsciiAdapter) ClasspathUtils.newInstance(className, | |||||
| return ClasspathUtils.newInstance(className, | |||||
| loader != null ? loader : | loader != null ? loader : | ||||
| Native2AsciiAdapterFactory.class.getClassLoader(), | Native2AsciiAdapterFactory.class.getClassLoader(), | ||||
| Native2AsciiAdapter.class); | Native2AsciiAdapter.class); | ||||
| @@ -246,11 +246,11 @@ public class FTP extends Task implements FTPTaskConfig { | |||||
| */ | */ | ||||
| @Override | @Override | ||||
| public String getParent() { | public String getParent() { | ||||
| String result = ""; | |||||
| StringBuilder result = new StringBuilder(); | |||||
| for (int i = 0; i < parts.length - 1; i++){ | for (int i = 0; i < parts.length - 1; i++){ | ||||
| result += File.separatorChar + parts[i]; | |||||
| result.append(File.separatorChar).append(parts[i]); | |||||
| } | } | ||||
| return result; | |||||
| return result.toString(); | |||||
| } | } | ||||
| @@ -145,11 +145,11 @@ public class FTPTaskMirrorImpl implements FTPTaskMirror { | |||||
| */ | */ | ||||
| @Override | @Override | ||||
| public String getParent() { | public String getParent() { | ||||
| String result = ""; | |||||
| for(int i = 0; i < parts.length - 1; i++){ | |||||
| result += File.separatorChar + parts[i]; | |||||
| StringBuilder result = new StringBuilder(); | |||||
| for (int i = 0; i < parts.length - 1; i++){ | |||||
| result.append(File.separatorChar).append(parts[i]); | |||||
| } | } | ||||
| return result; | |||||
| return result.toString(); | |||||
| } | } | ||||
| /* (non-Javadoc) | /* (non-Javadoc) | ||||
| @@ -206,7 +206,7 @@ public class RExecTask extends Task { | |||||
| try { | try { | ||||
| StringBuilder sb = new StringBuilder(); | StringBuilder sb = new StringBuilder(); | ||||
| int windowStart = -s.length(); | int windowStart = -s.length(); | ||||
| if (timeout == null || timeout.intValue() == 0) { | |||||
| if (timeout == null || timeout == 0) { | |||||
| while (windowStart < 0 | while (windowStart < 0 | ||||
| || !sb.substring(windowStart).equals(s)) { | || !sb.substring(windowStart).equals(s)) { | ||||
| sb.append((char) is.read()); | sb.append((char) is.read()); | ||||
| @@ -214,7 +214,7 @@ public class RExecTask extends Task { | |||||
| } | } | ||||
| } else { | } else { | ||||
| Calendar endTime = Calendar.getInstance(); | Calendar endTime = Calendar.getInstance(); | ||||
| endTime.add(Calendar.SECOND, timeout.intValue()); | |||||
| endTime.add(Calendar.SECOND, timeout); | |||||
| while (windowStart < 0 | while (windowStart < 0 | ||||
| || !sb.substring(windowStart).equals(s)) { | || !sb.substring(windowStart).equals(s)) { | ||||
| while (Calendar.getInstance().before(endTime) | while (Calendar.getInstance().before(endTime) | ||||
| @@ -265,7 +265,7 @@ public class RExecTask extends Task { | |||||
| InputStream is = this.getInputStream(); | InputStream is = this.getInputStream(); | ||||
| try { | try { | ||||
| StringBuilder sb = new StringBuilder(); | StringBuilder sb = new StringBuilder(); | ||||
| if (timeout == null || timeout.intValue() == 0) { | |||||
| if (timeout == null || timeout == 0) { | |||||
| int read; | int read; | ||||
| while ((read = is.read()) != -1) { | while ((read = is.read()) != -1) { | ||||
| char c = (char) read; | char c = (char) read; | ||||
| @@ -277,7 +277,7 @@ public class RExecTask extends Task { | |||||
| } | } | ||||
| } else { | } else { | ||||
| Calendar endTime = Calendar.getInstance(); | Calendar endTime = Calendar.getInstance(); | ||||
| endTime.add(Calendar.SECOND, timeout.intValue()); | |||||
| endTime.add(Calendar.SECOND, timeout); | |||||
| int read = 0; | int read = 0; | ||||
| while (read != -1) { | while (read != -1) { | ||||
| while (Calendar.getInstance().before(endTime) && is.available() == 0) { | while (Calendar.getInstance().before(endTime) && is.available() == 0) { | ||||
| @@ -348,7 +348,7 @@ public class TelnetTask extends Task { | |||||
| try { | try { | ||||
| StringBuilder sb = new StringBuilder(); | StringBuilder sb = new StringBuilder(); | ||||
| int windowStart = -s.length(); | int windowStart = -s.length(); | ||||
| if (timeout == null || timeout.intValue() == 0) { | |||||
| if (timeout == null || timeout == 0) { | |||||
| while (windowStart < 0 | while (windowStart < 0 | ||||
| || !sb.substring(windowStart).equals(s)) { | || !sb.substring(windowStart).equals(s)) { | ||||
| sb.append((char) is.read()); | sb.append((char) is.read()); | ||||
| @@ -356,7 +356,7 @@ public class TelnetTask extends Task { | |||||
| } | } | ||||
| } else { | } else { | ||||
| Calendar endTime = Calendar.getInstance(); | Calendar endTime = Calendar.getInstance(); | ||||
| endTime.add(Calendar.SECOND, timeout.intValue()); | |||||
| endTime.add(Calendar.SECOND, timeout); | |||||
| while (windowStart < 0 | while (windowStart < 0 | ||||
| || !sb.substring(windowStart).equals(s)) { | || !sb.substring(windowStart).equals(s)) { | ||||
| while (Calendar.getInstance().before(endTime) | while (Calendar.getInstance().before(endTime) | ||||
| @@ -124,7 +124,7 @@ public class AntSoundPlayer implements LineListener, BuildListener { | |||||
| } | } | ||||
| if (duration != null) { | if (duration != null) { | ||||
| playClip(audioClip, duration.longValue()); | |||||
| playClip(audioClip, duration); | |||||
| } else { | } else { | ||||
| playClip(audioClip, loops); | playClip(audioClip, loops); | ||||
| } | } | ||||
| @@ -162,7 +162,7 @@ public class SoundTask extends Task { | |||||
| Random rn = new Random(); | Random rn = new Random(); | ||||
| int x = rn.nextInt(numfiles); | int x = rn.nextInt(numfiles); | ||||
| // set the source to the file at that location | // set the source to the file at that location | ||||
| this.source = (File) files.elementAt(x); | |||||
| this.source = files.elementAt(x); | |||||
| } | } | ||||
| } else { | } else { | ||||
| log(source + ": invalid path.", Project.MSG_WARN); | log(source + ": invalid path.", Project.MSG_WARN); | ||||
| @@ -61,9 +61,7 @@ public class Directory { | |||||
| * @param directory a Directory | * @param directory a Directory | ||||
| */ | */ | ||||
| public void addDirectory(Directory directory) { | public void addDirectory(Directory directory) { | ||||
| if (!childDirectories.contains(directory)) { | |||||
| childDirectories.add(directory); | |||||
| } | |||||
| childDirectories.add(directory); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -210,7 +210,7 @@ public class SSHSession extends SSHBase { | |||||
| int rport = 0; | int rport = 0; | ||||
| public void setLPort(final int lport) { | public void setLPort(final int lport) { | ||||
| final Integer portKey = Integer.valueOf(lport); | |||||
| final Integer portKey = lport; | |||||
| if (localPortsUsed.contains(portKey)) { | if (localPortsUsed.contains(portKey)) { | ||||
| throw new BuildException( | throw new BuildException( | ||||
| "Multiple local tunnels defined to use same local port %d", | "Multiple local tunnels defined to use same local port %d", | ||||
| @@ -265,7 +265,7 @@ public class SSHSession extends SSHBase { | |||||
| } | } | ||||
| public void setRPort(final int rport) { | public void setRPort(final int rport) { | ||||
| final Integer portKey = Integer.valueOf(rport); | |||||
| final Integer portKey = rport; | |||||
| if (remotePortsUsed.contains(portKey)) { | if (remotePortsUsed.contains(portKey)) { | ||||
| throw new BuildException( | throw new BuildException( | ||||
| "Multiple remote tunnels defined to use same remote port %d", | "Multiple remote tunnels defined to use same remote port %d", | ||||
| @@ -364,10 +364,10 @@ public class Scp extends SSHBase { | |||||
| } | } | ||||
| message.setLogListener(this); | message.setLogListener(this); | ||||
| if (fileMode != null) { | if (fileMode != null) { | ||||
| message.setFileMode(fileMode.intValue()); | |||||
| message.setFileMode(fileMode); | |||||
| } | } | ||||
| if (dirMode != null) { | if (dirMode != null) { | ||||
| message.setDirMode(dirMode.intValue()); | |||||
| message.setDirMode(dirMode); | |||||
| } | } | ||||
| message.execute(); | message.execute(); | ||||
| } | } | ||||
| @@ -399,10 +399,10 @@ public class Scp extends SSHBase { | |||||
| } | } | ||||
| message.setLogListener(this); | message.setLogListener(this); | ||||
| if (fileMode != null) { | if (fileMode != null) { | ||||
| message.setFileMode(fileMode.intValue()); | |||||
| message.setFileMode(fileMode); | |||||
| } | } | ||||
| if (dirMode != null) { | if (dirMode != null) { | ||||
| message.setDirMode(dirMode.intValue()); | |||||
| message.setDirMode(dirMode); | |||||
| } | } | ||||
| message.execute(); | message.execute(); | ||||
| } finally { | } finally { | ||||
| @@ -420,7 +420,7 @@ public class ScpToMessage extends AbstractSshMessage { | |||||
| * @since Ant 1.9.5 | * @since Ant 1.9.5 | ||||
| */ | */ | ||||
| public int getFileMode() { | public int getFileMode() { | ||||
| return fileMode != null ? fileMode.intValue() : DEFAULT_FILE_MODE; | |||||
| return fileMode != null ? fileMode : DEFAULT_FILE_MODE; | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -438,7 +438,7 @@ public class ScpToMessage extends AbstractSshMessage { | |||||
| * @since Ant 1.9.5 | * @since Ant 1.9.5 | ||||
| */ | */ | ||||
| public int getDirMode() { | public int getDirMode() { | ||||
| return dirMode != null ? dirMode.intValue() : DEFAULT_DIR_MODE; | |||||
| return dirMode != null ? dirMode : DEFAULT_DIR_MODE; | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -640,7 +640,7 @@ public abstract class MSVSS extends Task implements MSVSSConstants { | |||||
| * @return True if the FailOnError flag has been set or if 'writablefiles=skip'. | * @return True if the FailOnError flag has been set or if 'writablefiles=skip'. | ||||
| */ | */ | ||||
| private boolean getFailOnError() { | private boolean getFailOnError() { | ||||
| return getWritableFiles().equals(WRITABLE_SKIP) ? false : failOnError; | |||||
| return !getWritableFiles().equals(WRITABLE_SKIP) && failOnError; | |||||
| } | } | ||||
| @@ -351,15 +351,11 @@ public abstract class DefaultRmicAdapter implements RmicAdapter { | |||||
| attributes.log("Compilation " + cmd.describeArguments(), | attributes.log("Compilation " + cmd.describeArguments(), | ||||
| Project.MSG_VERBOSE); | Project.MSG_VERBOSE); | ||||
| StringBuilder niceSourceList = | |||||
| new StringBuilder(compileList.size() == 1 ? "File" : "Files") | |||||
| .append(" to be compiled:"); | |||||
| niceSourceList.append( | |||||
| compileList.stream().peek(arg -> cmd.createArgument().setValue(arg)) | |||||
| .collect(Collectors.joining(" "))); | |||||
| attributes.log(niceSourceList.toString(), Project.MSG_VERBOSE); | |||||
| String niceSourceList = (compileList.size() == 1 ? "File" : "Files") + | |||||
| " to be compiled:" + | |||||
| compileList.stream().peek(arg -> cmd.createArgument().setValue(arg)) | |||||
| .collect(Collectors.joining(" ")); | |||||
| attributes.log(niceSourceList, Project.MSG_VERBOSE); | |||||
| } | } | ||||
| private void verifyArguments(Commandline cmd) { | private void verifyArguments(Commandline cmd) { | ||||
| @@ -56,7 +56,7 @@ public class DirSet extends AbstractFileSet implements ResourceCollection { | |||||
| @Override | @Override | ||||
| public Object clone() { | public Object clone() { | ||||
| if (isReference()) { | if (isReference()) { | ||||
| return ((DirSet) getRef(getProject())).clone(); | |||||
| return getRef(getProject()).clone(); | |||||
| } | } | ||||
| return super.clone(); | return super.clone(); | ||||
| } | } | ||||
| @@ -115,8 +115,7 @@ public class Environment { | |||||
| */ | */ | ||||
| public String getContent() throws BuildException { | public String getContent() throws BuildException { | ||||
| validate(); | validate(); | ||||
| return new StringBuilder(key.trim()).append("=") | |||||
| .append(value.trim()).toString(); | |||||
| return key.trim() + "=" + value.trim(); | |||||
| } | } | ||||
| /** | /** | ||||