diff options
author | Magdalena Grodzińska <mag.grodzinska@gmail.com> | 2019-11-24 21:31:43 +0100 |
---|---|---|
committer | Magdalena Grodzińska <mag.grodzinska@gmail.com> | 2019-11-24 21:31:43 +0100 |
commit | b4632d58a3387b298a5352d08ebfddba5bbb76dc (patch) | |
tree | 7f9cf3cdecf33ba17439542e3bc09aca80defee8 /src/main/java/pl/edu/mimuw/cloudatlas | |
parent | 60aa743347f1d7c099cc6fc34e4bc8a9eeaef983 (diff) |
Improve value input for boolean attributes
Diffstat (limited to 'src/main/java/pl/edu/mimuw/cloudatlas')
-rw-r--r-- | src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java b/src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java index a122813..745550b 100644 --- a/src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java +++ b/src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java @@ -185,9 +185,14 @@ public class ClientController { switch (attributeObject.getAttributeType()) { case "Boolean": - attributeValue = attributeObject.getValueString().toLowerCase().equals("true") ? - new ValueBoolean(true) : - new ValueBoolean(false); + if (attributeObject.getValueString().toLowerCase().equals("true")) { + attributeValue = new ValueBoolean(true); + } else if (attributeObject.getValueString().toLowerCase().equals("false")) { + attributeValue = new ValueBoolean(false); + } else { + String errMsg = "Incorrect boolean value: " + attributeObject.getValueString(); + throw new UnsupportedOperationException(errMsg); + } break; case "Double": attributeValue = new ValueDouble(Double.parseDouble(attributeObject.getValueString())); |