On 29/06/2026 20:47, [email protected] wrote:
This is an automated email from the ASF dual-hosted git repository.

rmaucher 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 be63410148 Trivial fixes from code review
be63410148 is described below

commit be634101482376ed50d6964e39ab0ecf8a95b575
Author: remm <[email protected]>
AuthorDate: Mon Jun 29 21:47:37 2026 +0200

     Trivial fixes from code review

<snip/>

@@ -1686,44 +1694,24 @@ public class ContextConfig implements LifecycleListener 
{
          long hostTimeStamp = 0;
if (globalWebXml != null) {
-            URLConnection uc = null;
              try {
                  URI uri = new URI(globalWebXml.getSystemId());
                  URL url = uri.toURL();
-                uc = url.openConnection();
+                URLConnection uc = url.openConnection();
                  globalTimeStamp = uc.getLastModified();
              } catch (IOException | URISyntaxException | 
IllegalArgumentException e) {
                  globalTimeStamp = -1;
-            } finally {
-                if (uc != null) {
-                    try {
-                        uc.getInputStream().close();
-                    } catch (IOException ioe) {
-                        ExceptionUtils.handleThrowable(ioe);
-                        globalTimeStamp = -1;
-                    }
-                }
              }
          }
if (hostWebXml != null) {
-            URLConnection uc = null;
              try {
                  URI uri = new URI(hostWebXml.getSystemId());
                  URL url = uri.toURL();
-                uc = url.openConnection();
+                URLConnection uc = url.openConnection();
                  hostTimeStamp = uc.getLastModified();
              } catch (IOException | URISyntaxException | 
IllegalArgumentException e) {
                  hostTimeStamp = -1;
-            } finally {
-                if (uc != null) {
-                    try {
-                        uc.getInputStream().close();
-                    } catch (IOException ioe) {
-                        ExceptionUtils.handleThrowable(ioe);
-                        hostTimeStamp = -1;
-                    }
-                }
              }
          }

I'll be reverting the above changes. They restore a potential fd leak if the resource implmentation opens a handle to read the last modified time. This has been known to happen with JARs.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to