@Override public boolean checkEntry(String archivePath) throws ZipAbortException { mLogger.verbose("=> %s", archivePath); File duplicate = checkFileForDuplicate(archivePath); if (duplicate != null) { throw new DuplicateFileException(archivePath, duplicate, mInputFile); } else { mAddedFiles.put(archivePath, mInputFile); } return true; } }
@Override public boolean checkEntry(String archivePath) throws ZipAbortException { mLogger.verbose("=> %s", archivePath); File duplicate = checkFileForDuplicate(archivePath); if (duplicate != null) { // we have a duplicate but it might be the same source file, in this case, // we just ignore the duplicate, and of course, we don't add it again. File potentialDuplicate = new File(mInputFile, archivePath); if (!duplicate.getAbsolutePath().equals(potentialDuplicate.getAbsolutePath())) { throw new DuplicateFileException(archivePath, duplicate, mInputFile); } return false; } else { mAddedFiles.put(archivePath, mInputFile); } return true; } }
private void doAddFile(File file, String archivePath) throws DuplicateFileException, IOException { if (!mFileFilter.apply(archivePath)) { return; } mLogger.verbose("%1$s => %2$s", file, archivePath); // If a file has to be merged, write it to a file in the merging folder and add it later. if (!mMergeFiles.keySet().contains(archivePath)) { File duplicate = checkFileForDuplicate(archivePath); if (duplicate != null) { throw new DuplicateFileException(archivePath, duplicate, file); } } else { File mergingFile = mMergeFiles.get(archivePath); if (!mergingFile.getParentFile().exists()) { mergingFile.getParentFile().mkdirs(); } FileOutputStream fos = new FileOutputStream(mMergeFiles.get(archivePath), true); try { fos.write(Files.toByteArray(file)); } finally { fos.close(); } return; } mAddedFiles.put(archivePath, file); mBuilder.writeFile(file, archivePath); }
File duplicate = checkFileForDuplicate(archivePath); if (duplicate != null) { throw new DuplicateFileException(archivePath, duplicate, mInputFile);
.map(QualifiedContent::getFile) .collect(Collectors.toList()); throw new TransformException(new DuplicateFileException(key, sources));