diff --git a/bundles/org.openhab.binding.sony/pom.xml b/bundles/org.openhab.binding.sony/pom.xml index 9fc70ba002bb9..0692ca36b9c53 100644 --- a/bundles/org.openhab.binding.sony/pom.xml +++ b/bundles/org.openhab.binding.sony/pom.xml @@ -10,7 +10,7 @@ 3.1.0-SNAPSHOT - 3.1.1 + 3.1.3 org.openhab.binding.sony openHAB Add-ons :: Bundles :: Sony Binding diff --git a/bundles/org.openhab.binding.sony/src/main/java/org/openhab/binding/sony/internal/dial/models/DialXmlReader.java b/bundles/org.openhab.binding.sony/src/main/java/org/openhab/binding/sony/internal/dial/models/DialXmlReader.java index cb397a00d3332..0562ddd0e632d 100644 --- a/bundles/org.openhab.binding.sony/src/main/java/org/openhab/binding/sony/internal/dial/models/DialXmlReader.java +++ b/bundles/org.openhab.binding.sony/src/main/java/org/openhab/binding/sony/internal/dial/models/DialXmlReader.java @@ -16,9 +16,11 @@ import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; +import org.openhab.binding.sony.internal.SonyHandlerFactory; import com.thoughtworks.xstream.XStream; import com.thoughtworks.xstream.io.xml.StaxDriver; +import com.thoughtworks.xstream.security.NoTypePermission; /** * This class represents creates the various XML readers (using XStream) to deserialize various calls. @@ -53,6 +55,8 @@ public class DialXmlReader { private DialXmlReader(@SuppressWarnings("rawtypes") final Class[] classes) { Objects.requireNonNull(classes, "classes cannot be null"); + xstream.addPermission(NoTypePermission.NONE); + xstream.allowTypesByWildcard(new String[] { SonyHandlerFactory.class.getPackageName() + ".**" }); xstream.setClassLoader(getClass().getClassLoader()); xstream.ignoreUnknownElements(); xstream.processAnnotations(classes); diff --git a/bundles/org.openhab.binding.sony/src/main/java/org/openhab/binding/sony/internal/ircc/models/IrccXmlReader.java b/bundles/org.openhab.binding.sony/src/main/java/org/openhab/binding/sony/internal/ircc/models/IrccXmlReader.java index 4f11f10b147f5..53996500be0ab 100644 --- a/bundles/org.openhab.binding.sony/src/main/java/org/openhab/binding/sony/internal/ircc/models/IrccXmlReader.java +++ b/bundles/org.openhab.binding.sony/src/main/java/org/openhab/binding/sony/internal/ircc/models/IrccXmlReader.java @@ -17,11 +17,13 @@ import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.jupnp.UpnpService; +import org.openhab.binding.sony.internal.SonyHandlerFactory; import org.openhab.binding.sony.internal.upnp.models.UpnpServiceList; import com.thoughtworks.xstream.XStream; import com.thoughtworks.xstream.converters.Converter; import com.thoughtworks.xstream.io.xml.StaxDriver; +import com.thoughtworks.xstream.security.NoTypePermission; /** * This class represents creates the various XML readers (using XStream) to deserialize various calls. @@ -71,6 +73,9 @@ public class IrccXmlReader { private IrccXmlReader(@SuppressWarnings("rawtypes") final Class[] classes, final Converter... converters) { Objects.requireNonNull(classes, "classes cannot be null"); + // XStream.setupDefaultSecurity(xstream); + xstream.addPermission(NoTypePermission.NONE); + xstream.allowTypesByWildcard(new String[] { SonyHandlerFactory.class.getPackageName() + ".**" }); xstream.setClassLoader(getClass().getClassLoader()); xstream.ignoreUnknownElements(); xstream.processAnnotations(classes); diff --git a/bundles/org.openhab.binding.sony/src/main/java/org/openhab/binding/sony/internal/scalarweb/ScalarWebHandler.java b/bundles/org.openhab.binding.sony/src/main/java/org/openhab/binding/sony/internal/scalarweb/ScalarWebHandler.java index be0b8bc61b4c3..12e0cfd4ea750 100644 --- a/bundles/org.openhab.binding.sony/src/main/java/org/openhab/binding/sony/internal/scalarweb/ScalarWebHandler.java +++ b/bundles/org.openhab.binding.sony/src/main/java/org/openhab/binding/sony/internal/scalarweb/ScalarWebHandler.java @@ -388,6 +388,7 @@ protected void connect() { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, "Error connecting to Scalar Web device (may need to turn it on manually)"); } catch (final Exception e) { + logger.debug("Unhandled exception connecting to Scalar Web device: {} ", e.getMessage(), e); updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, "Unhandled exception connecting to Scalar Web device (may need to turn it on manually): " + e.getMessage()); diff --git a/bundles/org.openhab.binding.sony/src/main/java/org/openhab/binding/sony/internal/transports/SonyAuthFilter.java b/bundles/org.openhab.binding.sony/src/main/java/org/openhab/binding/sony/internal/transports/SonyAuthFilter.java index 284b1ec1438d1..ce880b694aa20 100644 --- a/bundles/org.openhab.binding.sony/src/main/java/org/openhab/binding/sony/internal/transports/SonyAuthFilter.java +++ b/bundles/org.openhab.binding.sony/src/main/java/org/openhab/binding/sony/internal/transports/SonyAuthFilter.java @@ -144,10 +144,10 @@ public void filter(final @Nullable ClientRequestContext requestCtx) throws IOExc final NewCookie authCookie = newCookies.get(AUTHCOOKIENAME); if (authCookie != null) { // create cookie with expiry date using 80% of maxAge given in seconds - final Date expiryDate = new Date(new Date().getTime() + 800L *authCookie.getMaxAge()); - final NewCookie newAuthCookieToStore = new NewCookie( - authCookie.toCookie(), authCookie.getComment(), authCookie.getMaxAge(), - expiryDate, authCookie.isSecure(), authCookie.isHttpOnly()); + final Date expiryDate = new Date(new Date().getTime() + 800L * authCookie.getMaxAge()); + final NewCookie newAuthCookieToStore = new NewCookie(authCookie.toCookie(), + authCookie.getComment(), authCookie.getMaxAge(), expiryDate, authCookie.isSecure(), + authCookie.isHttpOnly()); logger.debug("Authorization cookie was renewed"); logger.debug("New auth cookie: {} for host: {}", newAuthCookieToStore.getValue(), host); authCookieStore.setAuthCookieForHost(host, newAuthCookieToStore); diff --git a/bundles/org.openhab.binding.sony/src/main/java/org/openhab/binding/sony/internal/upnp/models/UpnpXmlReader.java b/bundles/org.openhab.binding.sony/src/main/java/org/openhab/binding/sony/internal/upnp/models/UpnpXmlReader.java index 633fe943cfaf7..bb1fdb1692404 100644 --- a/bundles/org.openhab.binding.sony/src/main/java/org/openhab/binding/sony/internal/upnp/models/UpnpXmlReader.java +++ b/bundles/org.openhab.binding.sony/src/main/java/org/openhab/binding/sony/internal/upnp/models/UpnpXmlReader.java @@ -16,10 +16,12 @@ import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; +import org.openhab.binding.sony.internal.SonyHandlerFactory; import org.openhab.binding.sony.internal.SonyUtil; import com.thoughtworks.xstream.XStream; import com.thoughtworks.xstream.io.xml.StaxDriver; +import com.thoughtworks.xstream.security.NoTypePermission; /** * This class represents creates the various XML readers (using XStream) to deserialize various calls. @@ -47,6 +49,8 @@ public class UpnpXmlReader { private UpnpXmlReader(@SuppressWarnings("rawtypes") final Class[] classes) { Objects.requireNonNull(classes, "classes cannot be null"); + xstream.addPermission(NoTypePermission.NONE); + xstream.allowTypesByWildcard(new String[] { SonyHandlerFactory.class.getPackageName() + ".**" }); xstream.setClassLoader(getClass().getClassLoader()); xstream.ignoreUnknownElements(); xstream.processAnnotations(classes);