net.lingala.zip4j.exception.ZipException Java Examples

The following examples show how to use net.lingala.zip4j.exception.ZipException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HeaderUtilTest.java    From zip4j with Apache License 2.0 6 votes vote down vote up
@Test
public void testGetFileHeaderWithExactMatch() throws ZipException {
  ZipModel zipModel = new ZipModel();
  CentralDirectory centralDirectory = new CentralDirectory();
  centralDirectory.setFileHeaders(Arrays.asList(
      generateFileHeader(null),
      generateFileHeader(""),
      generateFileHeader("SOME_OTHER_NAME"),
      generateFileHeader(FILE_NAME)
  ));
  zipModel.setCentralDirectory(centralDirectory);

  FileHeader fileHeader = HeaderUtil.getFileHeader(zipModel, FILE_NAME);
  assertThat(fileHeader).isNotNull();
  assertThat(fileHeader.getFileName()).isEqualTo(FILE_NAME);
}
 
Example #2
Source File: ZipFile.java    From zip4j with Apache License 2.0 6 votes vote down vote up
/**
 * Returns the comment set for the Zip file
 *
 * @return String
 * @throws ZipException
 */
public String getComment() throws ZipException {
  if (!zipFile.exists()) {
    throw new ZipException("zip file does not exist, cannot read comment");
  }

  readZipInfo();

  if (zipModel == null) {
    throw new ZipException("zip model is null, cannot read comment");
  }

  if (zipModel.getEndOfCentralDirectoryRecord() == null) {
    throw new ZipException("end of central directory record is null, cannot read comment");
  }

  return zipModel.getEndOfCentralDirectoryRecord().getComment();
}
 
Example #3
Source File: ApkFile.java    From apkfile with Apache License 2.0 6 votes vote down vote up
ApkFile(String apkPath, boolean parseCertificate) throws IOException, ZipException {
    zipFile = new ZipFile(apkPath);
    theFile = new File(apkPath);
    androidManifest = null;
    resources = null;
    entryNameToDex = new HashMap<>();
    entryNameToEntry = buildEntryNameToEntry(zipFile);

    if (parseCertificate) {
        try {
            parseCertificate();
        } catch (ParseException e) {
            logger.error("Exception parsing certificate", e);
        }
    } else {
        certificate = null;
    }
}
 
Example #4
Source File: Unzip.java    From AndroidZip with Apache License 2.0 6 votes vote down vote up
private long calculateTotalWork(ArrayList fileHeaders) throws ZipException {
	
	if (fileHeaders == null) {
		throw new ZipException("fileHeaders is null, cannot calculate total work");
	}
	
	long totalWork = 0;
	
	for (int i = 0; i < fileHeaders.size(); i++) {
		FileHeader fileHeader = (FileHeader)fileHeaders.get(i);
		if (fileHeader.getZip64ExtendedInfo() != null && 
				fileHeader.getZip64ExtendedInfo().getUnCompressedSize() > 0) {
			totalWork += fileHeader.getZip64ExtendedInfo().getCompressedSize();
		} else {
			totalWork += fileHeader.getCompressedSize();
		}
		
	}
	
	return totalWork;
}
 
Example #5
Source File: StandardEncrypter.java    From AndroidZip with Apache License 2.0 6 votes vote down vote up
private void init(char[] password, int crc) throws ZipException {
	if (password == null || password.length <= 0) {
		throw new ZipException("input password is null or empty, cannot initialize standard encrypter");
	}
	zipCryptoEngine.initKeys(password);
	headerBytes = generateRandomBytes(InternalZipConstants.STD_DEC_HDR_SIZE);
	// Initialize again since the generated bytes were encrypted.
	zipCryptoEngine.initKeys(password);
	
	headerBytes[InternalZipConstants.STD_DEC_HDR_SIZE - 1] = (byte)((crc >>> 24));
	headerBytes[InternalZipConstants.STD_DEC_HDR_SIZE - 2] = (byte)((crc >>> 16));
	
	if (headerBytes.length < InternalZipConstants.STD_DEC_HDR_SIZE) {
		throw new ZipException("invalid header bytes generated, cannot perform standard encryption");
	}
	
	encryptData(headerBytes);
}
 
