Skip to content

Commit

Permalink
8311032: Empty value for java.protocol.handler.pkgs system property c…
Browse files Browse the repository at this point in the history
…an lead to unnecessary classloading attempts of protocol handlers

Reviewed-by: dfuchs
  • Loading branch information
jaikiran committed Jun 29, 2023
1 parent ded1370 commit 8f5a384
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/java.base/share/classes/java/net/URL.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -1433,7 +1433,7 @@ public URLStreamHandler createURLStreamHandler(String protocol) {
private static URLStreamHandler lookupViaProperty(String protocol) {
String packagePrefixList =
GetPropertyAction.privilegedGetProperty(protocolPathProp);
if (packagePrefixList == null) {
if (packagePrefixList == null || packagePrefixList.isEmpty()) {
// not set
return null;
}
Expand All @@ -1442,6 +1442,9 @@ private static URLStreamHandler lookupViaProperty(String protocol) {
URLStreamHandler handler = null;
for (int i=0; handler == null && i<packagePrefixes.length; i++) {
String packagePrefix = packagePrefixes[i].trim();
if (packagePrefix.isEmpty()) {
continue;
}
try {
String clsName = packagePrefix + "." + protocol + ".Handler";
Class<?> cls = null;
Expand Down

1 comment on commit 8f5a384

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.