This is an automated email from the ASF dual-hosted git repository. remm pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push: new c7a7581f30 Fix NPE and fix superclass use c7a7581f30 is described below commit c7a7581f30ca7ac5aa45a8b5d04186d31f1d7baa Author: remm <r...@apache.org> AuthorDate: Wed Sep 13 16:53:05 2023 +0200 Fix NPE and fix superclass use Found by coverity. --- .../catalina/valves/AbstractAccessLogValve.java | 33 ++-------------------- .../apache/catalina/valves/JDBCAccessLogValve.java | 9 ++---- 2 files changed, 5 insertions(+), 37 deletions(-) diff --git a/java/org/apache/catalina/valves/AbstractAccessLogValve.java b/java/org/apache/catalina/valves/AbstractAccessLogValve.java index 474a41fad4..5502d1c183 100644 --- a/java/org/apache/catalina/valves/AbstractAccessLogValve.java +++ b/java/org/apache/catalina/valves/AbstractAccessLogValve.java @@ -40,8 +40,6 @@ import jakarta.servlet.http.HttpSession; import org.apache.catalina.AccessLog; import org.apache.catalina.Globals; -import org.apache.catalina.LifecycleException; -import org.apache.catalina.LifecycleState; import org.apache.catalina.Session; import org.apache.catalina.connector.ClientAbortException; import org.apache.catalina.connector.Request; @@ -557,7 +555,9 @@ public abstract class AbstractAccessLogValve extends ValveBase implements Access this.pattern = pattern; } logElements = createLogElements(); - cachedElements = createCachedElements(logElements); + if (logElements != null) { + cachedElements = createCachedElements(logElements); + } } /** @@ -752,33 +752,6 @@ public abstract class AbstractAccessLogValve extends ValveBase implements Access } - /** - * Start this component and implement the requirements of - * {@link org.apache.catalina.util.LifecycleBase#startInternal()}. - * - * @exception LifecycleException if this component detects a fatal error that prevents this component from being - * used - */ - @Override - protected synchronized void startInternal() throws LifecycleException { - - setState(LifecycleState.STARTING); - } - - - /** - * Stop this component and implement the requirements of - * {@link org.apache.catalina.util.LifecycleBase#stopInternal()}. - * - * @exception LifecycleException if this component detects a fatal error that prevents this component from being - * used - */ - @Override - protected synchronized void stopInternal() throws LifecycleException { - - setState(LifecycleState.STOPPING); - } - /** * AccessLogElement writes the partial message into the buffer. */ diff --git a/java/org/apache/catalina/valves/JDBCAccessLogValve.java b/java/org/apache/catalina/valves/JDBCAccessLogValve.java index e6a38dc87a..ff9dcb4ff3 100644 --- a/java/org/apache/catalina/valves/JDBCAccessLogValve.java +++ b/java/org/apache/catalina/valves/JDBCAccessLogValve.java @@ -29,7 +29,6 @@ import jakarta.servlet.ServletException; import org.apache.catalina.AccessLog; import org.apache.catalina.LifecycleException; -import org.apache.catalina.LifecycleState; import org.apache.catalina.connector.Request; import org.apache.catalina.connector.Response; import org.apache.tomcat.util.ExceptionUtils; @@ -624,14 +623,12 @@ public final class JDBCAccessLogValve extends ValveBase implements AccessLog { */ @Override protected synchronized void startInternal() throws LifecycleException { - try { open(); } catch (SQLException e) { throw new LifecycleException(e); } - - setState(LifecycleState.STARTING); + super.startInternal(); } @@ -644,9 +641,7 @@ public final class JDBCAccessLogValve extends ValveBase implements AccessLog { */ @Override protected synchronized void stopInternal() throws LifecycleException { - - setState(LifecycleState.STOPPING); - + super.stopInternal(); close(); } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org