Browse Source

Squash catch

master
Gintas Grigelionis 7 years ago
parent
commit
22b69b9273
16 changed files with 22 additions and 85 deletions
  1. +5
    -17
      src/main/org/apache/tools/ant/IntrospectionHelper.java
  2. +1
    -4
      src/main/org/apache/tools/ant/Main.java
  3. +1
    -3
      src/main/org/apache/tools/ant/dispatch/DispatchUtils.java
  4. +1
    -3
      src/main/org/apache/tools/ant/filters/ClassConstants.java
  5. +2
    -7
      src/main/org/apache/tools/ant/filters/SortFilter.java
  6. +1
    -3
      src/main/org/apache/tools/ant/taskdefs/AntStructure.java
  7. +1
    -3
      src/main/org/apache/tools/ant/taskdefs/Checksum.java
  8. +1
    -6
      src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java
  9. +2
    -6
      src/main/org/apache/tools/ant/taskdefs/optional/PropertyFile.java
  10. +1
    -5
      src/main/org/apache/tools/ant/taskdefs/optional/XMLValidateTask.java
  11. +2
    -8
      src/main/org/apache/tools/ant/taskdefs/optional/junit/FormatterElement.java
  12. +1
    -10
      src/main/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java
  13. +1
    -3
      src/main/org/apache/tools/ant/types/XMLCatalog.java
  14. +1
    -3
      src/main/org/apache/tools/zip/ExtraFieldUtils.java
  15. +1
    -3
      src/tests/junit/org/apache/tools/ant/IntrospectionHelperTest.java
  16. +0
    -1
      src/tests/junit/org/apache/tools/ant/taskdefs/XmlPropertyTest.java

+ 5
- 17
src/main/org/apache/tools/ant/IntrospectionHelper.java View File

