Skip to content
Snippets Groups Projects
Unverified Commit 2b299b27 authored by Richard Cordovano's avatar Richard Cordovano Committed by GitHub
Browse files

Merge pull request #2295 from APriestman/7499_unsupportedContentType

7499 Add UnsupportedContent type
parents 81bd16f7 826e550a
No related branches found
No related tags found
No related merge requests found
......@@ -174,6 +174,15 @@ public interface ContentVisitor<T> {
* @return result of the visit
*/
T visit(OsAccount act);
/**
* Act on (visit) an UnsupportedContent object
*
* @param uc UnsupportedContent object to visit / act on
*
* @return result of the visit
*/
T visit(UnsupportedContent uc);
/**
* The default content visitor - quickest method for implementing a custom
......@@ -268,5 +277,10 @@ public T visit(Report r) {
public T visit(OsAccount act) {
return defaultVisit(act);
}
@Override
public T visit(UnsupportedContent uc) {
return defaultVisit(uc);
}
}
}
......@@ -3090,6 +3090,8 @@ public List<Content> getRootObjects() throws TskCoreException {
break;
case HOST_ADDRESS:
break;
case UNSUPPORTED:
break;
default:
throw new TskCoreException("Parentless object has wrong type to be a root: " + i.type);
}
......@@ -5660,7 +5662,7 @@ public Content getContentById(long id) throws TskCoreException {
content = hostAddressManager.getHostAddress(id);
break;
default:
throw new TskCoreException("Could not obtain Content object with ID: " + id);
content = new UnsupportedContent(this, id);
}
 
return content;
......
......@@ -186,6 +186,15 @@ public interface SleuthkitItemVisitor<T> {
* @return result of the visit
*/
T visit(OsAccount account);
/**
* Act on (visit) an UnsupportedContent object
*
* @param unsupportedContent content to visit / act on
*
* @return result of the visit
*/
T visit(UnsupportedContent unsupportedContent);
/**
* The default visitor - quickest method for implementing a custom visitor.
......@@ -284,5 +293,10 @@ public T visit(Report report) {
public T visit(OsAccount account) {
return defaultVisit(account);
}
@Override
public T visit(UnsupportedContent unsupportedContent) {
return defaultVisit(unsupportedContent);
}
}
}
......@@ -634,7 +634,8 @@ public enum ObjectType {
REPORT(6), ///< Report - see reports for more details
POOL(7), ///< Pool
OS_ACCOUNT(8), ///< OS Account - see tsk_os_accounts for more details
HOST_ADDRESS(9) ///< Host Address - see tsk_host_addresses for more details
HOST_ADDRESS(9), ///< Host Address - see tsk_host_addresses for more details
UNSUPPORTED(-1) ///< Unsupported type
;
private final short objectType;
......@@ -664,8 +665,7 @@ public static ObjectType valueOf(short objectType) {
return v;
}
}
throw new IllegalArgumentException(
MessageFormat.format(bundle.getString("TskData.objectTypeEnum.exception.msg1.text"), objectType));
return UNSUPPORTED;
}
}
......
/*
* Sleuth Kit Data Model
*
* Copyright 2021 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.sleuthkit.datamodel;
/**
* This content type is used as a default when the object type from the tsk_objects
* table is not present in the TskData.ObjectType enum. This should only come into play
* when loading case databases created by a newer version of Autopsy.
*/
public class UnsupportedContent extends AbstractContent {
/**
* Create an UnsupportedContent object.
* Only store the object id.
*
* @param db case database handle
* @param obj_id object id
*/
protected UnsupportedContent(SleuthkitCase db, long obj_id) {
super(db, obj_id, "Unsupported Content");
}
@Override
public int read(byte[] buf, long offset, long len) throws TskCoreException {
return 0;
}
@Override
public void close() {
// Do nothing
}
@Override
public long getSize() {
return 0;
}
@Override
public <T> T accept(ContentVisitor<T> v) {
return v.visit(this);
}
@Override
public <T> T accept(SleuthkitItemVisitor<T> v) {
return v.visit(this);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment