Commit ac185423 authored by wannes's avatar wannes
Browse files

Validate AddressLease,create input

parent fa498d62
......@@ -51,10 +51,14 @@ public class AddressLease extends ResourceBase {
}
@Put
public Representation create(Map<String, String> data) {
int clientId = Integer.parseInt(data.get("client"));
public Representation create(Map<String, Object> data) {
if (!data.containsKey("client") && !data.containsKey("version")) {
return clientError("INVALID_REQUEST", Status.CLIENT_ERROR_NOT_ACCEPTABLE);
}
int clientId = Integer.parseInt(data.get("client").toString());
assert clientId > 0;
int version = Integer.parseInt(data.get("version"));
int version = Integer.parseInt(data.get("version").toString());
assert version == 4 || version == 6;
String purpose = IPAddress.Purpose.CLIENT_ASSIGN;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment