X-Git-Url: https://code.wpia.club/?a=blobdiff_plain;f=tests%2Forg%2Fcacert%2Fgigi%2FtestUtils%2FIOUtils.java;h=23db401f8221d0c50769c08acb893437e53ba7a3;hb=0b0db3d1f59e3473fad2d8011f75552b7de1671e;hp=9a01a542d056ee1577cfc9eefd59c4b75b351ad8;hpb=24c0ab4dfac9faa7a978441582b9e2e9e348f419;p=gigi.git diff --git a/tests/org/cacert/gigi/testUtils/IOUtils.java b/tests/org/cacert/gigi/testUtils/IOUtils.java index 9a01a542..23db401f 100644 --- a/tests/org/cacert/gigi/testUtils/IOUtils.java +++ b/tests/org/cacert/gigi/testUtils/IOUtils.java @@ -17,7 +17,7 @@ public class IOUtils { public static String readURL(URLConnection in) { try { - if ( !in.getContentType().equals("text/html; charset=UTF-8")) { + if ( !in.getContentType().equals("text/html; charset=UTF-8") && !in.getContentType().equals("text/plain; charset=UTF-8")) { if (in instanceof HttpURLConnection && ((HttpURLConnection) in).getResponseCode() != 200) { System.err.println(readURL(new InputStreamReader(((HttpURLConnection) in).getErrorStream(), "UTF-8"))); } @@ -38,6 +38,7 @@ public class IOUtils { while ((len = in.read(buffer)) > 0) { caw.write(buffer, 0, len); } + in.close(); return new String(caw.toCharArray()); } catch (IOException e) { throw new Error(e); @@ -53,6 +54,7 @@ public class IOUtils { while ((len = in.read(buffer)) > 0) { baos.write(buffer, 0, len); } + in.close(); return baos.toByteArray(); } catch (IOException e) { throw new Error(e);