void (Throwable exception, SourceLocator[] locators, String[] messages) { if (exception instanceof TransformerException) { final TransformerException t = (TransformerException)exception; if (t.getLocator() != null) { messages[0] = t.getMessage(); locators[0] = t.getLocator(); } else if (exception.getCause() != null) { findLocator(exception.getCause(), locators, messages); } } else if (exception instanceof SAXParseException) { final SAXParseException sae = (SAXParseException)exception; messages[0] = sae.getMessage(); locators[0] = new SourceLocator() { public int getColumnNumber() { return sae.getColumnNumber(); } public int getLineNumber() { return sae.getLineNumber(); } public String getPublicId() { return null; } public String getSystemId() { return sae.getSystemId(); } }; } else if (exception.getCause() != null) { findLocator(exception.getCause(), locators, messages); } try { final Throwable t = (Throwable)exception.getClass().getMethod("getException", new Class[0]).invoke(exception, new Object[0]); if (t != exception) { findLocator(t, locators, messages); } } catch (Exception e) { // } }