Skip to content

Commit

Permalink
Fix repo values for RTaskWaitingReason
Browse files Browse the repository at this point in the history
In 3.9 this enum has values of 0, 1, 2. In 4.0 the "1" was removed,
shifting value of 2 to 1. Fortunately, since 4.0 we don't use values
other than 0 (at least it seems so); but in order to avoid migration
issues we now restored the deleted value of 1 as a placeholder.

Mapping of enums should be changed to be less fragile. Until that,
we CANNOT delete intermediary values from R-enums to avoid this kind
of problems.

This resolves MID-6117.
  • Loading branch information
mederly committed Apr 2, 2020
1 parent a09ace3 commit ce6cc36
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Expand Up @@ -18,6 +18,9 @@ public enum RTaskWaitingReason implements SchemaEnum<TaskWaitingReasonType> {

OTHER_TASKS(TaskWaitingReasonType.OTHER_TASKS),

// See MID-6117.
PLACEHOLDER(null),

OTHER(TaskWaitingReasonType.OTHER);

private TaskWaitingReasonType reason;
Expand Down
Expand Up @@ -317,8 +317,9 @@ public static <T extends SchemaEnum> T getRepoEnumValue(Object object, Class<T>
}
Object[] values = type.getEnumConstants();
for (Object value : values) {
//noinspection unchecked
T schemaEnum = (T) value;
if (schemaEnum.getSchemaValue().equals(object)) {
if (object.equals(schemaEnum.getSchemaValue())) {
return schemaEnum;
}
}
Expand Down

0 comments on commit ce6cc36

Please sign in to comment.