Skip to content
Snippets Groups Projects
Commit 0be10e42 authored by Sean-M's avatar Sean-M
Browse files

Fixed ToString exception throwing

parent 1f7e9e5d
No related branches found
No related tags found
No related merge requests found
......@@ -31,14 +31,12 @@
public abstract class AbstractContent implements Content {
public final static long UNKNOWN_ID = -1;
private SleuthkitCase db;
private long objId;
private String name;
private Content parent;
private String uniquePath;
protected long parentId;
protected AbstractContent(SleuthkitCase db, long obj_id, String name) {
this.db = db;
......@@ -197,24 +195,25 @@ public long getArtifactsCount(ARTIFACT_TYPE type) throws TskCoreException {
public long getAllArtifactsCount() throws TskCoreException {
return db.getBlackboardArtifactsCount(objId);
}
@Override
public String toString()
{
public String toString() {
return toString(true);
}
public String toString(boolean preserveState){
if(preserveState){
return "AbstractContent [\t" + "objId " + String.format("%010d",objId) + "\t" + "name " + name + "\t" + "parentId " + parentId + "\t" + "uniquePath " + uniquePath + "]\t";
}
else{
if (preserveState) {
return "AbstractContent [\t" + "objId " + String.format("%010d", objId) + "\t" + "name " + name + "\t" + "parentId " + parentId + "\t" + "uniquePath " + uniquePath + "]\t";
} else {
try {
return "AbstractContent [\t" + "objId " + String.format("%010d",objId) + "\t" + "name " + name + "\t" + "getUniquePath " + getUniquePath() + "\t" + "getParent " + getParent().getId() + "]\t";
} catch (Exception ex) {
//Logger.getLogger(AbstractContent.class.getName()).log(Level.SEVERE, null, ex);
return "AbstractContent [\t" + "objId " + String.format("%010d",objId) + "\t" + "name " + name + "\t" + "uniquePath " + uniquePath + "\t" + "parentId " + parentId + "]\t";
if (getParent() != null) {
return "AbstractContent [\t" + "objId " + String.format("%010d", objId) + "\t" + "name " + name + "\t" + "getUniquePath " + getUniquePath() + "\t" + "getParent " + getParent().getId() + "]\t";
} else {
return "AbstractContent [\t" + "objId " + String.format("%010d", objId) + "\t" + "name " + name + "\t" + "uniquePath " + getUniquePath() + "\t" + "parentId " + parentId + "]\t";
}
} catch (TskCoreException ex) {
Logger.getLogger(AbstractContent.class.getName()).log(Level.SEVERE, "Could not find Parent", ex);
return "AbstractContent [\t" + "objId " + String.format("%010d", objId) + "\t" + "name " + name + "\t" + "parentId " + parentId + "\t" + "uniquePath " + uniquePath + "]\t";
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment