Add error message for malformed job ids.
Change-Id: I315e3aa798af791f41535279e8a983e857f2b14e
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1495
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Ian Maxon <imaxon@apache.org>
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 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;
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.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 @@
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
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.