mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
NPE when throwable.toString() returns null (wierd...) fixed.
This commit is contained in:
@@ -57,7 +57,7 @@ public class Packet extends PacketWriter implements PoolOfKnownObjects {
|
||||
|
||||
public Packet addThrowable(Throwable throwable) {
|
||||
String filteredTrace = BaseTestRunner.getFilteredTrace(throwable);
|
||||
String message = makeNewLinesCompatibleWithJUnit(throwable.toString());
|
||||
String message = makeNewLinesCompatibleWithJUnit(throwableToString(throwable));
|
||||
addLimitedString(message);
|
||||
if (filteredTrace.startsWith(message))
|
||||
filteredTrace = filteredTrace.substring(message.length());
|
||||
@@ -65,6 +65,11 @@ public class Packet extends PacketWriter implements PoolOfKnownObjects {
|
||||
return this;
|
||||
}
|
||||
|
||||
private String throwableToString(final Throwable throwable) {
|
||||
final String tostring = throwable.toString();
|
||||
return tostring != null ? tostring : throwable.getClass().getName();
|
||||
}
|
||||
|
||||
private static String makeNewLinesCompatibleWithJUnit(String string) {
|
||||
try {
|
||||
StringWriter buffer = new StringWriter();
|
||||
|
||||
Reference in New Issue
Block a user