mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 16:14:10 -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());
|
throw new TMalformedURLException(e.toString());
|
||||||
}
|
}
|
||||||
int startIPv6Addr = spec.indexOf('[');
|
int startIPv6Addr = spec.indexOf('[');
|
||||||
if (index >= 0) {
|
if (index > 0) {
|
||||||
if (startIPv6Addr == -1 || index < startIPv6Addr) {
|
if (startIPv6Addr == -1 || index < startIPv6Addr) {
|
||||||
protocol = spec.substring(0, index);
|
protocol = spec.substring(0, index);
|
||||||
// According to RFC 2396 scheme part should match
|
// According to RFC 2396 scheme part should match
|
||||||
|
|
|
@ -228,6 +228,15 @@ public class URLTest {
|
||||||
} catch (MalformedURLException e) {
|
} catch (MalformedURLException e) {
|
||||||
fail("Unexpected exception (jar protocol, relative path)" + 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
|
@Test
|
||||||
|
|
Loading…
Reference in New Issue
Block a user