Package de.matrixweb.smaller.common

Examples of de.matrixweb.smaller.common.SmallerException


        public String call(final String input) {
          try {
            final Object result = javaMethod.invoke(object, input);
            return result == null ? null : result.toString();
          } catch (final IllegalAccessException e) {
            throw new SmallerException("Illegal access to callback method", e);
          } catch (final InvocationTargetException e) {
            throw new SmallerException("Failed to execute callback method", e
                .getTargetException());
          }
        }
      });
    } catch (final NoSuchMethodException e) {
      throw new SmallerException("Failed to reflect global method", e);
    }
  }
View Full Code Here


  public void addScriptFile(final String file) {
    final InputStream script = getClass().getResourceAsStream(file);
    try {
      addScriptSource(IOUtils.toString(script), file);
    } catch (final IOException e) {
      throw new SmallerException("Failed to include script file", e);
    } finally {
      if (script != null) {
        IOUtils.closeQuietly(script);
      }
    }
View Full Code Here

  @Override
  public void addScriptFile(final URL url) {
    try {
      addScriptSource(IOUtils.toString(url), url.getFile());
    } catch (final IOException e) {
      throw new SmallerException("Failed to include script file", e);
    }
  }
View Full Code Here

    try {
      final String data = new ObjectMapper().writeValueAsString(IOUtils
          .toString(input));
      output.write(this.engine.execute(String.format(this.source, data)));
    } catch (final NativeEngineException e) {
      throw new SmallerException("Failed to execute javascript", e);
    }
  }
View Full Code Here

        getModuleScriptProvider(clazz), null, null, false);
    require.install(scope);
    try {
      this.moduleScope = new ModuleScope(scope, new URI("./" + this.name), null);
    } catch (final URISyntaxException e) {
      throw new SmallerException("Failed to create moduleScope", e);
    }
    addGlobalFunction("print", LOGGER, "info");
  }
View Full Code Here

            IOUtils.toString(script), file, 1, null);
      } finally {
        IOUtils.closeQuietly(script);
      }
    } catch (final IOException e) {
      throw new SmallerException("Failed to include script file", e);
    }
  }
View Full Code Here

  public void addScriptFile(final URL url) {
    try {
      Context.getCurrentContext().evaluateString(this.moduleScope,
          IOUtils.toString(url), url.getFile(), 1, null);
    } catch (final IOException e) {
      throw new SmallerException("Failed to include script file", e);
    }
  }
View Full Code Here

      final Object result = context.evaluateString(scope,
          String.format(this.source, data), this.name, 1, null);

      output.append(String.valueOf(result));
    } catch (final JavaScriptException e) {
      throw new SmallerException("Failed to run javascript", e);
    } finally {
      Context.exit();
    }
  }
View Full Code Here

      try {
        this.node = new NodeJsExecutor();
        this.node.setModule(getClass(), "lessjs-" + this.version);
      } catch (final IOException e) {
        this.node = null;
        throw new SmallerException("Failed to conigure node for lessjs-"
            + this.version, e);
      }
    }
  }
View Full Code Here

    public String resolve(final String input) {
      try {
        return this.resolver.resolve(input.replace(WIN_LOC_HREF_FIX, ""))
            .getContents();
      } catch (final IOException e) {
        throw new SmallerException(
            "Failed to resolve resource '" + input + "'", e);
      }
    }
View Full Code Here

TOP

Related Classes of de.matrixweb.smaller.common.SmallerException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.