Committed by
Gerrit Code Review
Fix for the ONOS-4836
Change-Id: Iedf597bb79f27ca7834e85fc445ebd5736c852a7
Showing
4 changed files
with
20 additions
and
26 deletions
... | @@ -53,10 +53,6 @@ public final class FilteringObjectiveCodec extends JsonCodec<FilteringObjective> | ... | @@ -53,10 +53,6 @@ public final class FilteringObjectiveCodec extends JsonCodec<FilteringObjective> |
53 | " member is required in FilteringObjective"; | 53 | " member is required in FilteringObjective"; |
54 | private static final String NOT_NULL_MESSAGE = | 54 | private static final String NOT_NULL_MESSAGE = |
55 | "FilteringObjective cannot be null"; | 55 | "FilteringObjective cannot be null"; |
56 | - private static final String INVALID_TYPE_MESSAGE = | ||
57 | - "The requested type {} is not defined in FilteringObjective."; | ||
58 | - private static final String INVALID_OP_MESSAGE = | ||
59 | - "The requested operation {} is not defined for FilteringObjective."; | ||
60 | 56 | ||
61 | public static final String REST_APP_ID = "org.onosproject.rest"; | 57 | public static final String REST_APP_ID = "org.onosproject.rest"; |
62 | 58 | ||
... | @@ -136,8 +132,8 @@ public final class FilteringObjectiveCodec extends JsonCodec<FilteringObjective> | ... | @@ -136,8 +132,8 @@ public final class FilteringObjectiveCodec extends JsonCodec<FilteringObjective> |
136 | builder.deny(); | 132 | builder.deny(); |
137 | break; | 133 | break; |
138 | default: | 134 | default: |
139 | - log.warn(INVALID_TYPE_MESSAGE, typeStr); | 135 | + throw new IllegalArgumentException("The requested type " + typeStr + |
140 | - return null; | 136 | + " is not defined for FilteringObjective."); |
141 | } | 137 | } |
142 | 138 | ||
143 | // decode key | 139 | // decode key |
... | @@ -176,8 +172,8 @@ public final class FilteringObjectiveCodec extends JsonCodec<FilteringObjective> | ... | @@ -176,8 +172,8 @@ public final class FilteringObjectiveCodec extends JsonCodec<FilteringObjective> |
176 | filteringObjective = builder.remove(); | 172 | filteringObjective = builder.remove(); |
177 | break; | 173 | break; |
178 | default: | 174 | default: |
179 | - log.warn(INVALID_OP_MESSAGE, opStr); | 175 | + throw new IllegalArgumentException("The requested operation " + opStr + |
180 | - return null; | 176 | + " is not defined for FilteringObjective."); |
181 | } | 177 | } |
182 | 178 | ||
183 | return filteringObjective; | 179 | return filteringObjective; | ... | ... |
... | @@ -50,10 +50,6 @@ public final class ForwardingObjectiveCodec extends JsonCodec<ForwardingObjectiv | ... | @@ -50,10 +50,6 @@ public final class ForwardingObjectiveCodec extends JsonCodec<ForwardingObjectiv |
50 | " member is required in ForwardingObjective"; | 50 | " member is required in ForwardingObjective"; |
51 | private static final String NOT_NULL_MESSAGE = | 51 | private static final String NOT_NULL_MESSAGE = |
52 | "ForwardingObjective cannot be null"; | 52 | "ForwardingObjective cannot be null"; |
53 | - private static final String INVALID_FLAG_MESSAGE = | ||
54 | - "The requested flag {} is not defined in ForwardingObjective."; | ||
55 | - private static final String INVALID_OP_MESSAGE = | ||
56 | - "The requested operation {} is not defined for FilteringObjective."; | ||
57 | 53 | ||
58 | public static final String REST_APP_ID = "org.onosproject.rest"; | 54 | public static final String REST_APP_ID = "org.onosproject.rest"; |
59 | 55 | ||
... | @@ -130,8 +126,8 @@ public final class ForwardingObjectiveCodec extends JsonCodec<ForwardingObjectiv | ... | @@ -130,8 +126,8 @@ public final class ForwardingObjectiveCodec extends JsonCodec<ForwardingObjectiv |
130 | builder.withFlag(ForwardingObjective.Flag.VERSATILE); | 126 | builder.withFlag(ForwardingObjective.Flag.VERSATILE); |
131 | break; | 127 | break; |
132 | default: | 128 | default: |
133 | - log.warn(INVALID_FLAG_MESSAGE, flagStr); | 129 | + throw new IllegalArgumentException("The requested flag " + flagStr + |
134 | - return null; | 130 | + " is not defined for FilteringObjective."); |
135 | } | 131 | } |
136 | 132 | ||
137 | // decode selector | 133 | // decode selector |
... | @@ -156,7 +152,7 @@ public final class ForwardingObjectiveCodec extends JsonCodec<ForwardingObjectiv | ... | @@ -156,7 +152,7 @@ public final class ForwardingObjectiveCodec extends JsonCodec<ForwardingObjectiv |
156 | 152 | ||
157 | // decode operation | 153 | // decode operation |
158 | String opStr = nullIsIllegal(json.get(OPERATION), OPERATION + MISSING_MEMBER_MESSAGE).asText(); | 154 | String opStr = nullIsIllegal(json.get(OPERATION), OPERATION + MISSING_MEMBER_MESSAGE).asText(); |
159 | - ForwardingObjective forwardingObjective; | 155 | + ForwardingObjective forwardingObjective = null; |
160 | 156 | ||
161 | switch (opStr) { | 157 | switch (opStr) { |
162 | case "ADD": | 158 | case "ADD": |
... | @@ -166,8 +162,8 @@ public final class ForwardingObjectiveCodec extends JsonCodec<ForwardingObjectiv | ... | @@ -166,8 +162,8 @@ public final class ForwardingObjectiveCodec extends JsonCodec<ForwardingObjectiv |
166 | forwardingObjective = builder.remove(); | 162 | forwardingObjective = builder.remove(); |
167 | break; | 163 | break; |
168 | default: | 164 | default: |
169 | - log.warn(INVALID_OP_MESSAGE, opStr); | 165 | + throw new IllegalArgumentException("The requested operation " + opStr + |
170 | - return null; | 166 | + " is not defined for FilteringObjective."); |
171 | } | 167 | } |
172 | 168 | ||
173 | return forwardingObjective; | 169 | return forwardingObjective; | ... | ... |
... | @@ -53,10 +53,6 @@ public final class NextObjectiveCodec extends JsonCodec<NextObjective> { | ... | @@ -53,10 +53,6 @@ public final class NextObjectiveCodec extends JsonCodec<NextObjective> { |
53 | " member is required in NextObjective"; | 53 | " member is required in NextObjective"; |
54 | private static final String NOT_NULL_MESSAGE = | 54 | private static final String NOT_NULL_MESSAGE = |
55 | "NextObjective cannot be null"; | 55 | "NextObjective cannot be null"; |
56 | - private static final String INVALID_TYPE_MESSAGE = | ||
57 | - "The requested flag {} is not defined in NextObjective."; | ||
58 | - private static final String INVALID_OP_MESSAGE = | ||
59 | - "The requested operation {} is not defined for NextObjective."; | ||
60 | 56 | ||
61 | public static final String REST_APP_ID = "org.onosproject.rest"; | 57 | public static final String REST_APP_ID = "org.onosproject.rest"; |
62 | 58 | ||
... | @@ -142,8 +138,8 @@ public final class NextObjectiveCodec extends JsonCodec<NextObjective> { | ... | @@ -142,8 +138,8 @@ public final class NextObjectiveCodec extends JsonCodec<NextObjective> { |
142 | builder.withType(NextObjective.Type.SIMPLE); | 138 | builder.withType(NextObjective.Type.SIMPLE); |
143 | break; | 139 | break; |
144 | default: | 140 | default: |
145 | - log.warn(INVALID_TYPE_MESSAGE, typeStr); | 141 | + throw new IllegalArgumentException("The requested type " + typeStr + |
146 | - return null; | 142 | + " is not defined for FilteringObjective."); |
147 | } | 143 | } |
148 | 144 | ||
149 | // decode treatments | 145 | // decode treatments |
... | @@ -175,8 +171,8 @@ public final class NextObjectiveCodec extends JsonCodec<NextObjective> { | ... | @@ -175,8 +171,8 @@ public final class NextObjectiveCodec extends JsonCodec<NextObjective> { |
175 | nextObjective = builder.remove(); | 171 | nextObjective = builder.remove(); |
176 | break; | 172 | break; |
177 | default: | 173 | default: |
178 | - log.warn(INVALID_OP_MESSAGE, opStr); | 174 | + throw new IllegalArgumentException("The requested operation " + opStr + |
179 | - return null; | 175 | + " is not defined for FilteringObjective."); |
180 | } | 176 | } |
181 | 177 | ||
182 | return nextObjective; | 178 | return nextObjective; | ... | ... |
... | @@ -3,6 +3,7 @@ | ... | @@ -3,6 +3,7 @@ |
3 | "title": "nextObjective", | 3 | "title": "nextObjective", |
4 | "required": [ | 4 | "required": [ |
5 | "type", | 5 | "type", |
6 | + "id", | ||
6 | "priority", | 7 | "priority", |
7 | "timeout", | 8 | "timeout", |
8 | "isPermanent", | 9 | "isPermanent", |
... | @@ -16,6 +17,11 @@ | ... | @@ -16,6 +17,11 @@ |
16 | "type": "string", | 17 | "type": "string", |
17 | "example": "HASHED" | 18 | "example": "HASHED" |
18 | }, | 19 | }, |
20 | + "id": { | ||
21 | + "type": "integer", | ||
22 | + "format": "int64", | ||
23 | + "example": 1 | ||
24 | + }, | ||
19 | "priority": { | 25 | "priority": { |
20 | "type": "integer", | 26 | "type": "integer", |
21 | "format": "int64", | 27 | "format": "int64", |
... | @@ -308,4 +314,4 @@ | ... | @@ -308,4 +314,4 @@ |
308 | } | 314 | } |
309 | } | 315 | } |
310 | } | 316 | } |
311 | -} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
317 | +} | ... | ... |
-
Please register or login to post a comment