aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrudolf <rudolf@d688527b-c9ab-4aba-bd8d-4036d912da1d>2005-01-21 18:16:19 +0000
committerrudolf <rudolf@d688527b-c9ab-4aba-bd8d-4036d912da1d>2005-01-21 18:16:19 +0000
commitaff00529acfc1d6aa7ba36798982f7fd2a67fcf0 (patch)
tree38fdf173f219af93327b9a7a3ffb62ff1dd5cade
parentd3f610d5f4b4c43fed8ebfc0e178d4cfa65bb631 (diff)
downloadmoa-id-spss-aff00529acfc1d6aa7ba36798982f7fd2a67fcf0.tar.gz
moa-id-spss-aff00529acfc1d6aa7ba36798982f7fd2a67fcf0.tar.bz2
moa-id-spss-aff00529acfc1d6aa7ba36798982f7fd2a67fcf0.zip
added try catch block
git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@237 d688527b-c9ab-4aba-bd8d-4036d912da1d
-rw-r--r--id.server/src/at/gv/egovernment/moa/id/util/HTTPUtils.java9
-rw-r--r--id.server/src/at/gv/egovernment/moa/id/util/SSLUtils.java9
2 files changed, 14 insertions, 4 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);
diff --git a/id.server/src/at/gv/egovernment/moa/id/util/SSLUtils.java b/id.server/src/at/gv/egovernment/moa/id/util/SSLUtils.java
index bd64b5a42..9bdf8a20e 100644
--- a/id.server/src/at/gv/egovernment/moa/id/util/SSLUtils.java
+++ b/id.server/src/at/gv/egovernment/moa/id/util/SSLUtils.java
@@ -21,6 +21,7 @@ import java.util.Map;
import javax.net.ssl.SSLSocketFactory;
import org.apache.regexp.RE;
+import org.apache.regexp.RESyntaxException;
import at.gv.egovernment.moa.id.config.ConfigurationException;
import at.gv.egovernment.moa.id.config.ConfigurationProvider;
@@ -153,13 +154,17 @@ public class SSLUtils {
conn.setSSLSocketFactory(sslSocketFactory);
conn.connect();
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 other platforms
InputStream instream = new BufferedInputStream(conn.getInputStream());
InputStreamReader isr = new InputStreamReader(instream, encoding);
Reader in = new BufferedReader(isr);