/** * 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; }
public void warning(TransformerException ex) throws TransformerException { // TODO: We may want here to allow some special formatting of the messages, such as // "DEBUG:A debug message" or "INFO:Transforming <foo> in mode 'bar'" to use the different // log levels. This can include also deprecation logs for system-defined stylesheets // using "DEPRECATED:WARN:Styling 'foo' is replaced by 'bar'". if (logger.isWarnEnabled()) { Location loc = LocationUtils.getLocation(ex); logger.warn(ex.getMessage() + " at "+ loc == null ? uri : loc.toString()); } // Keep the warning (see below) warningEx = ex; }
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; } };
public void warning(TransformerException ex) throws TransformerException { // TODO: We may want here to allow some special formatting of the messages, such as // "DEBUG:A debug message" or "INFO:Transforming <foo> in mode 'bar'" to use the different // log levels. This can include also deprecation logs for system-defined stylesheets // using "DEPRECATED:WARN:Styling 'foo' is replaced by 'bar'". if (getLogger().isWarnEnabled()) { Location loc = LocationUtils.getLocation(ex); getLogger().warn(ex.getMessage() + " at " + (loc == null ? uri : loc.toString())); } // Keep the warning (see below) warningEx = ex; }
/** * 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; }
public void setup(SourceResolver resolver, Map objectModel, String src, Parameters par) throws ProcessingException, SAXException, IOException { super.setup(resolver, objectModel, src, par); Deprecation.logger.warn("NotifyingGenerator is deprecated in favor of ExceptionGenerator, at " + LocationUtils.getLocation(par)); this.notification = (Notifying) objectModel.get(Constants.NOTIFYING_OBJECT); if (this.notification == null) { throw new ProcessingException("Expected Constants.NOTIFYING_OBJECT not found in object model."); } }
Location loc = LocationUtils.getLocation(cause); if (LocationUtils.isKnown(loc)) { attr.clear(); dumpLocation(loc, attr, handler); loc = LocationUtils.getLocation(current); if (LocationUtils.isKnown(loc)) {
Location rawLoc = LocationUtils.getLocation(config); return new LocationImpl(desc.toString(), rawLoc.getURI(),
throw SourceUtil.handle("Error during resolving of '" + uri + "'.", se); } catch (ProcessingException e) { throw ProcessingException.throwLocated(null, e, LocationUtils.getLocation(location)); } catch (Exception e) { throw new SAXParseException(e.getMessage(), location, e);