You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by se...@apache.org on 2016/04/04 12:49:19 UTC
flink git commit: [FLINK-3635] [connectors] Potential null deference
in TwitterExample#SelectEnglishAndTokenizeFlatMap#flatMap
Repository: flink
Updated Branches:
refs/heads/master a6a53a494 -> 81fa9adcd
[FLINK-3635] [connectors] Potential null deference in TwitterExample#SelectEnglishAndTokenizeFlatMap#flatMap
This closes #1845
Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/81fa9adc
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/81fa9adc
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/81fa9adc
Branch: refs/heads/master
Commit: 81fa9adcd7ee076e1ea756ffed62f5359e183f9d
Parents: a6a53a4
Author: Tianji Li <sk...@gmail.com>
Authored: Thu Mar 31 22:38:23 2016 -0400
Committer: Stephan Ewen <se...@apache.org>
Committed: Mon Apr 4 12:48:14 2016 +0200
----------------------------------------------------------------------
.../apache/flink/streaming/examples/twitter/TwitterExample.java | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flink/blob/81fa9adc/flink-examples/flink-examples-streaming/src/main/java/org/apache/flink/streaming/examples/twitter/TwitterExample.java
----------------------------------------------------------------------
diff --git a/flink-examples/flink-examples-streaming/src/main/java/org/apache/flink/streaming/examples/twitter/TwitterExample.java b/flink-examples/flink-examples-streaming/src/main/java/org/apache/flink/streaming/examples/twitter/TwitterExample.java
index 031aa35..4f13f34 100644
--- a/flink-examples/flink-examples-streaming/src/main/java/org/apache/flink/streaming/examples/twitter/TwitterExample.java
+++ b/flink-examples/flink-examples-streaming/src/main/java/org/apache/flink/streaming/examples/twitter/TwitterExample.java
@@ -132,7 +132,9 @@ public class TwitterExample {
jsonParser = new ObjectMapper();
}
JsonNode jsonNode = jsonParser.readValue(value, JsonNode.class);
- if (jsonNode.has("user") && jsonNode.get("user").get("lang").asText().equals("en")) {
+ boolean isEnglish = jsonNode.has("user") && jsonNode.get("user").has("lang") && jsonNode.get("user").get("lang").asText().equals("en");
+ boolean hasText = jsonNode.has("text");
+ if (isEnglish && hasText) {
// message of tweet
StringTokenizer tokenizer = new StringTokenizer(jsonNode.get("text").asText());