[Demonstration 1]

[Buggy Method]
@RequestMapping(value = "/list", method = RequestMethod.GET)
public ResponseEntity<Map<String, Object>> getAll() {
    LOG.info("getting all stores");
    List<Store> stores = storeService.getStores();
    if (stores == null || stores.isEmpty()) {
        LOG.info("no stores found");
        //TODO: No content is weird :( let's return an empty list
        //return new ResponseEntity<List<Store>>(HttpStatus.NO_CONTENT);
    }
    //TODO: I'm trying to modify the response this way: { "stores":[ { store1},...], "otherparams": {}}
    //TODO: As mentioned, it would need to go into some functions / class
    Map<String, Object> results = new HashMap<String, Object>();
    results.put("stores", stores);
    results.put("messages", "OK");
    return new ResponseEntity(results, HttpStatus.OK);
}

[Buggy Hunk]
List<Store> stores = storeService.getStores();

[Patch]
List<Store> stores = storeService.getAllStores();

[Demonstration 2]

[Buggy Method]
public Span[] sentPosDetect(String s) {
    List<Span> sentences = new ArrayList<Span>();
    int start = 0;
    for (int i = 0; i < s.length(); i++) {
        char c = s.charAt(i);
        if (c == '\n' || c == '\r') {
            if (start - i > 0) {
                Span span = new Span(start, i).trim(s);
                if (span.length() > 0) {
                    sentences.add(span);
                }
                start = i + 1;
            }
        }
    }
    if (s.length() - start > 0) {
        Span span = new Span(start, s.length()).trim(s);
        if (span.length() > 0) {
            sentences.add(span);
        }
    }
    return sentences.toArray(new Span[sentences.size()]);
}

[Buggy Hunk]
if (start - i > 0) {

[Patch]
if (i - start > 0) {

[Demonstration 3]

[Buggy Method]
public static void main(String[] args) throws IOException {
    JSONConfigurationFile configFile = new JSONConfigurationFile();
    String hostName = null;
    ArrayList<Antenna> antennaList = null;
    ServerInfo serverInfo = null;
    try {
        configFile.loadConfiguration();
        hostName = configFile.getHostname();
        antennaList = configFile.getAntennaList();
        serverInfo = configFile.getServerInfo();
    } catch (LoadCancelledException e) {
        e.printStackTrace();
    }
    configFile.saveConfiguration(hostName, Antenna.toListOfStringArrays(antennaList), serverInfo.toStringList());
    configFile.displayErrorBox("Opening File", "Error message goes here");
    configFile.getConfigFilePath();
    //String savePath = configFile.saveFile();
    //FileWriter writer = new FileWriter(savePath);
    //writer.write("Test 2");
    //writer.flush();
    //writer.close();
}

[Buggy Hunk]
configFile.saveConfiguration(hostName, Antenna.toListOfStringArrays(antennaList), serverInfo.toStringList());

[Patch]
configFile.saveConfiguration(hostName, antennaList, serverInfo);