This is an automated email from the ASF dual-hosted git repository. remm pushed a commit to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/8.5.x by this push: new bf8c2d0da1 Fix NPE and fix superclass use bf8c2d0da1 is described below commit bf8c2d0da134b9a53bb934e7a2875a63a2824b69 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 f9079db1c7..fa72b07d19 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; @@ -563,7 +561,9 @@ public abstract class AbstractAccessLogValve extends ValveBase implements Access this.pattern = pattern; } logElements = createLogElements(); - cachedElements = createCachedElements(logElements); + if (logElements != null) { + cachedElements = createCachedElements(logElements); + } } /** @@ -763,33 +763,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