# HG changeset patch # User bpb # Date 1380669353 25200 # Node ID 572f940c122f06bd3b60ea13d83ff823e49717f2 # Parent 84e7f6685319e04db7b5b68a7bcb5a811b0acc94 7100860: URLClassPath may be very slow if jar index is used Summary: Remove validIndex() check. Reviewed-by: TBD Contributed-by: Brian Burkhalter diff -r 84e7f6685319 -r 572f940c122f src/share/classes/sun/misc/URLClassPath.java --- a/src/share/classes/sun/misc/URLClassPath.java Tue Oct 01 15:40:34 2013 -0700 +++ b/src/share/classes/sun/misc/URLClassPath.java Tue Oct 01 16:15:53 2013 -0700 @@ -785,33 +785,6 @@ }; } - - /* - * Returns true iff atleast one resource in the jar file has the same - * package name as that of the specified resource name. - */ - boolean validIndex(final String name) { - String packageName = name; - int pos; - if((pos = name.lastIndexOf("/")) != -1) { - packageName = name.substring(0, pos); - } - - String entryName; - ZipEntry entry; - Enumeration enum_ = jar.entries(); - while (enum_.hasMoreElements()) { - entry = enum_.nextElement(); - entryName = entry.getName(); - if((pos = entryName.lastIndexOf("/")) != -1) - entryName = entryName.substring(0, pos); - if (entryName.equals(packageName)) { - return true; - } - } - return false; - } - /* * Returns the URL for a resource with the specified name */ @@ -929,15 +902,6 @@ if (entry != null) { return newLoader.checkResource(name, check, entry); } - - /* Verify that at least one other resource with the - * same package name as the lookedup resource is - * present in the new jar - */ - if (!newLoader.validIndex(name)) { - /* the mapping is wrong */ - throw new InvalidJarIndexException("Invalid index"); - } } /* If newLoader is the current loader or if it is a