[Demonstration 1]

[Buggy Method]
@Override
public List<String> getChapterImages(final MangaChapter chapter) throws RepositoryException {
    String uri = baseUri + chapter.getUri();
    byte[] bytes = new byte[1024];
    List<String> imageUrls = null;
    LinesSearchInputStream inputStream = null;
    try {
        HttpGet request = new HttpGet(uri);
        HttpResponse response = loadPage(request);
        byte[] result = IoUtils.convertStreamToBytes(response.getEntity().getContent());
        String responseString = IoUtils.convertBytesToString(result);
        InputStream stringStream = new ByteArrayInputStream(responseString.getBytes());
        inputStream = new LinesSearchInputStream(stringStream, "var lstImages = new Array();", "var currImage = 0;");
        int status = LinesSearchInputStream.SEARCHING;
        while (status == LinesSearchInputStream.SEARCHING) {
            status = inputStream.read(bytes);
        }
        bytes = inputStream.getResult();
        String str = IoUtils.convertBytesToString(bytes);
        imageUrls = extractUrls(str);
    } catch (IOException e) {
        Log.d(TAG, e.getMessage());
        throw new RepositoryException(e.getMessage());
    } finally {
        if (inputStream != null) {
            try {
                inputStream.close();
            } catch (IOException e) {
                Log.d(TAG, e.getMessage());
            }
        }
    }
    return imageUrls;
}

[Buggy Hunk]
imageUrls = extractUrls(str);

[Patch]
imageUrls = decrypt(extractUrls(str));

[Demonstration 2]

[Buggy Method]
public String readConstLengthString(int length) throws IOException {
    byte[] string = new byte[length];
    this.inputStream.read(string);
    return new String(string, charset);
}

[Buggy Hunk]
this.inputStream.read(string);

[Patch]
this.read(string);

[Demonstration 3]

[Buggy Method]
@Test
public void test_image_upload_overwrite() {
    ImageUploader uploader = new ImageUploader(Mediator.url);
    String token = uploader.loginAsAdmin(Mediator.adminUsername, Mediator.adminPassword);
    if (token != null && !token.equals("")) {
        ProductPage page = uploader.page(0, 10);
        uploader.uploadJpeg(page, product -> {
            long productId = product.getId();
            long imageId = (productId % 6 + 1);
            String imageName = "/tmp/images" + imageId + ".jpg";
            return Arrays.asList(imageName);
        }, true);
    }
}

[Buggy Hunk]
if(token != null && !token.equals("")) {

[Patch]
if(!StringUtils.isEmpty(token)) {