/** * Raise a fatal error. */ public void fatal(String message, @Nullable Object source, @Nullable ParseState parseState, @Nullable Throwable cause) { Location location = new Location(getResource(), source); this.problemReporter.fatal(new Problem(message, location, parseState, cause)); }
/** * Get the description of the bean configuration source that triggered the error, * as contained within this Problem's Location object. * @see #getLocation() */ public String getResourceDescription() { return getLocation().getResource().getDescription(); }
@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("Configuration problem: "); sb.append(getMessage()); sb.append("\nOffending resource: ").append(getResourceDescription()); if (getParseState() != null) { sb.append('\n').append(getParseState()); } return sb.toString(); }
/** * Create a new BeanDefinitionParsingException. * @param problem the configuration problem that was detected during the parsing process */ public BeanDefinitionParsingException(Problem problem) { super(problem.getResourceDescription(), problem.toString(), problem.getRootCause()); }
protected Problem extendProblemDetails(Problem problem) { try { String element = ((Element) problem.getLocation().getSource()).getLocalName(); String namespace = ((Element) problem.getLocation().getSource()).getNamespaceURI(); String message = "The element '" + element + "' does not have an associated Bean Definition Parser." + " " + getMissingModuleOrExtensionMessage(namespace); return new Problem(message, problem.getLocation(), problem.getParseState(), problem.getRootCause()); } catch (Exception e) { // fall back to previous message return problem; } }
/** * Writes the supplied {@link Problem} to the {@link Log} at {@code WARN} level. * @param problem the source of the warning */ @Override public void warning(Problem problem) { logger.warn(problem, problem.getRootCause()); }
protected boolean isMissingParser(Problem problem) { // Spring doesn't give us much useful data here - parseState and rootCause are null String message = problem.getMessage(); return (null != message && message.startsWith(NO_PARSER_PREFIX)); }
protected Problem extendProblemDetails(Problem problem) { try { String element = ((Element) problem.getLocation().getSource()).getLocalName(); String namespace = ((Element) problem.getLocation().getSource()).getNamespaceURI(); String message = "The element '" + element + "' does not have an associated Bean Definition Parser." + " " + getMissingModuleOrExtensionMessage(namespace); return new Problem(message, problem.getLocation(), problem.getParseState(), problem.getRootCause()); } catch (Exception e) { // fall back to previous message return problem; } }
/** * Create a new BeanDefinitionParsingException. * @param problem the configuration problem that was detected during the parsing process */ public BeanDefinitionParsingException(Problem problem) { super(problem.getResourceDescription(), problem.toString(), problem.getRootCause()); }
/** * Writes the supplied {@link Problem} to the {@link Log} at {@code WARN} level. * @param problem the source of the warning */ @Override public void warning(Problem problem) { logger.warn(problem, problem.getRootCause()); }
protected boolean isMissingParser(Problem problem) { // Spring doesn't give us much useful data here - parseState and rootCause are null String message = problem.getMessage(); return (null != message && message.startsWith(NO_PARSER_PREFIX)); }
/** * Raise a regular error. */ public void error(String message, @Nullable Object source, @Nullable ParseState parseState, @Nullable Throwable cause) { Location location = new Location(getResource(), source); this.problemReporter.error(new Problem(message, location, parseState, cause)); }
protected Problem extendProblemDetails(Problem problem) { try { String element = ((Element) problem.getLocation().getSource()).getLocalName(); String namespace = ((Element) problem.getLocation().getSource()).getNamespaceURI(); String message = "The element '" + element + "' does not have an associated Bean Definition Parser." +" Is the module or transport associated with " + namespace + " present on the classpath?"; return new Problem(message, problem.getLocation(), problem.getParseState(), problem.getRootCause()); } catch (Exception e) { // fall back to previous message return problem; } }
@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("Configuration problem: "); sb.append(getMessage()); sb.append("\nOffending resource: ").append(getResourceDescription()); if (getParseState() != null) { sb.append('\n').append(getParseState()); } return sb.toString(); }
/** * Create a new BeanDefinitionParsingException. * @param problem the configuration problem that was detected during the parsing process */ public BeanDefinitionParsingException(Problem problem) { super(problem.getResourceDescription(), problem.toString(), problem.getRootCause()); }
/** * Get the description of the bean configuration source that triggered the error, * as contained within this Problem's Location object. * @see #getLocation() */ public String getResourceDescription() { return getLocation().getResource().getDescription(); }
/** * Writes the supplied {@link Problem} to the {@link Log} at <code>WARN</code> level. * @param problem the source of the warning */ public void warning(Problem problem) { this.logger.warn(problem, problem.getRootCause()); }
protected boolean isMissingParser(Problem problem) { // Spring doesn't give us much useful data here - parseState and rootCause are null String message = problem.getMessage(); return (null != message && message.startsWith(NO_PARSER_PREFIX)); }
/** * Raise a non-critical warning. */ public void warning(String message, @Nullable Object source, @Nullable ParseState parseState, @Nullable Throwable cause) { Location location = new Location(getResource(), source); this.problemReporter.warning(new Problem(message, location, parseState, cause)); }
@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("Configuration problem: "); sb.append(getMessage()); sb.append("\nOffending resource: ").append(getResourceDescription()); if (getParseState() != null) { sb.append('\n').append(getParseState()); } return sb.toString(); }