| @@ -613,6 +613,7 @@ public class DirectoryScanner | |||||
| * | * | ||||
| * @since Ant 1.6 | * @since Ant 1.6 | ||||
| */ | */ | ||||
| @SuppressWarnings("deprecated") | |||||
| public static void resetDefaultExcludes() { | public static void resetDefaultExcludes() { | ||||
| synchronized (defaultExcludes) { | synchronized (defaultExcludes) { | ||||
| defaultExcludes.clear(); | defaultExcludes.clear(); | ||||
| @@ -192,13 +192,11 @@ public final class ConcatFilter extends BaseParamFilterReader | |||||
| final Parameter[] params = getParameters(); | final Parameter[] params = getParameters(); | ||||
| if (params != null) { | if (params != null) { | ||||
| for (Parameter param : params) { | for (Parameter param : params) { | ||||
| if ("prepend".equals(param.getName())) { | |||||
| final String paramName = param.getName(); | |||||
| if ("prepend".equals(paramName)) { | |||||
| setPrepend(new File(param.getValue())); | setPrepend(new File(param.getValue())); | ||||
| continue; | |||||
| } | |||||
| if ("append".equals(param.getName())) { | |||||
| } else if ("append".equals(paramName)) { | |||||
| setAppend(new File(param.getValue())); | setAppend(new File(param.getValue())); | ||||
| continue; | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -188,13 +188,11 @@ public final class HeadFilter extends BaseParamFilterReader | |||||
| Parameter[] params = getParameters(); | Parameter[] params = getParameters(); | ||||
| if (params != null) { | if (params != null) { | ||||
| for (Parameter param : params) { | for (Parameter param : params) { | ||||
| if (LINES_KEY.equals(param.getName())) { | |||||
| final String paramName = param.getName(); | |||||
| if (LINES_KEY.equals(paramName)) { | |||||
| lines = Long.parseLong(param.getValue()); | lines = Long.parseLong(param.getValue()); | ||||
| continue; | |||||
| } | |||||
| if (SKIP_KEY.equals(param.getName())) { | |||||
| } else if (SKIP_KEY.equals(paramName)) { | |||||
| skip = Long.parseLong(param.getValue()); | skip = Long.parseLong(param.getValue()); | ||||
| continue; | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -318,16 +318,13 @@ public final class SortFilter extends BaseParamFilterReader | |||||
| 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())); | setReverse(Boolean.valueOf(param.getValue())); | ||||
| continue; | |||||
| } | |||||
| if (COMPARATOR_KEY.equals(paramName)) { | |||||
| } else if (COMPARATOR_KEY.equals(paramName)) { | |||||
| try { | try { | ||||
| String className = 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()); | ||||
| setComparator(comparatorInstance); | setComparator(comparatorInstance); | ||||
| continue; | |||||
| } catch (InstantiationException | ClassNotFoundException | IllegalAccessException e) { | } catch (InstantiationException | ClassNotFoundException | IllegalAccessException e) { | ||||
| /* | /* | ||||
| * IAE probably means an inner non-static class, that case is not considered | * IAE probably means an inner non-static class, that case is not considered | ||||
| @@ -188,13 +188,11 @@ public final class TailFilter extends BaseParamFilterReader | |||||
| Parameter[] params = getParameters(); | Parameter[] params = getParameters(); | ||||
| if (params != null) { | if (params != null) { | ||||
| for (Parameter param : params) { | for (Parameter param : params) { | ||||
| if (LINES_KEY.equals(param.getName())) { | |||||
| final String paramName = param.getName(); | |||||
| if (LINES_KEY.equals(paramName)) { | |||||
| setLines(Long.parseLong(param.getValue())); | setLines(Long.parseLong(param.getValue())); | ||||
| continue; | |||||
| } | |||||
| if (SKIP_KEY.equals(param.getName())) { | |||||
| } else if (SKIP_KEY.equals(paramName)) { | |||||
| skip = Long.parseLong(param.getValue()); | skip = Long.parseLong(param.getValue()); | ||||
| continue; | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -23,7 +23,6 @@ import java.io.IOException; | |||||
| import org.apache.bcel.classfile.ClassParser; | import org.apache.bcel.classfile.ClassParser; | ||||
| import org.apache.bcel.classfile.ConstantValue; | import org.apache.bcel.classfile.ConstantValue; | ||||
| import org.apache.bcel.classfile.Field; | import org.apache.bcel.classfile.Field; | ||||
| import org.apache.bcel.classfile.JavaClass; | |||||
| // CheckStyle:HideUtilityClassConstructorCheck OFF - bc | // CheckStyle:HideUtilityClassConstructorCheck OFF - bc | ||||
| /** | /** | ||||
| @@ -17,6 +17,8 @@ | |||||
| */ | */ | ||||
| package org.apache.tools.ant.launch; | package org.apache.tools.ant.launch; | ||||
| import org.apache.tools.ant.util.FileUtils; | |||||
| import java.io.ByteArrayOutputStream; | import java.io.ByteArrayOutputStream; | ||||
| import java.io.File; | import java.io.File; | ||||
| import java.io.UnsupportedEncodingException; | import java.io.UnsupportedEncodingException; | ||||
| @@ -472,8 +474,9 @@ public final class Locator { | |||||
| */ | */ | ||||
| public static URL[] getLocationURLs(File location, | public static URL[] getLocationURLs(File location, | ||||
| final String... extensions) | final String... extensions) | ||||
| throws MalformedURLException { | |||||
| throws MalformedURLException { | |||||
| URL[] urls = new URL[0]; | URL[] urls = new URL[0]; | ||||
| FileUtils utils = FileUtils.getFileUtils(); | |||||
| if (!location.exists()) { | if (!location.exists()) { | ||||
| return urls; | return urls; | ||||
| @@ -484,7 +487,7 @@ public final class Locator { | |||||
| String littlePath = path.toLowerCase(Locale.ENGLISH); | String littlePath = path.toLowerCase(Locale.ENGLISH); | ||||
| for (String extension : extensions) { | for (String extension : extensions) { | ||||
| if (littlePath.endsWith(extension)) { | if (littlePath.endsWith(extension)) { | ||||
| urls[0] = fileToURL(location); | |||||
| urls[0] = utils.getFileURL(location); | |||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| @@ -496,7 +499,7 @@ public final class Locator { | |||||
| }); | }); | ||||
| urls = new URL[matches.length]; | urls = new URL[matches.length]; | ||||
| for (int i = 0; i < matches.length; ++i) { | for (int i = 0; i < matches.length; ++i) { | ||||
| urls[i] = fileToURL(matches[i]); | |||||
| urls[i] = utils.getFileURL(matches[i]); | |||||
| } | } | ||||
| return urls; | return urls; | ||||
| } | } | ||||
| @@ -27,7 +27,6 @@ import java.nio.file.Files; | |||||
| import java.util.Date; | import java.util.Date; | ||||
| import java.util.Enumeration; | import java.util.Enumeration; | ||||
| import java.util.HashSet; | import java.util.HashSet; | ||||
| import java.util.Iterator; | |||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.Set; | import java.util.Set; | ||||
| import java.util.Vector; | import java.util.Vector; | ||||
| @@ -180,13 +180,9 @@ public class Get extends Task { | |||||
| public boolean doGet(final int logLevel, final DownloadProgress progress) | public boolean doGet(final int logLevel, final DownloadProgress progress) | ||||
| throws IOException { | throws IOException { | ||||
| checkAttributes(); | checkAttributes(); | ||||
| for (final Resource r : sources) { | |||||
| final URLProvider up = r.as(URLProvider.class); | |||||
| final URL source = up.getURL(); | |||||
| return doGet(source, destination, logLevel, progress); | |||||
| } | |||||
| /*NOTREACHED*/ | |||||
| return false; | |||||
| return doGet(sources.iterator().next().as(URLProvider.class).getURL(), | |||||
| destination, logLevel, progress); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -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.util.Iterator; | |||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.Vector; | import java.util.Vector; | ||||
| @@ -43,6 +43,7 @@ import org.apache.tools.ant.types.Mapper; | |||||
| * @deprecated since 1.5.x. | * @deprecated since 1.5.x. | ||||
| * Use <move> instead | * Use <move> instead | ||||
| */ | */ | ||||
| @Deprecated | |||||
| public class RenameExtensions extends MatchingTask { | public class RenameExtensions extends MatchingTask { | ||||
| private String fromExtension = ""; | private String fromExtension = ""; | ||||
| @@ -389,6 +389,7 @@ public class JDependTask extends Task { | |||||
| * @exception BuildException if an error occurs | * @exception BuildException if an error occurs | ||||
| */ | */ | ||||
| @Override | @Override | ||||
| @SuppressWarnings("deprecated") | |||||
| public void execute() throws BuildException { | public void execute() throws BuildException { | ||||
| CommandlineJava commandline = new CommandlineJava(); | CommandlineJava commandline = new CommandlineJava(); | ||||
| @@ -627,6 +628,7 @@ public class JDependTask extends Task { | |||||
| return new ExecuteWatchdog(getTimeout()); | return new ExecuteWatchdog(getTimeout()); | ||||
| } | } | ||||
| @SuppressWarnings("deprecated") | |||||
| private Optional<Path> getWorkingPath() { | private Optional<Path> getWorkingPath() { | ||||
| Optional<Path> result = Optional.ofNullable(getClassespath()); | Optional<Path> result = Optional.ofNullable(getClassespath()); | ||||
| if (result.isPresent()) { | if (result.isPresent()) { | ||||
| @@ -42,7 +42,6 @@ abstract class AbstractJUnitResultFormatter implements TestResultFormatter { | |||||
| this.sysOutStore.store(data); | this.sysOutStore.store(data); | ||||
| } catch (IOException e) { | } catch (IOException e) { | ||||
| handleException(e); | handleException(e); | ||||
| return; | |||||
| } | } | ||||
| } | } | ||||
| @@ -55,7 +54,6 @@ abstract class AbstractJUnitResultFormatter implements TestResultFormatter { | |||||
| this.sysErrStore.store(data); | this.sysErrStore.store(data); | ||||
| } catch (IOException e) { | } catch (IOException e) { | ||||
| handleException(e); | handleException(e); | ||||
| return; | |||||
| } | } | ||||
| } | } | ||||
| @@ -394,7 +394,6 @@ public class JUnitLauncherTask extends Task { | |||||
| } catch (IOException e) { | } catch (IOException e) { | ||||
| task.log("Failed while streaming " + (this.streamType == StreamType.SYS_OUT ? "sysout" : "syserr") + " data", | task.log("Failed while streaming " + (this.streamType == StreamType.SYS_OUT ? "sysout" : "syserr") + " data", | ||||
| e, Project.MSG_INFO); | e, Project.MSG_INFO); | ||||
| return; | |||||
| } finally { | } finally { | ||||
| streamContentDeliver.stop = true; | streamContentDeliver.stop = true; | ||||
| // just "wakeup" the delivery thread, to take into account | // just "wakeup" the delivery thread, to take into account | ||||
| @@ -500,7 +499,6 @@ public class JUnitLauncherTask extends Task { | |||||
| closeAndWait(sysErr); | closeAndWait(sysErr); | ||||
| } catch (InterruptedException e) { | } catch (InterruptedException e) { | ||||
| Thread.currentThread().interrupt(); | Thread.currentThread().interrupt(); | ||||
| return; | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -99,7 +99,6 @@ class LegacyPlainResultFormatter extends AbstractJUnitResultFormatter implements | |||||
| } | } | ||||
| } catch (IOException ioe) { | } catch (IOException ioe) { | ||||
| handleException(ioe); | handleException(ioe); | ||||
| return; | |||||
| } | } | ||||
| } | } | ||||
| @@ -61,7 +61,6 @@ class LegacyXmlResultFormatter extends AbstractJUnitResultFormatter implements T | |||||
| new XMLReportWriter().write(); | new XMLReportWriter().write(); | ||||
| } catch (IOException | XMLStreamException e) { | } catch (IOException | XMLStreamException e) { | ||||
| handleException(e); | handleException(e); | ||||
| return; | |||||
| } | } | ||||
| } | } | ||||
| @@ -30,7 +30,6 @@ import java.util.stream.Stream; | |||||
| import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.BuildException; | ||||
| import org.apache.tools.ant.ProjectComponent; | import org.apache.tools.ant.ProjectComponent; | ||||
| import org.apache.tools.ant.taskdefs.condition.Os; | import org.apache.tools.ant.taskdefs.condition.Os; | ||||
| import org.apache.tools.ant.util.StringUtils; | |||||
| /** | /** | ||||
| * Commandline objects help handling command lines specifying processes to | * Commandline objects help handling command lines specifying processes to | ||||
| @@ -18,7 +18,6 @@ | |||||
| package org.apache.tools.ant.types; | package org.apache.tools.ant.types; | ||||
| import java.util.Enumeration; | |||||
| import java.util.LinkedList; | import java.util.LinkedList; | ||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.ListIterator; | import java.util.ListIterator; | ||||
| @@ -279,6 +279,7 @@ public final class JavaEnvUtils { | |||||
| * @return true if the version of Java is the same as the given version. | * @return true if the version of Java is the same as the given version. | ||||
| * @since Ant 1.5 | * @since Ant 1.5 | ||||
| */ | */ | ||||
| @SuppressWarnings("deprecated") | |||||
| public static boolean isJavaVersion(String version) { | public static boolean isJavaVersion(String version) { | ||||
| return javaVersion.equals(version) | return javaVersion.equals(version) | ||||
| || (javaVersion.equals(JAVA_9) && JAVA_1_9.equals(version)); | || (javaVersion.equals(JAVA_9) && JAVA_1_9.equals(version)); | ||||
| @@ -124,6 +124,7 @@ public class JavaEnvUtilsTest { | |||||
| } | } | ||||
| @Test | @Test | ||||
| @SuppressWarnings("deprecated") | |||||
| public void isJavaVersionSupportsBothVersionsOfJava9() { | public void isJavaVersionSupportsBothVersionsOfJava9() { | ||||
| assumeTrue(JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_9)); | assumeTrue(JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_9)); | ||||
| assertTrue("JAVA_1_9 is not considered equal to JAVA_9", | assertTrue("JAVA_1_9 is not considered equal to JAVA_9", | ||||
| @@ -131,6 +132,7 @@ public class JavaEnvUtilsTest { | |||||
| } | } | ||||
| @Test | @Test | ||||
| @SuppressWarnings("deprecated") | |||||
| public void java10IsDetectedProperly() { | public void java10IsDetectedProperly() { | ||||
| assumeTrue("10".equals(System.getProperty("java.specification.version"))); | assumeTrue("10".equals(System.getProperty("java.specification.version"))); | ||||
| assertEquals("10", JavaEnvUtils.getJavaVersion()); | assertEquals("10", JavaEnvUtils.getJavaVersion()); | ||||