Skip to content

Commit 7d1fed4

Browse files
authored
[ecovacs] Catch more exceptions when parsing vacuum data (#20016)
Missing fields in the responses so far went uncaught Signed-off-by: Danny Baumann <dannybaumann@web.de>
1 parent 0e270ed commit 7d1fed4

3 files changed

Lines changed: 3 additions & 5 deletions

File tree

bundles/org.openhab.binding.ecovacs/src/main/java/org/openhab/binding/ecovacs/internal/api/impl/EcovacsApiImpl.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@
6767
import org.openhab.binding.ecovacs.internal.api.impl.dto.response.portal.PortalIotCommandXmlResponse;
6868
import org.openhab.binding.ecovacs.internal.api.impl.dto.response.portal.PortalIotProductResponse;
6969
import org.openhab.binding.ecovacs.internal.api.impl.dto.response.portal.PortalLoginResponse;
70-
import org.openhab.binding.ecovacs.internal.api.util.DataParsingException;
7170
import org.openhab.binding.ecovacs.internal.api.util.HashUtil;
7271
import org.openhab.core.OpenHAB;
7372
import org.slf4j.Logger;
@@ -306,7 +305,7 @@ public <T> T sendIotCommand(Device device, DeviceDescription desc, IotDeviceComm
306305
}
307306
try {
308307
return command.convertResponse(commandResponse, desc.protoVersion, gson);
309-
} catch (DataParsingException e) {
308+
} catch (Exception e) {
310309
logger.debug("Converting response for command {} failed", command, e);
311310
throw new EcovacsApiException(e);
312311
}

bundles/org.openhab.binding.ecovacs/src/main/java/org/openhab/binding/ecovacs/internal/api/impl/EcovacsIotMqDevice.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
import org.openhab.binding.ecovacs.internal.api.impl.dto.response.portal.PortalLoginResponse;
3939
import org.openhab.binding.ecovacs.internal.api.model.CleanLogRecord;
4040
import org.openhab.binding.ecovacs.internal.api.model.DeviceCapability;
41-
import org.openhab.binding.ecovacs.internal.api.util.DataParsingException;
4241
import org.openhab.core.io.net.http.TrustAllTrustManager;
4342
import org.slf4j.Logger;
4443
import org.slf4j.LoggerFactory;
@@ -179,7 +178,7 @@ public void connect(final EventListener listener, ScheduledExecutorService sched
179178
String eventName = receivedTopic.split("/")[2].toLowerCase();
180179
logger.trace("{}: Got MQTT message on topic {}: {}", getSerialNumber(), receivedTopic, payload);
181180
parser.handleMessage(eventName, payload);
182-
} catch (DataParsingException e) {
181+
} catch (Exception e) {
183182
listener.onEventStreamFailure(this, e);
184183
}
185184
};

bundles/org.openhab.binding.ecovacs/src/main/java/org/openhab/binding/ecovacs/internal/api/impl/EcovacsXmppDevice.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ public <T> T sendCommand(IotDeviceCommand<T> command) throws EcovacsApiException
147147
return command.convertResponse(responseObj, ProtocolVersion.XML, gson);
148148
}
149149
}
150-
} catch (DataParsingException | ParserConfigurationException | TransformerException e) {
150+
} catch (Exception e) {
151151
throw new EcovacsApiException(e);
152152
}
153153

0 commit comments

Comments
 (0)