diff --git a/pom.xml b/pom.xml index f9ffd9ba5..8c1b0408a 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ uk.ac.ebi jutils - 12.0.1-SNAPSHOT + 13.0-SNAPSHOT JUtils - Miscellanea of Java Utils @@ -142,7 +142,7 @@ org.springframework spring-web - 5.3.25 + 6.0.11 true @@ -158,9 +158,9 @@ - javax.servlet - javax.servlet-api - 4.0.1 + jakarta.servlet + jakarta.servlet-api + 6.0.0 true diff --git a/revision-history.md b/revision-history.md index 2037fa516..260f955d0 100644 --- a/revision-history.md +++ b/revision-history.md @@ -1,12 +1,15 @@ # Revision History -*This file was last revised on 2023-07-26*. **Please keep this note updated**. +*This file was last revised on 2023-07-31*. **Please keep this note updated**. -## 12.0.1-SNAPSHOT -* Current snapshot +## 13.0.1-SNAPSHOT +## 13.0 +* **These migrations are incompatible with older versions**: + * `javax.servlet-api` migrated to `jakarta.servlet-api`. + * `spring-web` moved to 6.0. -## 12.0-SNAPSHOT +## 12.0 * Migration to Java 17. **No backward compatibility guaranteed**. ## 11.1.1 diff --git a/src/main/java/uk/ac/ebi/utils/opt/net/ConfigBootstrapWebListener.java b/src/main/java/uk/ac/ebi/utils/opt/net/ConfigBootstrapWebListener.java index 02f0fa7c9..e8a338420 100644 --- a/src/main/java/uk/ac/ebi/utils/opt/net/ConfigBootstrapWebListener.java +++ b/src/main/java/uk/ac/ebi/utils/opt/net/ConfigBootstrapWebListener.java @@ -3,8 +3,8 @@ import java.util.HashMap; import java.util.Map; -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; +import jakarta.servlet.ServletContextEvent; +import jakarta.servlet.ServletContextListener; import uk.ac.ebi.utils.collections.OptionsMap; @@ -54,7 +54,7 @@ public void contextInitialized ( ServletContextEvent sce ) @Override public void contextDestroyed ( ServletContextEvent sce ) { - // Does nothing, added just for compatibility with older servlet APIs. + // Does nothing, added just for compatibility with servlet APIs. } diff --git a/src/main/java/uk/ac/ebi/utils/opt/springweb/exceptions/ResponseStatusException2.java b/src/main/java/uk/ac/ebi/utils/opt/springweb/exceptions/ResponseStatusException2.java index 09c62c933..514904604 100644 --- a/src/main/java/uk/ac/ebi/utils/opt/springweb/exceptions/ResponseStatusException2.java +++ b/src/main/java/uk/ac/ebi/utils/opt/springweb/exceptions/ResponseStatusException2.java @@ -3,6 +3,7 @@ import java.util.Optional; import org.springframework.http.HttpStatus; +import org.springframework.http.HttpStatusCode; import org.springframework.web.server.ResponseStatusException; /** @@ -54,7 +55,12 @@ public ResponseStatusException2 ( int rawStatusCode, String reason, Throwable ca */ public String getMessage () { - int code = this.getRawStatusCode (); + HttpStatusCode statusCode = Optional.ofNullable ( this.getStatusCode () ) + .orElse ( HttpStatus.INTERNAL_SERVER_ERROR ); + + int code = statusCode.value (); + + // Finding a reason with Spring >= 6 HttpStatus status = HttpStatus.resolve ( code ); String codeStr = "HTTP " +