public Location getLocation(Object obj, String description) { if (obj instanceof Configuration) { Configuration config = (Configuration)obj; String locString = config.getLocation(); Location result = LocationUtils.parse(locString); if (LocationUtils.isKnown(result)) { // Add description StringBuffer desc = new StringBuffer().append('<'); // Unfortunately Configuration.getPrefix() is not public try { if (config.getNamespace().startsWith("http://apache.org/cocoon/sitemap/")) { desc.append("map:"); } } catch (ConfigurationException e) { // no namespace: ignore } desc.append(config.getName()).append('>'); return new LocationImpl(desc.toString(), result); } else { return result; } } // Try next finders. return null; } };
/** * Get the exception that was catched by this listener, if any. * * @return the exception */ public Throwable getThrowable() { if (exception == null) { return null; } Location loc = LocationUtils.getLocation(exception); if (LocationUtils.isKnown(loc)) { // Has a location: don't loose this precious information! return exception; } // No location: if it's just a wrapper, consider only the wrapped exception if (exception.getCause() != null) { return exception.getCause(); } // That's the actual exception! return exception; }
/** * Get the exception that was catched by this listener, if any. * * @return the exception */ public Throwable getThrowable() { if (exception == null) { return null; } Location loc = LocationUtils.getLocation(exception); if (LocationUtils.isKnown(loc)) { // Has a location: don't loose this precious information! return exception; } // No location: if it's just a wrapper, consider only the wrapped exception if (exception.getCause() != null) { return exception.getCause(); } // That's the actual exception! return exception; }