# HG changeset patch # User Björn Ricks # Date 1352885781 -3600 # Node ID 5041105d2edd168a49a0a6709adfa5ba6d29f2f6 # Parent a08d25476f0a57e0566fd3b31104a582ed99120b Check if response code from GGInA is 200 OK Only parse the GGInA response if the status code is 200 OK. This improves the error message if GGInA is not available and shows the real reason instead of a JDOM error while parsing the response. diff -r a08d25476f0a -r 5041105d2edd flys-client/src/main/java/de/intevation/flys/client/server/auth/was/Authenticator.java --- a/flys-client/src/main/java/de/intevation/flys/client/server/auth/was/Authenticator.java Wed Nov 14 10:38:33 2012 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/server/auth/was/Authenticator.java Wed Nov 14 10:36:21 2012 +0100 @@ -5,6 +5,7 @@ import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; +import org.apache.http.StatusLine; import org.apache.http.client.HttpClient; import org.apache.http.conn.scheme.Scheme; import org.apache.http.conn.ssl.SSLSocketFactory; @@ -39,6 +40,12 @@ Request httpget = new Request("https://geoportal.bafg.de/" + "administration/WAS", username, password, encoding); HttpResponse response = httpclient.execute(httpget); + StatusLine stline = response.getStatusLine(); + if (stline.getStatusCode() != 200) { + throw new AuthenticationException("GGInA Server Error. " + + "Statuscode: " + stline.getStatusCode() + + ". Reason: " + stline.getReasonPhrase()); + } HttpEntity entity = response.getEntity(); if (entity == null) { //FIXME throw AuthenticationException