metron-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmerri...@apache.org
Subject [06/50] [abbrv] metron git commit: METRON-1493 Unhelpful Error Message When Assignment Expressions Fail (nickwallen) closes apache/metron#966
Date Fri, 27 Apr 2018 19:29:46 GMT
METRON-1493 Unhelpful Error Message When Assignment Expressions Fail (nickwallen) closes apache/metron#966


Project: http://git-wip-us.apache.org/repos/asf/metron/repo
Commit: http://git-wip-us.apache.org/repos/asf/metron/commit/52dd9fb8
Tree: http://git-wip-us.apache.org/repos/asf/metron/tree/52dd9fb8
Diff: http://git-wip-us.apache.org/repos/asf/metron/diff/52dd9fb8

Branch: refs/heads/feature/METRON-1416-upgrade-solr
Commit: 52dd9fb852bef5998dac83109ac6e122860be489
Parents: 9c5d9d7
Author: nickwallen <nick@nickallen.org>
Authored: Fri Mar 16 10:16:07 2018 -0400
Committer: nickallen <nickallen@apache.org>
Committed: Fri Mar 16 10:16:07 2018 -0400

----------------------------------------------------------------------
 .../common/shell/specials/AssignmentCommand.java      |  2 +-
 .../common/shell/specials/AssignmentCommandTest.java  | 14 ++++++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/metron/blob/52dd9fb8/metron-stellar/stellar-common/src/main/java/org/apache/metron/stellar/common/shell/specials/AssignmentCommand.java
----------------------------------------------------------------------
diff --git a/metron-stellar/stellar-common/src/main/java/org/apache/metron/stellar/common/shell/specials/AssignmentCommand.java
b/metron-stellar/stellar-common/src/main/java/org/apache/metron/stellar/common/shell/specials/AssignmentCommand.java
index e253b3b..664e01e 100644
--- a/metron-stellar/stellar-common/src/main/java/org/apache/metron/stellar/common/shell/specials/AssignmentCommand.java
+++ b/metron-stellar/stellar-common/src/main/java/org/apache/metron/stellar/common/shell/specials/AssignmentCommand.java
@@ -79,7 +79,7 @@ public class AssignmentCommand implements SpecialCommand {
       return result;
 
     } else {
-      return error("Assignment expression failed");
+      return result;
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/metron/blob/52dd9fb8/metron-stellar/stellar-common/src/test/java/org/apache/metron/stellar/common/shell/specials/AssignmentCommandTest.java
----------------------------------------------------------------------
diff --git a/metron-stellar/stellar-common/src/test/java/org/apache/metron/stellar/common/shell/specials/AssignmentCommandTest.java
b/metron-stellar/stellar-common/src/test/java/org/apache/metron/stellar/common/shell/specials/AssignmentCommandTest.java
index 899effb..1b5c9d5 100644
--- a/metron-stellar/stellar-common/src/test/java/org/apache/metron/stellar/common/shell/specials/AssignmentCommandTest.java
+++ b/metron-stellar/stellar-common/src/test/java/org/apache/metron/stellar/common/shell/specials/AssignmentCommandTest.java
@@ -149,6 +149,20 @@ public class AssignmentCommandTest {
     assertFalse(executor.getState().containsKey("x"));
   }
 
+  /**
+   * If an assignment expression fails, the error message should explain
+   * why the expression fails.
+   */
+  @Test
+  public void testErrorMessageWhenAssignmentFails() {
+    StellarResult result = command.execute("x := 0/0", executor);
+
+    // validate the result
+    assertTrue(result.isError());
+    assertTrue(result.getException().isPresent());
+    assertEquals(ArithmeticException.class, result.getException().get().getClass());
+  }
+
   @Test
   public void testAssignNull() {
     StellarResult result = command.execute("x := NULL", executor);


Mime
View raw message