Merge pull request #7214 from eugene7646/AID_fix_7926

Fix to not call Paths.get() all the time (7926)
This commit is contained in:
Richard Cordovano 2021-08-27 11:44:40 -04:00 committed by GitHub
commit 0c2022b8aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,32 +30,35 @@ import javax.annotation.concurrent.Immutable;
public final class Manifest implements Serializable { public final class Manifest implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private final String filePath; private final Path filePath;
private final Date dateFileCreated; private final Date dateFileCreated;
private final String caseName; private final String caseName;
private final String deviceId; private final String deviceId;
private final String dataSourcePath; private final Path dataSourcePath;
private final String dataSourceFileName;
private final Map<String, String> manifestProperties; private final Map<String, String> manifestProperties;
public Manifest(Path manifestFilePath, Date dateFileCreated, String caseName, String deviceId, Path dataSourcePath, Map<String, String> manifestProperties) { public Manifest(Path manifestFilePath, Date dateFileCreated, String caseName, String deviceId, Path dataSourcePath, Map<String, String> manifestProperties) {
this.filePath = manifestFilePath.toString(); this.filePath = Paths.get(manifestFilePath.toString());
this.dateFileCreated = dateFileCreated; this.dateFileCreated = new Date(dateFileCreated.getTime());
this.caseName = caseName; this.caseName = caseName;
this.deviceId = deviceId; this.deviceId = deviceId;
if (null != dataSourcePath) { if (null != dataSourcePath) {
this.dataSourcePath = dataSourcePath.toString(); this.dataSourcePath = Paths.get(dataSourcePath.toString());
dataSourceFileName = dataSourcePath.getFileName().toString();
} else { } else {
this.dataSourcePath = ""; this.dataSourcePath = Paths.get("");
dataSourceFileName = "";
} }
this.manifestProperties = new HashMap<>(manifestProperties); this.manifestProperties = new HashMap<>(manifestProperties);
} }
public Path getFilePath() { public Path getFilePath() {
return Paths.get(this.filePath); return this.filePath;
} }
public Date getDateFileCreated() { public Date getDateFileCreated() {
return new Date(this.dateFileCreated.getTime()); return dateFileCreated;
} }
public String getCaseName() { public String getCaseName() {
@ -67,11 +70,11 @@ public final class Manifest implements Serializable {
} }
public Path getDataSourcePath() { public Path getDataSourcePath() {
return Paths.get(dataSourcePath); return dataSourcePath;
} }
public String getDataSourceFileName() { public String getDataSourceFileName() {
return Paths.get(dataSourcePath).getFileName().toString(); return dataSourceFileName;
} }
public Map<String, String> getManifestProperties() { public Map<String, String> getManifestProperties() {