Browse Source

stick with RuntimeExceptions to prevent recursive logging loops

master
Stefan Bodewig 8 years ago
parent
commit
7081e356a8
4 changed files with 7 additions and 7 deletions
  1. +3
    -3
      src/main/org/apache/tools/ant/XmlLogger.java
  2. +2
    -2
      src/main/org/apache/tools/ant/listener/MailLogger.java
  3. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/LogOutputStream.java
  4. +1
    -1
      src/main/org/apache/tools/ant/util/DOMElementWriter.java

+ 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
}
}



+ 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();
}


Loading…
Cancel
Save