From b4632d58a3387b298a5352d08ebfddba5bbb76dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magdalena=20Grodzi=C5=84ska?= Date: Sun, 24 Nov 2019 21:31:43 +0100 Subject: Improve value input for boolean attributes --- .../java/pl/edu/mimuw/cloudatlas/client/ClientController.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src') 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())); -- cgit v1.2.3