Browse Source

Merge branch '1.9.x'

master
Stefan Bodewig 8 years ago
parent
commit
5e0632687f
29 changed files with 54 additions and 53 deletions
  1. +1
    -5
      src/main/org/apache/tools/ant/Main.java
  2. +4
    -4
      src/main/org/apache/tools/ant/Project.java
  3. +3
    -3
      src/main/org/apache/tools/ant/ProjectHelperRepository.java
  4. +3
    -3
      src/main/org/apache/tools/ant/XmlLogger.java
  5. +2
    -2
      src/main/org/apache/tools/ant/listener/MailLogger.java
  6. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/LogOutputStream.java
  7. +3
    -3
      src/main/org/apache/tools/ant/taskdefs/XSLTLiaison.java
  8. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java
  9. +3
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java
  10. +3
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/depend/JarFileIterator.java
  11. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/jlink/jlink.java
  12. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  13. +1
    -1
      src/main/org/apache/tools/ant/util/DOMElementWriter.java
  14. +1
    -1
      src/main/org/apache/tools/ant/util/FileUtils.java
  15. +1
    -1
      src/main/org/apache/tools/ant/util/ReaderInputStream.java
  16. +1
    -1
      src/main/org/apache/tools/ant/util/StringUtils.java
  17. +2
    -1
      src/main/org/apache/tools/ant/util/depend/AbstractAnalyzer.java
  18. +1
    -1
      src/main/org/apache/tools/ant/util/optional/JavaxScriptRunner.java
  19. +4
    -3
      src/main/org/apache/tools/tar/TarEntry.java
  20. +1
    -1
      src/main/org/apache/tools/tar/TarInputStream.java
  21. +2
    -2
      src/main/org/apache/tools/tar/TarOutputStream.java
  22. +2
    -2
      src/main/org/apache/tools/tar/TarUtils.java
  23. +1
    -1
      src/main/org/apache/tools/zip/AbstractUnicodeExtraField.java
  24. +1
    -1
      src/main/org/apache/tools/zip/AsiExtraField.java
  25. +3
    -3
      src/main/org/apache/tools/zip/ExtraFieldUtils.java
  26. +1
    -1
      src/main/org/apache/tools/zip/GeneralPurposeBit.java
  27. +2
    -2
      src/main/org/apache/tools/zip/ZipEntry.java
  28. +1
    -1
      src/main/org/apache/tools/zip/ZipLong.java
  29. +1
    -1
      src/main/org/apache/tools/zip/ZipShort.java

+ 1
- 5
src/main/org/apache/tools/ant/Main.java View File