Example #6
Source File: HeaderUtilTest.java    From zip4j with Apache License 2.0 6 votes vote down vote up
@Test
public void testGetIndexOfFileHeaderGetsIndexSuccessfully() throws ZipException {
  String fileNamePrefix = "FILE_NAME_";
  int numberOfEntriesToAdd = 10;
  List<FileHeader> fileHeadersInZipModel = generateFileHeaderWithFileNamesWithEmptyAndNullFileNames(fileNamePrefix, numberOfEntriesToAdd);
  ZipModel zipModel = new ZipModel();
  zipModel.getCentralDirectory().setFileHeaders(fileHeadersInZipModel);

  FileHeader fileHeaderToFind = new FileHeader();
  for (int i = 0; i < numberOfEntriesToAdd; i++) {
    fileHeaderToFind.setFileName(fileNamePrefix + i);
    assertThat(HeaderUtil.getIndexOfFileHeader(zipModel, fileHeaderToFind)).isEqualTo(i);
  }

  fileHeaderToFind.setFileName(fileNamePrefix + numberOfEntriesToAdd);
  assertThat(HeaderUtil.getIndexOfFileHeader(zipModel, fileHeaderToFind)).isEqualTo(-1);
}
 
Example #7
Source File: ZipFile.java    From zip4j with Apache License 2.0 6 votes vote down vote up
/**
 * Adds the folder in the given file object to the zip file. If zip file does not exist,
 * then a new zip file is created. If input folder is invalid then an exception
 * is thrown. Zip parameters for the files in the folder to be added can be set in
 * the input parameters
 *
 * @param folderToAdd
 * @param zipParameters
 * @throws ZipException
 */
public void addFolder(File folderToAdd, ZipParameters zipParameters) throws ZipException {
  if (folderToAdd == null) {
    throw new ZipException("input path is null, cannot add folder to zip file");
  }

  if (!folderToAdd.exists()) {
    throw new ZipException("folder does not exist");
  }

  if (!folderToAdd.isDirectory()) {
    throw new ZipException("input folder is not a directory");
  }

  if (!folderToAdd.canRead()) {
    throw new ZipException("cannot read input folder");
  }

  if (zipParameters == null) {
    throw new ZipException("input parameters are null, cannot add folder to zip file");
  }

  addFolder(folderToAdd, zipParameters, true);
}
 
Example #8
Source File: MiscZipFileIT.java    From zip4j with Apache License 2.0 6 votes vote down vote up
@Test
public void testSetCommentWithEmptyStringRemovesComment() throws ZipException {
  ZipFile zipFile = new ZipFile(generatedZipFile);
  zipFile.addFiles(FILES_TO_ADD);

  String comment = "SOME_COMMENT";
  zipFile.setComment(comment);
  assertThat(zipFile.getComment()).isEqualTo(comment);

  zipFile.setComment("");
  assertThat(zipFile.getComment()).isEqualTo("");

  //Make sure comment is empty and not null also when a new instance is now created
  zipFile = new ZipFile(generatedZipFile);
  assertThat(zipFile.getComment()).isEqualTo("");
}
 
Example #9
Source File: ZipUtil.java    From MonitorClient with Apache License 2.0 6 votes vote down vote up
/**
 * 添加文件夹到zip中
 * @data 2017年4月18日
 * @param inPath
 * @param storagePath
 * @param outPath
 * @param password
 * @return
 */
public static boolean addFoldInZip(String inPath,String storagePath,String outPath,String password) {
	try {
		ZipFile zipFile = new ZipFile(outPath);  
		ZipParameters parameters = new ZipParameters();       
		parameters.setCompressionMethod(Zip4jConstants.COMP_DEFLATE);         
		parameters.setCompressionLevel(Zip4jConstants.DEFLATE_LEVEL_NORMAL);
		parameters.setRootFolderInZip(storagePath);  ;  
		if(password!=null&&!password.equals("")){
			parameters.setEncryptFiles(true);  
			parameters.setEncryptionMethod(Zip4jConstants.ENC_METHOD_AES);  
			parameters.setAesKeyStrength(Zip4jConstants.AES_STRENGTH_256);  
			parameters.setPassword(password);  
		}
		zipFile.addFolder(inPath, parameters);  		
		return true;
	} catch (ZipException e) {
		e.printStackTrace();
		return false;
	}
}
 
