Repository: asterixdb
Updated Branches:
  refs/heads/master 45d4f6c94 -> 650b60806


Add error message for malformed job ids.

Change-Id: I315e3aa798af791f41535279e8a983e857f2b14e
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1495
Sonar-Qube: Jenkins <[email protected]>
Tested-by: Jenkins <[email protected]>
Integration-Tests: Jenkins <[email protected]>
Reviewed-by: Ian Maxon <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/650b6080
Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/650b6080
Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/650b6080

Branch: refs/heads/master
Commit: 650b6080649d29515cfecd78c6a7004a61f09020
Parents: 45d4f6c
Author: Till Westmann <[email protected]>
Authored: Mon Feb 13 14:09:21 2017 -0800
Committer: Till Westmann <[email protected]>
Committed: Tue Feb 14 08:33:59 2017 -0800

----------------------------------------------------------------------
 .../main/java/org/apache/hyracks/api/exceptions/ErrorCode.java | 1 +
 .../src/main/java/org/apache/hyracks/api/job/JobId.java        | 6 ++++--
 .../hyracks-api/src/main/resources/errormsg/en.properties      | 2 ++
 3 files changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/650b6080/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/ErrorCode.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/ErrorCode.java
 
b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/ErrorCode.java
index 3826f01..8b24cc2 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/ErrorCode.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/ErrorCode.java
@@ -54,6 +54,7 @@ public class ErrorCode {
     public static final int RESULT_FAILURE_NO_EXCEPTION = 17;
     public static final int INCONSISTENT_RESULT_METADATA = 18;
     public static final int CANNOT_TRUNCATE_OR_DELETE_FILE = 19;
+    public static final int NOT_A_JOBID = 20;
 
     // Compilation error codes.
     public static final int RULECOLLECTION_NOT_INSTANCE_OF_LIST = 10001;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/650b6080/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/job/JobId.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/job/JobId.java
 
b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/job/JobId.java
index 7969700..47da24a 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/job/JobId.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/job/JobId.java
@@ -23,6 +23,8 @@ import java.io.DataOutput;
 import java.io.IOException;
 import java.io.Serializable;
 
+import org.apache.hyracks.api.exceptions.ErrorCode;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.api.io.IWritable;
 
 public final class JobId implements IWritable, Serializable {
@@ -70,12 +72,12 @@ public final class JobId implements IWritable, Serializable 
{
         return "JID:" + id;
     }
 
-    public static JobId parse(String str) {
+    public static JobId parse(String str) throws HyracksDataException {
         if (str.startsWith("JID:")) {
             str = str.substring(4);
             return new JobId(Long.parseLong(str));
         }
-        throw new IllegalArgumentException();
+        throw HyracksDataException.create(ErrorCode.NOT_A_JOBID, str);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/650b6080/hyracks-fullstack/hyracks/hyracks-api/src/main/resources/errormsg/en.properties
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-api/src/main/resources/errormsg/en.properties
 
b/hyracks-fullstack/hyracks/hyracks-api/src/main/resources/errormsg/en.properties
index 931429a..2abca66 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-api/src/main/resources/errormsg/en.properties
+++ 
b/hyracks-fullstack/hyracks/hyracks-api/src/main/resources/errormsg/en.properties
@@ -38,4 +38,6 @@
 17 = No exception for failed result set %1$s for job %2$s
 18 = Inconsistent metadata for result set %1$s"
 19 = Can't truncate or delete the file: %1$s
+20 = '%1$s' is not a valid job id.
+
 10000 = The given rule collection %1$s is not an instance of the List class.

Reply via email to