This is an automated email from the ASF dual-hosted git repository. markt 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 bfccc40 Avoid NPE and keep original behaviour bfccc40 is described below commit bfccc408e8f939a5c4603996dbc7a6cd979a92ea Author: Mark Thomas <ma...@apache.org> AuthorDate: Tue Sep 15 17:04:43 2020 +0100 Avoid NPE and keep original behaviour --- .../apache/catalina/valves/PersistentValve.java | 29 +++++++++++++--------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/java/org/apache/catalina/valves/PersistentValve.java b/java/org/apache/catalina/valves/PersistentValve.java index df94820..5976f02 100644 --- a/java/org/apache/catalina/valves/PersistentValve.java +++ b/java/org/apache/catalina/valves/PersistentValve.java @@ -170,22 +170,27 @@ public class PersistentValve extends ValveBase { if (manager instanceof StoreManager) { Session session = manager.findSession(newsessionId); Store store = ((StoreManager) manager).getStore(); - synchronized (session) { - if (store != null && session != null && session.isValid() - && !isSessionStale(session, System.currentTimeMillis())) { - store.save(session); - ((StoreManager) manager).removeSuper(session); - session.recycle(); - } else { - if (container.getLogger().isDebugEnabled()) { - container.getLogger() - .debug("newsessionId store: " + store + " session: " + session + " valid: " - + (session == null ? "N/A" : Boolean.toString(session.isValid())) - + " stale: " + isSessionStale(session, System.currentTimeMillis())); + boolean stored = false; + if (session != null) { + synchronized (session) { + if (store != null && session.isValid() && + !isSessionStale(session, System.currentTimeMillis())) { + store.save(session); + ((StoreManager) manager).removeSuper(session); + session.recycle(); + stored = true; } } } + if (!stored) { + if (container.getLogger().isDebugEnabled()) { + container.getLogger() + .debug("newsessionId store: " + store + " session: " + session + " valid: " + + (session == null ? "N/A" : Boolean.toString(session.isValid())) + + " stale: " + isSessionStale(session, System.currentTimeMillis())); + } + } } else { if (container.getLogger().isDebugEnabled()) { container.getLogger().debug("newsessionId Manager: " + --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org