Skip to content
Snippets Groups Projects
Commit 8a856f20 authored by Raman Arora's avatar Raman Arora
Browse files

5795: Reevaluate MessageAttachment class.

 - Renamed members in FileAttachment class.
parent 49e47ac4
No related branches found
No related tags found
No related merge requests found
...@@ -40,8 +40,8 @@ ...@@ -40,8 +40,8 @@
*/ */
public final class FileAttachment implements Attachment { public final class FileAttachment implements Attachment {
private final String filePathName; private final String path;
private final long objId; private final long objectID;
// Mobile phones often create mount points to refer to SD Cards or other // Mobile phones often create mount points to refer to SD Cards or other
// fixed/removable storage media. // fixed/removable storage media.
...@@ -73,18 +73,18 @@ public final class FileAttachment implements Attachment { ...@@ -73,18 +73,18 @@ public final class FileAttachment implements Attachment {
public FileAttachment(SleuthkitCase caseDb, Content dataSource, String pathName) throws TskCoreException { public FileAttachment(SleuthkitCase caseDb, Content dataSource, String pathName) throws TskCoreException {
//normalize the slashes. //normalize the slashes.
this.filePathName = normalizePath(pathName); this.path = normalizePath(pathName);
String fileName = filePathName.substring(filePathName.lastIndexOf('/') + 1); String fileName = path.substring(path.lastIndexOf('/') + 1);
if (fileName.isEmpty()) { if (fileName.isEmpty()) {
throw new TskCoreException(String.format("No file name specified for attachment file: %s, on data source = %d", filePathName, dataSource.getId() )); throw new TskCoreException(String.format("No file name specified for attachment file: %s, on data source = %d", path, dataSource.getId() ));
} }
String parentPathSubString = (filePathName.lastIndexOf('/') < 0) ? "" : filePathName.substring(0, filePathName.lastIndexOf('/')); String parentPathSubString = (path.lastIndexOf('/') < 0) ? "" : path.substring(0, path.lastIndexOf('/'));
// find the attachment file // find the attachment file
objId = findAttachmentFile(caseDb, fileName, parentPathSubString, dataSource); objectID = findAttachmentFile(caseDb, fileName, parentPathSubString, dataSource);
} }
/** /**
...@@ -97,8 +97,8 @@ public FileAttachment(SleuthkitCase caseDb, Content dataSource, String pathName) ...@@ -97,8 +97,8 @@ public FileAttachment(SleuthkitCase caseDb, Content dataSource, String pathName)
* @param derivedFile Derived file for the attachment. * @param derivedFile Derived file for the attachment.
*/ */
public FileAttachment(DerivedFile derivedFile) { public FileAttachment(DerivedFile derivedFile) {
objId = derivedFile.getId(); objectID = derivedFile.getId();
filePathName = derivedFile.getLocalAbsPath() + "/" + derivedFile.getName(); path = derivedFile.getLocalAbsPath() + "/" + derivedFile.getName();
} }
/** /**
...@@ -107,8 +107,8 @@ public FileAttachment(DerivedFile derivedFile) { ...@@ -107,8 +107,8 @@ public FileAttachment(DerivedFile derivedFile) {
* @param abstractFile Abstract file for attachment.. * @param abstractFile Abstract file for attachment..
*/ */
public FileAttachment(AbstractFile abstractFile) { public FileAttachment(AbstractFile abstractFile) {
objId = abstractFile.getId(); objectID = abstractFile.getId();
filePathName = abstractFile.getParentPath() + "/" + abstractFile.getName(); path = abstractFile.getParentPath() + "/" + abstractFile.getName();
} }
/** /**
...@@ -117,17 +117,17 @@ public FileAttachment(AbstractFile abstractFile) { ...@@ -117,17 +117,17 @@ public FileAttachment(AbstractFile abstractFile) {
* @return full path name. * @return full path name.
*/ */
public String getPathName() { public String getPathName() {
return filePathName; return path;
} }
/** /**
* Returns the objId of the attachment file, if the file was found in the * Returns the objectID of the attachment file, if the file was found in the
* data source. * data source.
* *
* @return object id of the file. -1 if no matching file is found. * @return object id of the file. -1 if no matching file is found.
*/ */
public long getObjectId() { public long getObjectId() {
return objId; return objectID;
} }
/** /**
...@@ -245,11 +245,11 @@ private long pickBestMatchFile(List<Long> allocFileMatchesOnSameDatasource, ...@@ -245,11 +245,11 @@ private long pickBestMatchFile(List<Long> allocFileMatchesOnSameDatasource,
@Override @Override
public String getLocation() { public String getLocation() {
return this.filePathName; return this.path;
} }
@Override @Override
public Long getObjId() { public Long getObjId() {
return this.objId; return this.objectID;
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment