Program: 88765
Project: 88765
Buggy source:
Path extractDriver(Driver driver,Path fileToExtract) throws MojoExecutionException {
  String fileExtension=FilenameUtils.getExtension(fileToExtract.toString());
  try {
switch (fileExtension) {
case "String_Node_Str":
      mojo.getLog().info("String_Node_Str" + quote(fileToExtract) + "String_Node_Str");
    String extractedFilename=FilenameUtils.getBaseName(fileToExtract.toString());
  Path extractedFile=Paths.get(mojo.tempDirectory.getPath(),extractedFilename);
try (FileInputStream fin=new FileInputStream(fileToExtract.toFile())){
  try (BufferedInputStream bin=new BufferedInputStream(fin)){
    try (BZip2CompressorInputStream input=new BZip2CompressorInputStream(bin)){
      FileUtils.copyInputStreamToFile(input,extractedFile.toFile());
    }
   }
 }
 decideToDeleteFile(fileToExtract);
return extractDriver(driver,extractedFile);
case "String_Node_Str":
mojo.getLog().info("String_Node_Str" + quote(fileToExtract) + "String_Node_Str");
String extractedFromGzFilename=FilenameUtils.getBaseName(fileToExtract.toString());
Path extractedFromGzFile=Paths.get(mojo.tempDirectory.getPath(),extractedFromGzFilename);
try (FileInputStream fin=new FileInputStream(fileToExtract.toFile())){
try (BufferedInputStream bin=new BufferedInputStream(fin)){
try (GzipCompressorInputStream input=new GzipCompressorInputStream(bin)){
File file=new File(extractedFromGzFile.toFile(),extractedFromGzFilename);
if (!extractedFromGzFile.toFile().mkdirs()) {
throw new RuntimeException("String_Node_Str" + quote(extractedFromGzFile) + "String_Node_Str");
}
try (FileOutputStream out=new FileOutputStream(file)){
IOUtils.copy(input,out);
}
 }
 }
 }
 decideToDeleteFile(fileToExtract);
return extractedFromGzFile;
case "String_Node_Str":
case "String_Node_Str":
mojo.getLog().info("String_Node_Str" + quote(fileToExtract) + "String_Node_Str");
Path extractToDirectory=Paths.get(mojo.tempDirectory.getPath(),FilenameUtils.getBaseName(fileToExtract.toString()));
if (!extractToDirectory.toFile().mkdirs()) {
throw new RuntimeException("String_Node_Str" + quote(extractToDirectory) + "String_Node_Str");
}
Pattern pattern=null;
if (null != driver.getFileMatchInside()) {
pattern=Pattern.compile(driver.getFileMatchInside());
}
try (FileInputStream fin=new FileInputStream(fileToExtract.toFile())){
try (BufferedInputStream bin=new BufferedInputStream(fin)){
try (ArchiveInputStream aiStream=new ArchiveStreamFactory().createArchiveInputStream(fileExtension,bin)){
ArchiveEntry entry;
while ((entry=aiStream.getNextEntry()) != null) {
String name=entry.getName();
if (pattern != null && entry.isDirectory()) {
}
 else if (entry.isDirectory()) {
File directory=new File(extractToDirectory.toFile(),name);
if (!directory.mkdirs()) {
throw new RuntimeException("String_Node_Str" + quote(directory));
}
}
 else {
File file=null;
if (entry instanceof TarArchiveEntry) {
TarArchiveEntry archiveEntry=(TarArchiveEntry)entry;
if (archiveEntry.isFile()) {
file=new File(extractToDirectory.toFile(),name);
}
}
 else if (entry instanceof ZipArchiveEntry) {
ZipArchiveEntry archiveEntry=(ZipArchiveEntry)entry;
if (!archiveEntry.isUnixSymlink()) {
file=new File(extractToDirectory.toFile(),name);
}
}
if (pattern != null) {
if (pattern.matcher(name).matches()) {
file=new File(extractToDirectory.toFile(),FilenameUtils.getName(name));
}
 else {
file=null;
}
}
if (file != null) {
try (OutputStream out=new FileOutputStream(file)){
IOUtils.copy(aiStream,out);
}
 }
}
}
decideToDeleteFile(fileToExtract);
return extractToDirectory;
}
 }
 }
 case "String_Node_Str":
case "String_Node_Str":
mojo.getLog().info("String_Node_Str" + quote(fileToExtract) + "String_Node_Str");
Path copyToDirectory=Paths.get(mojo.tempDirectory.getPath(),FilenameUtils.getName(fileToExtract.toString()));
FileUtils.copyFile(fileToExtract.toFile(),copyToDirectory.toFile());
decideToDeleteFile(fileToExtract);
return mojo.tempDirectory.toPath();
default :
throw new UnsupportedOperationException("String_Node_Str" + fileExtension);
}
}
 catch (Exception e) {
throw new InstallDriversMojoExecutionException("String_Node_Str" + quote(fileToExtract) + "String_Node_Str"+ e.getMessage(),e,mojo,driver);
}
}

