Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2020, 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 @@ -112,6 +112,11 @@ private URI canonicalize(String uriString) throws URISyntaxException {
return new URI(uriString);
}

if (Character.isDigit(uriString.charAt(0))) {
// may be hostname or hostname:port since it starts with digits
uriString = "//" + uriString;
}

URI u = new URI(uriString);

if (u.isAbsolute()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

/*
* @test
* @bug 4990825
* @bug 4990825 8251155
* @summary test that HostIdentifier objects get created as expected
*/

Expand Down
14 changes: 14 additions & 0 deletions jdk/test/sun/jvmstat/monitor/HostIdentifier/testcases
Original file line number Diff line number Diff line change
Expand Up @@ -218,4 +218,18 @@ special syntax - not a valid URI, but allowed by HostIdentifier
<HostIdentifier> rmi://10.0.0.1:1234 </HostIdentifier>
</testcase>

<testcase id="31" HostIdentifierInput="12345">
<description>
Purely numeric
</description>
<HostIdentifier> //12345 </HostIdentifier>
</testcase>

<testcase id="32" HostIdentifierInput="12345:123">
<description>
Purely numeric
</description>
<HostIdentifier> //12345:123 </HostIdentifier>
</testcase>

</HostIdentifierTests>