8282300: Throws NamingException instead of InvalidNameException after JDK-8278972

Reviewed-by: bae
Backport-of: e6afb6ff81c9004aadaa6f694e643de9703dd32d
This commit is contained in:
Yuri Nesterenko 2022-02-25 15:48:19 +00:00 committed by Andrew Brygin
parent a4c19d9e66
commit f8e1bf0093

View File

@ -153,6 +153,12 @@ public class rmiURLContext extends GenericURLContext {
throw newNamingException(iae);
}
}
int fmark = url.indexOf('#', i);
if (fmark > -1) {
if (!acceptsFragment()) {
throw newNamingException(new IllegalArgumentException("URI fragments not supported: " + url));
}
}
if ("".equals(host)) {
host = null;
@ -286,12 +292,12 @@ public class rmiURLContext extends GenericURLContext {
}
NamingException newNamingException(Throwable cause) {
NamingException ne = new NamingException(cause.getMessage());
NamingException ne = new InvalidNameException(cause.getMessage());
ne.initCause(cause);
return ne;
}
boolean acceptsFragment() {
protected boolean acceptsFragment() {
return true;
}
}