From 4423b166cbed1fce1b8c5a7181457bb4020a2f75 Mon Sep 17 00:00:00 2001 From: Nils Schnabel Date: Sun, 31 Oct 2021 16:30:04 +0100 Subject: [PATCH] [pjlinkdevice] fix authentication (#11472) Signed-off-by: Nils Schnabel --- .../pjlinkdevice/internal/device/PJLinkDevice.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bundles/org.openhab.binding.pjlinkdevice/src/main/java/org/openhab/binding/pjlinkdevice/internal/device/PJLinkDevice.java b/bundles/org.openhab.binding.pjlinkdevice/src/main/java/org/openhab/binding/pjlinkdevice/internal/device/PJLinkDevice.java index a448fd9f8..f37cac52e 100644 --- a/bundles/org.openhab.binding.pjlinkdevice/src/main/java/org/openhab/binding/pjlinkdevice/internal/device/PJLinkDevice.java +++ b/bundles/org.openhab.binding.pjlinkdevice/src/main/java/org/openhab/binding/pjlinkdevice/internal/device/PJLinkDevice.java @@ -152,11 +152,11 @@ public class PJLinkDevice { socket.connect(socketAddress, timeout); socket.setSoTimeout(timeout); BufferedReader reader = getReader(); - String header = reader.readLine(); - if (header == null) { + String rawHeader = reader.readLine(); + if (rawHeader == null) { throw new ResponseException("No PJLink header received from the device"); } - header = header.toUpperCase(); + String header = rawHeader.toUpperCase(); switch (header.substring(0, "PJLINK x".length())) { case "PJLINK 0": logger.debug("Authentication not needed"); @@ -170,7 +170,7 @@ public class PJLinkDevice { throw new AuthenticationException("No password provided, but device requires authentication"); } else { try { - authenticate(header.substring("PJLINK 1 ".length())); + authenticate(rawHeader.substring("PJLINK 1 ".length())); } catch (AuthenticationException e) { // propagate AuthenticationException throw e;