Example #10
Source File: ZipFile.java    From AndroidZip with Apache License 2.0 6 votes vote down vote up
/**
 * Sets the password for the zip file
 * @param password
 * @throws ZipException
 */
public void setPassword(char[] password) throws ZipException {
	if (zipModel == null) {
		readZipInfo();
		if (zipModel == null) {
			throw new ZipException("Zip Model is null");
		}
	}
	
	if (zipModel.getCentralDirectory() == null || zipModel.getCentralDirectory().getFileHeaders() == null) {
		throw new ZipException("invalid zip file");
	}
	
	for (int i = 0; i < zipModel.getCentralDirectory().getFileHeaders().size(); i++) {
		if (zipModel.getCentralDirectory().getFileHeaders().get(i) != null) {
			if (((FileHeader)zipModel.getCentralDirectory().getFileHeaders().get(i)).isEncrypted()) {
				((FileHeader)zipModel.getCentralDirectory().getFileHeaders().get(i)).setPassword(password);
			}
		}
	}
}
 
Example #11
Source File: HeaderWriter.java    From AndroidZip with Apache License 2.0 6 votes vote down vote up
private byte[] byteArrayListToByteArray(List arrayList) throws ZipException {
	if (arrayList == null) {
		throw new ZipException("input byte array list is null, cannot conver to byte array");
	}
	
	if (arrayList.size() <= 0) {
		return null;
	}
	
	byte[] retBytes = new byte[arrayList.size()];
	
	for (int i = 0; i < arrayList.size(); i++) {
		retBytes[i] = Byte.parseByte((String)arrayList.get(i));
	}
	
	return retBytes;
}
 
Example #12
Source File: BuildTool.java    From thorntail with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
private void expandArtifact(File artifactFile) throws IOException {
    try {
        ZipFile zipFile = new ZipFile(artifactFile);
        for (FileHeader each : (List<FileHeader>) zipFile.getFileHeaders()) {
            String fileName = each.getFileName();
            if (fileName.startsWith("META-INF") && !fileName.startsWith("META-INF/versions")) {
                continue;
            }
            if (each.isDirectory()) {
                continue;
            }
            this.archive.add(new ZipFileHeaderAsset(zipFile, each), fileName);
        }
    } catch (ZipException e) {
        throw new IOException(e);
    }
}
 
Example #13
Source File: Zip4j.java    From maven-framework-project with MIT License 6 votes vote down vote up
/**
 * 示例2 创建压缩包添加文件到指定目录中进行压缩
 */
@Test
public void example2(){
	try {
           ZipFile zipFile = new ZipFile("src/main/resources/AddFilesDeflateComp.zip");
           ArrayList<File> filesToAdd = new ArrayList<File>();
           filesToAdd.add(new File("src/main/resources/sample.txt"));
           filesToAdd.add(new File("src/main/resources/zip4j.txt"));
           filesToAdd.add(new File("src/main/resources/zip4j-1.3.2.jar"));
            
           ZipParameters parameters = new ZipParameters();
           parameters.setCompressionMethod(Zip4jConstants.COMP_DEFLATE);
            
           parameters.setCompressionLevel(Zip4jConstants.DEFLATE_LEVEL_NORMAL);
           parameters.setRootFolderInZip("target/");

           zipFile.addFiles(filesToAdd, parameters);
       } catch (ZipException e) {
           e.printStackTrace();
       } 
}
 
Example #14
Source File: UnzipUtil.java    From zip4j with Apache License 2.0 6 votes vote down vote up
public static ZipInputStream createZipInputStream(ZipModel zipModel, FileHeader fileHeader, char[] password)
    throws IOException {

  SplitInputStream splitInputStream = null;
  try {
    splitInputStream = createSplitInputStream(zipModel);
    splitInputStream.prepareExtractionForFileHeader(fileHeader);

    ZipInputStream zipInputStream = new ZipInputStream(splitInputStream, password);
    if (zipInputStream.getNextEntry(fileHeader) == null) {
      throw new ZipException("Could not locate local file header for corresponding file header");
    }

    return zipInputStream;
  } catch (IOException e) {
    if (splitInputStream != null) {
      splitInputStream.close();
    }
    throw e;
  }
}
 
