Skip to content

Commit

Permalink
hande the case where Location is not preent in a redirect, needs to h…
Browse files Browse the repository at this point in the history
…andle better such error case for outputs like json
  • Loading branch information
ylafon committed Jun 25, 2018
1 parent 904753c commit 53bd453
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions org/w3c/css/util/HTTPURL.java
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,10 @@ private static URLConnection getConnection(URL url, URL referrer, int count,
try {
URL u = getURL(url, httpURL.getHeaderField("Location"));
return getConnection(u, ref, count + 1, ac);
} catch (Exception ex) {
// usually a NPE when Location is absent on a redirect.
// in any case, we will count this as non existent result.
throw new FileNotFoundException(url + ":" + " Error in "+status);
} finally {
httpURL.disconnect();
}
Expand Down

0 comments on commit 53bd453

Please sign in to comment.