sovon
sovon

Reputation: 907

why server return error code 502

This is my code for for reading file from URL.

 URL url = new URL(urlString);
 reader = new BufferedReader(new InputStreamReader(url.openStream()));

But the problem is-

java.io.IOException: Server returned HTTP response code: 502 for 
URL: http://dbpedia.org/data/Germany.json

This error does not occur every-time. can anybody help me?

Upvotes: 0

Views: 7526

Answers (1)

dab0bby
dab0bby

Reputation: 2991

If you try to access this link in the browser:

enter image description here

And according to List of HTTP status codes code 502 is:

The server was acting as a gateway or proxy and received an invalid response from the upstream server.

So that's the answer. :-)

in the console

enter image description here

Upvotes: 1

Related Questions