Example #15
Source File: MultDexSupport.java    From ApkToolPlus with Apache License 2.0 6 votes vote down vote up
protected List<File> unzipDexList(File apk, File tempDir){
    List<FileHeader> dexFileHeaders = MultDexSupport.getDexFileHeaders(apk);
    if(dexFileHeaders.isEmpty()){
        return new ArrayList<>(0);
    }
    // 解压dex文件
    tempDir.mkdirs();
    List<File> dexFileList = new ArrayList<>(dexFileHeaders.size());
    try {
        for(FileHeader dexFileHeader : dexFileHeaders){
            ZipFile zipFile = new ZipFile(apk);
            boolean unzip = ZipUtils.unzip(zipFile, dexFileHeader, tempDir);
            if(unzip){
                dexFileList.add(new File(tempDir,dexFileHeader.getFileName()));
            }
        }
        return dexFileList;
    } catch (ZipException e) {
        e.printStackTrace();
    }
    return new ArrayList<>(0);
}
 
Example #16
Source File: HeaderReaderIT.java    From zip4j with Apache License 2.0 5 votes vote down vote up
@Test
public void testReadAllWithoutFileHeaderSignatureThrowsException() throws IOException {
  ZipModel actualZipModel = generateZipModel(2);
  actualZipModel.getCentralDirectory().getFileHeaders().get(1).setSignature(HeaderSignature.DIGITAL_SIGNATURE);
  File headersFile = writeZipHeaders(actualZipModel);
  actualZipModel.setZipFile(headersFile);

  try(RandomAccessFile randomAccessFile = new RandomAccessFile(actualZipModel.getZipFile(),
      RandomAccessFileMode.READ.getValue())) {
    headerReader.readAllHeaders(randomAccessFile, null);
    fail("Should throw an exception");
  } catch (ZipException e) {
    assertThat(e.getMessage()).isEqualTo("Expected central directory entry not found (#2)");
  }
}
 
Example #17
Source File: HeaderReader.java    From zip4j with Apache License 2.0 5 votes vote down vote up
private void readZip64ExtendedInfo(FileHeader fileHeader, RawIO rawIO) throws ZipException {
  if (fileHeader.getExtraDataRecords() == null || fileHeader.getExtraDataRecords().size() <= 0) {
    return;
  }

  Zip64ExtendedInfo zip64ExtendedInfo = readZip64ExtendedInfo(fileHeader.getExtraDataRecords(), rawIO,
      fileHeader.getUncompressedSize(), fileHeader.getCompressedSize(), fileHeader.getOffsetLocalHeader(),
      fileHeader.getDiskNumberStart());

  if (zip64ExtendedInfo == null) {
    return;
  }

  fileHeader.setZip64ExtendedInfo(zip64ExtendedInfo);

  if (zip64ExtendedInfo.getUncompressedSize() != -1) {
    fileHeader.setUncompressedSize(zip64ExtendedInfo.getUncompressedSize());
  }

  if (zip64ExtendedInfo.getCompressedSize() != -1) {
    fileHeader.setCompressedSize(zip64ExtendedInfo.getCompressedSize());
  }

  if (zip64ExtendedInfo.getOffsetLocalHeader() != -1) {
    fileHeader.setOffsetLocalHeader(zip64ExtendedInfo.getOffsetLocalHeader());
  }

  if (zip64ExtendedInfo.getDiskNumberStart() != -1) {
    fileHeader.setDiskNumberStart(zip64ExtendedInfo.getDiskNumberStart());
  }
}
 
Example #18
Source File: ZipFileTest.java    From zip4j with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetInputStreamWhenFileHeaderIsNullThrowsException() throws IOException {
  expectedException.expectMessage("FileHeader is null, cannot get InputStream");
  expectedException.expect(ZipException.class);

  zipFile.getInputStream(null);
}
 
Example #19
Source File: RenameFilesInZipIT.java    From zip4j with Apache License 2.0 5 votes vote down vote up
@Test
public void testRenameSplitZipFileThrowsException() throws IOException {
  ZipFile zipFile = new ZipFile(generatedZipFile);
  zipFile.createSplitZipFile(Collections.singletonList(getTestFileFromResources("file_PDF_1MB.pdf")),
      new ZipParameters(), true, InternalZipConstants.MIN_SPLIT_LENGTH);

  expectedException.expect(ZipException.class);
  expectedException.expectMessage("Zip file format does not allow updating split/spanned files");

  zipFile.renameFile("file_PDF_1MB.pdf", "some_name.pdf");
}
 
