mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 10:17:41 +00:00
Text FileReport added to databse. Logger format changed
This commit is contained in:
parent
52c9e16f5a
commit
67ff3ee7cd
@ -25,6 +25,8 @@ import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.InvalidPathException;
|
||||
import java.nio.file.Paths;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.GregorianCalendar;
|
||||
@ -1163,7 +1165,14 @@ public class Case implements SleuthkitCase.ErrorObserver {
|
||||
* @throws TskCoreException
|
||||
*/
|
||||
public void addReport(String localPath, String srcModuleName, String reportName) throws TskCoreException {
|
||||
Report report = this.db.addReport(localPath, srcModuleName, reportName);
|
||||
String normalizedLocalPath;
|
||||
try {
|
||||
normalizedLocalPath = Paths.get(localPath).normalize().toString();
|
||||
} catch (InvalidPathException ex) {
|
||||
logger.log(Level.WARNING, "Invalid local path provided: " + localPath, ex);
|
||||
normalizedLocalPath = localPath;
|
||||
}
|
||||
Report report = this.db.addReport(normalizedLocalPath, srcModuleName, reportName);
|
||||
try {
|
||||
Case.pcs.firePropertyChange(Events.REPORT_ADDED.toString(), null, report);
|
||||
} catch (Exception ex) {
|
||||
|
@ -79,7 +79,7 @@ public final class Logger extends java.util.logging.Logger {
|
||||
+ record.getSourceMethodName() + "\n"
|
||||
+ record.getLevel() + ": "
|
||||
+ this.formatMessage(record) + "\n"
|
||||
+ record.getThrown().toString() + ": "
|
||||
+ record.getThrown().toString() + ":\n"
|
||||
+ StackTrace
|
||||
+ "\n";
|
||||
} else {
|
||||
|
@ -30,7 +30,9 @@ import java.util.logging.Level;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
|
||||
import org.openide.util.NbBundle;
|
||||
import org.sleuthkit.autopsy.casemodule.Case;
|
||||
import org.sleuthkit.datamodel.AbstractFile;
|
||||
import org.sleuthkit.datamodel.TskCoreException;
|
||||
|
||||
/**
|
||||
* A Tab-delimited text report of the files in the case.
|
||||
@ -68,8 +70,13 @@ import org.sleuthkit.datamodel.AbstractFile;
|
||||
if (out != null) {
|
||||
try {
|
||||
out.close();
|
||||
Case.getCurrentCase().addReport(reportPath, NbBundle.getMessage(this.getClass(),
|
||||
"FileReportText.getName.text"), "");
|
||||
} catch (IOException ex) {
|
||||
logger.log(Level.WARNING, "Could not close output writer when ending report.", ex); //NON-NLS
|
||||
} catch (TskCoreException ex) {
|
||||
String errorMessage = String.format("Error adding %s to case as a report", reportPath); //NON-NLS
|
||||
logger.log(Level.SEVERE, errorMessage, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user