Source:
private void addExtractedFiles(File src, Path resultsPath, List<Content> newDataSources) throws TskCoreException, IOException { SleuthkitCase skCase = Case.getCurrentCase().getSleuthkitCase(); SleuthkitCase.CaseDbTransaction trans = null; try { trans = skCase.beginTransaction(); LocalFilesDataSource localFilesDataSource = skCase.addLocalFilesDataSource(deviceId, this.src.getName(), timeZone, trans); LocalFileImporter fileImporter = new LocalFileImporter(skCase, trans); try (BufferedReader br = new BufferedReader(new InputStreamReader( new FileInputStream(resultsPath.toFile()), "UTF8"))) { String line; br.readLine(); int lineNumber = 2; while ((line = br.readLine()) != null) { if (cancelled) { rollbackTransaction(trans); return; } String[] fields = line.split("\t", -1); if (fields.length != 14) { rollbackTransaction(trans); throw new IOException(Bundle.AddLogicalImageTask_notEnoughFields(lineNumber, fields.length, 14)); } String vhdFilename = fields[0]; String filename = fields[7]; String parentPath = fields[8]; String extractedFilePath = fields[9]; String crtime = fields[10]; String mtime = fields[11]; String atime = fields[12]; String ctime = fields[13]; parentPath = ROOT_STR + "/" + vhdFilename + "/" + parentPath; if (lineNumber % 100 == 0) { progressMonitor.setProgressText(Bundle.AddLogicalImageTask_addingExtractedFile(lineNumber, totalFiles)); } fileImporter.addLocalFile( Paths.get(src.toString(), extractedFilePath).toFile(), filename, parentPath, Long.parseLong(ctime), Long.parseLong(crtime), Long.parseLong(atime), Long.parseLong(mtime), localFilesDataSource); lineNumber++; } } trans.commit(); newDataSources.add(localFilesDataSource); } catch (NumberFormatException | TskCoreException ex) { LOGGER.log(Level.SEVERE, "Error adding extracted files", ex); rollbackTransaction(trans); throw new TskCoreException(Bundle.AddLogicalImageTask_errorAddingExtractedFiles(), ex); } }

Target:
private void addExtractedFiles(File src, Path resultsPath, List<Content> newDataSources) throws TskCoreException, IOException { SleuthkitCase skCase = Case.getCurrentCase().getSleuthkitCase(); SleuthkitCase.CaseDbTransaction trans = null; try { trans = skCase.beginTransaction(); LocalFilesDataSource localFilesDataSource = skCase.addLocalFilesDataSource(deviceId, this.src.getName(), timeZone, trans); LocalFileImporter fileImporter = new LocalFileImporter(skCase, trans); try (BufferedReader br = new BufferedReader(new InputStreamReader( new FileInputStream(resultsPath.toFile()), "UTF8"))) { String line; br.readLine(); int lineNumber = 2; while ((line = br.readLine()) != null) { if (cancelled) { rollbackTransaction(trans); return; } String[] fields = line.split("\t", -1); if (fields.length != 14) { rollbackTransaction(trans); throw new IOException(Bundle.AddLogicalImageTask_notEnoughFields(lineNumber, fields.length, 14)); } String vhdFilename = fields[0]; String filename = fields[7]; String parentPath = fields[8]; String extractedFilePath = fields[9]; String crtime = fields[10]; String mtime = fields[11]; String atime = fields[12]; String ctime = fields[13]; parentPath = ROOT_STR + "/" + vhdFilename + "/" + parentPath; if (lineNumber % 100 == 0) { progressMonitor.setProgressText(Bundle.AddLogicalImageTask_addingExtractedFile(lineNumber, totalFiles)); } fileImporter.addLocalFile( Paths.get(src.toString(), extractedFilePath).toFile(), filename, parentPath, Long.parseLong(ctime), Long.parseLong(crtime), Long.parseLong(atime), Long.parseLong(mtime), localFilesDataSource); lineNumber++; } } trans.commit(); newDataSources.add(localFilesDataSource); } catch (NumberFormatException | TskCoreException ex) { LOGGER.log(Level.SEVERE, "Error adding extracted files", ex); rollbackTransaction(trans); throw new TskCoreException("Error adding extracted files", ex); } }