01: package de.schlund.pfixxml.util;
02:
03: /**
04: * This class provides generic XSLT extension function support,
05: * which can be used by extension function implementors:
06: *
07: * It supports thread local storage of extension function errors:
08: * due to an unfortunate implementation of Saxon's FunctionProxy
09: * only the exception message and no stacktrace or cause of an
10: * error, occurred within an extension function, is available in the
11: * resulting TransformerException. Using this class an extension
12: * function can catch its exceptions and store it calling the method
13: * setExtensionFunctionError. Later, during exception handling, the
14: * exception can be retrieved calling getExtensionFunctionError().
15: *
16: * @author mleidig@schlund.de
17: */
18: public class ExtensionFunctionUtils {
19:
20: private static ThreadLocal<Throwable> extFuncError = new ThreadLocal<Throwable>();
21:
22: public static void setExtensionFunctionError(Throwable t) {
23: extFuncError.set(t);
24: }
25:
26: public static Throwable getExtensionFunctionError() {
27: return extFuncError.get();
28: }
29:
30: }
|