/** * 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)); }
/** * 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)); }
/** * 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)); }
/** * 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)); }
/** * 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)); }
/** * 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)); }
/** * Define a Spring XML namespace definition to use. * @param definition the namespace definition */ public void xmlns(Map<String, String> definition) { if (!definition.isEmpty()) { for (Map.Entry<String,String> entry : definition.entrySet()) { String namespace = entry.getKey(); String uri = entry.getValue(); if (uri == null) { throw new IllegalArgumentException("Namespace definition must supply a non-null URI"); } NamespaceHandler namespaceHandler = this.groovyDslXmlBeanDefinitionReader.getNamespaceHandlerResolver().resolve(uri); if (namespaceHandler == null) { throw new BeanDefinitionParsingException(new Problem("No namespace handler found for URI: " + uri, new Location(new DescriptiveResource(("Groovy"))))); } this.namespaces.put(namespace, uri); } } }
/** * Define a Spring XML namespace definition to use. * @param definition the namespace definition */ public void xmlns(Map<String, String> definition) { if (!definition.isEmpty()) { for (Map.Entry<String,String> entry : definition.entrySet()) { String namespace = entry.getKey(); String uri = entry.getValue(); if (uri == null) { throw new IllegalArgumentException("Namespace definition must supply a non-null URI"); } NamespaceHandler namespaceHandler = this.groovyDslXmlBeanDefinitionReader.getNamespaceHandlerResolver().resolve(uri); if (namespaceHandler == null) { throw new BeanDefinitionParsingException(new Problem("No namespace handler found for URI: " + uri, new Location(new DescriptiveResource(("Groovy"))))); } this.namespaces.put(namespace, uri); } } }
throw new BeanDefinitionParsingException(new Problem("Error evaluating Groovy script: " + ex.getMessage(), new Location(encodedResource.getResource()), null, ex));
@Test(expected = BeanDefinitionParsingException.class) public void testError() throws Exception { FailFastProblemReporter reporter = new FailFastProblemReporter(); reporter.error(new Problem("VGER", new Location(new DescriptiveResource("here")), null, new IllegalArgumentException())); }
throw new BeanDefinitionParsingException(new Problem("Error evaluating Groovy script: " + ex.getMessage(), new Location(encodedResource.getResource()), null, ex));
@Test public void testWarn() throws Exception { Problem problem = new Problem("VGER", new Location(new DescriptiveResource("here")), null, new IllegalArgumentException()); Log log = mock(Log.class); FailFastProblemReporter reporter = new FailFastProblemReporter(); reporter.setLogger(log); reporter.warning(problem); verify(log).warn(any(), isA(IllegalArgumentException.class)); }
public void error(String message, Object source, ParseState parseState, Throwable cause) { Location location = new Location(getResource(), source); this.problemReporter.error(new Problem(message, location, parseState, cause)); }
public void fatal(String message, Object source, ParseState parseState, Throwable cause) { Location location = new Location(getResource(), source); this.problemReporter.fatal(new Problem(message, location, parseState, cause)); }
public void warning(String message, Object source, ParseState parseState, Throwable cause) { Location location = new Location(getResource(), source); this.problemReporter.warning(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." + " " + getMissingModuleOrExtensionMessage(namespace); return new Problem(message, problem.getLocation(), problem.getParseState(), problem.getRootCause()); } catch (Exception e) { // fall back to previous message return problem; } }
protected BeanDefinitionBuilder getBeanDefinitionBuilder(ParserContext parserContext) { try { return BeanDefinitionBuilder.rootBeanDefinition(messageProcessorClass.getName()); } catch (NoClassDefFoundError noClassDefFoundError) { throw new BeanDefinitionParsingException(new Problem(("Cannot launch the mule app, the message processor class " + messageProcessorClass.getName() + " was not found in the classpath."), new Location(parserContext.getReaderContext().getResource()), null, noClassDefFoundError)); } }
/** * Cause an error with the provided message. * * @param message the message. * @param parserContext the parser context. Used to provide the failing location. * @throws BeanDefinitionParsingException if we encounter a filter */ protected void error(final String message, final ParserContext parserContext) { log.error(message); throw new BeanDefinitionParsingException(new Problem(message, new Location(parserContext.getReaderContext() .getResource()))); }
/** * Raise a regular error. */ public void error(String message, Object source, ParseState parseState, 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." + " " + getMissingModuleOrExtensionMessage(namespace); return new Problem(message, problem.getLocation(), problem.getParseState(), problem.getRootCause()); } catch (Exception e) { // fall back to previous message return problem; } }