@Test void getResourceWhenResourceDirNotSet() { assertNull(this.environment.getResource("doesntexist")); }
@Override public URL getResource(String resourceName) { URL resourceURL = null; if (this.resourceDirectory != null) { try { File resourceFile = new File(this.resourceDirectory, resourceName); if (resourceFile.exists()) { resourceURL = resourceFile.toURI().toURL(); } } catch (MalformedURLException e) { this.logger.debug("Failed to access resource [{}]", resourceName, e); } } if (resourceURL == null) { resourceURL = (this.resourceClassLoader == null ? Thread.currentThread().getContextClassLoader() : this.resourceClassLoader).getResource(resourceName); } return resourceURL; }
StandardEnvironment extends AbstractEnvironment { @Override public URL getResource(String resourceName) { URL resourceURL = null; if (this.resourceDirectory != null) { try { File resourceFile = new File(this.resourceDirectory, resourceName); if (resourceFile.exists()) { resourceURL = resourceFile.toURI().toURL(); } } catch (MalformedURLException e) { this.logger.debug("Failed to access resource [{}]", resourceName, e); } } if (resourceURL == null) { resourceURL = (this.resourceClassLoader == null ? Thread.currentThread().getContextClassLoader() : this.resourceClassLoader).getResource(resourceName); } return resourceURL; } }
StandardEnvironment extends AbstractEnvironment { @Override public URL getResource(String resourceName) { URL resourceURL = null; if (this.resourceDirectory != null) { try { File resourceFile = new File(this.resourceDirectory, resourceName); if (resourceFile.exists()) { resourceURL = resourceFile.toURI().toURL(); } } catch (MalformedURLException e) { this.logger.debug("Failed to access resource [{}]", resourceName, e); } } if (resourceURL == null) { resourceURL = (this.resourceClassLoader == null ? Thread.currentThread().getContextClassLoader() : this.resourceClassLoader).getResource(resourceName); } return resourceURL; }  }
StandardEnvironment extends AbstractEnvironment { @Override public URL getResource(String resourceName) { URL resourceURL = null; if (this.resourceDirectory != null) { try { File resourceFile = new File(this.resourceDirectory, resourceName); if (resourceFile.exists()) { resourceURL = resourceFile.toURI().toURL(); } } catch (MalformedURLException e) { this.logger.debug("Failed to access resource [{}]", resourceName, e); } } if (resourceURL == null) { resourceURL = (this.resourceClassLoader == null ? Thread.currentThread().getContextClassLoader() : this.resourceClassLoader).getResource(resourceName); } return resourceURL; }  void setResourceDirectory(File resourceDirectory); void setResourceClassLoader(ClassLoader classLoader); @Override InputStream getResourceAsStream(String resourceName); @Override URL getResource(String resourceName); }
StandardEnvironment extends AbstractEnvironment { @Override public URL getResource(String resourceName) { URL resourceURL = null; if (this.resourceDirectory != null) { try { File resourceFile = new File(this.resourceDirectory, resourceName); if (resourceFile.exists()) { resourceURL = resourceFile.toURI().toURL(); } } catch (MalformedURLException e) { this.logger.debug("Failed to access resource [{}]", resourceName, e); } } if (resourceURL == null) { resourceURL = (this.resourceClassLoader == null ? Thread.currentThread().getContextClassLoader() : this.resourceClassLoader).getResource(resourceName); } return resourceURL; }  void setResourceDirectory(File resourceDirectory); void setResourceClassLoader(ClassLoader classLoader); @Override InputStream getResourceAsStream(String resourceName); @Override URL getResource(String resourceName);  }