From 763de3630829131122fbe565b43ab0616aa60ac7 Mon Sep 17 00:00:00 2001 From: Gintas Grigelionis Date: Sun, 1 Apr 2018 18:15:26 +0200 Subject: [PATCH] =?UTF-8?q?Remove=20extraneous=20exceptions=20and=20?= =?UTF-8?q?=E2=80=9Cextends=20Object=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../apache/tools/ant/filters/SortFilter.java | 2 +- .../apache/tools/ant/taskdefs/Deltree.java | 9 +- .../optional/jlink/ClassNameReader.java | 2 +- .../ant/types/selectors/SelectorUtils.java | 3 +- .../org/apache/tools/ant/util/UUEncoder.java | 4 +- .../apache/tools/bzip2/CBZip2InputStream.java | 4 +- .../tools/bzip2/CBZip2OutputStream.java | 2 +- .../apache/tools/ant/AntClassLoaderTest.java | 3 +- .../org/apache/tools/ant/BuildFileTest.java | 2 +- .../apache/tools/ant/DefaultLoggerTest.java | 2 +- .../tools/ant/DirectoryScannerTest.java | 2 +- .../apache/tools/ant/ExtendedTaskdefTest.java | 6 +- .../ant/ProjectHelperRepositoryTest.java | 6 +- .../apache/tools/ant/UnknownElementTest.java | 1 - .../org/apache/tools/ant/XmlLoggerTest.java | 2 +- .../tools/ant/filters/LineContainsTest.java | 2 +- .../tools/ant/filters/NoNewLineTest.java | 4 +- .../tools/ant/filters/TokenFilterTest.java | 10 +- .../apache/tools/ant/launch/LocatorTest.java | 20 ++-- .../tools/ant/taskdefs/ChecksumTest.java | 2 +- .../taskdefs/ExecStreamRedirectorTest.java | 2 +- .../tools/ant/taskdefs/ExecuteJavaTest.java | 2 +- .../tools/ant/taskdefs/FixCrLfTest.java | 42 ++++---- .../apache/tools/ant/taskdefs/MoveTest.java | 8 +- .../tools/ant/taskdefs/ReplaceTest.java | 4 +- .../tools/ant/taskdefs/RmicAdvancedTest.java | 96 +++++++++---------- .../tools/ant/taskdefs/SQLExecTest.java | 4 +- .../apache/tools/ant/taskdefs/StyleTest.java | 8 +- .../apache/tools/ant/taskdefs/TStampTest.java | 10 +- .../apache/tools/ant/taskdefs/ZipTest.java | 6 +- .../taskdefs/condition/AntVersionTest.java | 2 +- .../taskdefs/condition/IsReachableTest.java | 2 +- .../taskdefs/cvslib/ChangeLogParserTest.java | 2 +- .../taskdefs/optional/EchoPropertiesTest.java | 2 +- .../tools/ant/taskdefs/optional/JspcTest.java | 14 +-- .../taskdefs/optional/PropertyFileTest.java | 2 +- .../taskdefs/optional/ReplaceRegExpTest.java | 4 +- .../tools/ant/taskdefs/optional/RpmTest.java | 4 +- .../taskdefs/optional/SchemaValidateTest.java | 18 ++-- .../taskdefs/optional/XmlValidateTest.java | 4 +- .../tools/ant/taskdefs/optional/XsltTest.java | 8 +- .../taskdefs/optional/image/ImageTest.java | 2 +- .../optional/junit/JUnitReportTest.java | 6 +- .../optional/junit/JUnitTaskTest.java | 2 +- .../ant/taskdefs/optional/ssh/ScpTest.java | 3 +- .../tools/ant/types/CommandlineJavaTest.java | 2 +- .../tools/ant/types/XMLCatalogTest.java | 2 +- .../resources/LazyResourceCollectionTest.java | 4 +- .../ant/types/resources/ResourceListTest.java | 6 +- .../ant/types/resources/TarResourceTest.java | 4 +- .../apache/tools/bzip2/CBZip2StreamTest.java | 12 +-- .../apache/tools/zip/ZipOutputStreamTest.java | 4 +- .../vintage/AlwaysFailingJUnit4Test.java | 2 +- .../vintage/JUnit4SampleTest.java | 2 +- 54 files changed, 183 insertions(+), 200 deletions(-) diff --git a/src/main/org/apache/tools/ant/filters/SortFilter.java b/src/main/org/apache/tools/ant/filters/SortFilter.java index be08acb32..053fe2225 100644 --- a/src/main/org/apache/tools/ant/filters/SortFilter.java +++ b/src/main/org/apache/tools/ant/filters/SortFilter.java @@ -310,7 +310,7 @@ public final class SortFilter extends BaseParamFilterReader /** * Scans the parameters list */ - private void initialize() throws IOException { + private void initialize() { // get parameters Parameter[] params = getParameters(); if (params != null) { diff --git a/src/main/org/apache/tools/ant/taskdefs/Deltree.java b/src/main/org/apache/tools/ant/taskdefs/Deltree.java index 8657d76c1..8c8939156 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Deltree.java +++ b/src/main/org/apache/tools/ant/taskdefs/Deltree.java @@ -72,16 +72,11 @@ public class Deltree extends Task { log("Deleting: " + dir.getAbsolutePath()); - try { - removeDir(dir); - } catch (IOException ioe) { - String msg = "Unable to delete " + dir.getAbsolutePath(); - throw new BuildException(msg, getLocation()); - } + removeDir(dir); } } - private void removeDir(File dir) throws IOException { + private void removeDir(File dir) { // check to make sure that the given dir isn't a symlink // the comparison of absolute path and canonical path diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/jlink/ClassNameReader.java b/src/main/org/apache/tools/ant/taskdefs/optional/jlink/ClassNameReader.java index 7609c2f56..217ad8fb1 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/jlink/ClassNameReader.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/jlink/ClassNameReader.java @@ -104,7 +104,7 @@ class ConstantPool { * given just an InputStream. Reads in just enough to perform this * minimal task only. */ -public class ClassNameReader extends Object { +public class ClassNameReader { private static final int CLASS_MAGIC_NUMBER = 0xCAFEBABE; /** diff --git a/src/main/org/apache/tools/ant/types/selectors/SelectorUtils.java b/src/main/org/apache/tools/ant/types/selectors/SelectorUtils.java index 7ed9e99cc..b54ea8278 100644 --- a/src/main/org/apache/tools/ant/types/selectors/SelectorUtils.java +++ b/src/main/org/apache/tools/ant/types/selectors/SelectorUtils.java @@ -525,7 +525,8 @@ public final class SelectorUtils { /** * Same as {@link #tokenizePath tokenizePath} but hopefully faster. */ - /*package*/ static String[] tokenizePathAsArray(String path) { + /* package */ + static String[] tokenizePathAsArray(String path) { String root = null; if (FileUtils.isAbsolutePath(path)) { String[] s = FILE_UTILS.dissect(path); diff --git a/src/main/org/apache/tools/ant/util/UUEncoder.java b/src/main/org/apache/tools/ant/util/UUEncoder.java index b0c6737f2..852e9a1d3 100644 --- a/src/main/org/apache/tools/ant/util/UUEncoder.java +++ b/src/main/org/apache/tools/ant/util/UUEncoder.java @@ -87,11 +87,11 @@ public class UUEncoder { writer.flush(); } - private void encodeBegin() throws IOException { + private void encodeBegin() { encodeString("begin " + DEFAULT_MODE + " " + name + "\n"); } - private void encodeEnd() throws IOException { + private void encodeEnd() { encodeString(" \nend\n"); } diff --git a/src/main/org/apache/tools/bzip2/CBZip2InputStream.java b/src/main/org/apache/tools/bzip2/CBZip2InputStream.java index 7563a40e0..6a328f111 100644 --- a/src/main/org/apache/tools/bzip2/CBZip2InputStream.java +++ b/src/main/org/apache/tools/bzip2/CBZip2InputStream.java @@ -983,7 +983,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants { } } - private static final class Data extends Object { + private static final class Data { // (with blockSize 900k) final boolean[] inUse = new boolean[256]; // 256 byte @@ -1046,7 +1046,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants { } - private static void reportCRCError() throws IOException { + private static void reportCRCError() { // The clean way would be to throw an exception. //throw new IOException("crc error"); diff --git a/src/main/org/apache/tools/bzip2/CBZip2OutputStream.java b/src/main/org/apache/tools/bzip2/CBZip2OutputStream.java index a5ca068c2..ea4699567 100644 --- a/src/main/org/apache/tools/bzip2/CBZip2OutputStream.java +++ b/src/main/org/apache/tools/bzip2/CBZip2OutputStream.java @@ -1513,7 +1513,7 @@ public class CBZip2OutputStream extends OutputStream this.nMTF = wr + 1; } - static final class Data extends Object { + static final class Data { // with blockSize 900k /* maps unsigned byte => "does it occur in block" */ diff --git a/src/tests/junit/org/apache/tools/ant/AntClassLoaderTest.java b/src/tests/junit/org/apache/tools/ant/AntClassLoaderTest.java index a016d492f..a18064305 100644 --- a/src/tests/junit/org/apache/tools/ant/AntClassLoaderTest.java +++ b/src/tests/junit/org/apache/tools/ant/AntClassLoaderTest.java @@ -175,7 +175,7 @@ public class AntClassLoaderTest { * classes cannot be loaded */ @Test - public void testInvalidZipException() throws Exception { + public void testInvalidZipException() { buildRule.executeTarget("createNonJar"); File jar = new File(buildRule.getProject().getProperty("tmp.dir") + "/foo.jar"); @@ -234,6 +234,7 @@ public class AntClassLoaderTest { public URL getResource(String n) { return null; } + @SuppressWarnings("unchecked") public Enumeration getResources(String n) { return new CollectionUtils.EmptyEnumeration(); } diff --git a/src/tests/junit/org/apache/tools/ant/BuildFileTest.java b/src/tests/junit/org/apache/tools/ant/BuildFileTest.java index 60bf68b84..b63ac9eae 100644 --- a/src/tests/junit/org/apache/tools/ant/BuildFileTest.java +++ b/src/tests/junit/org/apache/tools/ant/BuildFileTest.java @@ -72,7 +72,7 @@ public abstract class BuildFileTest extends TestCase { * is automatically called, since it's trivial to have a * test target depend on it. */ - protected void tearDown() throws Exception { + protected void tearDown() { if (project == null) { /* * Maybe the BuildFileTest was subclassed and there is diff --git a/src/tests/junit/org/apache/tools/ant/DefaultLoggerTest.java b/src/tests/junit/org/apache/tools/ant/DefaultLoggerTest.java index 303a44b60..60e818c9f 100644 --- a/src/tests/junit/org/apache/tools/ant/DefaultLoggerTest.java +++ b/src/tests/junit/org/apache/tools/ant/DefaultLoggerTest.java @@ -36,7 +36,7 @@ public class DefaultLoggerTest { @SuppressWarnings("serial") @Test - public void testThrowableMessage() throws Exception { // #43398 + public void testThrowableMessage() { // #43398 BuildException be = new BuildException("oops", new Location("build.xml", 1, 0)); assertEquals( "build.xml:1: oops" + StringUtils.LINE_SEP, diff --git a/src/tests/junit/org/apache/tools/ant/DirectoryScannerTest.java b/src/tests/junit/org/apache/tools/ant/DirectoryScannerTest.java index 819d4e50e..ae40fa610 100644 --- a/src/tests/junit/org/apache/tools/ant/DirectoryScannerTest.java +++ b/src/tests/junit/org/apache/tools/ant/DirectoryScannerTest.java @@ -508,7 +508,7 @@ public class DirectoryScannerTest { } @Test - public void testRecursiveExcludes() throws Exception { + public void testRecursiveExcludes() { DirectoryScanner ds = new DirectoryScanner(); ds.setBasedir(new File(buildRule.getProject().getProperty("output"))); ds.setExcludes(new String[] {"**/beta/**"}); diff --git a/src/tests/junit/org/apache/tools/ant/ExtendedTaskdefTest.java b/src/tests/junit/org/apache/tools/ant/ExtendedTaskdefTest.java index d5444f9ea..e5413b6af 100644 --- a/src/tests/junit/org/apache/tools/ant/ExtendedTaskdefTest.java +++ b/src/tests/junit/org/apache/tools/ant/ExtendedTaskdefTest.java @@ -41,12 +41,12 @@ public class ExtendedTaskdefTest { } @After - public void tearDown() throws Exception { + public void tearDown() { buildRule.executeTarget("teardown"); } @Test - public void testRun() throws Exception { + public void testRun() { try { buildRule.executeTarget("testRun"); fail("BuildException should have been thrown"); @@ -56,7 +56,7 @@ public class ExtendedTaskdefTest { } @Test - public void testRun2() throws Exception { + public void testRun2() { try { buildRule.executeTarget("testRun2"); fail("BuildException should have been thrown"); diff --git a/src/tests/junit/org/apache/tools/ant/ProjectHelperRepositoryTest.java b/src/tests/junit/org/apache/tools/ant/ProjectHelperRepositoryTest.java index eec42f783..6b766f3c0 100644 --- a/src/tests/junit/org/apache/tools/ant/ProjectHelperRepositoryTest.java +++ b/src/tests/junit/org/apache/tools/ant/ProjectHelperRepositoryTest.java @@ -45,7 +45,7 @@ public class ProjectHelperRepositoryTest { } @Test - public void testFind() throws Exception { + public void testFind() { ProjectHelperRepository repo = ProjectHelperRepository.getInstance(); repo.registerProjectHelper(SomeHelper.class); @@ -75,7 +75,7 @@ public class ProjectHelperRepositoryTest { } @Test - public void testNoDefaultContructor() throws Exception { + public void testNoDefaultContructor() { class IncrrectHelper extends ProjectHelper { // the default constructor is not visible to ant here @@ -92,7 +92,7 @@ public class ProjectHelperRepositoryTest { } @Test - public void testUnkwnowHelper() throws Exception { + public void testUnkwnowHelper() { ProjectHelperRepository repo = ProjectHelperRepository.getInstance(); try { repo.registerProjectHelper("xxx.yyy.zzz.UnknownHelper"); diff --git a/src/tests/junit/org/apache/tools/ant/UnknownElementTest.java b/src/tests/junit/org/apache/tools/ant/UnknownElementTest.java index 003f1a964..d60f22fef 100644 --- a/src/tests/junit/org/apache/tools/ant/UnknownElementTest.java +++ b/src/tests/junit/org/apache/tools/ant/UnknownElementTest.java @@ -24,7 +24,6 @@ import org.junit.Rule; import org.junit.Test; import java.util.ArrayList; -import java.util.Iterator; import java.util.List; import static org.junit.Assert.assertEquals; diff --git a/src/tests/junit/org/apache/tools/ant/XmlLoggerTest.java b/src/tests/junit/org/apache/tools/ant/XmlLoggerTest.java index cfeb16b4d..58fc0a834 100644 --- a/src/tests/junit/org/apache/tools/ant/XmlLoggerTest.java +++ b/src/tests/junit/org/apache/tools/ant/XmlLoggerTest.java @@ -26,7 +26,7 @@ public class XmlLoggerTest { @Test // see https://issues.apache.org/bugzilla/show_bug.cgi?id=56850 // "NPE in XmlLogger.buildFinished" - public void test() throws Throwable { + public void test() { final XmlLogger logger = new XmlLogger(); final Cvs task = new Cvs(); final BuildEvent event = new BuildEvent(task); diff --git a/src/tests/junit/org/apache/tools/ant/filters/LineContainsTest.java b/src/tests/junit/org/apache/tools/ant/filters/LineContainsTest.java index d10d9516d..5127c8639 100644 --- a/src/tests/junit/org/apache/tools/ant/filters/LineContainsTest.java +++ b/src/tests/junit/org/apache/tools/ant/filters/LineContainsTest.java @@ -49,7 +49,7 @@ public class LineContainsTest { } @Test - public void testNegateLineContains() throws IOException { + public void testNegateLineContains() { buildRule.executeTarget("testNegateLineContains"); } diff --git a/src/tests/junit/org/apache/tools/ant/filters/NoNewLineTest.java b/src/tests/junit/org/apache/tools/ant/filters/NoNewLineTest.java index c12a1d3fd..c826e3cba 100644 --- a/src/tests/junit/org/apache/tools/ant/filters/NoNewLineTest.java +++ b/src/tests/junit/org/apache/tools/ant/filters/NoNewLineTest.java @@ -18,8 +18,6 @@ package org.apache.tools.ant.filters; -import java.io.IOException; - import org.apache.tools.ant.BuildFileRule; import org.junit.Before; import org.junit.Rule; @@ -41,7 +39,7 @@ public class NoNewLineTest { @Test - public void testNoAddNewLine() throws IOException { + public void testNoAddNewLine() { buildRule.executeTarget("testNoAddNewLine"); } diff --git a/src/tests/junit/org/apache/tools/ant/filters/TokenFilterTest.java b/src/tests/junit/org/apache/tools/ant/filters/TokenFilterTest.java index b07abe0d5..a0125e917 100644 --- a/src/tests/junit/org/apache/tools/ant/filters/TokenFilterTest.java +++ b/src/tests/junit/org/apache/tools/ant/filters/TokenFilterTest.java @@ -51,18 +51,18 @@ public class TokenFilterTest { /** make sure tokenfilter exists */ @Test - public void testTokenfilter() throws IOException { + public void testTokenfilter() { buildRule.executeTarget("tokenfilter"); } @Test - public void testTrimignore() throws IOException { + public void testTrimignore() { buildRule.executeTarget("trimignore"); assertContains("Hello-World", buildRule.getLog()); } @Test - public void testStringTokenizer() throws IOException { + public void testStringTokenizer() { buildRule.executeTarget("stringtokenizer"); assertContains("#This#is#a#number#of#words#", buildRule.getLog()); } @@ -98,7 +98,7 @@ public class TokenFilterTest { } @Test - public void testReplaceStrings() throws IOException { + public void testReplaceStrings() { buildRule.executeTarget("replacestrings"); assertContains("bar bar bar", buildRule.getLog()); } @@ -175,7 +175,7 @@ public class TokenFilterTest { } @Test - public void testFilterReplaceStrings() throws IOException { + public void testFilterReplaceStrings() { buildRule.executeTarget("filterreplacestrings"); assertContains("bar bar bar", buildRule.getLog()); } diff --git a/src/tests/junit/org/apache/tools/ant/launch/LocatorTest.java b/src/tests/junit/org/apache/tools/ant/launch/LocatorTest.java index b8dffae6a..31c6adefd 100644 --- a/src/tests/junit/org/apache/tools/ant/launch/LocatorTest.java +++ b/src/tests/junit/org/apache/tools/ant/launch/LocatorTest.java @@ -38,7 +38,7 @@ public class LocatorTest { @Before - public void setUp() throws Exception { + public void setUp() { windows = Os.isFamily(Os.FAMILY_DOS); unix = Os.isFamily(Os.FAMILY_UNIX); } @@ -88,7 +88,7 @@ public class LocatorTest { * this isn't really a valid URI, except maybe in IE * @throws Exception if something goes wrong */ - public void testNetworkURI() throws Exception { + public void testNetworkURI() { resolveTo("file:\\\\PC03\\jclasses\\lib\\ant-1.7.0.jar", "" + "\\\\PC03\\jclasses\\lib\\ant-1.7.0.jar", "\\\\PC03\\jclasses\\lib\\ant-1.7.0.jar"); @@ -96,26 +96,26 @@ public class LocatorTest { @Ignore("We don't appear to generate paths like this in the launcher") @Test - public void testTripleForwardSlashNetworkURI() throws Exception { + public void testTripleForwardSlashNetworkURI() { resolveTo("file:///PC03/jclasses/lib/ant-1.7.0.jar", "///PC03/jclasses/lib/ant-1.7.0.jar", "\\\\PC03\\jclasses\\lib\\ant-1.7.0.jar"); } @Test - public void testUnixNetworkPath() throws Exception { + public void testUnixNetworkPath() { resolveTo("file://cluster/home/ant/lib", "//cluster/home/ant/lib", "\\\\cluster\\home\\ant\\lib"); } @Test - public void testUnixPath() throws Exception { + public void testUnixPath() { resolveTo("file:/home/ant/lib", "/home/ant/lib", null); } @Test - public void testSpacedURI() throws Exception { + public void testSpacedURI() { resolveTo("file:C:\\Program Files\\Ant\\lib", "C:\\Program Files\\Ant\\lib", "C:\\Program Files\\Ant\\lib"); @@ -126,7 +126,7 @@ public class LocatorTest { * @throws Throwable if desired */ @Test - public void testAntOnRemoteShare() throws Throwable { + public void testAntOnRemoteShare() { String resolved = Locator.fromJarURI(SHARED_JAR_URI); assertResolved(SHARED_JAR_URI, LAUNCHER_JAR, resolved, unix); assertResolved(SHARED_JAR_URI, LAUNCHER_JAR.replace('/', '\\'), @@ -139,7 +139,7 @@ public class LocatorTest { * @throws Throwable if desired */ @Test - public void testFileFromRemoteShare() throws Throwable { + public void testFileFromRemoteShare() { String resolved = Locator.fromJarURI(SHARED_JAR_URI); File f = new File(resolved); String path = f.getAbsolutePath(); @@ -149,7 +149,7 @@ public class LocatorTest { } @Test - public void testHttpURI() throws Exception { + public void testHttpURI() { String url = "http://ant.apache.org"; try { Locator.fromURI(url); @@ -174,7 +174,7 @@ public class LocatorTest { } @Test - public void testOddLowAsciiURI() throws Exception { + public void testOddLowAsciiURI() { assertResolves("hash# and percent%"); } diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/ChecksumTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/ChecksumTest.java index 8d26153d0..e103f98ec 100644 --- a/src/tests/junit/org/apache/tools/ant/taskdefs/ChecksumTest.java +++ b/src/tests/junit/org/apache/tools/ant/taskdefs/ChecksumTest.java @@ -42,7 +42,7 @@ public class ChecksumTest { } @Test - public void testCreateMd5() throws IOException { + public void testCreateMd5() { buildRule.executeTarget("createMd5"); } diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/ExecStreamRedirectorTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/ExecStreamRedirectorTest.java index ba39fd5e3..99302de9e 100644 --- a/src/tests/junit/org/apache/tools/ant/taskdefs/ExecStreamRedirectorTest.java +++ b/src/tests/junit/org/apache/tools/ant/taskdefs/ExecStreamRedirectorTest.java @@ -23,7 +23,7 @@ public class ExecStreamRedirectorTest { private Project project; @Before - public void setUp() throws Exception { + public void setUp() { project = new Project(); project.init(); final File antFile = new File(System.getProperty("root"), "src/etc/testcases/taskdefs/exec/exec-with-redirector.xml"); diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/ExecuteJavaTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/ExecuteJavaTest.java index 06beab434..b6d3e5a2d 100644 --- a/src/tests/junit/org/apache/tools/ant/taskdefs/ExecuteJavaTest.java +++ b/src/tests/junit/org/apache/tools/ant/taskdefs/ExecuteJavaTest.java @@ -54,7 +54,7 @@ public class ExecuteJavaTest { ej.setClasspath(cp); } - private Commandline getCommandline(int timetorun) throws Exception { + private Commandline getCommandline(int timetorun) { Commandline cmd = new Commandline(); cmd.setExecutable(TimeProcess.class.getName()); cmd.createArgument().setValue(String.valueOf(timetorun)); diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/FixCrLfTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/FixCrLfTest.java index 258688de5..451a951fc 100644 --- a/src/tests/junit/org/apache/tools/ant/taskdefs/FixCrLfTest.java +++ b/src/tests/junit/org/apache/tools/ant/taskdefs/FixCrLfTest.java @@ -49,107 +49,107 @@ public class FixCrLfTest { } @Test - public void test1() throws IOException { + public void test1() { buildRule.executeTarget("test1"); } @Test - public void test2() throws IOException { + public void test2() { buildRule.executeTarget("test2"); } @Test - public void test3() throws IOException { + public void test3() { buildRule.executeTarget("test3"); } @Test - public void test4() throws IOException { + public void test4() { buildRule.executeTarget("test4"); } @Test - public void test5() throws IOException { + public void test5() { buildRule.executeTarget("test5"); } @Test - public void test6() throws IOException { + public void test6() { buildRule.executeTarget("test6"); } @Test - public void test7() throws IOException { + public void test7() { buildRule.executeTarget("test7"); } @Test - public void test8() throws IOException { + public void test8() { buildRule.executeTarget("test8"); } @Test - public void test9() throws IOException { + public void test9() { buildRule.executeTarget("test9"); } @Test - public void testMacLines() throws IOException { + public void testMacLines() { buildRule.executeTarget("testMacLines"); } @Test - public void testNoOverwrite() throws IOException { + public void testNoOverwrite() { buildRule.executeTarget("testNoOverwrite"); } @Test - public void testEncoding() throws IOException { + public void testEncoding() { buildRule.executeTarget("testEncoding"); } @Test - public void testOutputEncoding() throws IOException { + public void testOutputEncoding() { buildRule.executeTarget("testOutputEncoding"); } @Test - public void testLongLines() throws IOException { + public void testLongLines() { buildRule.executeTarget("testLongLines"); } @Test - public void testCrCrLfSequenceUnix() throws IOException { + public void testCrCrLfSequenceUnix() { buildRule.executeTarget("testCrCrLfSequence-unix"); } @Test - public void testCrCrLfSequenceDos() throws IOException { + public void testCrCrLfSequenceDos() { buildRule.executeTarget("testCrCrLfSequence-dos"); } @Test - public void testCrCrLfSequenceMac() throws IOException { + public void testCrCrLfSequenceMac() { buildRule.executeTarget("testCrCrLfSequence-mac"); } @Test - public void testFixlastDos() throws IOException { + public void testFixlastDos() { buildRule.executeTarget("testFixlastDos"); } @Test - public void testFixlastFalseMac() throws IOException { + public void testFixlastFalseMac() { buildRule.executeTarget("testFixlastFalseMac"); } @Test - public void testFixFile() throws Exception { + public void testFixFile() { buildRule.executeTarget("testFixFile"); } @Test - public void testFixFileExclusive() throws Exception { + public void testFixFileExclusive() { try { buildRule.executeTarget("testFixFileExclusive"); fail(FixCRLF.ERROR_FILE_AND_SRCDIR); diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/MoveTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/MoveTest.java index 9f5a7994c..37990031f 100644 --- a/src/tests/junit/org/apache/tools/ant/taskdefs/MoveTest.java +++ b/src/tests/junit/org/apache/tools/ant/taskdefs/MoveTest.java @@ -65,7 +65,7 @@ public class MoveTest { /** Bugzilla Report 11732 */ @Test - public void testDirectoryRemoval() throws IOException { + public void testDirectoryRemoval() { buildRule.executeTarget("testDirectoryRemoval"); String output = buildRule.getProject().getProperty("output"); @@ -81,7 +81,7 @@ public class MoveTest { /** Bugzilla Report 18886 */ @Test - public void testDirectoryRetaining() throws IOException { + public void testDirectoryRetaining() { buildRule.executeTarget("testDirectoryRetaining"); String output = buildRule.getProject().getProperty("output"); assertTrue(new File(output,"E").exists()); @@ -100,7 +100,7 @@ public class MoveTest { testCompleteDirectoryMove("testCompleteDirectoryMove2"); } - private void testCompleteDirectoryMove(String target) throws IOException { + private void testCompleteDirectoryMove(String target) { buildRule.executeTarget(target); String output = buildRule.getProject().getProperty("output"); assertTrue(new File(output,"E").exists()); @@ -111,7 +111,7 @@ public class MoveTest { } @Test - public void testPathElementMove() throws IOException { + public void testPathElementMove() { buildRule.executeTarget("testPathElementMove"); String output = buildRule.getProject().getProperty("output"); assertTrue(new File(output,"E").exists()); diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/ReplaceTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/ReplaceTest.java index 4a9691eae..3d2ff4fc9 100644 --- a/src/tests/junit/org/apache/tools/ant/taskdefs/ReplaceTest.java +++ b/src/tests/junit/org/apache/tools/ant/taskdefs/ReplaceTest.java @@ -130,7 +130,7 @@ public class ReplaceTest { } @Test - public void testNoPreserveLastModified() throws Exception { + public void testNoPreserveLastModified() { buildRule.executeTarget("lastModifiedSetup"); File testFile = new File(buildRule.getOutputDir(), "test.txt"); assumeTrue("Could not change file modification time", @@ -141,7 +141,7 @@ public class ReplaceTest { } @Test - public void testPreserveLastModified() throws Exception { + public void testPreserveLastModified() { buildRule.executeTarget("lastModifiedSetup"); File testFile = new File(buildRule.getOutputDir(), "test.txt"); assumeTrue("Could not change file modification time", diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/RmicAdvancedTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/RmicAdvancedTest.java index 5aa7c4f27..9dbbbc462 100644 --- a/src/tests/junit/org/apache/tools/ant/taskdefs/RmicAdvancedTest.java +++ b/src/tests/junit/org/apache/tools/ant/taskdefs/RmicAdvancedTest.java @@ -52,7 +52,7 @@ public class RmicAdvancedTest { * The JUnit setup method */ @Before - public void setUp() throws Exception { + public void setUp() { buildRule.configureProject(TASKDEFS_DIR + "rmic.xml"); } @@ -60,7 +60,7 @@ public class RmicAdvancedTest { * verify that "default" binds us to the default compiler */ @Test - public void testDefault() throws Exception { + public void testDefault() { buildRule.executeTarget("testDefault"); } @@ -68,7 +68,7 @@ public class RmicAdvancedTest { * verify that "default" binds us to the default compiler */ @Test - public void testDefaultDest() throws Exception { + public void testDefaultDest() { buildRule.executeTarget("testDefaultDest"); } @@ -76,7 +76,7 @@ public class RmicAdvancedTest { * verify that "" binds us to the default compiler */ @Test - public void testEmpty() throws Exception { + public void testEmpty() { buildRule.executeTarget("testEmpty"); } @@ -84,7 +84,7 @@ public class RmicAdvancedTest { * verify that "" binds us to the default compiler */ @Test - public void testEmptyDest() throws Exception { + public void testEmptyDest() { buildRule.executeTarget("testEmptyDest"); } @@ -92,7 +92,7 @@ public class RmicAdvancedTest { * test sun's rmic compiler */ @Test - public void testRmic() throws Exception { + public void testRmic() { buildRule.executeTarget("testRmic"); } @@ -100,7 +100,7 @@ public class RmicAdvancedTest { * test sun's rmic compiler */ @Test - public void testRmicDest() throws Exception { + public void testRmicDest() { buildRule.executeTarget("testRmicDest"); } @@ -109,7 +109,7 @@ public class RmicAdvancedTest { * out -J arguments when not forking */ @Test - public void testRmicJArg() throws Exception { + public void testRmicJArg() { buildRule.executeTarget("testRmicJArg"); } @@ -118,7 +118,7 @@ public class RmicAdvancedTest { * out -J arguments when not forking */ @Test - public void testRmicJArgDest() throws Exception { + public void testRmicJArgDest() { buildRule.executeTarget("testRmicJArgDest"); } @@ -126,7 +126,7 @@ public class RmicAdvancedTest { * A unit test for JUnit */ @Test - public void testKaffe() throws Exception { + public void testKaffe() { buildRule.executeTarget("testKaffe"); } @@ -134,7 +134,7 @@ public class RmicAdvancedTest { * A unit test for JUnit */ @Test - public void testKaffeDest() throws Exception { + public void testKaffeDest() { buildRule.executeTarget("testKaffeDest"); } @@ -144,7 +144,7 @@ public class RmicAdvancedTest { */ @Test @Ignore("WLRmic tests don't work") - public void XtestWlrmic() throws Exception { + public void XtestWlrmic() { buildRule.executeTarget("testWlrmic"); } @@ -153,7 +153,7 @@ public class RmicAdvancedTest { */ @Test @Ignore("WLRmic tests don't work") - public void XtestWlrmicJArg() throws Exception { + public void XtestWlrmicJArg() { buildRule.executeTarget("testWlrmicJArg"); } @@ -161,7 +161,7 @@ public class RmicAdvancedTest { * test the forking compiler */ @Test - public void testForking() throws Exception { + public void testForking() { buildRule.executeTarget("testForking"); } @@ -169,7 +169,7 @@ public class RmicAdvancedTest { * test the forking compiler */ @Test - public void testForkingAntClasspath() throws Exception { + public void testForkingAntClasspath() { buildRule.executeTarget("testForkingAntClasspath"); } @@ -177,7 +177,7 @@ public class RmicAdvancedTest { * test the forking compiler */ @Test - public void testForkingAntClasspathDest() throws Exception { + public void testForkingAntClasspathDest() { buildRule.executeTarget("testForkingAntClasspathDest"); } @@ -185,7 +185,7 @@ public class RmicAdvancedTest { * test the forking compiler */ @Test - public void testAntClasspath() throws Exception { + public void testAntClasspath() { buildRule.executeTarget("testAntClasspath"); } @@ -193,7 +193,7 @@ public class RmicAdvancedTest { * test the forking compiler */ @Test - public void testAntClasspathDest() throws Exception { + public void testAntClasspathDest() { buildRule.executeTarget("testAntClasspathDest"); } @@ -201,7 +201,7 @@ public class RmicAdvancedTest { * A unit test for JUnit */ @Test - public void testBadName() throws Exception { + public void testBadName() { tried.expect(BuildException.class); tried.expectMessage(RmicAdapterFactory.ERROR_UNKNOWN_COMPILER); buildRule.executeTarget("testBadName"); @@ -211,7 +211,7 @@ public class RmicAdvancedTest { * load an adapter by name */ @Test - public void testExplicitClass() throws Exception { + public void testExplicitClass() { buildRule.executeTarget("testExplicitClass"); } @@ -219,7 +219,7 @@ public class RmicAdvancedTest { * A unit test for JUnit */ @Test - public void testWrongClass() throws Exception { + public void testWrongClass() { tried.expect(BuildException.class); tried.expectMessage(RmicAdapterFactory.ERROR_NOT_RMIC_ADAPTER); buildRule.executeTarget("testWrongClass"); @@ -229,7 +229,7 @@ public class RmicAdvancedTest { * A unit test for JUnit */ @Test - public void testDefaultBadClass() throws Exception { + public void testDefaultBadClass() { tried.expect(BuildException.class); tried.expectMessage(Rmic.ERROR_RMIC_FAILED); try { @@ -244,7 +244,7 @@ public class RmicAdvancedTest { * A unit test for JUnit */ @Test - public void testMagicProperty() throws Exception { + public void testMagicProperty() { tried.expect(BuildException.class); tried.expectMessage(RmicAdapterFactory.ERROR_UNKNOWN_COMPILER); buildRule.executeTarget("testMagicProperty"); @@ -254,20 +254,20 @@ public class RmicAdvancedTest { * A unit test for JUnit */ @Test - public void testMagicPropertyOverridesEmptyString() throws Exception { + public void testMagicPropertyOverridesEmptyString() { tried.expect(BuildException.class); tried.expectMessage(RmicAdapterFactory.ERROR_UNKNOWN_COMPILER); buildRule.executeTarget("testMagicPropertyOverridesEmptyString"); } @Test - public void testMagicPropertyIsEmptyString() throws Exception { + public void testMagicPropertyIsEmptyString() { buildRule.executeTarget("testMagicPropertyIsEmptyString"); } @Test @Ignore("Previously named to prevent execution") - public void NotestFailingAdapter() throws Exception { + public void NotestFailingAdapter() { tried.expect(BuildException.class); tried.expectMessage(Rmic.ERROR_RMIC_FAILED); buildRule.executeTarget("testFailingAdapter"); @@ -278,7 +278,7 @@ public class RmicAdvancedTest { * @throws Exception if something goes wrong */ @Test - public void testVersion11() throws Exception { + public void testVersion11() { buildRule.executeTarget("testVersion11"); } @@ -287,7 +287,7 @@ public class RmicAdvancedTest { * @throws Exception if something goes wrong */ @Test - public void testVersion11Dest() throws Exception { + public void testVersion11Dest() { buildRule.executeTarget("testVersion11Dest"); } @@ -297,7 +297,7 @@ public class RmicAdvancedTest { * @throws Exception if something goes wrong */ @Test - public void testVersion12() throws Exception { + public void testVersion12() { buildRule.executeTarget("testVersion12"); } @@ -307,7 +307,7 @@ public class RmicAdvancedTest { * @throws Exception if something goes wrong */ @Test - public void testVersion12Dest() throws Exception { + public void testVersion12Dest() { buildRule.executeTarget("testVersion12Dest"); } @@ -317,7 +317,7 @@ public class RmicAdvancedTest { * @throws Exception if something goes wrong */ @Test - public void testVersionCompat() throws Exception { + public void testVersionCompat() { buildRule.executeTarget("testVersionCompat"); } @@ -327,7 +327,7 @@ public class RmicAdvancedTest { * @throws Exception if something goes wrong */ @Test - public void testVersionCompatDest() throws Exception { + public void testVersionCompatDest() { buildRule.executeTarget("testVersionCompatDest"); } @@ -337,13 +337,13 @@ public class RmicAdvancedTest { * @throws Exception if something goes wrong */ @Test - public void testXnewForked() throws Exception { + public void testXnewForked() { assumeFalse("Current system is Java 9 or newer", JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_9)); buildRule.executeTarget("testXnewForked"); } @Test - public void testXnewForkedJava9plus() throws Exception { + public void testXnewForkedJava9plus() { assumeTrue("Current system is Java 8 or older", JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_9)); tried.expect(BuildException.class); tried.expectMessage("JDK9 has removed support for -Xnew"); @@ -356,13 +356,13 @@ public class RmicAdvancedTest { * @throws Exception if something goes wrong */ @Test - public void testXnewForkedDest() throws Exception { + public void testXnewForkedDest() { assumeFalse("Current system is Java 9 or newer", JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_9)); buildRule.executeTarget("testXnewForkedDest"); } @Test - public void testXnewForkedDestJava9plus() throws Exception { + public void testXnewForkedDestJava9plus() { assumeTrue("Current system is Java 8 or older", JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_9)); tried.expect(BuildException.class); tried.expectMessage("JDK9 has removed support for -Xnew"); @@ -375,13 +375,13 @@ public class RmicAdvancedTest { * @throws Exception if something goes wrong */ @Test - public void testXnewCompiler() throws Exception { + public void testXnewCompiler() { assumeFalse("Current system is Java 9 or newer", JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_9)); buildRule.executeTarget("testXnewCompiler"); } @Test - public void testXnewCompilerJava9plus() throws Exception { + public void testXnewCompilerJava9plus() { assumeTrue("Current system is Java 8 or older", JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_9)); tried.expect(BuildException.class); tried.expectMessage("JDK9 has removed support for -Xnew"); @@ -394,13 +394,13 @@ public class RmicAdvancedTest { * @throws Exception if something goes wrong */ @Test - public void testXnewCompilerDest() throws Exception { + public void testXnewCompilerDest() { assumeFalse("Current system is Java 9 or newer", JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_9)); buildRule.executeTarget("testXnewCompilerDest"); } @Test - public void testXnewCompilerDestJava9plus() throws Exception { + public void testXnewCompilerDestJava9plus() { assumeTrue("Current system is Java 8 or older", JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_9)); tried.expect(BuildException.class); tried.expectMessage("JDK9 has removed support for -Xnew"); @@ -413,13 +413,13 @@ public class RmicAdvancedTest { * @throws Exception if something goes wrong */ @Test - public void testIDL() throws Exception { + public void testIDL() { assumeFalse("Current system is Java 11 or newer", JavaEnvUtils.isAtLeastJavaVersion("11")); buildRule.executeTarget("testIDL"); } @Test - public void testIDLJava11plus() throws Exception { + public void testIDLJava11plus() { assumeTrue("Current system is Java 10 or older", JavaEnvUtils.isAtLeastJavaVersion("11")); tried.expect(BuildException.class); tried.expectMessage("this rmic implementation doesn't support the -idl switch"); @@ -432,13 +432,13 @@ public class RmicAdvancedTest { * @throws Exception if something goes wrong */ @Test - public void testIDLDest() throws Exception { + public void testIDLDest() { assumeFalse("Current system is Java 11 or newer", JavaEnvUtils.isAtLeastJavaVersion("11")); buildRule.executeTarget("testIDLDest"); } @Test - public void testIDLDestJava11plus() throws Exception { + public void testIDLDestJava11plus() { assumeTrue("Current system is Java 10 or older", JavaEnvUtils.isAtLeastJavaVersion("11")); tried.expect(BuildException.class); tried.expectMessage("this rmic implementation doesn't support the -idl switch"); @@ -451,13 +451,13 @@ public class RmicAdvancedTest { * @throws Exception if something goes wrong */ @Test - public void testIIOP() throws Exception { + public void testIIOP() { assumeFalse("Current system is Java 11 or newer", JavaEnvUtils.isAtLeastJavaVersion("11")); buildRule.executeTarget("testIIOP"); } @Test - public void testIIOPJava11plus() throws Exception { + public void testIIOPJava11plus() { assumeTrue("Current system is Java 10 or older", JavaEnvUtils.isAtLeastJavaVersion("11")); tried.expect(BuildException.class); tried.expectMessage("this rmic implementation doesn't support the -iiop switch"); @@ -470,13 +470,13 @@ public class RmicAdvancedTest { * @throws Exception if something goes wrong */ @Test - public void testIIOPDest() throws Exception { + public void testIIOPDest() { assumeFalse("Current system is Java 11 or newer", JavaEnvUtils.isAtLeastJavaVersion("11")); buildRule.executeTarget("testIIOPDest"); } @Test - public void testIIOPDestJava11plus() throws Exception { + public void testIIOPDestJava11plus() { assumeTrue("Current system is Java 10 or older", JavaEnvUtils.isAtLeastJavaVersion("11")); tried.expect(BuildException.class); tried.expectMessage("this rmic implementation doesn't support the -iiop switch"); diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/SQLExecTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/SQLExecTest.java index faa890e26..68679855c 100644 --- a/src/tests/junit/org/apache/tools/ant/taskdefs/SQLExecTest.java +++ b/src/tests/junit/org/apache/tools/ant/taskdefs/SQLExecTest.java @@ -63,7 +63,7 @@ public class SQLExecTest { public static final String SQL = "sql"; @Before - public void setUp() throws Exception { + public void setUp() { // make sure the cache is cleared. JDBCTask.getLoaderMap().clear(); } @@ -98,7 +98,7 @@ public class SQLExecTest { } @Test - public void testNull() throws Exception { + public void testNull() { doMultipleCalls(1000, NULL, true, true); } diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/StyleTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/StyleTest.java index e95852476..6cde0ff49 100644 --- a/src/tests/junit/org/apache/tools/ant/taskdefs/StyleTest.java +++ b/src/tests/junit/org/apache/tools/ant/taskdefs/StyleTest.java @@ -44,12 +44,12 @@ public class StyleTest { public final BuildFileRule buildRule = new BuildFileRule(); @Before - public void setUp() throws Exception { + public void setUp() { buildRule.configureProject("src/etc/testcases/taskdefs/style/build.xml"); } @Test - public void testStyleIsSet() throws Exception { + public void testStyleIsSet() { try { buildRule.executeTarget("testStyleIsSet"); @@ -130,14 +130,14 @@ public class StyleTest { } @Test - public void testDirectoryHierarchyWithDirMatching() throws Exception { + public void testDirectoryHierarchyWithDirMatching() { buildRule.executeTarget("testDirectoryHierarchyWithDirMatching"); assertTrue(new File(buildRule.getOutputDir().getAbsoluteFile(), "dest/level1/data.html") .exists()); } @Test - public void testDirsWithSpaces() throws Exception { + public void testDirsWithSpaces() { buildRule.executeTarget("testDirsWithSpaces"); assertTrue(new File(buildRule.getOutputDir().getAbsoluteFile(), "d est/data.html") .exists()); diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/TStampTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/TStampTest.java index 033d1b9ff..f8e76bae3 100644 --- a/src/tests/junit/org/apache/tools/ant/taskdefs/TStampTest.java +++ b/src/tests/junit/org/apache/tools/ant/taskdefs/TStampTest.java @@ -40,7 +40,7 @@ public class TStampTest { protected Location location; @Before - public void setUp() throws Exception { + public void setUp() { location = new Location("test.xml"); project = new Project(); tstamp = new Tstamp(); @@ -49,7 +49,7 @@ public class TStampTest { } @Test - public void testTimeZone() throws Exception { + public void testTimeZone() { Tstamp.CustomFormat format = tstamp.createFormat(); format.setProperty("today"); format.setPattern("HH:mm:ss z"); @@ -71,7 +71,7 @@ public class TStampTest { * @throws Exception if something goes wrong */ @Test - public void testWriteOrder() throws Exception { + public void testWriteOrder() { Tstamp.CustomFormat format = tstamp.createFormat(); format.setProperty("TODAY"); format.setPattern("HH:mm:ss z"); @@ -94,7 +94,7 @@ public class TStampTest { * @throws Exception if something goes wrong */ @Test - public void testPrefix() throws Exception { + public void testPrefix() { tstamp.setPrefix("prefix"); tstamp.execute(); String prop = project.getProperty("prefix.DSTAMP"); @@ -102,7 +102,7 @@ public class TStampTest { } @Test - public void testFormatPrefix() throws Exception { + public void testFormatPrefix() { Tstamp.CustomFormat format = tstamp.createFormat(); format.setProperty("format"); format.setPattern("HH:mm:ss z"); diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/ZipTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/ZipTest.java index 4a73aec82..b2e285847 100644 --- a/src/tests/junit/org/apache/tools/ant/taskdefs/ZipTest.java +++ b/src/tests/junit/org/apache/tools/ant/taskdefs/ZipTest.java @@ -21,7 +21,6 @@ package org.apache.tools.ant.taskdefs; import java.io.File; import java.io.IOException; import java.util.zip.ZipEntry; -import java.util.zip.ZipException; import java.util.zip.ZipFile; import org.apache.tools.ant.BuildException; @@ -217,8 +216,7 @@ public class ZipTest { // Bugzilla Report 33412 @Test - public void testDefaultExcludesAndUpdate() - throws ZipException, IOException { + public void testDefaultExcludesAndUpdate() throws IOException { buildRule.executeTarget("testDefaultExcludesAndUpdate"); ZipFile f = null; try { @@ -303,7 +301,7 @@ public class ZipTest { } @Test - public void testRegexpMapper() throws IOException { + public void testRegexpMapper() { buildRule.executeTarget("testRegexpMapper1"); File testFile = new File(buildRule.getOutputDir(), "regexp.zip"); long l = testFile.lastModified(); diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/condition/AntVersionTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/condition/AntVersionTest.java index b70a1381f..e0a4f43ed 100644 --- a/src/tests/junit/org/apache/tools/ant/taskdefs/condition/AntVersionTest.java +++ b/src/tests/junit/org/apache/tools/ant/taskdefs/condition/AntVersionTest.java @@ -32,7 +32,7 @@ public class AntVersionTest { public BuildFileRule buildRule = new BuildFileRule(); @Before - public void setUp() throws Exception { + public void setUp() { buildRule.configureProject("src/etc/testcases/taskdefs/conditions/antversion.xml"); } diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/condition/IsReachableTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/condition/IsReachableTest.java index a58fb970d..bef7ab160 100644 --- a/src/tests/junit/org/apache/tools/ant/taskdefs/condition/IsReachableTest.java +++ b/src/tests/junit/org/apache/tools/ant/taskdefs/condition/IsReachableTest.java @@ -44,7 +44,7 @@ public class IsReachableTest { @Test - public void testLocalhost() throws Exception { + public void testLocalhost() { buildRule.executeTarget("testLocalhost"); } diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/cvslib/ChangeLogParserTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/cvslib/ChangeLogParserTest.java index fd065d1e4..4496bf028 100644 --- a/src/tests/junit/org/apache/tools/ant/taskdefs/cvslib/ChangeLogParserTest.java +++ b/src/tests/junit/org/apache/tools/ant/taskdefs/cvslib/ChangeLogParserTest.java @@ -34,7 +34,7 @@ public class ChangeLogParserTest { protected ChangeLogParser parser = new ChangeLogParser(); @Test - public void testOldCvsFormat() throws Exception { + public void testOldCvsFormat() { parser.stdout("Working file: build.xml"); parser.stdout("revision 1.475"); parser.stdout("date: 2004/06/05 16:10:32; author: somebody; state: Exp; lines: +2 -2"); diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/EchoPropertiesTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/EchoPropertiesTest.java index 9d34760ea..0536c9aa4 100644 --- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/EchoPropertiesTest.java +++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/EchoPropertiesTest.java @@ -182,7 +182,7 @@ public class EchoPropertiesTest { } @Test - public void testWithPrefixAndRegex() throws Exception { + public void testWithPrefixAndRegex() { try { buildRule.executeTarget("testWithPrefixAndRegex"); fail("BuildException should have been thrown on Prefix and RegEx being set"); diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/JspcTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/JspcTest.java index 3955f576e..3ec210e48 100644 --- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/JspcTest.java +++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/JspcTest.java @@ -60,12 +60,12 @@ public class JspcTest { } @Test - public void testUriroot() throws Exception { + public void testUriroot() { executeJspCompile("testUriroot", "uriroot_jsp.java"); } @Test - public void testXml() throws Exception { + public void testXml() { executeJspCompile("testXml", "xml_jsp.java"); } @@ -73,7 +73,7 @@ public class JspcTest { * try a keyword in a file */ @Test - public void testKeyword() throws Exception { + public void testKeyword() { executeJspCompile("testKeyword", "default_jsp.java"); } @@ -81,13 +81,13 @@ public class JspcTest { * what happens to 1nvalid-classname */ @Test - public void testInvalidClassname() throws Exception { + public void testInvalidClassname() { executeJspCompile("testInvalidClassname", "_1nvalid_0002dclassname_jsp.java"); } @Test - public void testNoTld() throws Exception { + public void testNoTld() { try { buildRule.executeTarget("testNoTld"); fail("Not found"); @@ -97,7 +97,7 @@ public class JspcTest { } @Test - public void testNotAJspFile() throws Exception { + public void testNotAJspFile() { buildRule.executeTarget("testNotAJspFile"); } @@ -107,7 +107,7 @@ public class JspcTest { */ @Ignore("picks up on the missing_tld file, and incorrectly bails") @Test - public void testWebapp() throws Exception { + public void testWebapp() { buildRule.executeTarget("testWebapp"); } diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/PropertyFileTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/PropertyFileTest.java index fa6cd86bc..7ccf00aa9 100644 --- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/PropertyFileTest.java +++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/PropertyFileTest.java @@ -115,7 +115,7 @@ public class PropertyFileTest { } @Test - public void testExerciseDefaultAndIncrement() throws Exception { + public void testExerciseDefaultAndIncrement() { buildRule.executeTarget("exercise"); assertEquals("3", buildRule.getProject().getProperty("int.with.default")); assertEquals("1", buildRule.getProject().getProperty("int.without.default")); diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/ReplaceRegExpTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/ReplaceRegExpTest.java index be1685bc0..96b55e509 100644 --- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/ReplaceRegExpTest.java +++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/ReplaceRegExpTest.java @@ -108,7 +108,7 @@ public class ReplaceRegExpTest { } @Test - public void testNoPreserveLastModified() throws Exception { + public void testNoPreserveLastModified() { buildRule.executeTarget("lastModifiedSetup"); File testFile = new File(buildRule.getOutputDir(), "test.txt"); assumeTrue(testFile.setLastModified(testFile.lastModified() @@ -119,7 +119,7 @@ public class ReplaceRegExpTest { } @Test - public void testPreserveLastModified() throws Exception { + public void testPreserveLastModified() { buildRule.executeTarget("lastModifiedSetup"); File testFile = new File(buildRule.getOutputDir(), "test.txt"); assumeTrue(testFile.setLastModified(testFile.lastModified() diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/RpmTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/RpmTest.java index b557f4497..137003855 100644 --- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/RpmTest.java +++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/RpmTest.java @@ -31,7 +31,7 @@ import static org.apache.tools.ant.AntAssert.assertContains; public class RpmTest { @Test - public void testShouldThrowExceptionWhenRpmFails() throws Exception { + public void testShouldThrowExceptionWhenRpmFails() { Rpm rpm = new MyRpm(); rpm.setProject(new Project()); rpm.setFailOnError(true); @@ -45,7 +45,7 @@ public class RpmTest { } @Test - public void testShouldNotThrowExceptionWhenRpmFails() throws Exception { + public void testShouldNotThrowExceptionWhenRpmFails() { Rpm rpm = new MyRpm(); rpm.execute(); } diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/SchemaValidateTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/SchemaValidateTest.java index 643aa6eba..12443f9cf 100644 --- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/SchemaValidateTest.java +++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/SchemaValidateTest.java @@ -49,7 +49,7 @@ public class SchemaValidateTest { * test with no namespace */ @Test - public void testNoNamespace() throws Exception { + public void testNoNamespace() { buildRule.executeTarget("testNoNamespace"); } @@ -57,12 +57,12 @@ public class SchemaValidateTest { * add namespace awareness. */ @Test - public void testNSMapping() throws Exception { + public void testNSMapping() { buildRule.executeTarget("testNSMapping"); } @Test - public void testNoEmptySchemaNamespace() throws Exception { + public void testNoEmptySchemaNamespace() { try { buildRule.executeTarget("testNoEmptySchemaNamespace"); fail("Empty namespace URI"); @@ -72,7 +72,7 @@ public class SchemaValidateTest { } @Test - public void testNoEmptySchemaLocation() throws Exception { + public void testNoEmptySchemaLocation() { try { buildRule.executeTarget("testNoEmptySchemaLocation"); fail("Empty schema location"); @@ -83,7 +83,7 @@ public class SchemaValidateTest { } @Test - public void testNoFile() throws Exception { + public void testNoFile() { try { buildRule.executeTarget("testNoFile"); fail("No file at file attribute"); @@ -94,7 +94,7 @@ public class SchemaValidateTest { } @Test - public void testNoDoubleSchemaLocation() throws Exception { + public void testNoDoubleSchemaLocation() { try { buildRule.executeTarget("testNoDoubleSchemaLocation"); fail("Two locations for schemas"); @@ -105,7 +105,7 @@ public class SchemaValidateTest { } @Test - public void testNoDuplicateSchema() throws Exception { + public void testNoDuplicateSchema() { try { buildRule.executeTarget("testNoDuplicateSchema"); fail("duplicate schemas with different values"); @@ -116,12 +116,12 @@ public class SchemaValidateTest { } @Test - public void testEqualsSchemasOK() throws Exception { + public void testEqualsSchemasOK() { buildRule.executeTarget("testEqualsSchemasOK"); } @Test - public void testFileset() throws Exception { + public void testFileset() { buildRule.executeTarget("testFileset"); } } diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/XmlValidateTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/XmlValidateTest.java index 2e5bbbbcf..f0b32b098 100644 --- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/XmlValidateTest.java +++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/XmlValidateTest.java @@ -54,7 +54,7 @@ public class XmlValidateTest { * Basic inline 'dtd' element test. */ @Test - public void testValidate() throws Exception { + public void testValidate() { buildRule.executeTarget("testValidate"); } @@ -62,7 +62,7 @@ public class XmlValidateTest { * Test indirect validation. */ @Test - public void testDeepValidate() throws Exception { + public void testDeepValidate() { buildRule.executeTarget("testDeepValidate"); } diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/XsltTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/XsltTest.java index e757faeee..5c6a27953 100644 --- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/XsltTest.java +++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/XsltTest.java @@ -56,17 +56,17 @@ public class XsltTest { } @Test - public void testCatalog() throws Exception { + public void testCatalog() { buildRule.executeTarget("testCatalog"); } @Test - public void testOutputProperty() throws Exception { + public void testOutputProperty() { buildRule.executeTarget("testOutputProperty"); } @Test - public void testXMLWithEntitiesInNonAsciiPath() throws Exception { + public void testXMLWithEntitiesInNonAsciiPath() { buildRule.executeTarget("testXMLWithEntitiesInNonAsciiPath"); } @@ -75,7 +75,7 @@ public class XsltTest { * @throws Exception if something goes wrong. */ @Test - public void testStyleSheetWithInclude() throws Exception { + public void testStyleSheetWithInclude() { buildRule.executeTarget("testStyleSheetWithInclude"); if (buildRule.getLog().contains("java.io.FileNotFoundException")) { fail("xsl:include was not found"); diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/image/ImageTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/image/ImageTest.java index 1fb82d4db..2b8b58294 100644 --- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/image/ImageTest.java +++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/image/ImageTest.java @@ -72,7 +72,7 @@ public class ImageTest { } @Test - public void testOverwriteTrue() throws InterruptedException { + public void testOverwriteTrue() { buildRule.executeTarget("testSimpleScale"); AntAssert.assertContains("Processing File", buildRule.getLog()); File f = new File(buildRule.getOutputDir(), LARGEIMAGE); diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitReportTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitReportTest.java index c467e9a17..1f30e35a7 100644 --- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitReportTest.java +++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitReportTest.java @@ -97,21 +97,21 @@ public class JUnitReportTest { } @Test - public void testEmptyFile() throws Exception { + public void testEmptyFile() { buildRule.executeTarget("testEmptyFile"); assertIndexCreated(); assertContains("Required text not found in log", XMLResultAggregator.WARNING_EMPTY_FILE, buildRule.getLog()); } @Test - public void testIncompleteFile() throws Exception { + public void testIncompleteFile() { buildRule.executeTarget("testIncompleteFile"); assertIndexCreated(); assertContains("Required text not found in log", XMLResultAggregator.WARNING_IS_POSSIBLY_CORRUPTED, buildRule.getLog()); } @Test - public void testWrongElement() throws Exception { + public void testWrongElement() { buildRule.executeTarget("testWrongElement"); assertIndexCreated(); assertContains("Required text not found in log", XMLResultAggregator.WARNING_INVALID_ROOT_ELEMENT, buildRule.getLog()); diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTaskTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTaskTest.java index 6d88c6cf3..cac0f5b55 100644 --- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTaskTest.java +++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTaskTest.java @@ -97,7 +97,7 @@ public class JUnitTaskTest { } @Test - public void testNonForkedCapture() throws IOException { + public void testNonForkedCapture() { buildRule.executeTarget("capture"); assertNoPrint(buildRule.getLog(), "log"); assertNoPrint(buildRule.getFullLog(), "debug log"); diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/ssh/ScpTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/ssh/ScpTest.java index 7be54186d..6df995417 100644 --- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/ssh/ScpTest.java +++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/ssh/ScpTest.java @@ -22,7 +22,6 @@ import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.util.ArrayList; -import java.util.Iterator; import java.util.List; import org.apache.tools.ant.BuildException; @@ -174,7 +173,7 @@ public class ScpTest { } @Test - public void testRemoteToDir() throws IOException { + public void testRemoteToDir() { // first try an invalid URI try { diff --git a/src/tests/junit/org/apache/tools/ant/types/CommandlineJavaTest.java b/src/tests/junit/org/apache/tools/ant/types/CommandlineJavaTest.java index 5f6bb506d..3b137129e 100644 --- a/src/tests/junit/org/apache/tools/ant/types/CommandlineJavaTest.java +++ b/src/tests/junit/org/apache/tools/ant/types/CommandlineJavaTest.java @@ -102,7 +102,7 @@ public class CommandlineJavaTest { } @Test - public void testJarOption() throws Exception { + public void testJarOption() { CommandlineJava c = new CommandlineJava(); c.createArgument().setValue("arg1"); c.setJar("myfile.jar"); diff --git a/src/tests/junit/org/apache/tools/ant/types/XMLCatalogTest.java b/src/tests/junit/org/apache/tools/ant/types/XMLCatalogTest.java index 961e55dca..befdbc1dc 100644 --- a/src/tests/junit/org/apache/tools/ant/types/XMLCatalogTest.java +++ b/src/tests/junit/org/apache/tools/ant/types/XMLCatalogTest.java @@ -56,7 +56,7 @@ public class XMLCatalogTest { return cat; } - private static String toURLString(File file) throws MalformedURLException { + private static String toURLString(File file) { return JAXPUtils.getSystemId(file); } diff --git a/src/tests/junit/org/apache/tools/ant/types/resources/LazyResourceCollectionTest.java b/src/tests/junit/org/apache/tools/ant/types/resources/LazyResourceCollectionTest.java index 34a4f09bb..24de5c0b7 100644 --- a/src/tests/junit/org/apache/tools/ant/types/resources/LazyResourceCollectionTest.java +++ b/src/tests/junit/org/apache/tools/ant/types/resources/LazyResourceCollectionTest.java @@ -77,7 +77,7 @@ public class LazyResourceCollectionTest { } @Test - public void testLazyLoading() throws Exception { + public void testLazyLoading() { StringResourceCollection collectionTest = new StringResourceCollection(); LazyResourceCollectionWrapper lazyCollection = new LazyResourceCollectionWrapper(); lazyCollection.add(collectionTest); @@ -118,7 +118,7 @@ public class LazyResourceCollectionTest { } @Test - public void testCaching() throws Exception { + public void testCaching() { StringResourceCollection collectionTest = new StringResourceCollection(); LazyResourceCollectionWrapper lazyCollection = new LazyResourceCollectionWrapper(); lazyCollection.add(collectionTest); diff --git a/src/tests/junit/org/apache/tools/ant/types/resources/ResourceListTest.java b/src/tests/junit/org/apache/tools/ant/types/resources/ResourceListTest.java index f0201789d..e7c8d78b1 100644 --- a/src/tests/junit/org/apache/tools/ant/types/resources/ResourceListTest.java +++ b/src/tests/junit/org/apache/tools/ant/types/resources/ResourceListTest.java @@ -35,12 +35,12 @@ public class ResourceListTest { public BuildFileRule buildRule = new BuildFileRule(); @Before - public void setUp() throws Exception { + public void setUp() { buildRule.configureProject("src/etc/testcases/types/resources/resourcelist.xml"); } @After - public void tearDown() throws Exception { + public void tearDown() { buildRule.executeTarget("tearDown"); } @@ -108,7 +108,7 @@ public class ResourceListTest { } @Test - public void testCircularReference() throws Exception { + public void testCircularReference() { ResourceList rl1 = new ResourceList(); rl1.setProject(buildRule.getProject()); rl1.setRefid(new Reference(buildRule.getProject(), "foo")); diff --git a/src/tests/junit/org/apache/tools/ant/types/resources/TarResourceTest.java b/src/tests/junit/org/apache/tools/ant/types/resources/TarResourceTest.java index f848f7da7..66a3d8595 100644 --- a/src/tests/junit/org/apache/tools/ant/types/resources/TarResourceTest.java +++ b/src/tests/junit/org/apache/tools/ant/types/resources/TarResourceTest.java @@ -36,13 +36,13 @@ public class TarResourceTest { public BuildFileRule buildRule = new BuildFileRule(); @Before - public void setUp() throws Exception { + public void setUp() { buildRule.configureProject("src/etc/testcases/types/resources/tarentry.xml"); } @After - public void tearDown() throws Exception { + public void tearDown() { buildRule.executeTarget("tearDown"); } diff --git a/src/tests/junit/org/apache/tools/bzip2/CBZip2StreamTest.java b/src/tests/junit/org/apache/tools/bzip2/CBZip2StreamTest.java index 88b500a86..8d0b1a166 100644 --- a/src/tests/junit/org/apache/tools/bzip2/CBZip2StreamTest.java +++ b/src/tests/junit/org/apache/tools/bzip2/CBZip2StreamTest.java @@ -23,20 +23,12 @@ import java.io.IOException; import org.junit.Test; -import static org.junit.Assert.fail; - public class CBZip2StreamTest { @SuppressWarnings("resource") - @Test + @Test(expected = IOException.class) public void testNullPointer() throws IOException { - try { - new CBZip2InputStream(new ByteArrayInputStream(new byte[0])); - fail("expected an exception"); - } catch (IOException e) { - // expected - //TODO assert exception values - } + new CBZip2InputStream(new ByteArrayInputStream(new byte[0])); } @Test diff --git a/src/tests/junit/org/apache/tools/zip/ZipOutputStreamTest.java b/src/tests/junit/org/apache/tools/zip/ZipOutputStreamTest.java index f41b246f5..991dc69ef 100644 --- a/src/tests/junit/org/apache/tools/zip/ZipOutputStreamTest.java +++ b/src/tests/junit/org/apache/tools/zip/ZipOutputStreamTest.java @@ -32,7 +32,7 @@ public class ZipOutputStreamTest { private ZipLong zl; @Before - public void setUp() throws Exception { + public void setUp() { time = new Date(); Calendar cal = Calendar.getInstance(); cal.setTime(time); @@ -55,7 +55,7 @@ public class ZipOutputStreamTest { @Test - public void testZipLong() throws Exception { + public void testZipLong() { ZipLong test = ZipOutputStream.toDosTime(time); assertEquals(test.getValue(), zl.getValue()); } diff --git a/src/tests/junit/org/example/junitlauncher/vintage/AlwaysFailingJUnit4Test.java b/src/tests/junit/org/example/junitlauncher/vintage/AlwaysFailingJUnit4Test.java index bb1b0daca..cf4317c02 100644 --- a/src/tests/junit/org/example/junitlauncher/vintage/AlwaysFailingJUnit4Test.java +++ b/src/tests/junit/org/example/junitlauncher/vintage/AlwaysFailingJUnit4Test.java @@ -10,7 +10,7 @@ import static org.junit.Assert.assertEquals; public class AlwaysFailingJUnit4Test { @Test - public void testWillFail() throws Exception { + public void testWillFail() { assertEquals("Values weren't equal", 3, 4); } } diff --git a/src/tests/junit/org/example/junitlauncher/vintage/JUnit4SampleTest.java b/src/tests/junit/org/example/junitlauncher/vintage/JUnit4SampleTest.java index bf606a27d..f5896e1d3 100644 --- a/src/tests/junit/org/example/junitlauncher/vintage/JUnit4SampleTest.java +++ b/src/tests/junit/org/example/junitlauncher/vintage/JUnit4SampleTest.java @@ -14,7 +14,7 @@ public class JUnit4SampleTest { } @Test - public void testBar() throws Exception { + public void testBar() { Assert.assertTrue(true); }