Skip to content

Commit d19834f

Browse files
Yuri NesterenkoRealCLanger
authored andcommitted
8282300: Throws NamingException instead of InvalidNameException after JDK-8278972
Backport-of: e6afb6ff81c9004aadaa6f694e643de9703dd32d
1 parent a61b441 commit d19834f

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/jdk.naming.rmi/share/classes/com/sun/jndi/url/rmi/rmiURLContext.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,12 @@ private void parseStrict() throws NamingException {
147147
throw newNamingException(iae);
148148
}
149149
}
150+
int fmark = url.indexOf('#', i);
151+
if (fmark > -1) {
152+
if (!acceptsFragment()) {
153+
throw newNamingException(new IllegalArgumentException("URI fragments not supported: " + url));
154+
}
155+
}
150156

151157
if ("".equals(host)) {
152158
host = null;
@@ -280,12 +286,12 @@ private void parseLegacy() {
280286
}
281287

282288
NamingException newNamingException(Throwable cause) {
283-
NamingException ne = new NamingException(cause.getMessage());
289+
NamingException ne = new InvalidNameException(cause.getMessage());
284290
ne.initCause(cause);
285291
return ne;
286292
}
287293

288-
boolean acceptsFragment() {
294+
protected boolean acceptsFragment() {
289295
return true;
290296
}
291297
}

0 commit comments

Comments
 (0)