public File locateFile(String path) { if (isNullOrEmpty(path)) { return null; } String outputFile = tmpOutputFileName(path); try { return resourceManager.getResourceAsFile(path, outputFile); } catch (ResourceNotFoundException e) { throw new RuntimeException("Unable to locate file with path: " + path, e); } catch (FileResourceCreationException e) { throw new RuntimeException("Unable to create temporaty file '" + outputFile + "' in the output directory", e); } }
private static String getSystemProperty(String name) { String value = System.getProperty(name); if (isNullOrEmpty(value)) { fail("System property '" + name + "' is not defined"); } return value; }
/** * Returns the given string if it is nonempty; {@code null} otherwise. * * @param string the string to test and possibly return * @return {@code string} itself if it is nonempty; {@code null} if it is * empty or null */ @Nullable public static String emptyToNull(@Nullable String string) { return isNullOrEmpty(string) ? null : string; }