@@ -613,12 +613,9 @@ public final class IntrospectionHelper {
project.setProjectReference(nestedElement);
}
return nestedElement;
} catch (final IllegalAccessException ie) {
} catch (final IllegalAccessException | InstantiationException ie) {
// impossible as getMethods should only return public methods
throw new BuildException(ie);
} catch (final InstantiationException ine) {
// impossible as getMethods should only return public methods
throw new BuildException(ine);
} catch (final InvocationTargetException ite) {
throw extractBuildException(ite);
}
@@ -787,12 +784,9 @@ public final class IntrospectionHelper {
}
try {
ns.store(parent, child);
} catch (final IllegalAccessException ie) {
} catch (final IllegalAccessException | InstantiationException ie) {
// impossible as getMethods should only return public methods
throw new BuildException(ie);
} catch (final InstantiationException ine) {
// impossible as getMethods should only return public methods
throw new BuildException(ine);
} catch (final InvocationTargetException ite) {
throw extractBuildException(ite);
}
@@ -1162,9 +1156,7 @@ public final class IntrospectionHelper {
throw new BuildException("Can't assign non-numeric"
+ " value '" + value + "' to"
+ " attribute " + attrName);
} catch (final InvocationTargetException e) {
throw e;
} catch (final IllegalAccessException e) {
} catch (final InvocationTargetException | IllegalAccessException e) {
throw e;
} catch (final Exception e) {
throw new BuildException(e);
@@ -1346,9 +1338,7 @@ public final class IntrospectionHelper {
project.setProjectReference(nestedObject);
}
return nestedObject;
} catch (final IllegalAccessException ex) {
throw new BuildException(ex);
} catch (final InstantiationException ex) {
} catch (final IllegalAccessException | InstantiationException ex) {
throw new BuildException(ex);
} catch (final IllegalArgumentException ex) {
if (polyType == null) {
@@ -1374,9 +1364,7 @@ public final class IntrospectionHelper {
public void store() {
try {
nestedCreator.store(parent, nestedObject);
} catch (final IllegalAccessException ex) {
throw new BuildException(ex);
} catch (final InstantiationException ex) {
} catch (final IllegalAccessException | InstantiationException ex) {
throw new BuildException(ex);
} catch (final IllegalArgumentException ex) {
if (polyType == null) {


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

@@ -858,12 +858,9 @@ public class Main implements AntMain {
System.setErr(savedErr);
System.setIn(savedIn);
}
} catch (final RuntimeException exc) {
} catch (final RuntimeException | Error exc) {
error = exc;
throw exc;
} catch (final Error e) {
error = e;
throw e;
} finally {
if (!projectHelp) {
try {


+ 1
- 3
src/main/org/apache/tools/ant/dispatch/DispatchUtils.java View File

@@ -112,9 +112,7 @@ public class DispatchUtils {
} else {
throw new BuildException(t);
}
} catch (NoSuchMethodException e) {
throw new BuildException(e);
} catch (IllegalAccessException e) {
} catch (NoSuchMethodException | IllegalAccessException e) {
throw new BuildException(e);
}
}


+ 1
- 3
src/main/org/apache/tools/ant/filters/ClassConstants.java View File

@@ -126,9 +126,7 @@ public final class ClassConstants
return read();
}
}
} catch (NoClassDefFoundError ex) {
throw ex;
} catch (RuntimeException ex) {
} catch (NoClassDefFoundError | RuntimeException ex) {
throw ex;
} catch (InvocationTargetException ex) {
Throwable t = ex.getTargetException();


+ 2
- 7
src/main/org/apache/tools/ant/filters/SortFilter.java View File

@@ -328,16 +328,11 @@ public final class SortFilter extends BaseParamFilterReader
= (Comparator<? super String>) (Class.forName(className).newInstance());
setComparator(comparatorInstance);
continue;
} catch (InstantiationException e) {
throw new BuildException(e);
} catch (IllegalAccessException e) {
} catch (InstantiationException | ClassNotFoundException | IllegalAccessException e) {
/*
* Probably a inner non-static class, this this case is
* not considered
* IAE probably means an inner non-static class, that case is not considered
*/
throw new BuildException(e);
} catch (ClassNotFoundException e) {
throw new BuildException(e);
} catch (ClassCastException e) {
throw new BuildException("Value of comparator attribute"
+ " should implement"


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

@@ -366,9 +366,7 @@ public class AntStructure extends Task {
} else {
sb.append(Stream.of(values).collect(joinAlts));
}
} catch (final InstantiationException ie) {
sb.append("CDATA ");
} catch (final IllegalAccessException ie) {
} catch (final InstantiationException | IllegalAccessException ie) {
sb.append("CDATA ");
}
} else if (Enum.class.isAssignableFrom(type)) {


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

@@ -371,10 +371,8 @@ public class Checksum extends MatchingTask implements Condition {
if (provider != null) {
try {
messageDigest = MessageDigest.getInstance(algorithm, provider);
} catch (NoSuchAlgorithmException noalgo) {
} catch (NoSuchAlgorithmException | NoSuchProviderException noalgo) {
throw new BuildException(noalgo, getLocation());
} catch (NoSuchProviderException noprovider) {
throw new BuildException(noprovider, getLocation());
}
} else {
try {


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

@@ -188,12 +188,7 @@ public class ExecuteJava implements Runnable, TimeoutObserver {
if (caught != null) {
throw caught;
}
} catch (BuildException e) {
throw e;
} catch (SecurityException e) {
throw e;
} catch (ThreadDeath e) {
// TODO could perhaps also call thread.stop(); not sure if anyone cares
} catch (BuildException | ThreadDeath | SecurityException e) {
throw e;
} catch (Throwable e) {
throw new BuildException(e);


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

@@ -466,9 +466,7 @@ public class PropertyFile extends Task {
} else {
currentValue = 0;
}
} catch (NumberFormatException nfe) {
// swallow
} catch (ParseException pe) {
} catch (NumberFormatException | ParseException nfe) {
// swallow
}

@@ -479,9 +477,7 @@ public class PropertyFile extends Task {
if (value != null) {
try {
operationValue = fmt.parse(value).intValue();
} catch (NumberFormatException nfe) {
// swallow
} catch (ParseException pe) {
} catch (NumberFormatException | ParseException nfe) {
// swallow
}
}


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

@@ -394,11 +394,7 @@ public class XMLValidateTask extends Task {
}

reader = readerClass.newInstance();
} catch (ClassNotFoundException e) {
throw new BuildException(INIT_FAILED_MSG + readerClassName, e);
} catch (InstantiationException e) {
throw new BuildException(INIT_FAILED_MSG + readerClassName, e);
} catch (IllegalAccessException e) {
} catch (ClassNotFoundException | IllegalAccessException | InstantiationException e) {
throw new BuildException(INIT_FAILED_MSG + readerClassName, e);
}
}


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

@@ -294,11 +294,7 @@ public class FormatterElement {
} else {
f = Class.forName(classname, true, loader);
}
} catch (ClassNotFoundException e) {
throw new BuildException(
"Using loader " + loader + " on class " + classname
+ ": " + e, e);
} catch (NoClassDefFoundError e) {
} catch (ClassNotFoundException | NoClassDefFoundError e) {
throw new BuildException(
"Using loader " + loader + " on class " + classname
+ ": " + e, e);
@@ -340,9 +336,7 @@ public class FormatterElement {
setter.invoke(r, project);
} catch (NoSuchMethodException e) {
// no setProject to invoke; just ignore
} catch (IllegalAccessException e) {
throw new BuildException(e);
} catch (InvocationTargetException e) {
} catch (IllegalAccessException | InvocationTargetException e) {
throw new BuildException(e);
}
}


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

@@ -20,7 +20,6 @@ package org.apache.tools.ant.taskdefs.optional.pvcs;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
@@ -282,15 +281,7 @@ public class Pvcs extends Task {
throw new BuildException(msg, getLocation());
}

} catch (FileNotFoundException e) {
String msg = "Failed executing: " + commandLine.toString()
+ ". Exception: " + e.getMessage();
throw new BuildException(msg, getLocation());
} catch (IOException e) {
String msg = "Failed executing: " + commandLine.toString()
+ ". Exception: " + e.getMessage();
throw new BuildException(msg, getLocation());
} catch (ParseException e) {
} catch (ParseException | IOException e) {
String msg = "Failed executing: " + commandLine.toString()
+ ". Exception: " + e.getMessage();
throw new BuildException(msg, getLocation());


+ 1
- 3
src/main/org/apache/tools/ant/types/XMLCatalog.java View File

@@ -572,9 +572,7 @@ public class XMLCatalog extends DataType
spFactory.setNamespaceAware(true);
try {
reader = spFactory.newSAXParser().getXMLReader();
} catch (ParserConfigurationException ex) {
throw new TransformerException(ex);
} catch (SAXException ex) {
} catch (ParserConfigurationException | SAXException ex) {
throw new TransformerException(ex);
}
}


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

@@ -174,10 +174,8 @@ public class ExtraFieldUtils {
.parseFromCentralDirectoryData(data, start + WORD, length);
}
v.add(ze);
} catch (InstantiationException ie) {
} catch (InstantiationException | IllegalAccessException ie) {
throw new ZipException(ie.getMessage());
} catch (IllegalAccessException iae) {
throw new ZipException(iae.getMessage());
}
start += (length + WORD);
}


+ 1
- 3
src/tests/junit/org/apache/tools/ant/IntrospectionHelperTest.java View File

@@ -702,9 +702,7 @@ public class IntrospectionHelperTest {

try {
m.invoke(this, arg);
} catch (IllegalAccessException e) {
throw new BuildException(e);
} catch (InvocationTargetException e) {
} catch (IllegalAccessException | InvocationTargetException e) {
throw new BuildException(e);
}



+ 0
- 1
src/tests/junit/org/apache/tools/ant/taskdefs/XmlPropertyTest.java View File

@@ -26,7 +26,6 @@ import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import java.util.Vector;

import org.apache.tools.ant.BuildFileRule;


Loading…
Cancel
Save