From f5101b17648352a5eaf6ce2b8e70427e721239fd Mon Sep 17 00:00:00 2001 From: mlobstein Date: Sat, 15 Oct 2022 02:33:12 -0500 Subject: [PATCH] Log invalid number when expecting numeric response from projector (#13549) Signed-off-by: Michael Lobstein --- .../benqprojector/internal/BenqProjectorDevice.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bundles/org.openhab.binding.benqprojector/src/main/java/org/openhab/binding/benqprojector/internal/BenqProjectorDevice.java b/bundles/org.openhab.binding.benqprojector/src/main/java/org/openhab/binding/benqprojector/internal/BenqProjectorDevice.java index 090de7617..b14dddf5f 100644 --- a/bundles/org.openhab.binding.benqprojector/src/main/java/org/openhab/binding/benqprojector/internal/BenqProjectorDevice.java +++ b/bundles/org.openhab.binding.benqprojector/src/main/java/org/openhab/binding/benqprojector/internal/BenqProjectorDevice.java @@ -92,7 +92,12 @@ public class BenqProjectorDevice { protected int queryInt(String query) throws BenqProjectorCommandException, BenqProjectorException { String response = sendQuery(query); - return Integer.parseInt(response); + try { + return Integer.parseInt(response); + } catch (NumberFormatException nfe) { + throw new BenqProjectorCommandException( + "Unable to parse response '" + response + "' as Integer for command: " + query); + } } protected String queryString(String query) throws BenqProjectorCommandException, BenqProjectorException {