Package de.matrixweb.smaller.common

Examples of de.matrixweb.smaller.common.SmallerException


        holder.servletService = this.bundleContext.registerService(javax.servlet.Servlet.class, holder.servlet, props);

        this.services.add(holder);
      }
    } catch (final IOException e) {
      throw new SmallerException("Failed to register smaller servlets", e);
    }
  }
View Full Code Here


    try {
      if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) {
        throw new ExecutionException(IOUtils.toString(in));
      }
      if (getHeader(response, "X-Smaller-Status").equals("ERROR")) {
        throw new SmallerException(getHeader(response, "X-Smaller-Message")
            .replace("#@@#", "\n"));
      }
      return IOUtils.toByteArray(in);
    } finally {
      IOUtils.closeQuietly(in);
View Full Code Here

          }
          hexString.append(hex);
        }
        return hexString.toString();
      } catch (NoSuchAlgorithmException e) {
        throw new SmallerException("Failed to create version-hash", e);
      } catch (UnsupportedEncodingException e) {
        throw new SmallerException("Failed to create version-hash", e);
      } finally {
        FileUtils.deleteDirectory(temp);
      }
    } catch (IOException e) {
      throw new SmallerException("Failed to create version-hash", e);
    }
  }
View Full Code Here

            && FilenameUtils.isExtension(resource.getPath(), "json")) {
          return executeSimpleMerge(vfs, resource, options);
        }
        return executeComplexMerge(vfs, resource, options);
      } catch (final IOException e) {
        throw new SmallerException("Failed to merge files", e);
      }
    }

    final VFile snapshot = vfs.stack();
    try {
View Full Code Here

      try {
        this.task.getClass().getMethod("execute").invoke(this.task);
      } catch (final InvocationTargetException e) {
        final Throwable t = e.getTargetException();
        if ("SmallerException".equals(t.getClass().getSimpleName())) {
          throw new SmallerException(t.getMessage(), e);
        }
        throw e;
      }
    }
View Full Code Here

      main = new File(input, "META-INF/MAIN.json");
      if (!main.exists()) {
        // Old behaviour: Search directly in root of zip
        main = new File(input, "MAIN.json");
        if (!main.exists()) {
          throw new SmallerException(
              "Missing instructions file 'META-INF/smaller.json'");
        }
      }
    }
    return main;
View Full Code Here

        if (ext.equals("svg")) {
          target = new File(base, s).getAbsolutePath();
        }
        break;
      default:
        throw new SmallerException("Invalid resource type " + type);
      }
    }
    return target;
  }
View Full Code Here

  public Resource resolve(final String path) {
    try {
      return new VFSResource(this, this.vfs.find(path.startsWith("/") ? path
          : '/' + path));
    } catch (final IOException e) {
      throw new SmallerException("Failed to resolve '" + path + "'", e);
    }
  }
View Full Code Here

      try {
        this.node = new NodeJsExecutor();
        this.node.setModule(getClass(), "typescript-0.9.1");
      } catch (final IOException e) {
        this.node = null;
        throw new SmallerException("Failed to setup node for typescript", e);
      }
    }
    final String outfile = this.node.run(vfs,
        resource != null ? resource.getPath() : null, options);
    Resource result = resource;
View Full Code Here

        exceptions.add(executeProcessAsyncron(cdl, manifest,
            processDescription, vfs, targetDir, resolver, version));
      }
      cdl.await(5, TimeUnit.MINUTES);
    } catch (final InterruptedException e) {
      throw new SmallerException("Failed to process smaller request", e);
    }

    for (final AtomicReference<Exception> exception : exceptions) {
      if (exception.get() != null) {
        final Exception e = exception.get();
        if (e instanceof SmallerException) {
          throw (SmallerException) e;
        } else if (e instanceof IOException) {
          throw (IOException) e;
        }
        throw new SmallerException("Failed to execute smaller process", e);
      }
    }

    writeResults(vfs, targetDir, manifest);
  }
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.