Index: impl/src/main/java/org/jboss/arquillian/graphene/enricher/LocationEnricher.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- impl/src/main/java/org/jboss/arquillian/graphene/enricher/LocationEnricher.java (revision 6e044c647b4af05164202c79125d200203eb48d6) +++ impl/src/main/java/org/jboss/arquillian/graphene/enricher/LocationEnricher.java (revision ) @@ -57,6 +57,10 @@ @Override public Object[] resolve(Method method) { + + URL contextRoot = getContextRoot(method); + contextRootStore.set(contextRoot); + int indexOfInitialPage = getIndexOfParameterWithAnnotation(InitialPage.class, method); if (indexOfInitialPage == -1) { return new Object[method.getParameterTypes().length]; @@ -67,8 +71,6 @@ Object[] result = new Object[method.getParameterTypes().length]; result[indexOfInitialPage] = goTo(parameterTypes[indexOfInitialPage], qualifier); - URL contextRoot = getContextRoot(method); - contextRootStore.set(contextRoot); return result; } @@ -106,20 +108,26 @@ } } - private URL getURLFromLocation(Location location) throws MalformedURLException { + private URL getURLFromLocationWithRoot(Location location) throws MalformedURLException { final URL contextRoot = contextRootStore.get(); - - URI uri; - - try { - uri = new URI(location.value()); - } catch (URISyntaxException e) { - if (contextRoot != null) { - return new URL(contextRoot, location.value()); - } else { - throw new IllegalStateException(String.format( + if (contextRoot != null) { + return new URL(contextRoot, location.value()); + } else { + throw new IllegalStateException(String.format( "The location %s is not valid URI and no contextRoot was discovered to treat it as relative URL", location)); - } + } + } + + private URL getURLFromLocation(Location location) throws MalformedURLException { + URI uri; + + try { + uri = new URI(location.value()); + if (!uri.isAbsolute()) { + return getURLFromLocationWithRoot(location); + } + } catch (URISyntaxException e) { + return getURLFromLocationWithRoot(location); } if ("resource".equals(uri.getScheme())) {