| 141 |
primaryStage.setScene(scene); |
primaryStage.setScene(scene); |
| 142 |
primaryStage.show(); |
primaryStage.show(); |
| 143 |
|
|
| 144 |
Thread.currentThread().setUncaughtExceptionHandler(handler); |
// |
| 145 |
|
// 広域例外ハンドラーの設定 |
| 146 |
|
// |
| 147 |
|
Thread.setDefaultUncaughtExceptionHandler((thread, exception) -> Unchecked.execute(() -> { |
| 148 |
|
onCaughtException(thread, exception); |
| 149 |
|
})); |
| 150 |
} |
} |
| 151 |
|
|
| 152 |
protected Thread.UncaughtExceptionHandler handler = new Thread.UncaughtExceptionHandler() { |
/** 例外を補足したときに画面に例外のスタックトレースを表示します。 |
| 153 |
@Override |
* |
| 154 |
public void uncaughtException(Thread t, Throwable e) { |
* @param thread 例外をスローしたスレッド |
| 155 |
showException(e); |
* @param exception スローされた例外 |
| 156 |
} |
*/ |
| 157 |
}; |
protected void onCaughtException(Thread thread, Throwable exception) { |
|
|
|
|
protected void showException(Throwable exception) { |
|
| 158 |
exception.printStackTrace(); |
exception.printStackTrace(); |
| 159 |
|
|
| 160 |
Runnable r = ()-> { |
Platform.runLater(() -> { |
| 161 |
String title; |
try { |
| 162 |
if(exception instanceof JpkiException) { |
String title; |
| 163 |
title = "エラー"; |
if(exception instanceof JpkiException) { |
| 164 |
} else { |
title = "エラー"; |
| 165 |
title = exception.getClass().getName(); |
} else { |
| 166 |
} |
title = exception.getClass().getName(); |
| 167 |
String message = exception.getLocalizedMessage(); |
} |
| 168 |
if(message != null) { |
String message = exception.getLocalizedMessage(); |
| 169 |
message = message.trim(); |
if(message != null) { |
| 170 |
|
message = message.trim(); |
| 171 |
|
} |
| 172 |
|
toast.show(Toast.COLOR_ERROR, title, message); |
| 173 |
|
} catch(Throwable t) { |
| 174 |
|
t.printStackTrace(); |
| 175 |
|
System.exit(0); |
| 176 |
} |
} |
| 177 |
toast.show(Toast.COLOR_ERROR, title, message); |
}); |
|
}; |
|
|
if(Platform.isFxApplicationThread()) { |
|
|
r.run(); |
|
|
} else { |
|
|
Platform.runLater(r); |
|
|
} |
|
| 178 |
} |
} |
| 179 |
|
|
| 180 |
@FXML Toast toast; |
@FXML Toast toast; |
| 282 |
lvSignature.getItems().add(signature); |
lvSignature.getItems().add(signature); |
| 283 |
} |
} |
| 284 |
checkJpkiAvailability(); |
checkJpkiAvailability(); |
|
}).onFailed(exception -> { |
|
|
showException(exception); |
|
| 285 |
})); |
})); |
| 286 |
} |
} |
| 287 |
|
|