/** * Load a template library from a resource on the class path. * * @return loaded template library * @throws java.lang.IllegalArgumentException resource not found or could not be loaded */ static IdentityTemplateLibrary loadFromResource(String resource) { InputStream in = IdentityTemplateLibrary.class.getResourceAsStream(resource); try { return load(in); } catch (IOException e) { throw new IllegalArgumentException("Could not load template library from resource " + resource, e); } finally { try { if (in != null) in.close(); } catch (IOException e) { // ignored } } }
/** * Load a template library from a resource on the class path. * * @return loaded template library * @throws java.lang.IllegalArgumentException resource not found or could not be loaded */ static IdentityTemplateLibrary loadFromResource(String resource) { InputStream in = IdentityTemplateLibrary.class.getResourceAsStream(resource); try { return load(in); } catch (IOException e) { throw new IllegalArgumentException("Could not load template library from resource " + resource, e); } finally { try { if (in != null) in.close(); } catch (IOException e) { // ignored } } }