wro4j-core/src/main/java/ro/isdc/wro/model/resource/processor/decorator/ExceptionHandlingProcessorDecorator.java
@Override
  public void process(final Resource resource, final Reader reader, final Writer writer)
      throws IOException {
    final String resourceContent = IOUtils.toString(reader);
    final Reader innerReader = new StringReader(resourceContent);
    final StringWriter innerWriter = new StringWriter();
    try {
      super.process(resource, innerReader, innerWriter);
      writer.write(innerWriter.toString());
    } catch (final Exception e) {
      final String processorName = toString();
      if (isIgnoreFailingProcessor()) {
        LOG.debug("Ignoring failed processor. Original Exception", e);
        writer.write(resourceContent);
        // don't wrap exception unless required
      } else {
        LOG.error("Failed to process the resource: {} using processor: {}. Reason: {}", resource, processorName, e.getMessage());
        final String resourceUri = resource != null ? resource.getUri() : null;
        throw WroRuntimeException.wrap(e,
            "The processor: " + processorName + " faile while processing uri: " + resourceUri).setResource(resource);
      }
    } finally {
      reader.close();
      writer.close();
    }
  }
@Override
  public void process(final Resource resource, final Reader reader, final Writer writer)
      throws IOException {
    final String resourceContent = IOUtils.toString(reader);
    final Reader innerReader = new StringReader(resourceContent);
    final StringWriter innerWriter = new StringWriter();
    try {
      super.process(resource, innerReader, innerWriter);
      writer.write(innerWriter.toString());
    } catch (final Exception e) {
      final String processorName = toString();
      if (isIgnoreFailingProcessor()) {
        LOG.debug("Ignoring failed processor. Original Exception", e);
        writer.write(resourceContent);
        // don't wrap exception unless required
      } else {
        LOG.error("Failed to process the resource: {} using processor: {}. Reason: {}", resource, processorName, e.getMessage());
        final String resourceUri = resource != null ? resource.getUri() : null;
        throw WroRuntimeException.wrap(e,
            "The processor: " + processorName + " faile while processing uri: " + resourceUri).setResource(resource);
      }
    } finally {
      reader.close();
      writer.close();
    }
  }
@ Override public void process ( final Resource resource , final Reader reader , final Writer writer ) throws IOException { final String resourceContent = IOUtils . toString ( reader ) ; final Reader innerReader = new StringReader ( resourceContent ) ; final StringWriter innerWriter = new StringWriter ( ) ; try { super . process ( resource , innerReader , innerWriter ) ; writer . write ( innerWriter . toString ( ) ) ; } catch ( final Exception e ) { final String processorName = toString ( ) ; if ( isIgnoreFailingProcessor ( ) ) { LOG . debug ( "Ignoring failed processor. Original Exception" , e ) ; writer . write ( resourceContent ) ; // don't wrap exception unless required } else { LOG . error ( "Failed to process the resource: {} using processor: {}. Reason: {}" , resource , processorName , e . getMessage ( ) ) ; final String resourceUri = resource != null ? resource . getUri ( ) : null ; throw WroRuntimeException . wrap ( e , "The processor: " + processorName + " faile while processing uri: " + resourceUri ) . setResource ( resource ) ; } } finally { reader . close ( ) ; writer . close ( ) ; } }
{@inheritDoc}
{