private PathPattern getPattern(String path, Class c) { PathPattern p = null; try { p = new PathPattern(new PathTemplate(path)); } catch (IllegalArgumentException ex) { Errors.error("Illegal URI template for root resource class " + c.getName() + ": "+ ex.getMessage()); } return p; }
@Override public void initiate(final ResourceConfig rc, final IoCComponentProviderFactory _provider) { Errors.processWithErrors(new Errors.Closure<Void>() { @Override public Void f() { Errors.setReportMissingDependentFieldOrMethod(false); _initiate(rc, _provider); return null; } }); }
Errors.nonPublicClass(clazz); Errors.interfaceClass(clazz); } else { Errors.abstractClass(clazz); Errors.innerClass(clazz); Errors.nonPublicConstructor(clazz); Errors.missingDependency(ctorInjectablePair.constructor, i);
p = new PathPattern(new PathTemplate(locator.getPath().getValue())); } catch (IllegalArgumentException ex) { Errors.error(String.format("Illegal URI template for sub-resource locator %s: %s", locator.getMethod(), ex.getMessage())); continue; Errors.error(String.format("Conflicting URI templates. " + "The URI template %s for sub-resource locator %s " + "and the URI template %s transform to the same regular expression %s", Errors.missingDependency(locator.getMethod(), i);
public static void missingDependency(Method m, int i) { if (getReportMissingDependentFieldOrMethod()) { error("Missing dependency for method " + m + " at parameter at index " + i); } } }
Errors.missingDependency(sm.getMethod(), methodIndex);
Errors.setReportMissingDependentFieldOrMethod(true); cpFactory.injectOnAllComponents(); cpFactory.injectOnProviderInstances(resourceConfig.getProviderSingletons());
public static <T> T processWithErrors(Closure<T> c) { Errors e = errors.get(); if (e == null) { e = new Errors(); errors.set(e); } e.preProcess(); RuntimeException caught = null; try { return c.f(); } catch (RuntimeException re) { // If a runtime exception is caught then report errors and // rethrow caught = re; } finally { e.postProcess(caught == null); } throw caught; }
p = new PathPattern(new PathTemplate(locator.getPath().getValue())); } catch (IllegalArgumentException ex) { Errors.error(String.format("Illegal URI template for sub-resource locator %s: %s", locator.getMethod(), ex.getMessage())); continue; Errors.error(String.format("Conflicting URI templates. " + "The URI template %s for sub-resource locator %s " + "and the URI template %s transform to the same regular expression %s", Errors.missingDependency(locator.getMethod(), i);
public static void missingDependency(Method m, int i) { if (getReportMissingDependentFieldOrMethod()) { error("Missing dependency for method " + m + " at parameter at index " + i); } } }
Errors.missingDependency(af.getField());
Errors.setReportMissingDependentFieldOrMethod(true); componentProviderFactory.injectOnAllComponents(); componentProviderFactory.injectOnProviderInstances(config.getSingletons());
public static <T> T processWithErrors(Closure<T> c) { Errors e = errors.get(); if (e == null) { e = new Errors(); errors.set(e); } e.preProcess(); RuntimeException caught = null; try { return c.f(); } catch (RuntimeException re) { // If a runtime exception is caught then report errors and // rethrow caught = re; } finally { e.postProcess(caught == null); } throw caught; }
final int modifiers = c.getModifiers(); if (!Modifier.isPublic(modifiers)) { Errors.nonPublicClass(c); Errors.interfaceClass(c); } else { Errors.abstractClass(c); Errors.innerClass(c); Errors.nonPublicConstructor(c);
public void onConflict(PathPattern p1, PathPattern p2) { Errors.error(String.format("Conflicting URI templates. " + "The URI templates %s and %s for root resource classes " + "transform to the same regular expression %s", p1.getTemplate().getTemplate(), p2.getTemplate().getTemplate(), p1)); } });
/* package */ UriRules<UriRule> getUriRules(final Class c) { assert c != null; // Try the non-blocking read, the most common operation UriRules<UriRule> r = rulesMap.get(c); if (r != null) { return r; } // Not present use a synchronized block to ensure that only one // instance is created and put to the map synchronized (abstractResourceMap) { // One or more threads may have been blocking on the synchronized // block, re-check the map r = rulesMap.get(c); if (r != null) { return r; } r = Errors.processWithErrors(new Errors.Closure<ResourceUriRules>() { @Override public ResourceUriRules f() { return newResourceUriRules(getAbstractResource(c)); } }).getRules(); rulesMap.put(c, r); } return r; }
p = new PathPattern(new PathTemplate(locator.getPath().getValue())); } catch (IllegalArgumentException ex) { Errors.error(String.format("Illegal URI template for sub-resource locator %s: %s", locator.getMethod(), ex.getMessage())); continue; Errors.error(String.format("Conflicting URI templates. " + "The URI template %s for sub-resource locator %s " + "and the URI template %s transform to the same regular expression %s", Errors.missingDependency(locator.getMethod(), i);
public static void missingDependency(Field f) { if (getReportMissingDependentFieldOrMethod()) { error("Missing dependency for field: " + f.toGenericString()); } }
Errors.missingDependency(abstractResourceMethod.getMethod(), i);
Errors.setReportMissingDependentFieldOrMethod(true); componentProviderFactory.injectOnAllComponents(); componentProviderFactory.injectOnProviderInstances(config.getSingletons());