Bonjour,

Ce matin vous m'avez fais découvrir SwingWorker, je n'ai pas trainé à en coder un mais j'ai un petit problème avec les exceptions.
Mon application possède un Thread.uncaughtExceptionHandler qui fonctionne correctement mais dans la méthode doInBackground de 'MonSwingWorker' si une execption se produit, 'MonExceptionHandler' ne la récupère pas..
Pire rien ne s'affiche dans la console !

J'ai exposé mon problème ici : http://www.developpez.net/forums/sho...d.php?t=491615

Mais pour simplifier les choses au maximum j'ai simplifié mon code et vous le montre (il ne fonctionne toujours pas)
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
 
public class MonWorker extends SwingWorker {
  protected File doInBackground() throws IOException {	
    System.out.println("Throw exception..");
    throw new NullPointerException("plop");
  }
}
 
// Dans mon application
public class MonApplication extends JFrame {
  public static void main(String[] args) {
    UncaughtExceptionHandler exceptionHandler = 
       Thread.new UncaughtExceptionHandler() {
       public void uncaughtException(Thread thread, final Throwable  throwable) {        
          throwable.printStackTrace();
       }
    }
    Thread.setDefaultUncaughtExceptionHandler(exceptionHandler);
  }
}
Savez-vous m'aider ? Merci

Edit 1 : Pourtant en ajoutant un petit syso dans mon action et dans mon worker j'ai le même handler :
INFO [AWT-EventQueue-0] be.me.actions.AbstractAction - Performing MonAction
Worker : be.me.DefaultExceptionHandler@3e1bc8
Action : be.me.DefaultExceptionHandler@3e1bc8
Throw NullPointerException(plop).. <- class be.me.core.workers.MonWorker