Kavitha Alagesan
Committed by Gerrit Code Review

Fix for the ONOS-4836

Change-Id: Iedf597bb79f27ca7834e85fc445ebd5736c852a7
......@@ -53,10 +53,6 @@ public final class FilteringObjectiveCodec extends JsonCodec<FilteringObjective>
" member is required in FilteringObjective";
private static final String NOT_NULL_MESSAGE =
"FilteringObjective cannot be null";
private static final String INVALID_TYPE_MESSAGE =
"The requested type {} is not defined in FilteringObjective.";
private static final String INVALID_OP_MESSAGE =
"The requested operation {} is not defined for FilteringObjective.";
public static final String REST_APP_ID = "org.onosproject.rest";
......@@ -136,8 +132,8 @@ public final class FilteringObjectiveCodec extends JsonCodec<FilteringObjective>
builder.deny();
break;
default:
log.warn(INVALID_TYPE_MESSAGE, typeStr);
return null;
throw new IllegalArgumentException("The requested type " + typeStr +
" is not defined for FilteringObjective.");
}
// decode key
......@@ -176,8 +172,8 @@ public final class FilteringObjectiveCodec extends JsonCodec<FilteringObjective>
filteringObjective = builder.remove();
break;
default:
log.warn(INVALID_OP_MESSAGE, opStr);
return null;
throw new IllegalArgumentException("The requested operation " + opStr +
" is not defined for FilteringObjective.");
}
return filteringObjective;
......
......@@ -50,10 +50,6 @@ public final class ForwardingObjectiveCodec extends JsonCodec<ForwardingObjectiv
" member is required in ForwardingObjective";
private static final String NOT_NULL_MESSAGE =
"ForwardingObjective cannot be null";
private static final String INVALID_FLAG_MESSAGE =
"The requested flag {} is not defined in ForwardingObjective.";
private static final String INVALID_OP_MESSAGE =
"The requested operation {} is not defined for FilteringObjective.";
public static final String REST_APP_ID = "org.onosproject.rest";
......@@ -130,8 +126,8 @@ public final class ForwardingObjectiveCodec extends JsonCodec<ForwardingObjectiv
builder.withFlag(ForwardingObjective.Flag.VERSATILE);
break;
default:
log.warn(INVALID_FLAG_MESSAGE, flagStr);
return null;
throw new IllegalArgumentException("The requested flag " + flagStr +
" is not defined for FilteringObjective.");
}
// decode selector
......@@ -156,7 +152,7 @@ public final class ForwardingObjectiveCodec extends JsonCodec<ForwardingObjectiv
// decode operation
String opStr = nullIsIllegal(json.get(OPERATION), OPERATION + MISSING_MEMBER_MESSAGE).asText();
ForwardingObjective forwardingObjective;
ForwardingObjective forwardingObjective = null;
switch (opStr) {
case "ADD":
......@@ -166,8 +162,8 @@ public final class ForwardingObjectiveCodec extends JsonCodec<ForwardingObjectiv
forwardingObjective = builder.remove();
break;
default:
log.warn(INVALID_OP_MESSAGE, opStr);
return null;
throw new IllegalArgumentException("The requested operation " + opStr +
" is not defined for FilteringObjective.");
}
return forwardingObjective;
......
......@@ -53,10 +53,6 @@ public final class NextObjectiveCodec extends JsonCodec<NextObjective> {
" member is required in NextObjective";
private static final String NOT_NULL_MESSAGE =
"NextObjective cannot be null";
private static final String INVALID_TYPE_MESSAGE =
"The requested flag {} is not defined in NextObjective.";
private static final String INVALID_OP_MESSAGE =
"The requested operation {} is not defined for NextObjective.";
public static final String REST_APP_ID = "org.onosproject.rest";
......@@ -142,8 +138,8 @@ public final class NextObjectiveCodec extends JsonCodec<NextObjective> {
builder.withType(NextObjective.Type.SIMPLE);
break;
default:
log.warn(INVALID_TYPE_MESSAGE, typeStr);
return null;
throw new IllegalArgumentException("The requested type " + typeStr +
" is not defined for FilteringObjective.");
}
// decode treatments
......@@ -175,8 +171,8 @@ public final class NextObjectiveCodec extends JsonCodec<NextObjective> {
nextObjective = builder.remove();
break;
default:
log.warn(INVALID_OP_MESSAGE, opStr);
return null;
throw new IllegalArgumentException("The requested operation " + opStr +
" is not defined for FilteringObjective.");
}
return nextObjective;
......
......@@ -3,6 +3,7 @@
"title": "nextObjective",
"required": [
"type",
"id",
"priority",
"timeout",
"isPermanent",
......@@ -16,6 +17,11 @@
"type": "string",
"example": "HASHED"
},
"id": {
"type": "integer",
"format": "int64",
"example": 1
},
"priority": {
"type": "integer",
"format": "int64",
......@@ -308,4 +314,4 @@
}
}
}
}
\ No newline at end of file
}
......