Skip to content

Commit 4513cba

Browse files
committed
Add null check in ExceptionDetailsErrorDialog
1 parent bac3f06 commit 4513cba

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

core/ui/src/main/java/org/phoebus/ui/Messages.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public class Messages
3434
public static String DefaultNewColumnName;
3535
/**DoNotShow */
3636
public static String DoNotShow;
37+
3738
/**Format_Binary */
3839
public static String Format_Binary;
3940
/**Format_Compact */
@@ -68,6 +69,7 @@ public class Messages
6869
public static String MoveRowDown;
6970
/**MoveRowUp */
7071
public static String MoveRowUp;
72+
public static String NoExceptionAvailable;
7173
/**NumberInputHdr */
7274
public static String NumberInputHdr;
7375
/**Num_Selected */

core/ui/src/main/java/org/phoebus/ui/dialog/ExceptionDetailsErrorDialog.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import javafx.scene.control.TextArea;
1717
import javafx.scene.input.Clipboard;
1818
import javafx.scene.input.ClipboardContent;
19+
import org.phoebus.ui.Messages;
1920

2021
import java.io.ByteArrayOutputStream;
2122
import java.io.PrintStream;
@@ -91,8 +92,11 @@ public static void openError(final String title, final Exception exception)
9192
private static void doOpenError(final Node node, final String title, final String message, final Exception exception, final boolean append_stacktrace_msgs)
9293
{
9394
StringBuilder messageBuilder = new StringBuilder(message).append(LINE_SEPARATOR);
94-
if(append_stacktrace_msgs)
95-
{
95+
96+
if(exception == null){
97+
messageBuilder.append(System.lineSeparator()).append(Messages.NoExceptionAvailable);
98+
}
99+
else{
96100
messageBuilder.append(exception.getMessage() != null ? exception.getMessage() : exception.getClass()).append(LINE_SEPARATOR).append("Cause:").append(LINE_SEPARATOR);
97101
Throwable cause = exception.getCause();
98102
int exceptionIndex = 1;

core/ui/src/main/resources/org/phoebus/ui/messages.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ MoveColumnLeft=Move Column Left
2525
MoveColumnRight=Move Column Right
2626
MoveRowDown=Move Row Down
2727
MoveRowUp=Move Row Up
28+
NoExceptionAvailable=<no exception information available>
2829
NumberInputHdr=Please enter a number
2930
Num_Selected=selected
3031
Redo_TT=Re-do last change

0 commit comments

Comments
 (0)