From 6d6228698faba79d3e4db68b89e9b6041cebcfca Mon Sep 17 00:00:00 2001 From: sumitraina Date: Tue, 31 May 2016 11:43:35 -0700 Subject: [PATCH] Update RAD.java to account for null isForceDiff The constructor for the class RAD expects an optional argument for the class member isForceDiff which is a Boolean wrapper (line 46). If the argument is not passed in, the member stays null. line 46: this.isForceDiff = Boolean.parseBoolean(parameters[3]); This throws an NPE at line 181 where the code checks if (this.isForceDiff). line 181: } else if (this.isForceDiff) { To overcome this, isForceDiff has to be passed at least as False. Fix: The code should check for null at line 181 or make isForceDiff primitive for it to default to false. Raised an issue at https://github.com/Netflix/Surus/issues/11 --- src/main/java/org/surus/pig/RAD.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/surus/pig/RAD.java b/src/main/java/org/surus/pig/RAD.java index bdba9c3..d58c7cf 100644 --- a/src/main/java/org/surus/pig/RAD.java +++ b/src/main/java/org/surus/pig/RAD.java @@ -178,7 +178,7 @@ public DataBag exec(Tuple input) throws IOException { if (this.isForceDiff == null && dickeyFullerTest.isNeedsDiff()) { // Auto Diff inputArrayTransformed = dickeyFullerTest.getZeroPaddedDiff(); - } else if (this.isForceDiff) { + } else if (Boolean.TRUE.equals(this.isForceDiff)) { // Force Diff inputArrayTransformed = dickeyFullerTest.getZeroPaddedDiff(); }