m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMagdalena Grodzińska <mag.grodzinska@gmail.com>2019-11-24 21:31:43 +0100
committerMagdalena Grodzińska <mag.grodzinska@gmail.com>2019-11-24 21:31:43 +0100
commitb4632d58a3387b298a5352d08ebfddba5bbb76dc (patch)
tree7f9cf3cdecf33ba17439542e3bc09aca80defee8 /src
parent60aa743347f1d7c099cc6fc34e4bc8a9eeaef983 (diff)
Improve value input for boolean attributes
Diffstat (limited to 'src')
-rw-r--r--src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java11
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()));