mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 08:14:09 -08:00
classlib: throw exception from URL constructor when invalid ':' provided
This commit is contained in:
parent
ce5e3bfeb7
commit
e4a408d26e
|
@ -72,7 +72,7 @@ public final class TURL implements Serializable {
|
|||
throw new TMalformedURLException(e.toString());
|
||||
}
|
||||
int startIPv6Addr = spec.indexOf('[');
|
||||
if (index >= 0) {
|
||||
if (index > 0) {
|
||||
if (startIPv6Addr == -1 || index < startIPv6Addr) {
|
||||
protocol = spec.substring(0, index);
|
||||
// According to RFC 2396 scheme part should match
|
||||
|
|
|
@ -228,6 +228,15 @@ public class URLTest {
|
|||
} catch (MalformedURLException e) {
|
||||
fail("Unexpected exception (jar protocol, relative path)" + e);
|
||||
}
|
||||
|
||||
// no protocol
|
||||
caught = false;
|
||||
try {
|
||||
u = new URL(":");
|
||||
} catch (MalformedURLException e) {
|
||||
caught = true;
|
||||
}
|
||||
assertTrue("7 Failed to throw MalformedURLException", caught);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue
Block a user