Committed by
Thomas Vachuska
[ONOS-2546]Modify the bug of conditional judgment when converting
JsonNode into ColumnType or BaseType. Change-Id: I8199c097b1cad0234486b9ac3d0eedce9c4772ac
Showing
2 changed files
with
7 additions
and
7 deletions
| ... | @@ -121,8 +121,8 @@ public final class BaseTypeFactory { | ... | @@ -121,8 +121,8 @@ public final class BaseTypeFactory { |
| 121 | if (node != null) { | 121 | if (node != null) { |
| 122 | max = node.asInt(); | 122 | max = node.asInt(); |
| 123 | } | 123 | } |
| 124 | - if (node.has("enum")) { | 124 | + if (type.has("enum")) { |
| 125 | - JsonNode anEnum = node.get("enum").get(1); | 125 | + JsonNode anEnum = type.get("enum").get(1); |
| 126 | for (JsonNode n : anEnum) { | 126 | for (JsonNode n : anEnum) { |
| 127 | enums.add(n.asInt()); | 127 | enums.add(n.asInt()); |
| 128 | } | 128 | } |
| ... | @@ -148,8 +148,8 @@ public final class BaseTypeFactory { | ... | @@ -148,8 +148,8 @@ public final class BaseTypeFactory { |
| 148 | if (node != null) { | 148 | if (node != null) { |
| 149 | max = node.asDouble(); | 149 | max = node.asDouble(); |
| 150 | } | 150 | } |
| 151 | - if (node.has("enum")) { | 151 | + if (type.has("enum")) { |
| 152 | - JsonNode anEnum = node.get("enum").get(1); | 152 | + JsonNode anEnum = type.get("enum").get(1); |
| 153 | for (JsonNode n : anEnum) { | 153 | for (JsonNode n : anEnum) { |
| 154 | enums.add(n.asDouble()); | 154 | enums.add(n.asDouble()); |
| 155 | } | 155 | } |
| ... | @@ -175,8 +175,8 @@ public final class BaseTypeFactory { | ... | @@ -175,8 +175,8 @@ public final class BaseTypeFactory { |
| 175 | if (node != null) { | 175 | if (node != null) { |
| 176 | maxLength = node.asInt(); | 176 | maxLength = node.asInt(); |
| 177 | } | 177 | } |
| 178 | - if (node.has("enum")) { | 178 | + if (type.has("enum")) { |
| 179 | - JsonNode enumVal = node.get("enum"); | 179 | + JsonNode enumVal = type.get("enum"); |
| 180 | if (enumVal.isArray()) { | 180 | if (enumVal.isArray()) { |
| 181 | JsonNode anEnum = enumVal.get(1); | 181 | JsonNode anEnum = enumVal.get(1); |
| 182 | for (JsonNode n : anEnum) { | 182 | for (JsonNode n : anEnum) { | ... | ... |
| ... | @@ -61,7 +61,7 @@ public final class ColumnTypeFactory { | ... | @@ -61,7 +61,7 @@ public final class ColumnTypeFactory { |
| 61 | * @return ColumnType | 61 | * @return ColumnType |
| 62 | */ | 62 | */ |
| 63 | public static ColumnType getColumnTypeFromJson(JsonNode json) { | 63 | public static ColumnType getColumnTypeFromJson(JsonNode json) { |
| 64 | - if (json.isObject() && !json.has(Type.VALUE.type())) { | 64 | + if (!json.isObject() || !json.has(Type.VALUE.type())) { |
| 65 | return createAtomicColumnType(json); | 65 | return createAtomicColumnType(json); |
| 66 | } else if (!json.isValueNode() && json.has(Type.VALUE.type())) { | 66 | } else if (!json.isValueNode() && json.has(Type.VALUE.type())) { |
| 67 | return createKeyValuedColumnType(json); | 67 | return createKeyValuedColumnType(json); | ... | ... |
-
Please register or login to post a comment