[Demonstration 1]

[Buggy Method]
@Test
public void testHttpAbsoluteURL2() throws Throwable {
    final Request req = new RequestBuilder().url("https://playframework.com/playframework").build();
    final TestCall call = new TestCall("/url", "GET");
    assertEquals("Absolute URL should have HTTP scheme", "http://playframework.com/url", call.absoluteURL(req, false));
}

[Buggy Hunk]
.url("https://playframework.com/playframework").build();

[Patch]
.uri("https://playframework.com/playframework").build();

[Demonstration 2]

[Buggy Method]
@Test
public void testJson() throws Exception {
    URL url = getClass().getResource("repo.json");
    JsonRepository repo = new JsonRepository(url.toExternalForm());
    verify(repo);
}

[Buggy Hunk]
JsonRepository repo = new JsonRepository(url.toExternalForm());

[Patch]
JsonRepository repo = new JsonRepository(url.toExternalForm(), 0, false);

[Demonstration 3]

[Buggy Method]
static String resolve(String context, String spec) {
    // TODO: test!
    try {
        URL cUrl = new URL(context);
        URL url = new URL(cUrl, spec);
        // this constructor escapes its arguments, if necessary
        URI uri = new URI(url.getProtocol(), url.getHost(), url.getPath(), url.getQuery(), url.getRef());
        return uri.toASCIIString();
    } catch (URISyntaxException e) {
    } catch (MalformedURLException e) {
    } catch (NullPointerException e) {
    }
    return spec;
}

[Buggy Hunk]
URI uri = new URI(url.getProtocol(), url.getHost(), url.getPath(), url.getQuery(), url.getRef());

[Patch]
URI uri = new URI(url.getProtocol(), url.getUserInfo(), url.getHost(), url.getPort(), url.getPath(), url.getQuery(), url.getRef());