100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps
Java asset-managementbuildingdashboarddataplatformdevice-managementedge-computingenergyenergy-managementenergy-monitorfleet-managementfleet-telematicsiotiot-applicationiot-platformmodbusmqttmqtt-brokerota-updaterules-enginesmartcity
Upgrade Resteasy version (#2542)
Eric Bariauxec2b2b34267f
diff --git a/gradle.properties b/gradle.propertiesindex ced0d8cf8..4a9fe336c 100644--- a/gradle.properties+++ b/gradle.properties@@ -16,7 +16,7 @@ slf4jVersion = 2.0.6guavaVersion = 33.5.0-jrecheckerframeworkVersion = 3.53.0undertowVersion = 2.3.22.Final-resteasyVersion = 6.2.11.Final+resteasyVersion = 6.2.15.FinalkeycloakVersion = 25.0.3classgraphVersion=4.8.184jacksonVersion = 2.20.1diff --git a/manager/src/main/java/org/openremote/manager/map/MapResourceImpl.java b/manager/src/main/java/org/openremote/manager/map/MapResourceImpl.javaindex 88f7e1282..a1ade670b 100644--- a/manager/src/main/java/org/openremote/manager/map/MapResourceImpl.java+++ b/manager/src/main/java/org/openremote/manager/map/MapResourceImpl.java@@ -74,6 +74,7 @@ public class MapResourceImpl extends WebResource implements MapResource {@Overridepublic ObjectNode uploadMap(RequestParams requestParams, String filename) {+ // Starting with Resteasy 6.2.15.Final, request.getContentLength() returns -1 if Content-Length header is not setif (request.getContentLength() > mapService.customMapLimit) {throw new WebApplicationException(Response.Status.REQUEST_ENTITY_TOO_LARGE);}diff --git a/manager/src/main/java/org/openremote/manager/map/MapService.java b/manager/src/main/java/org/openremote/manager/map/MapService.javaindex 43d3b9fab..6a77312dc 100644--- a/manager/src/main/java/org/openremote/manager/map/MapService.java+++ b/manager/src/main/java/org/openremote/manager/map/MapService.java@@ -26,6 +26,8 @@ import com.fasterxml.jackson.databind.node.ObjectNode;import io.undertow.server.HttpHandler;import io.undertow.server.handlers.ResponseCodeHandler;import io.undertow.server.handlers.proxy.ProxyHandler;+import jakarta.ws.rs.WebApplicationException;+import jakarta.ws.rs.core.Response;import jakarta.ws.rs.core.UriBuilder;import org.openremote.container.web.WebService;import org.openremote.manager.app.ConfigurationService;@@ -520,18 +522,14 @@ public class MapService implements ContainerService {if (written > customMapLimit) {String msg = "Stream continued passed custom map limit size: " + tilesPath;LOG.log(Level.SEVERE, msg);- throw new IOException(msg);+ deletePartiallyWrittenFile(tilesPath, filename);+ throw new WebApplicationException(Response.Status.REQUEST_ENTITY_TOO_LARGE);}outputStream.write(buffer, 0, bytesRead);written += bytesRead;}} catch (IOException e) {- try {- // Attempt to delete this invalid map data file- Files.deleteIfExists(tilesPath);- } catch (IOException ex) {- LOG.log(Level.WARNING, "Could not delete partially written file: " + filename, ex);- }+ deletePartiallyWrittenFile(tilesPath, filename);throw e;}@@ -541,12 +539,7 @@ public class MapService implements ContainerService {saveMapMetadata(metadata);if (loadedFile == null || !loadedFile.toAbsolutePath().equals(tilesPath.toAbsolutePath())) {- try {- // Attempt to delete this invalid map data file- Files.deleteIfExists(tilesPath);- } catch (IOException ex) {- LOG.log(Level.WARNING, "Could not delete partially written file: " + filename, ex);- }+ deletePartiallyWrittenFile(tilesPath, filename);throw new IOException("Failed to load map data ensure the uploaded file is a valid mbtiles file: " + filename);}@@ -562,6 +555,15 @@ public class MapService implements ContainerService {}}+ private void deletePartiallyWrittenFile(Path file, String filename) {+ try {+ // Attempt to delete this invalid map data file+ Files.deleteIfExists(file);+ } catch (IOException ex) {+ LOG.log(Level.WARNING, "Could not delete partially written file: " + filename, ex);+ }+ }+public void deleteUploadedFile() throws IOException {Path previousCustomTilesPath = configurationService.getCustomMapTilesPath(true);