8308184: Launching java with large number of jars in classpath with java.protocol.handler.pkgs system property set can lead to StackOverflowError

Reviewed-by: mchung, alanb
This commit is contained in:
Jaikiran Pai 2023-06-12 09:45:07 +00:00
parent 4d4706967d
commit 268ec61d4f
2 changed files with 143 additions and 3 deletions

View file

@ -53,11 +53,9 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.Properties;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.jar.JarFile;
import java.util.zip.CRC32;
@ -209,7 +207,9 @@ public class URLClassPath {
this.unopenedUrls = unopenedUrls;
this.path = path;
this.jarHandler = null;
// the application class loader uses the built-in protocol handler to avoid protocol
// handler lookup when opening JAR files on the class path.
this.jarHandler = new sun.net.www.protocol.jar.Handler();
this.acc = null;
}