Java 类org.eclipse.jgit.api.errors.PatchApplyException 实例源码

项目:IodineToolkit    文件:PatchService.java   
public boolean applyPatches() throws Exception {
    git.reset().setMode(ResetCommand.ResetType.HARD).setRef(getSrcCommit().getName()).call();
    File[] patchFiles = patchDirectory.listFiles(((dir, name) -> name.endsWith(".patch"))
    ) != null ? patchDirectory.listFiles(((dir, name) -> name.endsWith(".patch"))) : new
            File[0];
    boolean allPatchesApplied = true;
    for (File patchFile : patchFiles) {
        try {
            git.apply().setPatch(new FileInputStream(patchFile)).call();
        }catch(PatchApplyException e) {
            allPatchesApplied = false;
            System.out.println("Failed to apply patch "+patchFile.getName()+". " + e.getMessage());
        }
    }
    return allPatchesApplied;
}