This is an automated email from the ASF dual-hosted git repository. remm pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/9.0.x by this push: new c4aea9684f Fix NPE and fix superclass use c4aea9684f is described below commit c4aea9684fe795990927a94587f5057322604ef8 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 b6907d0591..0287eab383 100644 --- a/java/org/apache/catalina/valves/AbstractAccessLogValve.java +++ b/java/org/apache/catalina/valves/AbstractAccessLogValve.java @@ -39,8 +39,6 @@ import javax.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; @@ -554,7 +552,9 @@ public abstract class AbstractAccessLogValve extends ValveBase implements Access this.pattern = pattern; } logElements = createLogElements(); - cachedElements = createCachedElements(logElements); + if (logElements != null) { + cachedElements = createCachedElements(logElements); + } } /** @@ -754,33 +754,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 c1ce3fd561..07e7319bdb 100644 --- a/java/org/apache/catalina/valves/JDBCAccessLogValve.java +++ b/java/org/apache/catalina/valves/JDBCAccessLogValve.java @@ -29,7 +29,6 @@ import javax.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