@@ -978,10 +978,6 @@ public class Main implements AntMain {
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
* log.
@@ -1003,7 +999,7 @@ public class Main implements AntMain {
System.err.println("The specified logger class "
+ loggerClassname
+ " could not be used because " + e.getMessage());
throw new RuntimeException();
throw e;
}
} else {
logger = new DefaultLogger();


+ 4
- 4
src/main/org/apache/tools/ant/Project.java View File

@@ -1430,7 +1430,7 @@ public class Project implements ResourceFactory {
"Target '" + curtarget.getName()
+ "' failed with message '"
+ thrownException.getMessage() + "'.", MSG_ERR);
thrownException.printStackTrace(System.err);
thrownException.printStackTrace(System.err); //NOSONAR
if (buildException == null) {
buildException =
new BuildException(thrownException);
@@ -1836,7 +1836,7 @@ public class Project implements ResourceFactory {
if (st == null) {
tsort(root[i], targetTable, state, visiting, ret);
} else if (st == VISITING) {
throw new RuntimeException("Unexpected node in visiting state: "
throw new BuildException("Unexpected node in visiting state: "
+ root[i]);
}
}
@@ -1855,7 +1855,7 @@ public class Project implements ResourceFactory {
if (st == null) {
tsort(curTarget, targetTable, state, visiting, complete);
} else if (st == VISITING) {
throw new RuntimeException("Unexpected node in visiting state: "
throw new BuildException("Unexpected node in visiting state: "
+ curTarget);
}
}
@@ -1941,7 +1941,7 @@ public class Project implements ResourceFactory {
}
final String p = visiting.pop();
if (root != p) {
throw new RuntimeException("Unexpected internal error: expected to "
throw new BuildException("Unexpected internal error: expected to "
+ "pop " + root + " but got " + p);
}
state.put(root, VISITED);


+ 3
- 3
src/main/org/apache/tools/ant/ProjectHelperRepository.java View File

@@ -62,7 +62,7 @@ public class ProjectHelperRepository {
PROJECTHELPER2_CONSTRUCTOR = ProjectHelper2.class.getConstructor();
} catch (Exception e) {
// ProjectHelper2 must be available
throw new RuntimeException(e);
throw new BuildException(e);
}
}

@@ -263,7 +263,7 @@ public class ProjectHelperRepository {
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);
}

@@ -286,7 +286,7 @@ public class ProjectHelperRepository {
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);
}



+ 3
- 3
src/main/org/apache/tools/ant/XmlLogger.java View File

@@ -264,7 +264,7 @@ public class XmlLogger implements BuildLogger {
if (!threadStack.empty()) {
TimedElement poppedStack = threadStack.pop();
if (poppedStack != targetElement) {
throw new RuntimeException("Mismatch - popped element = " + poppedStack
throw new RuntimeException("Mismatch - popped element = " + poppedStack //NOSONAR
+ " finished target element = " + targetElement);
}
if (!threadStack.empty()) {
@@ -316,7 +316,7 @@ public class XmlLogger implements BuildLogger {
Task task = event.getTask();
TimedElement taskElement = tasks.get(task);
if (taskElement == null) {
throw new RuntimeException("Unknown task " + task + " not in " + tasks);
throw new RuntimeException("Unknown task " + task + " not in " + tasks); //NOSONAR
}
long totalTime = System.currentTimeMillis() - taskElement.startTime;
taskElement.element.setAttribute(TIME_ATTR, DefaultLogger.formatTime(totalTime));
@@ -334,7 +334,7 @@ public class XmlLogger implements BuildLogger {
if (!threadStack.empty()) {
TimedElement poppedStack = threadStack.pop();
if (poppedStack != taskElement) {
throw new RuntimeException("Mismatch - popped element = " + poppedStack
throw new RuntimeException("Mismatch - popped element = " + poppedStack //NOSONAR
+ " finished task element = " + taskElement);
}
}


+ 2
- 2
src/main/org/apache/tools/ant/listener/MailLogger.java View File

@@ -327,7 +327,7 @@ public class MailLogger extends DefaultLogger {
* property is not present in properties.
*/
private String getValue(Hashtable<String, Object> properties, String name,
String defaultValue) throws Exception {
String defaultValue) {
String propertyName = "MailLogger." + name;
String value = (String) properties.get(propertyName);

@@ -336,7 +336,7 @@ public class MailLogger extends DefaultLogger {
}

if (value == null) {
throw new Exception("Missing required parameter: " + propertyName);
throw new RuntimeException("Missing required parameter: " + propertyName); //NOSONAR
}

return value;


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/LogOutputStream.java View File

@@ -77,7 +77,7 @@ public class LogOutputStream extends LineOrientedOutputStream {
super.processBuffer();
} catch (IOException e) {
// impossible since *our* processLine doesn't throw an IOException
throw new RuntimeException("Impossible IOException caught: " + e);
throw new RuntimeException("Impossible IOException caught: " + e); //NOSONAR
}
}



+ 3
- 3
src/main/org/apache/tools/ant/taskdefs/XSLTLiaison.java View File

@@ -44,7 +44,7 @@ public interface XSLTLiaison {
* @throws Exception thrown if any problems happens.
* @since Ant 1.4
*/
void setStylesheet(File stylesheet) throws Exception;
void setStylesheet(File stylesheet) throws Exception; //NOSONAR

/**
* Add a parameter to be set during the XSL transformation.
@@ -54,7 +54,7 @@ public interface XSLTLiaison {
* @see XSLTLiaison4#addParam(java.lang.String, java.lang.Object)
* @since Ant 1.3
*/
void addParam(String name, String expression) throws Exception;
void addParam(String name, String expression) throws Exception; //NOSONAR

/**
* Perform the transformation of a file into another.
@@ -64,6 +64,6 @@ public interface XSLTLiaison {
* @see #setStylesheet(File)
* @since Ant 1.4
*/
void transform(File infile, File outfile) throws Exception;
void transform(File infile, File outfile) throws Exception; //NOSONAR

} //-- XSLTLiaison

+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java View File

@@ -721,7 +721,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
* @return the requested class.
* @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();
if (loader == null) {
return Class.forName(classname);
@@ -1380,7 +1380,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
* @since Ant 1.7
*/
private void setLiaisonDynamicFileParameters(
final XSLTLiaison liaison, final File inFile) throws Exception {
final XSLTLiaison liaison, final File inFile) throws Exception { //NOSONAR
if (fileNameParameter != null) {
liaison.addParam(fileNameParameter, inFile.getName());
}


+ 3
- 2
src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java View File

@@ -143,7 +143,7 @@ public class TraXLiaison implements XSLTLiaison4, ErrorListener, XSLTLoggerAware
* Constructor for TraXLiaison.
* @throws Exception never
*/
public TraXLiaison() throws Exception {
public TraXLiaison() throws Exception { //NOSONAR
}

/**
@@ -316,7 +316,8 @@ public class TraXLiaison implements XSLTLiaison4, ErrorListener, XSLTLoggerAware
* @see #addParam(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) {
readTemplates();
}


+ 3
- 1
src/main/org/apache/tools/ant/taskdefs/optional/depend/JarFileIterator.java View File

@@ -22,6 +22,8 @@ import java.io.InputStream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;

import org.apache.tools.ant.BuildException;

/**
* A class file iterator which iterates through the contents of a Java jar
* file.
@@ -79,7 +81,7 @@ public class JarFileIterator implements ClassFileIterator {
text += ": " + message;
}

throw new RuntimeException("Problem reading JAR file: " + text);
throw new BuildException("Problem reading JAR file: " + text);
}

return nextElement;


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/jlink/jlink.java View File

@@ -144,7 +144,7 @@ public class jlink {
* a rational manner to outfile.
* @throws Exception on error.
*/
public void link() throws Exception {
public void link() throws Exception { //NOSONAR
ZipOutputStream output = new ZipOutputStream(new FileOutputStream(outfile));

if (compression) {


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java View File

@@ -701,10 +701,10 @@ public class JUnitTask extends Task {
/**
* Creates a new JUnitRunner and enables fork of a new Java VM.
*
* @throws Exception under ??? circumstances
* @throws Exception never
* @since Ant 1.2
*/
public JUnitTask() throws Exception {
public JUnitTask() throws Exception { //NOSONAR
}

/**


+ 1
- 1
src/main/org/apache/tools/ant/util/DOMElementWriter.java View File

@@ -494,7 +494,7 @@ public class DOMElementWriter {
try {
encodedata(out, value);
} catch (IOException ex) {
throw new RuntimeException(ex);
throw new RuntimeException(ex); //NOSONAR
}
return out.toString();
}


+ 1
- 1
src/main/org/apache/tools/ant/util/FileUtils.java View File

@@ -1591,7 +1591,7 @@ public class FileUtils {
*
* @since Ant 1.7
*/
public static String getRelativePath(File fromFile, File toFile) throws Exception {
public static String getRelativePath(File fromFile, File toFile) throws Exception { //NOSONAR
String fromPath = fromFile.getCanonicalPath();
String toPath = toFile.getCanonicalPath();



+ 1
- 1
src/main/org/apache/tools/ant/util/ReaderInputStream.java View File

@@ -148,7 +148,7 @@ public class ReaderInputStream extends InputStream {
try {
in.mark(limit);
} catch (IOException ioe) {
throw new RuntimeException(ioe.getMessage());
throw new RuntimeException(ioe.getMessage()); //NOSONAR
}
}



+ 1
- 1
src/main/org/apache/tools/ant/util/StringUtils.java View File

@@ -199,7 +199,7 @@ public final class StringUtils {
* @throws Exception if there is a problem.
* @since Ant 1.7
*/
public static long parseHumanSizes(String humanSize) throws Exception {
public static long parseHumanSizes(String humanSize) throws Exception { //NOSONAR
long factor = 1L;
char s = humanSize.charAt(0);
switch (s) {


+ 2
- 1
src/main/org/apache/tools/ant/util/depend/AbstractAnalyzer.java View File

@@ -22,6 +22,7 @@ import java.util.Enumeration;
import java.util.Vector;
import java.util.zip.ZipFile;

import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.util.VectorSet;

@@ -80,7 +81,7 @@ public abstract class AbstractAnalyzer implements DependencyAnalyzer {
*/
public Enumeration<File> getFileDependencies() {
if (!supportsFileDependencies()) {
throw new RuntimeException("File dependencies are not supported "
throw new BuildException("File dependencies are not supported "
+ "by this analyzer");
}
if (!determined) {


+ 1
- 1
src/main/org/apache/tools/ant/util/optional/JavaxScriptRunner.java View File

@@ -126,7 +126,7 @@ public class JavaxScriptRunner extends ScriptRunnerBase {
}
}

private ReflectWrapper createEngine() throws Exception {
private ReflectWrapper createEngine() {
if (engine != null) {
return engine;
}


+ 4
- 3
src/main/org/apache/tools/tar/TarEntry.java View File

@@ -846,7 +846,7 @@ public class TarEntry implements TarConstants {
writeEntryHeader(outbuf, TarUtils.FALLBACK_ENCODING, false);
} catch (IOException ex2) {
// impossible
throw new RuntimeException(ex2);
throw new RuntimeException(ex2); //NOSONAR
}
}
}
@@ -932,7 +932,7 @@ public class TarEntry implements TarConstants {
parseTarHeader(header, TarUtils.DEFAULT_ENCODING, true);
} catch (IOException ex2) {
// not really possible
throw new RuntimeException(ex2);
throw new RuntimeException(ex2); //NOSONAR
}
}
}
@@ -1095,7 +1095,8 @@ public class TarEntry implements TarConstants {
try {
buffer1 = expected.getBytes("ASCII");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e); // Should not happen
// Should not happen
throw new RuntimeException(e); //NOSONAR
}
return isEqual(buffer1, 0, buffer1.length, buffer, offset, length,
false);


+ 1
- 1
src/main/org/apache/tools/tar/TarInputStream.java View File

@@ -276,7 +276,7 @@ public class TarInputStream extends FilterInputStream {
while (numToSkip > 0) {
long skipped = skip(numToSkip);
if (skipped <= 0) {
throw new RuntimeException("failed to skip current tar"
throw new IOException("failed to skip current tar"
+ " entry");
}
numToSkip -= skipped;


+ 2
- 2
src/main/org/apache/tools/tar/TarOutputStream.java View File

@@ -586,7 +586,7 @@ public class TarOutputStream extends FilterOutputStream {

private void failForBigNumber(String field, long value, long maxValue, String additionalMsg) {
if (value < 0 || value > maxValue) {
throw new RuntimeException(field + " '" + value
throw new RuntimeException(field + " '" + value //NOSONAR
+ "' is too big ( > "
+ maxValue + " )");
}
@@ -638,7 +638,7 @@ public class TarOutputStream extends FilterOutputStream {
write(0); // NUL terminator
closeEntry();
} else if (longFileMode != LONGFILE_TRUNCATE) {
throw new RuntimeException(fieldName + " '" + name
throw new RuntimeException(fieldName + " '" + name //NOSONAR
+ "' is too long ( > "
+ TarConstants.NAMELEN + " bytes)");
}


+ 2
- 2
src/main/org/apache/tools/tar/TarUtils.java View File

@@ -265,7 +265,7 @@ public class TarUtils {
return parseName(buffer, offset, length, FALLBACK_ENCODING);
} catch (final IOException ex2) {
// impossible
throw new RuntimeException(ex2);
throw new RuntimeException(ex2); //NOSONAR
}
}
}
@@ -324,7 +324,7 @@ public class TarUtils {
FALLBACK_ENCODING);
} catch (final IOException ex2) {
// impossible
throw new RuntimeException(ex2);
throw new RuntimeException(ex2); //NOSONAR
}
}
}


+ 1
- 1
src/main/org/apache/tools/zip/AbstractUnicodeExtraField.java View File

@@ -54,7 +54,7 @@ public abstract class AbstractUnicodeExtraField implements ZipExtraField {
try {
unicodeName = text.getBytes("UTF-8");
} catch (final UnsupportedEncodingException e) {
throw new RuntimeException("FATAL: UTF-8 encoding not supported.",
throw new RuntimeException("FATAL: UTF-8 encoding not supported.", //NOSONAR
e);
}
}


+ 1
- 1
src/main/org/apache/tools/zip/AsiExtraField.java View File

@@ -346,7 +346,7 @@ public class AsiExtraField implements ZipExtraField, UnixStat, Cloneable {
return cloned;
} catch (CloneNotSupportedException cnfe) {
// impossible
throw new RuntimeException(cnfe);
throw new RuntimeException(cnfe); //NOSONAR
}
}
}

+ 3
- 3
src/main/org/apache/tools/zip/ExtraFieldUtils.java View File

@@ -63,11 +63,11 @@ public class ExtraFieldUtils {
ZipExtraField ze = (ZipExtraField) c.newInstance();
implementations.put(ze.getHeaderId(), c);
} catch (ClassCastException cc) {
throw new RuntimeException(c + " doesn\'t implement ZipExtraField");
throw new RuntimeException(c + " doesn\'t implement ZipExtraField"); //NOSONAR
} catch (InstantiationException ie) {
throw new RuntimeException(c + " is not a concrete class");
throw new RuntimeException(c + " is not a concrete class"); //NOSONAR
} catch (IllegalAccessException ie) {
throw new RuntimeException(c + "\'s no-arg constructor is not public");
throw new RuntimeException(c + "\'s no-arg constructor is not public"); //NOSONAR
}
}



+ 1
- 1
src/main/org/apache/tools/zip/GeneralPurposeBit.java View File

@@ -188,7 +188,7 @@ public final class GeneralPurposeBit implements Cloneable {
return super.clone();
} catch (CloneNotSupportedException ex) {
// impossible
throw new RuntimeException("GeneralPurposeBit is not Cloneable?", ex);
throw new RuntimeException("GeneralPurposeBit is not Cloneable?", ex); //NOSONAR
}
}
}

+ 2
- 2
src/main/org/apache/tools/zip/ZipEntry.java View File

@@ -517,7 +517,7 @@ public class ZipEntry extends java.util.zip.ZipEntry implements Cloneable {
mergeExtraFields(local, true);
} catch (final ZipException e) {
// actually this is not be possible as of Ant 1.8.1
throw new RuntimeException("Error parsing extra fields for entry: "
throw new RuntimeException("Error parsing extra fields for entry: " //NOSONAR
+ getName() + " - " + e.getMessage(), e);
}
}
@@ -544,7 +544,7 @@ public class ZipEntry extends java.util.zip.ZipEntry implements Cloneable {
ExtraFieldUtils.UnparseableExtraField.READ);
mergeExtraFields(central, false);
} catch (final ZipException e) {
throw new RuntimeException(e.getMessage(), e);
throw new RuntimeException(e.getMessage(), e); //NOSONAR
}
}



+ 1
- 1
src/main/org/apache/tools/zip/ZipLong.java View File

@@ -190,7 +190,7 @@ public final class ZipLong implements Cloneable {
return super.clone();
} catch (CloneNotSupportedException cnfe) {
// impossible
throw new RuntimeException(cnfe);
throw new RuntimeException(cnfe); //NOSONAR
}
}



+ 1
- 1
src/main/org/apache/tools/zip/ZipShort.java View File

@@ -155,7 +155,7 @@ public final class ZipShort implements Cloneable {
return super.clone();
} catch (CloneNotSupportedException cnfe) {
// impossible
throw new RuntimeException(cnfe);
throw new RuntimeException(cnfe); //NOSONAR
}
}



Loading…
Cancel
Save