Skip to content

Commit

Permalink
[NO ISSUE][FAIL] Use Formatted Exception For Duplicate Fields
Browse files Browse the repository at this point in the history
- user model changes: no
- storage format changes: no
- interface changes: no

Details:
- Use formatted duplicate field name exception
  instead of illegal state exception.

Change-Id: I7ef04b8723c027aa3b43d35bfe96ecaf575ccc4c
Reviewed-on: https://asterix-gerrit.ics.uci.edu/2852
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Contrib: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Murtadha Hubail <mhubail@apache.org>
Reviewed-by: Till Westmann <tillw@apache.org>
  • Loading branch information
mhubail committed Aug 7, 2018
1 parent 700bbdd commit 53f4f6f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
Expand Up @@ -115,7 +115,7 @@
<test-case FilePath="objects">
<compilation-unit name="closed-closed-fieldname-conflict_issue173">
<output-dir compare="Text">closed-closed-fieldname-conflict_issue173</output-dir>
<expected-error>Closed fields 0 and 1 have the same field name "name"</expected-error>
<expected-error>Duplicate field name "name"</expected-error>
</compilation-unit>
</test-case>
<test-case FilePath="objects">
Expand Down
Expand Up @@ -178,7 +178,7 @@
<test-case FilePath="objects">
<compilation-unit name="closed-closed-fieldname-conflict_issue173">
<output-dir compare="Text">closed-closed-fieldname-conflict_issue173</output-dir>
<expected-error>Closed fields 0 and 1 have the same field name "name"</expected-error>
<expected-error>Duplicate field name "name"</expected-error>
<source-location>false</source-location>
</compilation-unit>
</test-case>
Expand Down
Expand Up @@ -22,6 +22,8 @@
import java.io.IOException;
import java.util.Arrays;

import org.apache.asterix.common.exceptions.ErrorCode;
import org.apache.asterix.common.exceptions.RuntimeDataException;
import org.apache.asterix.om.types.ARecordType;
import org.apache.hyracks.api.dataflow.value.IBinaryComparator;
import org.apache.hyracks.api.dataflow.value.IBinaryHashFunction;
Expand Down Expand Up @@ -99,8 +101,7 @@ public void reset(ARecordType recType) {
int j = getFieldIndex(baaos.getByteArray(), serializedFieldNameOffsets[i],
UTF8StringUtil.getStringLength(baaos.getByteArray(), serializedFieldNameOffsets[i]));
if (j != i) {
throw new IllegalStateException("Closed fields " + j + " and " + i
+ " have the same field name \"" + fieldNames[i] + "\"");
throw new RuntimeDataException(ErrorCode.DUPLICATE_FIELD_NAME, fieldNames[i]);
}
}
} catch (IOException e) {
Expand Down

0 comments on commit 53f4f6f

Please sign in to comment.