File tree Expand file tree Collapse file tree
java/src/org/openqa/selenium/grid/web Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2626import org .openqa .selenium .remote .http .UrlPath ;
2727
2828import java .io .UncheckedIOException ;
29+ import java .net .MalformedURLException ;
30+ import java .net .URL ;
2931import java .util .Optional ;
3032import java .util .stream .Collectors ;
3133
@@ -67,9 +69,16 @@ public HttpResponse execute(HttpRequest req) throws UncheckedIOException {
6769 Optional <Resource > result = resource .get (req .getUri ());
6870
6971 if (!result .isPresent ()) {
72+ String errorMessage ;
73+ try {
74+ new URL (req .getUri ());
75+ errorMessage = "Unable to find " + req .getUri ();
76+ } catch (MalformedURLException ignore ) {
77+ errorMessage = "Unable to find resource, invalid path in url." ;
78+ }
7079 return new HttpResponse ()
7180 .setStatus (HTTP_NOT_FOUND )
72- .setContent (utf8String ("Unable to find " + req . getUri () ));
81+ .setContent (utf8String (errorMessage ));
7382 }
7483
7584 Resource resource = result .get ();
You can’t perform that action at this time.
0 commit comments