@Test public void resource_that_throws_exception() throws Exception { Resource resource = new AbstractResource("throwfoo") { @Override public URL toURL() { return null; } @Override public boolean exists() { return true; } @Override protected Resource newResource(String path) { return null; } @Override public InputStream openStream() throws IOException { throw new IOException("foo"); } }; try { getParser().parseTemplate(resource); unreachable(); } catch (RuntimeException ex) { if (ex.getCause() instanceof TapestryException && ex.getCause().getCause() instanceof IOException) { assertMessageContains(ex, "foo"); } else { throw ex; } } }
public ComponentTemplate parseTemplate(final Resource templateResource) { if (!templateResource.exists()) throw new RuntimeException(String.format("Template resource %s does not exist.", templateResource)); return tracker.invoke("Parsing component template " + templateResource, new Invokable<ComponentTemplate>() { public ComponentTemplate invoke() { return new SaxTemplateParser(templateResource, configuration).parse(defaultCompressWhitespace); } }); }
TemplateParserImpl implements TemplateParser { public ComponentTemplate parseTemplate(final Resource templateResource) { if (!templateResource.exists()) throw new RuntimeException(String.format("Template resource %s does not exist.", templateResource)); return tracker.invoke("Parsing component template " + templateResource, new Invokable<ComponentTemplate>() { public ComponentTemplate invoke() { return new SaxTemplateParser(templateResource, configuration).parse(defaultCompressWhitespace); } }); } }
TemplateParserImpl implements TemplateParser { public ComponentTemplate parseTemplate(final Resource templateResource) { if (!templateResource.exists()) throw new RuntimeException(String.format("Template resource %s does not exist.", templateResource)); return tracker.invoke("Parsing component template " + templateResource, new Invokable<ComponentTemplate>() { public ComponentTemplate invoke() { return new SaxTemplateParser(templateResource, configuration).parse(defaultCompressWhitespace); } }); } TemplateParserImpl(Map<String, URL> configuration,

                              @Symbol(SymbolConstants.COMPRESS_WHITESPACE)
                              boolean defaultCompressWhitespace, OperationTracker tracker); }
TemplateParserImpl implements TemplateParser { public ComponentTemplate parseTemplate(final Resource templateResource) { if (!templateResource.exists()) throw new RuntimeException(String.format("Template resource %s does not exist.", templateResource)); return tracker.invoke("Parsing component template " + templateResource, new Invokable<ComponentTemplate>() { public ComponentTemplate invoke() { return new SaxTemplateParser(templateResource, configuration).parse(defaultCompressWhitespace); } }); } TemplateParserImpl(Map<String, URL> configuration,

                              @Symbol(SymbolConstants.COMPRESS_WHITESPACE)
                              boolean defaultCompressWhitespace, OperationTracker tracker); ComponentTemplate parseTemplate(final Resource templateResource); Map<String, URL> getDTDURLMappings(); }
TemplateParserImpl implements TemplateParser { public ComponentTemplate parseTemplate(final Resource templateResource) { if (!templateResource.exists()) throw new RuntimeException(String.format("Template resource %s does not exist.", templateResource)); return tracker.invoke("Parsing component template " + templateResource, new Invokable<ComponentTemplate>() { public ComponentTemplate invoke() { return new SaxTemplateParser(templateResource, configuration).parse(defaultCompressWhitespace); } }); } TemplateParserImpl(Map<String, URL> configuration,

                              @Symbol(SymbolConstants.COMPRESS_WHITESPACE)
                              boolean defaultCompressWhitespace, OperationTracker tracker); ComponentTemplate parseTemplate(final Resource templateResource); Map<String, URL> getDTDURLMappings();  }