mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-06 21:00:22 +00:00
Address codacy errors and netbeans suggestions in FileExportRuleSet.java, array now coppied
This commit is contained in:
parent
daef5d4355
commit
dfeeb60367
@ -48,7 +48,7 @@ final class FileExportRuleSet implements Serializable, Comparable<FileExportRule
|
|||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
private String name;
|
private String name;
|
||||||
private final TreeMap<String, Rule> rules;
|
private final Map<String, Rule> rules;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs an empty named set of uniquely named rules.
|
* Constructs an empty named set of uniquely named rules.
|
||||||
@ -390,13 +390,18 @@ final class FileExportRuleSet implements Serializable, Comparable<FileExportRule
|
|||||||
List<Long> evaluate(long dataSourceId) throws ExportRulesException {
|
List<Long> evaluate(long dataSourceId) throws ExportRulesException {
|
||||||
try {
|
try {
|
||||||
SleuthkitCase db = Case.getCurrentCaseThrows().getSleuthkitCase();
|
SleuthkitCase db = Case.getCurrentCaseThrows().getSleuthkitCase();
|
||||||
|
ResultSet resultSet = null;
|
||||||
try (SleuthkitCase.CaseDbQuery queryResult = db.executeQuery(getQuery(dataSourceId))) {
|
try (SleuthkitCase.CaseDbQuery queryResult = db.executeQuery(getQuery(dataSourceId))) {
|
||||||
ResultSet resultSet = queryResult.getResultSet();
|
resultSet = queryResult.getResultSet();
|
||||||
List<Long> fileIds = new ArrayList<>();
|
List<Long> fileIds = new ArrayList<>();
|
||||||
while (resultSet.next()) {
|
while (resultSet.next()) {
|
||||||
fileIds.add(resultSet.getLong("obj_id"));
|
fileIds.add(resultSet.getLong("obj_id"));
|
||||||
}
|
}
|
||||||
return fileIds;
|
return fileIds;
|
||||||
|
} finally {
|
||||||
|
if (resultSet != null) {
|
||||||
|
resultSet.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (NoCurrentCaseException ex) {
|
} catch (NoCurrentCaseException ex) {
|
||||||
throw new ExportRulesException("No current case", ex);
|
throw new ExportRulesException("No current case", ex);
|
||||||
@ -922,7 +927,7 @@ final class FileExportRuleSet implements Serializable, Comparable<FileExportRule
|
|||||||
* @return The value, may be null.
|
* @return The value, may be null.
|
||||||
*/
|
*/
|
||||||
String getStringRepresentationOfValue() {
|
String getStringRepresentationOfValue() {
|
||||||
String valueText = "";
|
String valueText;
|
||||||
switch (this.attributeValueType) {
|
switch (this.attributeValueType) {
|
||||||
case BYTE:
|
case BYTE:
|
||||||
valueText = new String(Hex.encodeHex(getByteValue()));
|
valueText = new String(Hex.encodeHex(getByteValue()));
|
||||||
@ -1083,12 +1088,12 @@ final class FileExportRuleSet implements Serializable, Comparable<FileExportRule
|
|||||||
}
|
}
|
||||||
SleuthkitCase caseDb = currentCase.getSleuthkitCase();
|
SleuthkitCase caseDb = currentCase.getSleuthkitCase();
|
||||||
BlackboardArtifact.Type artifactType;
|
BlackboardArtifact.Type artifactType;
|
||||||
BlackboardAttribute.Type attributeType;
|
|
||||||
try {
|
try {
|
||||||
artifactType = caseDb.getArtifactType(artifactTypeName);
|
artifactType = caseDb.getArtifactType(artifactTypeName);
|
||||||
} catch (TskCoreException ex) {
|
} catch (TskCoreException ex) {
|
||||||
throw new ExportRulesException(String.format("The specified %s artifact type does not exist in case database for %s", artifactTypeName, currentCase.getCaseDirectory()), ex);
|
throw new ExportRulesException(String.format("The specified %s artifact type does not exist in case database for %s", artifactTypeName, currentCase.getCaseDirectory()), ex);
|
||||||
}
|
}
|
||||||
|
BlackboardAttribute.Type attributeType;
|
||||||
try {
|
try {
|
||||||
attributeType = caseDb.getAttributeType(attributeTypeName);
|
attributeType = caseDb.getAttributeType(attributeTypeName);
|
||||||
} catch (TskCoreException ex) {
|
} catch (TskCoreException ex) {
|
||||||
@ -1116,6 +1121,8 @@ final class FileExportRuleSet implements Serializable, Comparable<FileExportRule
|
|||||||
case DATETIME:
|
case DATETIME:
|
||||||
clause += String.format("attrs%d.value_int64 %s '%s'", index, this.op.getSymbol(), this.dateTimeValue.getMillis() / 1000);
|
clause += String.format("attrs%d.value_int64 %s '%s'", index, this.op.getSymbol(), this.dateTimeValue.getMillis() / 1000);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return clause;
|
return clause;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user