Package ro.isdc.wro

Examples of ro.isdc.wro.WroRuntimeException


      throws Exception {
    final List<ResourcePreProcessor> processors = new ArrayList<ResourcePreProcessor>();
    processors.add(new ResourcePreProcessor() {
      public void process(final Resource resource, final Reader reader, final Writer writer)
          throws IOException {
        throw new WroRuntimeException("processor fails");
      }
    });
    doFilterWithProcessors(processors);
  }
View Full Code Here


  protected InputStream getModelResourceAsStream()
      throws IOException {
    final ServletContext servletContext = context.getServletContext();
    // Don't allow NPE, throw a more detailed exception
    if (servletContext == null) {
      throw new WroRuntimeException(
          "No servletContext is available. Probably you are running this code outside of the request cycle!");
    }
    final String resourceLocation = "/WEB-INF/" + getDefaultModelFilename();
    final InputStream stream = servletContext.getResourceAsStream(resourceLocation);
    if (stream == null) {
View Full Code Here

        if (cause instanceof WroRuntimeException) {
          throw (WroRuntimeException) cause;
        } else if (cause instanceof IOException) {
          throw (IOException) cause;
        } else {
          throw new WroRuntimeException("Problem during parallel pre processing", e);
        }
      }
    }
    return result.toString();
  }
View Full Code Here

          cacheKey.getGroupName(), cacheKey.getType());
      // find processed result for a group
      final WroModel model = modelFactory.create();
      final Group group = new WroModelInspector(model).getGroupByName(cacheKey.getGroupName());
      if (group == null) {
        throw new WroRuntimeException("No such group available in the model: " + cacheKey.getGroupName());
      }
      final Group filteredGroup = group.collectResourcesOfType(cacheKey.getType());
      if (filteredGroup.getResources().isEmpty()) {
        LOG.debug("No resources found in group: {} and resource type: {}", group.getName(), cacheKey.getType());
        if (!context.getConfig().isIgnoreEmptyGroup()) {
          throw new WroRuntimeException("No resources found in group: " + group.getName());
        }
      }
      final String result = preProcessorExecutor.processAndMerge(filteredGroup.getResources(), cacheKey.isMinimize());
      return applyPostProcessors(cacheKey, result);
    } catch (final IOException e) {
      throw new WroRuntimeException("Exception while merging resources: " + e.getMessage(), e).logError();
    } finally {
      callbackRegistry.onProcessingComplete();
    }
  }
View Full Code Here

   */
  public final InputStream locate(final String uri)
    throws IOException {
    final UriLocator uriLocator = getInstance(uri);
    if (uriLocator == null) {
      throw new WroRuntimeException("No locator is capable of handling uri: " + uri);
    }
    LOG.debug("[OK] locating {} using locator: {}", uri, uriLocator.getClass().getSimpleName());
    return new AutoCloseInputStream(uriLocator.locate(uri));
  }
View Full Code Here

      final byte[] bytes = dataUri.getBytes(CharEncoding.UTF_8);
      final boolean exceedLimit = bytes.length >= SIZE_LIMIT;
      LOG.debug("dataUri size: {}KB, limit exceeded: {}", bytes.length / 1024, exceedLimit);
      return !exceedLimit;
    } catch (final UnsupportedEncodingException e) {
      throw new WroRuntimeException("Should never happen", e);
    }
  }
View Full Code Here

  public static void waitUntil(final Function<Void, Boolean> function, final long timeout) {
    final long start = System.currentTimeMillis();
    try {
      while (!function.apply(null)) {
        if (System.currentTimeMillis() - start > timeout) {
          throw new WroRuntimeException("Timeout of " + timeout + "ms exceeded.");
        }
      }
    } catch (final Exception e) {
      throw WroRuntimeException.wrap(e);
    }
View Full Code Here

        LOG.debug("Authorizing url: '{}'", allowedUrl);
        ((MutableResourceAuthorizationManager) authorizationManager).add(allowedUrl);
      }

    } else {
      throw new WroRuntimeException("This processor (" + getClass().getSimpleName()
          + ") requires an instance of MutableResourceAuthorizationManager!");
    }
  }
View Full Code Here

   * @return the injected object instance. Useful for fluent interface.
   */
  public <T> T inject(final T object) {
    notNull(object);
    if (!Context.isContextSet()) {
      throw new WroRuntimeException("No Context Set");
    }
    if (!injectedObjects.containsKey(computeKey(object))) {
      injectedObjects.put(computeKey(object), true);
      processInjectAnnotation(object);
    }
View Full Code Here

          if (!acceptAnnotatedField(object, field)) {
            final String message = String.format(
                "@Inject cannot be applied on object: %s to field of type: %s using injector %s", object,
                field.getType(), this);
            LOG.error(message + ". Supported types are: {}", map.keySet());
            throw new WroRuntimeException(message);
          }
        }
      }
      // handle special cases like decorators. Perform recursive injection
      if (object instanceof ObjectDecorator) {
View Full Code Here

TOP

Related Classes of ro.isdc.wro.WroRuntimeException

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.