Fixed version (ground truth):
Path extractDriver(Driver driver,Path fileToExtract) throws MojoExecutionException {
  String fileExtension=FilenameUtils.getExtension(fileToExtract.toString());
  try {
switch (fileExtension) {
case "String_Node_Str":
      mojo.getLog().info("String_Node_Str" + quote(fileToExtract) + "String_Node_Str");
    String extractedFilename=FilenameUtils.getBaseName(fileToExtract.toString());
  Path extractedFile=Paths.get(mojo.tempDirectory.getPath(),extractedFilename);
try (FileInputStream fin=new FileInputStream(fileToExtract.toFile())){
  try (BufferedInputStream bin=new BufferedInputStream(fin)){
    try (BZip2CompressorInputStream input=new BZip2CompressorInputStream(bin)){
      FileUtils.copyInputStreamToFile(input,extractedFile.toFile());
    }
   }
 }
 decideToDeleteFile(fileToExtract);
return extractDriver(driver,extractedFile);
case "String_Node_Str":
mojo.getLog().info("String_Node_Str" + quote(fileToExtract) + "String_Node_Str");
String extractedFromGzFilename=FilenameUtils.getBaseName(fileToExtract.toString());
Path extractedFromGzFile=Paths.get(mojo.tempDirectory.getPath(),extractedFromGzFilename);
try (FileInputStream fin=new FileInputStream(fileToExtract.toFile())){
try (BufferedInputStream bin=new BufferedInputStream(fin)){
try (GzipCompressorInputStream input=new GzipCompressorInputStream(bin)){
File file=new File(extractedFromGzFile.toFile(),extractedFromGzFilename);
if (!extractedFromGzFile.toFile().mkdirs()) {
throw new RuntimeException("String_Node_Str" + quote(extractedFromGzFile) + "String_Node_Str");
}
try (FileOutputStream out=new FileOutputStream(file)){
IOUtils.copy(input,out);
}
 }
 }
 }
 decideToDeleteFile(fileToExtract);
return extractedFromGzFile;
case "String_Node_Str":
case "String_Node_Str":
mojo.getLog().info("String_Node_Str" + quote(fileToExtract) + "String_Node_Str");
Path extractToDirectory=Paths.get(mojo.tempDirectory.getPath(),FilenameUtils.getBaseName(fileToExtract.toString()));
if (!extractToDirectory.toFile().mkdirs()) {
throw new RuntimeException("String_Node_Str" + quote(extractToDirectory) + "String_Node_Str");
}
Pattern pattern=null;
if (null != driver.getFileMatchInside()) {
pattern=Pattern.compile(driver.getFileMatchInside());
}
try (FileInputStream fin=new FileInputStream(fileToExtract.toFile())){
try (BufferedInputStream bin=new BufferedInputStream(fin)){
try (ArchiveInputStream aiStream=new ArchiveStreamFactory().createArchiveInputStream(fileExtension,bin)){
ArchiveEntry entry;
while ((entry=aiStream.getNextEntry()) != null) {
String name=entry.getName();
if (pattern != null && entry.isDirectory()) {
}
 else if (entry.isDirectory()) {
File directory=new File(extractToDirectory.toFile(),name);
if (!directory.mkdirs()) {
throw new RuntimeException("String_Node_Str" + quote(directory));
}
}
 else {
File file=null;
if (entry instanceof TarArchiveEntry) {
TarArchiveEntry archiveEntry=(TarArchiveEntry)entry;
if (archiveEntry.isFile()) {
file=new File(extractToDirectory.toFile(),name);
}
}
 else if (entry instanceof ZipArchiveEntry) {
ZipArchiveEntry archiveEntry=(ZipArchiveEntry)entry;
if (!archiveEntry.isUnixSymlink()) {
file=new File(extractToDirectory.toFile(),name);
}
}
if (pattern != null) {
if (pattern.matcher(name).matches()) {
file=new File(extractToDirectory.toFile(),FilenameUtils.getName(name));
}
 else {
file=null;
}
}
if (file != null) {
try (OutputStream out=new FileOutputStream(file)){
IOUtils.copy(aiStream,out);
}
 }
}
}
decideToDeleteFile(fileToExtract);
return extractToDirectory;
}
 }
 }
 case "String_Node_Str":
case "String_Node_Str":
if (mojo.keepDownloadedWebdrivers) {
mojo.getLog().info("String_Node_Str" + quote(fileToExtract) + "String_Node_Str");
Path copyToDirectory=Paths.get(mojo.tempDirectory.getPath(),FilenameUtils.getName(fileToExtract.toString()));
FileUtils.copyFile(fileToExtract.toFile(),copyToDirectory.toFile());
decideToDeleteFile(fileToExtract);
return mojo.tempDirectory.toPath();
}
 else {
return fileToExtract;
}
default :
throw new UnsupportedOperationException("String_Node_Str" + fileExtension);
}
}
 catch (Exception e) {
throw new InstallDriversMojoExecutionException("String_Node_Str" + quote(fileToExtract) + "String_Node_Str"+ e.getMessage(),e,mojo,driver);
}
}