Skip to content

Commit 7de2cf8

Browse files
turbanoffdfuch
authored andcommitted
8273910: Redundant condition and assignment in java.net.URI
Reviewed-by: dfuchs
1 parent 8ca0846 commit 7de2cf8

File tree

1 file changed

+4
-7
lines changed
  • src/java.base/share/classes/java/net

1 file changed

+4
-7
lines changed

src/java.base/share/classes/java/net/URI.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2207,7 +2207,6 @@ private static URI resolve(URI base, URI child) {
22072207
ru.authority = child.authority;
22082208
ru.host = child.host;
22092209
ru.userInfo = child.userInfo;
2210-
ru.host = child.host;
22112210
ru.port = child.port;
22122211
ru.path = child.path;
22132212
}
@@ -3490,14 +3489,12 @@ private int parseHostname(int start, int n)
34903489
if (q <= p)
34913490
break;
34923491
l = p;
3492+
p = q;
3493+
q = scan(p, n, L_ALPHANUM | L_DASH, H_ALPHANUM | H_DASH);
34933494
if (q > p) {
3495+
if (input.charAt(q - 1) == '-')
3496+
fail("Illegal character in hostname", q - 1);
34943497
p = q;
3495-
q = scan(p, n, L_ALPHANUM | L_DASH, H_ALPHANUM | H_DASH);
3496-
if (q > p) {
3497-
if (input.charAt(q - 1) == '-')
3498-
fail("Illegal character in hostname", q - 1);
3499-
p = q;
3500-
}
35013498
}
35023499
q = scan(p, n, '.');
35033500
if (q <= p)

0 commit comments

Comments
 (0)