List of usage examples for java.nio.file NoSuchFileException addSuppressed
public final synchronized void addSuppressed(Throwable exception)
From source file:org.sakuli.utils.ResourceHelper.java
/** * Resolves a resource from the Classpath. * * @param classDef a instance of {@link Class} * @param classPathResource resource string like e.g. "/filename.file". * @param exceptionMessage custom exception message, if file couldn't resolved. * @return a {@link Path} object of the classpath resource. * @throws NoSuchFileException/* w w w. ja va 2s . c o m*/ */ public static Path getClasspathResource(Class<?> classDef, String classPathResource, String exceptionMessage) throws NoSuchFileException { try { return Paths.get(classDef.getResource(classPathResource).toURI()); } catch (FileSystemNotFoundException | URISyntaxException | NullPointerException e) { NoSuchFileException exc = new NoSuchFileException(classPathResource, null, exceptionMessage); exc.addSuppressed(e); throw exc; } }