Example #20
Source File: HeaderWriter.java    From AndroidZip with Apache License 2.0 5 votes vote down vote up
private int countNumberOfFileHeaderEntriesOnDisk(ArrayList fileHeaders, 
		int numOfDisk) throws ZipException {
	if (fileHeaders == null) {
		throw new ZipException("file headers are null, cannot calculate number of entries on this disk");
	}
	
	int noEntries = 0;
	for (int i = 0; i < fileHeaders.size(); i++) {
		FileHeader fileHeader = (FileHeader)fileHeaders.get(i);
		if (fileHeader.getDiskNumberStart() == numOfDisk) {
			noEntries++;
		}
	}
	return noEntries;
}
 
Example #21
Source File: ZipFile.java    From zip4j with Apache License 2.0 5 votes vote down vote up
/**
 * Adds the list of input files to the zip file. If zip file does not exist, then
 * this method creates a new zip file. Parameters such as compression type, etc
 * can be set in the input parameters.
 *
 * @param filesToAdd
 * @param parameters
 * @throws ZipException
 */
public void addFiles(List<File> filesToAdd, ZipParameters parameters) throws ZipException {

  if (filesToAdd == null || filesToAdd.size() == 0) {
    throw new ZipException("input file List is null or empty");
  }

  if (parameters == null) {
    throw new ZipException("input parameters are null");
  }

  if (progressMonitor.getState() == ProgressMonitor.State.BUSY) {
    throw new ZipException("invalid operation - Zip4j is in busy state");
  }

  readZipInfo();

  if (zipModel == null) {
    throw new ZipException("internal error: zip model is null");
  }

  if (zipFile.exists() && zipModel.isSplitArchive()) {
    throw new ZipException("Zip file already exists. Zip file format does not allow updating split/spanned files");
  }

  new AddFilesToZipTask(zipModel, password, headerWriter, buildAsyncParameters()).execute(
      new AddFilesToZipTaskParameters(filesToAdd, parameters, charset));
}
 
Example #22
Source File: Zip4jUtil.java    From AndroidZip with Apache License 2.0 5 votes vote down vote up
/**
 * returns the length of the string by wrapping it in a byte buffer with
 * the appropriate charset of the input string and returns the limit of the 
 * byte buffer
 * @param str
 * @return length of the string
 * @throws ZipException
 */
public static int getEncodedStringLength(String str) throws ZipException {
	if (!isStringNotNullAndNotEmpty(str)) {
		throw new ZipException("input string is null, cannot calculate encoded String length");
	}
	
	String charset = detectCharSet(str);
	return getEncodedStringLength(str, charset);
}
 
Example #23
Source File: FileHeaderFactoryTest.java    From zip4j with Apache License 2.0 5 votes vote down vote up
@Test
public void testVersionMadeByWindowsWithUnixModeOn() throws ZipException {
  changeOsSystemPropertyToWindows();
  ZipParameters zipParameters = generateZipParameters();
  zipParameters.setUnixMode(true);
  testVersionMadeBy(zipParameters, 819);
}
 
Example #24
Source File: UnzipUtil.java    From AndroidZip with Apache License 2.0 5 votes vote down vote up
public static void applyFileAttributes(FileHeader fileHeader, File file,
		UnzipParameters unzipParameters) throws ZipException{
	
	if (fileHeader == null) {
		throw new ZipException("cannot set file properties: file header is null");
	}
	
	if (file == null) {
		throw new ZipException("cannot set file properties: output file is null");
	}
	
	if (!Zip4jUtil.checkFileExists(file)) {
		throw new ZipException("cannot set file properties: file doesnot exist");
	}
	
	if (unzipParameters == null || !unzipParameters.isIgnoreDateTimeAttributes()) {
		setFileLastModifiedTime(fileHeader, file);
	}
	
	if (unzipParameters == null) {
		setFileAttributes(fileHeader, file, true, true, true, true);
	} else {
		if (unzipParameters.isIgnoreAllFileAttributes()) {
			setFileAttributes(fileHeader, file, false, false, false, false);
		} else {
			setFileAttributes(fileHeader, file, !unzipParameters.isIgnoreReadOnlyFileAttribute(),
					!unzipParameters.isIgnoreHiddenFileAttribute(), 
					!unzipParameters.isIgnoreArchiveFileAttribute(),
					!unzipParameters.isIgnoreSystemFileAttribute());
		}
	}
}
 
