From ba7189c688335937d6f59e63ba284f213ef036d9 Mon Sep 17 00:00:00 2001 From: Patrik Helsing Date: Sun, 29 May 2016 11:48:32 +0200 Subject: [PATCH] Get rid of Java 7 dependencies --- .../jsonpath/matchers/helpers/ResourceHelpers.java | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/json-path-assert/src/test/java/com/jayway/jsonpath/matchers/helpers/ResourceHelpers.java b/json-path-assert/src/test/java/com/jayway/jsonpath/matchers/helpers/ResourceHelpers.java index c2c8724a..6c263850 100644 --- a/json-path-assert/src/test/java/com/jayway/jsonpath/matchers/helpers/ResourceHelpers.java +++ b/json-path-assert/src/test/java/com/jayway/jsonpath/matchers/helpers/ResourceHelpers.java @@ -4,11 +4,8 @@ import org.apache.commons.io.IOUtils; import java.io.File; import java.io.IOException; -import java.net.URI; import java.net.URISyntaxException; import java.net.URL; -import java.nio.file.Path; -import java.nio.file.Paths; import static java.lang.ClassLoader.getSystemResource; import static java.lang.ClassLoader.getSystemResourceAsStream; @@ -18,18 +15,16 @@ public class ResourceHelpers { try { return IOUtils.toString(getSystemResourceAsStream(resource)); } catch (IOException e) { - throw new AssertionError("Resource not found", e); + throw new AssertionError("Resource not found: " + e.getMessage()); } } public static File resourceAsFile(String resource) { try { URL systemResource = getSystemResource(resource); - URI uri = systemResource.toURI(); - Path path = Paths.get(uri); - return path.toFile(); + return new File(systemResource.toURI()); } catch (URISyntaxException e) { - throw new AssertionError("URI syntax error", e); + throw new AssertionError("URI syntax error:" + e.getMessage()); } } }