wro4j-extensions/src/main/java/ro/isdc/wro/extensions/script/RhinoScriptBuilder.java
public RhinoScriptBuilder evaluateChain(final InputStream stream, final String sourceName)
    throws IOException {
    notNull(stream);
    try {
      getContext().evaluateReader(scope, new InputStreamReader(stream), sourceName, 1, null);
      return this;
    } catch(final RhinoException e) {
      if (e instanceof RhinoException) {
        LOG.error("RhinoException: {}", RhinoUtils.createExceptionMessage(e));
      }
      throw e;
    } catch (final RuntimeException e) {
      LOG.error("Exception caught", e);
      throw e;
    } finally {
      stream.close();
    }
  }
public RhinoScriptBuilder evaluateChain(final InputStream stream, final String sourceName)
    throws IOException {
    notNull(stream);
    try {
      getContext().evaluateReader(scope, new InputStreamReader(stream), sourceName, 1, null);
      return this;
    } catch(final RhinoException e) {
      if (e instanceof RhinoException) {
        LOG.error("RhinoException: {}", RhinoUtils.createExceptionMessage(e));
      }
      throw e;
    } catch (final RuntimeException e) {
      LOG.error("Exception caught", e);
      throw e;
    } finally {
      stream.close();
    }
  }
public RhinoScriptBuilder evaluateChain ( final InputStream stream , final String sourceName ) throws IOException { notNull ( stream ) ; try { getContext ( ) . evaluateReader ( scope , new InputStreamReader ( stream ) , sourceName , 1 , null ) ; return this ; } catch ( final RhinoException e ) { if ( e instanceof RhinoException ) { LOG . error ( "RhinoException: {}" , RhinoUtils . createExceptionMessage ( e ) ) ; } throw e ; } catch ( final RuntimeException e ) { LOG . error ( "Exception caught" , e ) ; throw e ; } finally { stream . close ( ) ; } }
Evaluates a script and return {@link RhinoScriptBuilder} for a chained script evaluation.

@param stream {@link InputStream} of the script to evaluate.
@param sourceName the name of the evaluated script.
@return {@link RhinoScriptBuilder} chain with required script evaluated.
@throws IOException if the script couldn't be retrieved.
Evaluates a script and return { @link RhinoScriptBuilder } for a chained script evaluation .