[Demonstration 1]

[Buggy Method]
public String getArrivalTime(String Airline, String flightNum) throws IOException, com.amazonaws.util.json.JSONException {
    String airlineCode = null;
    URL url1 = new URL("https://iatacodes.org/api/v6/airlines?api_key=9661f1fe-2d46-490c-b475-161c41dd432d");
    URLConnection uc = url1.openConnection();
    uc.connect();
    StringBuilder JSON_DATA = new StringBuilder();
    BufferedReader br = new BufferedReader(new InputStreamReader(uc.getInputStream()));
    String l = null;
    while ((l = br.readLine()) != null) {
        JSON_DATA = JSON_DATA.append(l);
    }
    // br.close();
    System.out.println(JSON_DATA);
    com.amazonaws.util.json.JSONObject obj = new com.amazonaws.util.json.JSONObject(JSON_DATA.toString());
    JSONArray response = obj.getJSONArray("response");
    for (int i = 0; i < response.length(); i++) {
        JSONObject airline = response.getJSONObject(i);
        if (airline.getString("name").equalsIgnoreCase(Airline)) {
            airlineCode = airline.getString("code");
            System.out.println(airlineCode);
        }
    }
    String userPassword = "swarooprao:baf818d30d41d7670790c4112afd40501b4329fd";
    String encoding = new String(Base64.encodeBase64(userPassword.getBytes()));
    URL url0 = new URL("http://flightxml.flightaware.com/json/FlightXML2/InFlightInfo?ident=" + airlineCode + flightNum);
    uc = url0.openConnection();
    uc.setRequestProperty("Authorization", "Basic " + encoding);
    uc.connect();
    JSON_DATA = new StringBuilder();
    br = new BufferedReader(new InputStreamReader(uc.getInputStream()));
    l = null;
    while ((l = br.readLine()) != null) {
        JSON_DATA = JSON_DATA.append(l);
    }
    // br.close();
    System.out.println(JSON_DATA);
    obj = new com.amazonaws.util.json.JSONObject(JSON_DATA.toString());
    String faFlightID = obj.getJSONObject("InFlightInfoResult").getString("faFlightID");
    String airportID = obj.getJSONObject("InFlightInfoResult").getString("destination");
    URL url2 = new URL("http://flightxml.flightaware.com/json/FlightXML2/AirportInfo?airportCode=" + airportID);
    uc = url2.openConnection();
    uc.setRequestProperty("Authorization", "Basic " + encoding);
    uc.connect();
    JSON_DATA = new StringBuilder();
    br = new BufferedReader(new InputStreamReader(uc.getInputStream()));
    l = null;
    while ((l = br.readLine()) != null) {
        JSON_DATA = JSON_DATA.append(l);
    }
    // 1482572033
    System.out.println(JSON_DATA);
    obj = new com.amazonaws.util.json.JSONObject(JSON_DATA.toString());
    String timezone = obj.getJSONObject("AirportInfoResult").getString("timezone");
    System.out.println(timezone);
    URL url = new URL("http://flightxml.flightaware.com/json/FlightXML2/FlightInfoEx?ident=" + faFlightID);
    uc = url.openConnection();
    uc.setRequestProperty("Authorization", "Basic " + encoding);
    uc.connect();
    JSON_DATA = new StringBuilder();
    br = new BufferedReader(new InputStreamReader(uc.getInputStream()));
    l = null;
    while ((l = br.readLine()) != null) {
        JSON_DATA = JSON_DATA.append(l);
    }
    br.close();
    // 1482572033
    System.out.println(JSON_DATA);
    obj = new com.amazonaws.util.json.JSONObject(JSON_DATA.toString());
    String a = obj.getJSONObject("FlightInfoExResult").getJSONArray("flights").getJSONObject(0).getString("estimatedarrivaltime");
    System.out.println(a);
    Date date = new Date(Long.parseLong(a) * 1000);
    // SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy");
    SimpleDateFormat formatter = new SimpleDateFormat("hh:mm a");
    formatter.setTimeZone(TimeZone.getTimeZone(timezone));
    String time = formatter.format(date);
    return time;
}

[Buggy Hunk]
formatter.setTimeZone(TimeZone.getTimeZone(timezone));

[Patch]
formatter.setTimeZone(TimeZone.getTimeZone(timezone.substring(1)));

[Demonstration 2]

[Buggy Method]
@Test
public void updatePropertyToNodeInTransactionAndRollbackTest() {
    // given
    Session session = sessionPool.createSession();
    session.setTransactionManager(transactionManager);
    TransactionalGraphService transactionalGraphService = new TransactionalGraphService();
    Transaction tran1 = session.beginTransaction();
    transactionalGraphService.context(tran1).createNode(new Label("Person"), new Properties().add("name", "Adam", STRING));
    transactionalGraphService.context(tran1).commit();
    assertThat(transactionalGraphService.getPersistentNodeById(1).isPresent()).isTrue();
    //when
    Transaction tran2 = session.beginTransaction();
    transactionalGraphService.context(tran2).setProperty(1, new Property("name", STRING, "Bob"));
    Node readedNode = transactionalGraphService.context(tran2).getNodeById(1).get();
    assertThat(readedNode.getProperty("name").get()).isEqualTo(new Property("name", STRING, "Bob"));
    transactionalGraphService.context(tran2).rollback();
    // then
    assertThat(transactionalGraphService.getAllNodes()).hasSize(1);
    Optional<Node> nodeOptional = transactionalGraphService.getPersistentNodeById(1);
    assertThat(nodeOptional.get().getId()).isEqualTo(1);
    assertThat(nodeOptional.get().getLabel()).isEqualTo(new Label("Person"));
    assertThat(nodeOptional.get().hasProperty("name")).isTrue();
    assertThat(nodeOptional.get().getProperty("name").get()).isEqualTo(new Property("name", STRING, "Adam"));
    assertThat(nodeOptional.get().getRelationships()).isEmpty();
}

[Buggy Hunk]
assertThat(transactionalGraphService.getAllNodes()).hasSize(1);

[Patch]
assertThat(transactionalGraphService.getAllPersistentNodes()).hasSize(1);

[Demonstration 3]

[Buggy Method]
@Test
public void testCustomizeServletContainer() {
    env.setActiveProfiles(JHipsterConstants.SPRING_PROFILE_PRODUCTION);
    UndertowEmbeddedServletContainerFactory container = new UndertowEmbeddedServletContainerFactory();
    webConfigurer.customize(container);
    assertThat(container.getMimeMappings().get("abs")).isEqualTo("audio/x-mpeg");
    assertThat(container.getMimeMappings().get("html")).isEqualTo("text/html;charset=utf-8");
    assertThat(container.getMimeMappings().get("json")).isEqualTo("text/html;charset=utf-8");
    if (container.getDocumentRoot() != null) {
        assertThat(container.getDocumentRoot().getPath()).isEqualTo("target/www");
    }
    Builder builder = Undertow.builder();
    container.getBuilderCustomizers().forEach(c -> c.customize(builder));
    OptionMap.Builder serverOptions = (OptionMap.Builder) ReflectionTestUtils.getField(builder, "serverOptions");
    assertThat(serverOptions.getMap().get(UndertowOptions.ENABLE_HTTP2)).isNull();
}

[Buggy Hunk]
assertThat(container.getDocumentRoot().getPath()).isEqualTo("target/www");

[Patch]
assertThat(container.getDocumentRoot().getPath()).isEqualTo("target" + File.separator + "www");