| @@ -978,10 +978,6 @@ public class Main implements AntMain { | |||||
| project.setInputHandler(handler); | project.setInputHandler(handler); | ||||
| } | } | ||||
| // TODO: (Jon Skeet) Any reason for writing a message and then using a bare | |||||
| // RuntimeException rather than just using a BuildException here? Is it | |||||
| // in case the message could end up being written to no loggers (as the | |||||
| // loggers could have failed to be created due to this failure)? | |||||
| /** | /** | ||||
| * Creates the default build logger for sending build events to the ant | * Creates the default build logger for sending build events to the ant | ||||
| * log. | * log. | ||||
| @@ -1003,7 +999,7 @@ public class Main implements AntMain { | |||||
| System.err.println("The specified logger class " | System.err.println("The specified logger class " | ||||
| + loggerClassname | + loggerClassname | ||||
| + " could not be used because " + e.getMessage()); | + " could not be used because " + e.getMessage()); | ||||
| throw new RuntimeException(); | |||||
| throw e; | |||||
| } | } | ||||
| } else { | } else { | ||||
| logger = new DefaultLogger(); | logger = new DefaultLogger(); | ||||
| @@ -1836,7 +1836,7 @@ public class Project implements ResourceFactory { | |||||
| if (st == null) { | if (st == null) { | ||||
| tsort(root[i], targetTable, state, visiting, ret); | tsort(root[i], targetTable, state, visiting, ret); | ||||
| } else if (st == VISITING) { | } else if (st == VISITING) { | ||||
| throw new RuntimeException("Unexpected node in visiting state: " | |||||
| throw new BuildException("Unexpected node in visiting state: " | |||||
| + root[i]); | + root[i]); | ||||
| } | } | ||||
| } | } | ||||
| @@ -1855,7 +1855,7 @@ public class Project implements ResourceFactory { | |||||
| if (st == null) { | if (st == null) { | ||||
| tsort(curTarget, targetTable, state, visiting, complete); | tsort(curTarget, targetTable, state, visiting, complete); | ||||
| } else if (st == VISITING) { | } else if (st == VISITING) { | ||||
| throw new RuntimeException("Unexpected node in visiting state: " | |||||
| throw new BuildException("Unexpected node in visiting state: " | |||||
| + curTarget); | + curTarget); | ||||
| } | } | ||||
| } | } | ||||
| @@ -1941,7 +1941,7 @@ public class Project implements ResourceFactory { | |||||
| } | } | ||||
| final String p = visiting.pop(); | final String p = visiting.pop(); | ||||
| if (root != p) { | if (root != p) { | ||||
| throw new RuntimeException("Unexpected internal error: expected to " | |||||
| throw new BuildException("Unexpected internal error: expected to " | |||||
| + "pop " + root + " but got " + p); | + "pop " + root + " but got " + p); | ||||
| } | } | ||||
| state.put(root, VISITED); | state.put(root, VISITED); | ||||
| @@ -62,7 +62,7 @@ public class ProjectHelperRepository { | |||||
| PROJECTHELPER2_CONSTRUCTOR = ProjectHelper2.class.getConstructor(); | PROJECTHELPER2_CONSTRUCTOR = ProjectHelper2.class.getConstructor(); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| // ProjectHelper2 must be available | // ProjectHelper2 must be available | ||||
| throw new RuntimeException(e); | |||||
| throw new BuildException(e); | |||||
| } | } | ||||
| } | } | ||||
| @@ -263,7 +263,7 @@ public class ProjectHelperRepository { | |||||
| return helper; | return helper; | ||||
| } | } | ||||
| } | } | ||||
| throw new RuntimeException("BUG: at least the ProjectHelper2 should " | |||||
| throw new BuildException("BUG: at least the ProjectHelper2 should " | |||||
| + "have supported the file " + buildFile); | + "have supported the file " + buildFile); | ||||
| } | } | ||||
| @@ -286,7 +286,7 @@ public class ProjectHelperRepository { | |||||
| return helper; | return helper; | ||||
| } | } | ||||
| } | } | ||||
| throw new RuntimeException("BUG: at least the ProjectHelper2 should " | |||||
| throw new BuildException("BUG: at least the ProjectHelper2 should " | |||||
| + "have supported the file " + antlib); | + "have supported the file " + antlib); | ||||
| } | } | ||||
| @@ -721,7 +721,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { | |||||
| * @return the requested class. | * @return the requested class. | ||||
| * @exception Exception if the class could not be loaded. | * @exception Exception if the class could not be loaded. | ||||
| */ | */ | ||||
| private Class loadClass(final String classname) throws Exception { | |||||
| private Class loadClass(final String classname) throws ClassNotFoundException { | |||||
| setupLoader(); | setupLoader(); | ||||
| if (loader == null) { | if (loader == null) { | ||||
| return Class.forName(classname); | return Class.forName(classname); | ||||
| @@ -322,7 +322,8 @@ public class TraXLiaison implements XSLTLiaison4, ErrorListener, XSLTLoggerAware | |||||
| * @see #addParam(java.lang.String, java.lang.String) | * @see #addParam(java.lang.String, java.lang.String) | ||||
| * @see #setOutputProperty(java.lang.String, java.lang.String) | * @see #setOutputProperty(java.lang.String, java.lang.String) | ||||
| */ | */ | ||||
| private void createTransformer() throws Exception { | |||||
| private void createTransformer() | |||||
| throws IOException, ParserConfigurationException, SAXException, TransformerException { | |||||
| if (templates == null) { | if (templates == null) { | ||||
| readTemplates(); | readTemplates(); | ||||
| } | } | ||||
| @@ -22,6 +22,8 @@ import java.io.InputStream; | |||||
| import java.util.zip.ZipEntry; | import java.util.zip.ZipEntry; | ||||
| import java.util.zip.ZipInputStream; | import java.util.zip.ZipInputStream; | ||||
| import org.apache.tools.ant.BuildException; | |||||
| /** | /** | ||||
| * A class file iterator which iterates through the contents of a Java jar | * A class file iterator which iterates through the contents of a Java jar | ||||
| * file. | * file. | ||||
| @@ -79,7 +81,7 @@ public class JarFileIterator implements ClassFileIterator { | |||||
| text += ": " + message; | text += ": " + message; | ||||
| } | } | ||||
| throw new RuntimeException("Problem reading JAR file: " + text); | |||||
| throw new BuildException("Problem reading JAR file: " + text); | |||||
| } | } | ||||
| return nextElement; | return nextElement; | ||||
| @@ -22,6 +22,7 @@ import java.util.Enumeration; | |||||
| import java.util.Vector; | import java.util.Vector; | ||||
| import java.util.zip.ZipFile; | import java.util.zip.ZipFile; | ||||
| import org.apache.tools.ant.BuildException; | |||||
| import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
| import org.apache.tools.ant.util.VectorSet; | import org.apache.tools.ant.util.VectorSet; | ||||
| @@ -80,7 +81,7 @@ public abstract class AbstractAnalyzer implements DependencyAnalyzer { | |||||
| */ | */ | ||||
| public Enumeration<File> getFileDependencies() { | public Enumeration<File> getFileDependencies() { | ||||
| if (!supportsFileDependencies()) { | if (!supportsFileDependencies()) { | ||||
| throw new RuntimeException("File dependencies are not supported " | |||||
| throw new BuildException("File dependencies are not supported " | |||||
| + "by this analyzer"); | + "by this analyzer"); | ||||
| } | } | ||||
| if (!determined) { | if (!determined) { | ||||
| @@ -126,7 +126,7 @@ public class JavaxScriptRunner extends ScriptRunnerBase { | |||||
| } | } | ||||
| } | } | ||||
| private ReflectWrapper createEngine() throws Exception { | |||||
| private ReflectWrapper createEngine() { | |||||
| if (engine != null) { | if (engine != null) { | ||||
| return engine; | return engine; | ||||
| } | } | ||||
| @@ -276,7 +276,7 @@ public class TarInputStream extends FilterInputStream { | |||||
| while (numToSkip > 0) { | while (numToSkip > 0) { | ||||
| long skipped = skip(numToSkip); | long skipped = skip(numToSkip); | ||||
| if (skipped <= 0) { | if (skipped <= 0) { | ||||
| throw new RuntimeException("failed to skip current tar" | |||||
| throw new IOException("failed to skip current tar" | |||||
| + " entry"); | + " entry"); | ||||
| } | } | ||||
| numToSkip -= skipped; | numToSkip -= skipped; | ||||