git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@800678 13f79535-47bb-0310-9956-ffa450edef68master
@@ -420,6 +420,10 @@ Fixed bugs: | |||||
failed to load. | failed to load. | ||||
Bugzilla Report 44103. | Bugzilla Report 44103. | ||||
* Logging exceptions without a message would cause a | |||||
NullPointerException. | |||||
Bugzilla Report 47623. | |||||
Other changes: | Other changes: | ||||
-------------- | -------------- | ||||
* The get task now also follows redirects from http to https | * The get task now also follows redirects from http to https | ||||
@@ -2171,6 +2171,9 @@ public class Project implements ResourceFactory { | |||||
private void fireMessageLoggedEvent(BuildEvent event, String message, | private void fireMessageLoggedEvent(BuildEvent event, String message, | ||||
int priority) { | int priority) { | ||||
if (message == null) { | |||||
message = String.valueOf(message); | |||||
} | |||||
if (message.endsWith(StringUtils.LINE_SEP)) { | if (message.endsWith(StringUtils.LINE_SEP)) { | ||||
int endIndex = message.length() - StringUtils.LINE_SEP.length(); | int endIndex = message.length() - StringUtils.LINE_SEP.length(); | ||||
event.setMessage(message.substring(0, endIndex), priority); | event.setMessage(message.substring(0, endIndex), priority); | ||||
@@ -276,6 +276,14 @@ public class ProjectTest extends TestCase { | |||||
assertTrue("Expected logging thread to finish successfully", done[0]); | assertTrue("Expected logging thread to finish successfully", done[0]); | ||||
} | } | ||||
/** | |||||
* @see https://issues.apache.org/bugzilla/show_bug.cgi?id=47623 | |||||
*/ | |||||
public void testNullThrowableMessageLog() { | |||||
p.log(new Task() {}, null, new Throwable(), Project.MSG_ERR); | |||||
// be content if no exception has been thrown | |||||
} | |||||
private class DummyTaskPrivate extends Task { | private class DummyTaskPrivate extends Task { | ||||
public DummyTaskPrivate() {} | public DummyTaskPrivate() {} | ||||
public void execute() {} | public void execute() {} | ||||