org.orange.util
Class NestedException.Helper


public class NestedException.Helper

Helper pour simplifier l'implémentation de toute exception implémentant l'interface NestedException.
Avec ce helper, une nested-exception s'implémente :


public class MyNestedException
extends Exception
implements NestedException
{
private Throwable nestedThrowable;
public MyNestedException(String message, Throwable nestedThrowable) {
super(message);
this.nestedThrowable = nestedThrowable;
}

public Throwable getNestedThrowable() {
return nestedThrowable;
}

public void printStackTrace(java.io.PrintStream s) {
synchronized(s) {
NestedException.Helper.printNestedStackTrace(s, this);
super.printStackTrace(s);
}
}

public void printStackTrace(java.io.PrintWriter w) {
synchronized(w) {
NestedException.Helper.printNestedStackTrace(w, this);
super.printStackTrace(w);
}
}

public String toString() {
return NestedException.Helper.toString(this, super.toString());
}
}

Method Summary
 static ThrowablegetInitialNestedThrowable(Throwable t)
          Parcourt tout l'arbre des exception chaînées, afin d'en tirer la cause initiale.
 static voidprintNestedStackTrace(PrintStream s, NestedException ne)
           
 static voidprintNestedStackTrace(PrintWriter w, NestedException ne)
           
 static voidprintStackTrace(PrintWriter w, Throwable t)
          Cette methode nous permet d'ecrire une stack trace complete dans l'API servlet 2.2.
 static StringtoString(NestedException ne, String superToString)
           

Method Detail

getInitialNestedThrowable

public static Throwable getInitialNestedThrowable(Throwable t)
Parcourt tout l'arbre des exception chaînées, afin d'en tirer la cause initiale.
Gère les type d'exception suivantes :

printNestedStackTrace

public static void printNestedStackTrace(PrintStream s, NestedException ne)

printNestedStackTrace

public static void printNestedStackTrace(PrintWriter w, NestedException ne)

printStackTrace

public static void printStackTrace(PrintWriter w, Throwable t)
Cette methode nous permet d'ecrire une stack trace complete dans l'API servlet 2.2.
Car lorsque l'on fait appel à la methode printStackTrace sur une ServletException nous n'avons que l'exception de
premier niveau, mais pas l'exception nested.
Ce probleme est regle dans l'API servlet 2.3

toString

public static String toString(NestedException ne, String superToString)

Dependency Links

to Class java.io.PrintStream

to Class org.orange.util.NestedException

to Class java.lang.Throwable

to Class java.io.PrintWriter

to Class java.lang.String

to Class javax.servlet.ServletException

to Class java.sql.SQLException

to Class Diagram org.orange.util

to Class Diagram org.orange

to Class Diagram org

to Class Diagram <default>