From: Felix Dörre Date: Thu, 24 Jul 2014 22:58:56 +0000 (+0200) Subject: Testcases more verbose on server fail (with illegal charset) X-Git-Url: https://code.wpia.club/?p=gigi.git;a=commitdiff_plain;h=1a4d7172820d805adfb752a36497abeda8d39e1e Testcases more verbose on server fail (with illegal charset) --- diff --git a/tests/org/cacert/gigi/testUtils/IOUtils.java b/tests/org/cacert/gigi/testUtils/IOUtils.java index b7452d2a..2db46f87 100644 --- a/tests/org/cacert/gigi/testUtils/IOUtils.java +++ b/tests/org/cacert/gigi/testUtils/IOUtils.java @@ -4,6 +4,7 @@ import java.io.CharArrayWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.Reader; +import java.net.HttpURLConnection; import java.net.URLConnection; public class IOUtils { @@ -14,6 +15,10 @@ public class IOUtils { public static String readURL(URLConnection in) { try { if (!in.getContentType().equals("text/html; charset=UTF-8")) { + if (in instanceof HttpURLConnection && ((HttpURLConnection) in).getResponseCode() != 200) { + System.err + .println(readURL(new InputStreamReader(((HttpURLConnection) in).getErrorStream(), "UTF-8"))); + } throw new Error("Unrecognized content-type: " + in.getContentType()); } return readURL(new InputStreamReader(in.getInputStream(), "UTF-8"));