summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaurice Laveaux <m.laveaux@student.tue.nl>2014-05-01 17:31:29 +0200
committerMaurice Laveaux <m.laveaux@student.tue.nl>2014-05-01 17:31:29 +0200
commit6f31522cdb498be2e7b42f59c16538d98f83471a (patch)
tree33acfd075d860fcc8a3e3f840ef2fd59726099ec
parentdaf59bc4f7e5d29466e61ada9bf5eaaf2431ac3c (diff)
parent9c2f6a8112f6ad40789046dddd5c5ae6a79e213d (diff)
downloadTwitterDataAnalytics-6f31522cdb498be2e7b42f59c16538d98f83471a.tar.gz
Merge branch 'master' of git.lekensteyn.nl:tue/2IOC0-DBL/TwitterDataAnalytics
-rw-r--r--src/io/StreamImpl.java16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/io/StreamImpl.java b/src/io/StreamImpl.java
index 16d0f2b..4141711 100644
--- a/src/io/StreamImpl.java
+++ b/src/io/StreamImpl.java
@@ -196,6 +196,7 @@ public class StreamImpl implements Stream {
private HttpURLConnection connect(String keywords) throws IOException {
String postData = "track=" + URLEncoder.encode(keywords, "UTF-8");
+ postData += "&language=en";
HttpURLConnection conn;
conn = (HttpURLConnection) new URL(STREAM_URL).openConnection();
conn.setRequestMethod("POST");
@@ -237,10 +238,13 @@ public class StreamImpl implements Stream {
@Override
public void run() {
InputStream is = null;
+ IOException run_error = null;
try {
is = connection.getInputStream();
parseMainLoop(wrapGzip(is));
} catch (IOException ex) {
+ run_error = ex;
+ } finally {
if (is != null) {
try {
is.close();
@@ -249,11 +253,13 @@ public class StreamImpl implements Stream {
}
}
connection.disconnect();
- // synchronize just in case the exception listener gets modified
- // while hell breaks lose.
- synchronized (listenerSync) {
- if (exceptionListener != null) {
- exceptionListener.exceptionGenerated(ex);
+ if (run_error != null) {
+ // synchronize just in case the exception listener gets
+ // modified while hell breaks lose.
+ synchronized (listenerSync) {
+ if (exceptionListener != null) {
+ exceptionListener.exceptionGenerated(run_error);
+ }
}
}
}