From e2c0cc6775134e615d664d873c0de55befd13ce7 Mon Sep 17 00:00:00 2001 From: Ceki Gulcu Date: Fri, 26 Aug 2022 20:39:44 +0200 Subject: [PATCH] migrate to Jakarta EE Signed-off-by: Ceki Gulcu --- logback-access/pom.xml | 17 +++- .../access/ViewStatusMessagesServlet.java | 6 +- .../logback/access/jetty/RequestLogImpl.java | 30 +++--- .../qos/logback/access/servlet/TeeFilter.java | 16 ++-- .../access/servlet/TeeHttpServletRequest.java | 6 +- .../servlet/TeeHttpServletResponse.java | 6 +- .../access/servlet/TeeServletInputStream.java | 6 +- .../servlet/TeeServletOutputStream.java | 6 +- .../ch/qos/logback/access/servlet/Util.java | 4 +- .../access/sift/AccessEventDiscriminator.java | 4 +- .../qos/logback/access/spi/AccessEvent.java | 8 +- .../qos/logback/access/spi/IAccessEvent.java | 4 +- .../logback/access/tomcat/LogbackValve.java | 4 +- .../logback/access/dummy/DummyRequest.java | 4 +- .../logback/access/dummy/DummyResponse.java | 6 +- .../dummy/DummyServletOutputStream.java | 4 +- .../access/jetty/JettyFixtureBase.java | 6 +- .../logback/access/pattern/ConverterTest.java | 2 +- logback-classic/pom.xml | 19 ++-- .../classic/ViewStatusMessagesServlet.java | 4 +- .../helpers/MDCInsertingServletFilter.java | 14 +-- .../selector/servlet/ContextDetachingSCL.java | 4 +- .../selector/servlet/LoggerContextFilter.java | 12 +-- .../LogbackServletContainerInitializer.java | 6 +- .../LogbackServletContextListener.java | 4 +- .../src/main/{java9 => java}/module-info.java | 2 +- .../classic/net/SMTPAppender_GreenTest.java | 6 +- ...ogbackServletContainerInitializerTest.java | 5 +- .../qos/logback/classic/util/EnvUtilTest.java | 2 +- logback-core/pom.xml | 27 +++--- .../logback/core/net/LoginAuthenticator.java | 4 +- .../logback/core/net/SMTPAppenderBase.java | 22 ++--- .../status/ViewStatusMessagesServletBase.java | 8 +- .../src/main/{java9 => java}/module-info.java | 12 ++- logback-examples/pom.xml | 4 +- .../java/chapters/mdc/UserServletFilter.java | 14 +-- pom.xml | 96 +++++++------------ 37 files changed, 192 insertions(+), 212 deletions(-) rename logback-classic/src/main/{java9 => java}/module-info.java (97%) rename logback-core/src/main/{java9 => java}/module-info.java (86%) diff --git a/logback-access/pom.xml b/logback-access/pom.xml index f02df3d06e..0894305a00 100755 --- a/logback-access/pom.xml +++ b/logback-access/pom.xml @@ -34,8 +34,8 @@ - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api provided @@ -65,8 +65,15 @@ - javax.mail - javax.mail-api + jakarta.mail + jakarta.mail-api + compile + true + + + + jakarta.activation + jakarta.activation-api compile true @@ -135,7 +142,7 @@ ch.qos.logback.core.rolling, ch.qos.logback.core.rolling.helper, - javax.servlet.*;version="4.0.0", + jakarta.servlet.*;version="4.0.0", org.apache.catalina.*;version="${tomcat.version}";resolution:=optional, org.eclipse.jetty.*;version="${jetty.version}";resolution:=optional, * diff --git a/logback-access/src/main/java/ch/qos/logback/access/ViewStatusMessagesServlet.java b/logback-access/src/main/java/ch/qos/logback/access/ViewStatusMessagesServlet.java index ce4d448a2f..1658380874 100644 --- a/logback-access/src/main/java/ch/qos/logback/access/ViewStatusMessagesServlet.java +++ b/logback-access/src/main/java/ch/qos/logback/access/ViewStatusMessagesServlet.java @@ -13,9 +13,9 @@ */ package ch.qos.logback.access; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.ServletContext; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import ch.qos.logback.core.status.StatusManager; import ch.qos.logback.core.status.ViewStatusMessagesServletBase; diff --git a/logback-access/src/main/java/ch/qos/logback/access/jetty/RequestLogImpl.java b/logback-access/src/main/java/ch/qos/logback/access/jetty/RequestLogImpl.java index acb9aa67a9..0c36aa9e61 100644 --- a/logback-access/src/main/java/ch/qos/logback/access/jetty/RequestLogImpl.java +++ b/logback-access/src/main/java/ch/qos/logback/access/jetty/RequestLogImpl.java @@ -15,6 +15,7 @@ import java.io.File; import java.net.URL; +import java.util.EventListener; import java.util.HashMap; import java.util.Iterator; import java.util.List; @@ -243,20 +244,10 @@ enum State { String fileName; String resource; - // Jetty 9.4.x and newer is considered modern. - boolean modernJettyRequestLog; boolean quiet = false; public RequestLogImpl() { putObject(CoreConstants.EVALUATOR_MAP, new HashMap>()); - - // plumb the depths of Jetty and the environment ... - if (EnvUtil.isClassAvailable(this.getClass(), "jakarta.servlet.http.HttpServlet")) { - throw new RuntimeException("The new jakarta.servlet classes are not supported by this " + "version of logback-access (check for a newer version of logback-access that " + "does support it)"); - } - - // look for modern approach to RequestLog - modernJettyRequestLog = EnvUtil.isClassAvailable(this.getClass(), "org.eclipse.jetty.server.CustomRequestLog"); } @Override @@ -270,11 +261,7 @@ public void log(Request jettyRequest, Response jettyResponse) { } private JettyServerAdapter makeJettyServerAdapter(Request jettyRequest, Response jettyResponse) { - if (modernJettyRequestLog) { - return new JettyModernServerAdapter(jettyRequest, jettyResponse); - } else { - return new JettyServerAdapter(jettyRequest, jettyResponse); - } + return new JettyModernServerAdapter(jettyRequest, jettyResponse); } protected void addInfo(String msg) { @@ -402,6 +389,16 @@ public boolean isFailed() { return state == State.FAILED; } + @Override + public boolean addEventListener(EventListener listener) { + return false; + } + + @Override + public boolean removeEventListener(EventListener listener) { + return false; + } + public boolean isQuiet() { return quiet; @@ -466,13 +463,10 @@ public FilterReply getFilterChainDecision(IAccessEvent event) { return fai.getFilterChainDecision(event); } - - @Override public void addLifeCycleListener(LifeCycle.Listener listener) { // we'll implement this when asked } - @Override public void removeLifeCycleListener(LifeCycle.Listener listener) { // we'll implement this when asked } diff --git a/logback-access/src/main/java/ch/qos/logback/access/servlet/TeeFilter.java b/logback-access/src/main/java/ch/qos/logback/access/servlet/TeeFilter.java index 9a10d8fe91..ba8d5a2682 100644 --- a/logback-access/src/main/java/ch/qos/logback/access/servlet/TeeFilter.java +++ b/logback-access/src/main/java/ch/qos/logback/access/servlet/TeeFilter.java @@ -19,14 +19,14 @@ import java.util.ArrayList; import java.util.List; -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.Filter; +import jakarta.servlet.FilterChain; +import jakarta.servlet.FilterConfig; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import static ch.qos.logback.access.AccessConstants.LB_OUTPUT_BUFFER; import static ch.qos.logback.access.AccessConstants.TEE_FILTER_INCLUDES_PARAM; diff --git a/logback-access/src/main/java/ch/qos/logback/access/servlet/TeeHttpServletRequest.java b/logback-access/src/main/java/ch/qos/logback/access/servlet/TeeHttpServletRequest.java index 8ab9c6dad1..0abb0059f8 100644 --- a/logback-access/src/main/java/ch/qos/logback/access/servlet/TeeHttpServletRequest.java +++ b/logback-access/src/main/java/ch/qos/logback/access/servlet/TeeHttpServletRequest.java @@ -17,9 +17,9 @@ import java.io.IOException; import java.io.InputStreamReader; -import javax.servlet.ServletInputStream; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletRequestWrapper; +import jakarta.servlet.ServletInputStream; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequestWrapper; import static ch.qos.logback.access.AccessConstants.LB_INPUT_BUFFER; diff --git a/logback-access/src/main/java/ch/qos/logback/access/servlet/TeeHttpServletResponse.java b/logback-access/src/main/java/ch/qos/logback/access/servlet/TeeHttpServletResponse.java index b50a147b01..6140a5557a 100644 --- a/logback-access/src/main/java/ch/qos/logback/access/servlet/TeeHttpServletResponse.java +++ b/logback-access/src/main/java/ch/qos/logback/access/servlet/TeeHttpServletResponse.java @@ -17,9 +17,9 @@ import java.io.OutputStreamWriter; import java.io.PrintWriter; -import javax.servlet.ServletOutputStream; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpServletResponseWrapper; +import jakarta.servlet.ServletOutputStream; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletResponseWrapper; public class TeeHttpServletResponse extends HttpServletResponseWrapper { diff --git a/logback-access/src/main/java/ch/qos/logback/access/servlet/TeeServletInputStream.java b/logback-access/src/main/java/ch/qos/logback/access/servlet/TeeServletInputStream.java index 207a84f234..7c349542b8 100644 --- a/logback-access/src/main/java/ch/qos/logback/access/servlet/TeeServletInputStream.java +++ b/logback-access/src/main/java/ch/qos/logback/access/servlet/TeeServletInputStream.java @@ -18,9 +18,9 @@ import java.io.IOException; import java.io.InputStream; -import javax.servlet.ReadListener; -import javax.servlet.ServletInputStream; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.ReadListener; +import jakarta.servlet.ServletInputStream; +import jakarta.servlet.http.HttpServletRequest; class TeeServletInputStream extends ServletInputStream { diff --git a/logback-access/src/main/java/ch/qos/logback/access/servlet/TeeServletOutputStream.java b/logback-access/src/main/java/ch/qos/logback/access/servlet/TeeServletOutputStream.java index 22fb1ceaa9..ffe9fde593 100644 --- a/logback-access/src/main/java/ch/qos/logback/access/servlet/TeeServletOutputStream.java +++ b/logback-access/src/main/java/ch/qos/logback/access/servlet/TeeServletOutputStream.java @@ -16,9 +16,9 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; -import javax.servlet.ServletOutputStream; -import javax.servlet.ServletResponse; -import javax.servlet.WriteListener; +import jakarta.servlet.ServletOutputStream; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.WriteListener; public class TeeServletOutputStream extends ServletOutputStream { diff --git a/logback-access/src/main/java/ch/qos/logback/access/servlet/Util.java b/logback-access/src/main/java/ch/qos/logback/access/servlet/Util.java index 9348ee3cbc..0d033a98a6 100755 --- a/logback-access/src/main/java/ch/qos/logback/access/servlet/Util.java +++ b/logback-access/src/main/java/ch/qos/logback/access/servlet/Util.java @@ -15,8 +15,8 @@ import ch.qos.logback.access.AccessConstants; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; public class Util { diff --git a/logback-access/src/main/java/ch/qos/logback/access/sift/AccessEventDiscriminator.java b/logback-access/src/main/java/ch/qos/logback/access/sift/AccessEventDiscriminator.java index 820d85d5fe..21ebd9603e 100644 --- a/logback-access/src/main/java/ch/qos/logback/access/sift/AccessEventDiscriminator.java +++ b/logback-access/src/main/java/ch/qos/logback/access/sift/AccessEventDiscriminator.java @@ -13,8 +13,8 @@ */ package ch.qos.logback.access.sift; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpSession; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpSession; import ch.qos.logback.access.spi.IAccessEvent; import ch.qos.logback.core.sift.AbstractDiscriminator; diff --git a/logback-access/src/main/java/ch/qos/logback/access/spi/AccessEvent.java b/logback-access/src/main/java/ch/qos/logback/access/spi/AccessEvent.java index 6661dbd568..88f1a22c05 100755 --- a/logback-access/src/main/java/ch/qos/logback/access/spi/AccessEvent.java +++ b/logback-access/src/main/java/ch/qos/logback/access/spi/AccessEvent.java @@ -19,10 +19,10 @@ import ch.qos.logback.core.Context; import ch.qos.logback.core.spi.SequenceNumberGenerator; -import javax.servlet.http.Cookie; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; +import jakarta.servlet.http.Cookie; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpSession; import java.io.Serializable; import java.util.ArrayList; diff --git a/logback-access/src/main/java/ch/qos/logback/access/spi/IAccessEvent.java b/logback-access/src/main/java/ch/qos/logback/access/spi/IAccessEvent.java index d526ff7e6e..89c93aa2ca 100644 --- a/logback-access/src/main/java/ch/qos/logback/access/spi/IAccessEvent.java +++ b/logback-access/src/main/java/ch/qos/logback/access/spi/IAccessEvent.java @@ -15,8 +15,8 @@ import ch.qos.logback.core.spi.DeferredProcessingAware; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import java.util.Enumeration; import java.util.List; import java.util.Map; diff --git a/logback-access/src/main/java/ch/qos/logback/access/tomcat/LogbackValve.java b/logback-access/src/main/java/ch/qos/logback/access/tomcat/LogbackValve.java index 145ccb6f3d..4cc1a647e3 100644 --- a/logback-access/src/main/java/ch/qos/logback/access/tomcat/LogbackValve.java +++ b/logback-access/src/main/java/ch/qos/logback/access/tomcat/LogbackValve.java @@ -25,8 +25,8 @@ import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; +import jakarta.servlet.ServletContext; +import jakarta.servlet.ServletException; import org.apache.catalina.Lifecycle; import org.apache.catalina.LifecycleException; diff --git a/logback-access/src/test/java/ch/qos/logback/access/dummy/DummyRequest.java b/logback-access/src/test/java/ch/qos/logback/access/dummy/DummyRequest.java index c5c100a22d..4e2539c445 100644 --- a/logback-access/src/test/java/ch/qos/logback/access/dummy/DummyRequest.java +++ b/logback-access/src/test/java/ch/qos/logback/access/dummy/DummyRequest.java @@ -15,8 +15,8 @@ import ch.qos.logback.access.AccessConstants; -import javax.servlet.*; -import javax.servlet.http.*; +import jakarta.servlet.*; +import jakarta.servlet.http.*; import java.io.BufferedReader; import java.io.IOException; import java.io.UnsupportedEncodingException; diff --git a/logback-access/src/test/java/ch/qos/logback/access/dummy/DummyResponse.java b/logback-access/src/test/java/ch/qos/logback/access/dummy/DummyResponse.java index e8950c1412..4d5a055206 100644 --- a/logback-access/src/test/java/ch/qos/logback/access/dummy/DummyResponse.java +++ b/logback-access/src/test/java/ch/qos/logback/access/dummy/DummyResponse.java @@ -17,9 +17,9 @@ import java.io.PrintWriter; import java.util.*; -import javax.servlet.ServletOutputStream; -import javax.servlet.http.Cookie; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.ServletOutputStream; +import jakarta.servlet.http.Cookie; +import jakarta.servlet.http.HttpServletResponse; public class DummyResponse implements HttpServletResponse { diff --git a/logback-access/src/test/java/ch/qos/logback/access/dummy/DummyServletOutputStream.java b/logback-access/src/test/java/ch/qos/logback/access/dummy/DummyServletOutputStream.java index 9403065098..30a4115ed2 100644 --- a/logback-access/src/test/java/ch/qos/logback/access/dummy/DummyServletOutputStream.java +++ b/logback-access/src/test/java/ch/qos/logback/access/dummy/DummyServletOutputStream.java @@ -13,8 +13,8 @@ */ package ch.qos.logback.access.dummy; -import javax.servlet.ServletOutputStream; -import javax.servlet.WriteListener; +import jakarta.servlet.ServletOutputStream; +import jakarta.servlet.WriteListener; import java.io.IOException; import java.io.OutputStream; diff --git a/logback-access/src/test/java/ch/qos/logback/access/jetty/JettyFixtureBase.java b/logback-access/src/test/java/ch/qos/logback/access/jetty/JettyFixtureBase.java index 7c9e7fc308..0e546d6da7 100644 --- a/logback-access/src/test/java/ch/qos/logback/access/jetty/JettyFixtureBase.java +++ b/logback-access/src/test/java/ch/qos/logback/access/jetty/JettyFixtureBase.java @@ -20,9 +20,9 @@ import org.eclipse.jetty.server.Handler; import org.eclipse.jetty.server.handler.AbstractHandler; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; public class JettyFixtureBase { diff --git a/logback-access/src/test/java/ch/qos/logback/access/pattern/ConverterTest.java b/logback-access/src/test/java/ch/qos/logback/access/pattern/ConverterTest.java index 7a8c05512d..32abe54036 100644 --- a/logback-access/src/test/java/ch/qos/logback/access/pattern/ConverterTest.java +++ b/logback-access/src/test/java/ch/qos/logback/access/pattern/ConverterTest.java @@ -18,7 +18,7 @@ import java.util.ArrayList; import java.util.List; -import javax.servlet.http.Cookie; +import jakarta.servlet.http.Cookie; import ch.qos.logback.access.spi.IAccessEvent; import org.junit.After; diff --git a/logback-classic/pom.xml b/logback-classic/pom.xml index 7dd5bfb630..4e48be43c1 100755 --- a/logback-classic/pom.xml +++ b/logback-classic/pom.xml @@ -78,15 +78,15 @@ - javax.mail - javax.mail-api + jakarta.mail + jakarta.mail-api compile true com.sun.mail - javax.mail + jakarta.mail runtime true @@ -103,18 +103,18 @@ test - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api provided + com.icegreen greenmail - - 1.5.14 - + 2.0.0-alpha-1 test + org.apache.felix org.apache.felix.main @@ -147,7 +147,6 @@ ${maven.compiler.source} ${maven.compiler.target} - true ${project.build.outputDirectory}/META-INF/MANIFEST.MF @@ -293,7 +292,7 @@ of java code. --> sun.reflect;resolution:=optional, - javax.*;resolution:=optional, + jakarta.*;resolution:=optional, org.xml.*;resolution:=optional, org.slf4j, org.slf4j.spi, diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/ViewStatusMessagesServlet.java b/logback-classic/src/main/java/ch/qos/logback/classic/ViewStatusMessagesServlet.java index 113aacabb3..9c00493064 100644 --- a/logback-classic/src/main/java/ch/qos/logback/classic/ViewStatusMessagesServlet.java +++ b/logback-classic/src/main/java/ch/qos/logback/classic/ViewStatusMessagesServlet.java @@ -13,8 +13,8 @@ */ package ch.qos.logback.classic; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.slf4j.LoggerFactory; diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/helpers/MDCInsertingServletFilter.java b/logback-classic/src/main/java/ch/qos/logback/classic/helpers/MDCInsertingServletFilter.java index 6b3ba8006e..d4fba62160 100644 --- a/logback-classic/src/main/java/ch/qos/logback/classic/helpers/MDCInsertingServletFilter.java +++ b/logback-classic/src/main/java/ch/qos/logback/classic/helpers/MDCInsertingServletFilter.java @@ -15,13 +15,13 @@ import java.io.IOException; -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.Filter; +import jakarta.servlet.FilterChain; +import jakarta.servlet.FilterConfig; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.HttpServletRequest; import org.slf4j.MDC; diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/selector/servlet/ContextDetachingSCL.java b/logback-classic/src/main/java/ch/qos/logback/classic/selector/servlet/ContextDetachingSCL.java index 5b2f6145c1..d5811952f7 100644 --- a/logback-classic/src/main/java/ch/qos/logback/classic/selector/servlet/ContextDetachingSCL.java +++ b/logback-classic/src/main/java/ch/qos/logback/classic/selector/servlet/ContextDetachingSCL.java @@ -17,8 +17,8 @@ import javax.naming.Context; import javax.naming.NamingException; -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; +import jakarta.servlet.ServletContextEvent; +import jakarta.servlet.ServletContextListener; import org.slf4j.Logger; diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/selector/servlet/LoggerContextFilter.java b/logback-classic/src/main/java/ch/qos/logback/classic/selector/servlet/LoggerContextFilter.java index 3d13a96558..95bf34e268 100644 --- a/logback-classic/src/main/java/ch/qos/logback/classic/selector/servlet/LoggerContextFilter.java +++ b/logback-classic/src/main/java/ch/qos/logback/classic/selector/servlet/LoggerContextFilter.java @@ -15,12 +15,12 @@ import java.io.IOException; -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; +import jakarta.servlet.Filter; +import jakarta.servlet.FilterChain; +import jakarta.servlet.FilterConfig; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; import org.slf4j.LoggerFactory; diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/servlet/LogbackServletContainerInitializer.java b/logback-classic/src/main/java/ch/qos/logback/classic/servlet/LogbackServletContainerInitializer.java index c2f7322fad..e5a35613e2 100755 --- a/logback-classic/src/main/java/ch/qos/logback/classic/servlet/LogbackServletContainerInitializer.java +++ b/logback-classic/src/main/java/ch/qos/logback/classic/servlet/LogbackServletContainerInitializer.java @@ -4,9 +4,9 @@ import java.util.Set; -import javax.servlet.ServletContainerInitializer; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; +import jakarta.servlet.ServletContainerInitializer; +import jakarta.servlet.ServletContext; +import jakarta.servlet.ServletException; import ch.qos.logback.classic.util.StatusViaSLF4JLoggerFactory; import ch.qos.logback.core.util.OptionHelper; diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/servlet/LogbackServletContextListener.java b/logback-classic/src/main/java/ch/qos/logback/classic/servlet/LogbackServletContextListener.java index f3f61c6b4c..cc01383151 100755 --- a/logback-classic/src/main/java/ch/qos/logback/classic/servlet/LogbackServletContextListener.java +++ b/logback-classic/src/main/java/ch/qos/logback/classic/servlet/LogbackServletContextListener.java @@ -1,7 +1,7 @@ package ch.qos.logback.classic.servlet; -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; +import jakarta.servlet.ServletContextEvent; +import jakarta.servlet.ServletContextListener; import org.slf4j.ILoggerFactory; import org.slf4j.LoggerFactory; diff --git a/logback-classic/src/main/java9/module-info.java b/logback-classic/src/main/java/module-info.java similarity index 97% rename from logback-classic/src/main/java9/module-info.java rename to logback-classic/src/main/java/module-info.java index 9eea17aecf..21fc223d3d 100644 --- a/logback-classic/src/main/java9/module-info.java +++ b/logback-classic/src/main/java/module-info.java @@ -1,7 +1,7 @@ module ch.qos.logback.classic { requires org.slf4j; requires static java.management; - //requires static javax.servlet; + requires static jakarta.servlet; requires ch.qos.logback.core; uses ch.qos.logback.classic.spi.Configurator; diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/net/SMTPAppender_GreenTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/net/SMTPAppender_GreenTest.java index 7ecb9e98c6..29df9da1dc 100755 --- a/logback-classic/src/test/java/ch/qos/logback/classic/net/SMTPAppender_GreenTest.java +++ b/logback-classic/src/test/java/ch/qos/logback/classic/net/SMTPAppender_GreenTest.java @@ -51,9 +51,9 @@ import ch.qos.logback.core.testUtil.RandomUtil; import ch.qos.logback.core.util.StatusListenerConfigHelper; import ch.qos.logback.core.util.StatusPrinter; -import javax.mail.MessagingException; -import javax.mail.internet.MimeMessage; -import javax.mail.internet.MimeMultipart; +import jakarta.mail.MessagingException; +import jakarta.mail.internet.MimeMessage; +import jakarta.mail.internet.MimeMultipart; public class SMTPAppender_GreenTest { diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/servlet/LogbackServletContainerInitializerTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/servlet/LogbackServletContainerInitializerTest.java index 6e23664ba8..b89d1daae3 100755 --- a/logback-classic/src/test/java/ch/qos/logback/classic/servlet/LogbackServletContainerInitializerTest.java +++ b/logback-classic/src/test/java/ch/qos/logback/classic/servlet/LogbackServletContainerInitializerTest.java @@ -6,12 +6,11 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; +import jakarta.servlet.ServletContext; +import jakarta.servlet.ServletException; import org.junit.After; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import ch.qos.logback.core.CoreConstants; diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/util/EnvUtilTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/util/EnvUtilTest.java index c594eb7ade..f4af55efbc 100644 --- a/logback-classic/src/test/java/ch/qos/logback/classic/util/EnvUtilTest.java +++ b/logback-classic/src/test/java/ch/qos/logback/classic/util/EnvUtilTest.java @@ -15,7 +15,7 @@ public class EnvUtilTest { public void versionTest() { String versionStr = EnvUtil.logbackVersion(); assertNotNull(versionStr); - assertTrue(versionStr.startsWith("1.3")); + assertTrue(versionStr.startsWith("1.4")); } diff --git a/logback-core/pom.xml b/logback-core/pom.xml index e94044c2e9..ff26d15d95 100755 --- a/logback-core/pom.xml +++ b/logback-core/pom.xml @@ -35,37 +35,40 @@ - javax.mail - javax.mail-api + jakarta.mail + jakarta.mail-api compile true - javax.activation - javax.activation-api + jakarta.activation + jakarta.activation-api compile true com.sun.mail - javax.mail + jakarta.mail runtime true + + jakarta.servlet + jakarta.servlet-api + compile + true + + + org.mockito mockito-core test - - javax.servlet - javax.servlet-api - compile - true - + @@ -138,7 +141,7 @@ <_failok>true ch.qos.logback.core.* - javax.*;resolution:=optional, + jakarta.*;resolution:=optional, org.xml.*;resolution:=optional, org.fusesource.jansi;resolution:=optional, org.codehaus.janino;resolution:=optional, diff --git a/logback-core/src/main/java/ch/qos/logback/core/net/LoginAuthenticator.java b/logback-core/src/main/java/ch/qos/logback/core/net/LoginAuthenticator.java index 018545337d..6b0546baff 100644 --- a/logback-core/src/main/java/ch/qos/logback/core/net/LoginAuthenticator.java +++ b/logback-core/src/main/java/ch/qos/logback/core/net/LoginAuthenticator.java @@ -13,8 +13,8 @@ */ package ch.qos.logback.core.net; -import javax.mail.Authenticator; -import javax.mail.PasswordAuthentication; +import jakarta.mail.Authenticator; +import jakarta.mail.PasswordAuthentication; /** * Used by SMTPAppender for authentication purposes. diff --git a/logback-core/src/main/java/ch/qos/logback/core/net/SMTPAppenderBase.java b/logback-core/src/main/java/ch/qos/logback/core/net/SMTPAppenderBase.java index 259771f37d..4518c85888 100755 --- a/logback-core/src/main/java/ch/qos/logback/core/net/SMTPAppenderBase.java +++ b/logback-core/src/main/java/ch/qos/logback/core/net/SMTPAppenderBase.java @@ -20,15 +20,15 @@ import java.util.Properties; import java.util.concurrent.Future; -import javax.mail.Message; -import javax.mail.Multipart; -import javax.mail.Session; -import javax.mail.Transport; -import javax.mail.internet.AddressException; -import javax.mail.internet.InternetAddress; -import javax.mail.internet.MimeBodyPart; -import javax.mail.internet.MimeMessage; -import javax.mail.internet.MimeMultipart; +import jakarta.mail.Message; +import jakarta.mail.Multipart; +import jakarta.mail.Session; +import jakarta.mail.Transport; +import jakarta.mail.internet.AddressException; +import jakarta.mail.internet.InternetAddress; +import jakarta.mail.internet.MimeBodyPart; +import jakarta.mail.internet.MimeMessage; +import jakarta.mail.internet.MimeMultipart; import javax.naming.Context; import ch.qos.logback.core.AppenderBase; @@ -625,7 +625,7 @@ public String getJndiLocation() { } /** - * Set the location where a {@link javax.mail.Session} resource is located in + * Set the location where a {@link jakarta.mail.Session} resource is located in * JNDI. Default value is "java:comp/env/mail/Session". * * @param jndiLocation @@ -640,7 +640,7 @@ public boolean isSessionViaJNDI() { } /** - * If set to true, a {@link javax.mail.Session} resource will be retrieved from + * If set to true, a {@link jakarta.mail.Session} resource will be retrieved from * JNDI. Default is false. * * @param sessionViaJNDI whether to obtain a javax.mail.Session by JNDI diff --git a/logback-core/src/main/java/ch/qos/logback/core/status/ViewStatusMessagesServletBase.java b/logback-core/src/main/java/ch/qos/logback/core/status/ViewStatusMessagesServletBase.java index e1c483b1ab..5ce08af67f 100644 --- a/logback-core/src/main/java/ch/qos/logback/core/status/ViewStatusMessagesServletBase.java +++ b/logback-core/src/main/java/ch/qos/logback/core/status/ViewStatusMessagesServletBase.java @@ -20,10 +20,10 @@ import java.io.StringWriter; import java.util.List; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import ch.qos.logback.core.CoreConstants; import ch.qos.logback.core.helpers.Transform; diff --git a/logback-core/src/main/java9/module-info.java b/logback-core/src/main/java/module-info.java similarity index 86% rename from logback-core/src/main/java9/module-info.java rename to logback-core/src/main/java/module-info.java index c15967d8b3..141449bf63 100644 --- a/logback-core/src/main/java9/module-info.java +++ b/logback-core/src/main/java/module-info.java @@ -1,11 +1,11 @@ -module ch.qos.logback.core { +module ch.qos.logback.core { requires static transitive java.sql; requires static transitive java.naming; requires static transitive java.xml; - //requires static javax.mail; - //requires static javax.activation; + requires static jakarta.mail; + requires static jakarta.activation; - //requires static jakarta.servlet; + requires static jakarta.servlet; requires static janino; requires static commons.compiler; @@ -47,6 +47,10 @@ exports ch.qos.logback.core.spi; exports ch.qos.logback.core.status; + exports ch.qos.logback.core.model.util; + + exports ch.qos.logback.core.recovery; + exports ch.qos.logback.core.util; exports ch.qos.logback.core.read; diff --git a/logback-examples/pom.xml b/logback-examples/pom.xml index a24f757210..a5edab57e8 100755 --- a/logback-examples/pom.xml +++ b/logback-examples/pom.xml @@ -40,8 +40,8 @@ 1.2.18.4 - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api compile true diff --git a/logback-examples/src/main/java/chapters/mdc/UserServletFilter.java b/logback-examples/src/main/java/chapters/mdc/UserServletFilter.java index 8d96661b8c..d7796715aa 100644 --- a/logback-examples/src/main/java/chapters/mdc/UserServletFilter.java +++ b/logback-examples/src/main/java/chapters/mdc/UserServletFilter.java @@ -16,13 +16,13 @@ import java.io.IOException; import java.security.Principal; -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.Filter; +import jakarta.servlet.FilterChain; +import jakarta.servlet.FilterConfig; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.HttpServletRequest; import org.slf4j.MDC; diff --git a/pom.xml b/pom.xml index e6968afccd..88ab244090 100755 --- a/pom.xml +++ b/pom.xml @@ -49,17 +49,21 @@ 2022-08-09T08:27:00Z 1.2.11 - 8 - ${jdk.version} - ${jdk.version} + 11 + ${jdk.version} UTF-8 4.13.1 1.3 - - 1.6.2 - 1.2.0 - 4.0.1 - ${servlet-api.version} + 2.0.1 + 2.1.0 + 5.0.0 + 2.0.0-alpha-1 + + + com.icegreen + greenmail + 2.0.0-alpha-1 + 1.5.14 3.1.7 + 10.0.10 + 11.0.6 + 3.10.1 1.18 @@ -165,35 +169,34 @@ ${jansi.version} - - javax.mail - javax.mail-api - ${javax.mail.version} + com.sun.mail + jakarta.mail + ${jakarta.mail.version} - javax.activation - javax.activation-api - ${javax.activation.version} + jakarta.servlet + jakarta.servlet-api + ${jakarta.servlet.version} - com.sun.mail - javax.mail - ${javax.mail.version} + com.icegreen + greenmail + ${greenmail.version} @@ -217,11 +220,7 @@ ${jetty.version} - - javax.servlet - javax.servlet-api - ${javax.servlet.version} - + org.mockito @@ -349,34 +348,9 @@ org.apache.maven.plugins maven-compiler-plugin - - - - default-compile - - compile - - - ${jdk.version} - ${jdk.version} - - - - - module-compile - compile - - compile - - - 9 - - ${project.basedir}/src/main/java9 - - true - - - + + ${jdk.version} +