code: public static URL extractArchiveURL(URL jarUrl) throws MalformedURLException {
          String urlFile = jarUrl.getFile();
  
          int endIndex = urlFile.indexOf(WAR_URL_SEPARATOR);
          if (endIndex != -1) {
              // Tomcat's "jar:war:file:...mywar.war*/WEB-INF/lib/myjar.jar!/myentry.txt"
              String warFile = urlFile.substring(0, endIndex);
              int startIndex = warFile.indexOf(WAR_URL_PREFIX);
              if (startIndex != -1) {
                  return new URL(warFile.substring(startIndex + WAR_URL_PREFIX.length()));
              }
          }
  
          // Regular "jar:file:...myjar.jar!/myentry.txt"
          return extractJarFileURL(jarUrl);
      }
docs: Extract the URL for the outermost archive from the given jar/war URL
  (which may point to a resource in a jar file or to a jar file itself).
  <p>In the case of a jar file nested within a war file, this will return
  a URL to the war file since that is the one resolvable in the file system.
  
  @param jarUrl the original URL
  @return the URL for the actual jar file
  @throws MalformedURLException if no valid jar file URL could be extracted
  @see #extractJarFileURL(URL)
  @since 4.1.8