Develop and Download Open Source Software

Browse Subversion Repository

Diff of /jpki-pdf-signer/trunk/src/main/java/net/osdn/jpki/pdf_signer/MainApp.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 67 by hirukawa_ryo, Sun Jan 8 08:37:44 2023 UTC revision 68 by hirukawa_ryo, Mon Jan 9 00:38:35 2023 UTC
# Line 141  public class MainApp extends SingletonAp Line 141  public class MainApp extends SingletonAp
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;
# Line 279  public class MainApp extends SingletonAp Line 282  public class MainApp extends SingletonAp
282                  lvSignature.getItems().add(signature);                  lvSignature.getItems().add(signature);
283              }              }
284              checkJpkiAvailability();              checkJpkiAvailability();
         }).onFailed(exception -> {  
             showException(exception);  
285          }));          }));
286      }      }
287    

Legend:
Removed from v.67  
changed lines
  Added in v.68

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26