aboutsummaryrefslogtreecommitdiff
path: root/id.server/src/at/gv/egovernment/moa/id/util/HTTPUtils.java
diff options
context:
space:
mode:
Diffstat (limited to 'id.server/src/at/gv/egovernment/moa/id/util/HTTPUtils.java')
-rw-r--r--id.server/src/at/gv/egovernment/moa/id/util/HTTPUtils.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/id.server/src/at/gv/egovernment/moa/id/util/HTTPUtils.java b/id.server/src/at/gv/egovernment/moa/id/util/HTTPUtils.java
index 270b0c968..035c47eb9 100644
--- a/id.server/src/at/gv/egovernment/moa/id/util/HTTPUtils.java
+++ b/id.server/src/at/gv/egovernment/moa/id/util/HTTPUtils.java
@@ -17,6 +17,7 @@ import java.net.HttpURLConnection;
import java.net.URL;
import org.apache.regexp.RE;
+import org.apache.regexp.RESyntaxException;
/**
*
@@ -40,13 +41,17 @@ public class HTTPUtils {
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
conn.setRequestMethod("GET");
String contentType = conn.getContentType();
- RE regExp = new RE("(;.*charset=)(\"*)(.*[^\"])");
+ RE regExp = null;
+ try {
+ regExp = new RE("(;.*charset=)(\"*)(.*[^\"])");
+ } catch (RESyntaxException e) {
+ //RESyntaxException is not possible = expr. is costant
+ }
boolean charsetSupplied = regExp.match(contentType);
String encoding = "ISO-8859-1"; //default HTTP encoding
if (charsetSupplied) {
encoding = regExp.getParen(3);
}
- //TODO RS TEST if this works on all platforms
InputStream instream = new BufferedInputStream(conn.getInputStream());
InputStreamReader isr = new InputStreamReader(instream, encoding);
Reader in = new BufferedReader(isr);