File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
src/main/java/com/itextpdf/rups/model Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ This file is part of the iText (R) project.
4949import java .awt .Toolkit ;
5050import java .awt .Window ;
5151import java .awt .event .HierarchyEvent ;
52+ import java .util .Optional ;
5253import javax .swing .JOptionPane ;
5354import javax .swing .JScrollPane ;
5455import javax .swing .JTextArea ;
@@ -143,7 +144,17 @@ private static void limitDialogSize(Window window) {
143144 private static String getTraceString (Throwable th ) {
144145 final StringWriter sw = new StringWriter ();
145146 final PrintWriter pw = new PrintWriter (sw );
146- th .printStackTrace (pw );
147+ final Optional <Throwable > chuckIt = Optional .ofNullable (th );
148+ chuckIt .map (Throwable ::getLocalizedMessage )
149+ .ifPresent (pw ::println );
150+ chuckIt .map (Throwable ::getCause )
151+ .map (Throwable ::getLocalizedMessage )
152+ .ifPresent ((String msg ) -> {
153+ pw .print ("Caused by: " );
154+ pw .println (msg );
155+ });
156+ pw .append ("[Stack Trace]\n " );
157+ chuckIt .ifPresent (throwable -> throwable .printStackTrace (pw ));
147158 return sw .toString ();
148159 }
149160}
You can’t perform that action at this time.
0 commit comments