Example #25
Source File: FileUtilsTest.java    From zip4j with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetZipFileNameWithoutExtensionThrowsExceptionWhenEmpty() throws ZipException {
  expectedException.expectMessage("zip file name is empty or null, cannot determine zip file name");
  expectedException.expect(ZipException.class);

  FileUtils.getZipFileNameWithoutExtension("");
}
 
Example #26
Source File: HeaderWriter.java    From AndroidZip with Apache License 2.0 5 votes vote down vote up
private void copyByteArrayToArrayList(byte[] byteArray, List arrayList) throws ZipException {
	if (arrayList == null || byteArray == null) {
		throw new ZipException("one of the input parameters is null, cannot copy byte array to array list");
	}
	
	for (int i = 0; i < byteArray.length; i++) {
		arrayList.add(Byte.toString(byteArray[i]));
	}
}
 
Example #27
Source File: SplitOutputStream.java    From AndroidZip with Apache License 2.0 5 votes vote down vote up
/**
 * Checks if the given buffer size will be fit in the current split file.
 * If this output stream is a non-split file, then this method always returns true
 * @param bufferSize
 * @return true if the buffer size is fit in the current split file or else false.
 * @throws ZipException
 */
public boolean isBuffSizeFitForCurrSplitFile(int bufferSize) throws ZipException {
	if (bufferSize < 0) {
		throw new ZipException("negative buffersize for isBuffSizeFitForCurrSplitFile");
	}
	
	if (splitLength >= InternalZipConstants.MIN_SPLIT_LENGTH) {
		return (bytesWrittenForThisPart + bufferSize <= splitLength);
	} else {
		//Non split zip -- return true
		return true;
	}
}
 
Example #28
Source File: JiaGu.java    From ApkToolPlus with Apache License 2.0 5 votes vote down vote up
/**
 * 加密dex
 *
 * @param decompileDir
 * @return
 */
private static boolean encryptDex(File apk, File decompileDir) {

    File dexFile = new File(decompileDir, "classes.dex");
    if (dexFile.exists()) {
        dexFile.delete();
    }

    try {
        // 解压apk中的classes.dex
        ZipFile zipFile = new ZipFile(apk);
        ZipUtils.unzip(zipFile, "classes.dex", dexFile.getParentFile());
    } catch (ZipException e) {
        e.printStackTrace();
        return false;
    }

    File assets = new File(decompileDir, "assets");
    assets.mkdirs();

    File encryptFile = new File(assets, JIAGU_DATA_BIN);
    encryptFile.delete();

    EncryptUtils.encrypt(dexFile, encryptFile);
    dexFile.delete();

    return true;
}
 
Example #29
Source File: FileUtilsTest.java    From zip4j with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetZipFileNameWithoutExtensionThrowsExceptionWhenNull() throws ZipException {
  expectedException.expectMessage("zip file name is empty or null, cannot determine zip file name");
  expectedException.expect(ZipException.class);

  FileUtils.getZipFileNameWithoutExtension(null);
}
 
Example #30
Source File: MiscZipFileIT.java    From zip4j with Apache License 2.0 5 votes vote down vote up
@Test
public void testZipSlipFix() throws Exception {
  ZipParameters zipParameters = new ZipParameters();
  zipParameters.setFileNameInZip("../../bad.txt");

  ZipFile zip = new ZipFile(generatedZipFile);
  zip.addFile(TestUtils.getTestFileFromResources("sample_text1.txt"), zipParameters);

  try {
    zip.extractAll(outputFolder.getAbsolutePath());
    fail("zip4j is vulnerable for slip zip");
  } catch (ZipException e) {
    assertThat(e).hasMessageStartingWith("illegal file name that breaks out of the target directory: ");
  }
}