4791 use name of first image in multi-image data sources

This commit is contained in:
William Schaefer 2019-03-04 16:24:43 -05:00
parent ba0010f626
commit 90c75d635e

View File

@ -46,8 +46,7 @@ public class DataSourceLoader {
//try block releases resources - exceptions are handled in done()
try (
SleuthkitCase.CaseDbQuery query = tskDb.executeQuery(SELECT_DATA_SOURCES_LOGICAL);
ResultSet resultSet = query.getResultSet()
) {
ResultSet resultSet = query.getResultSet()) {
while (resultSet.next()) {
Long objectId = resultSet.getLong(1);
String dataSourceName = resultSet.getString(2);
@ -56,7 +55,7 @@ public class DataSourceLoader {
}
}
private void loadImageSources(SleuthkitCase tskDb, Map<Long, String> dataSouceMap) throws SQLException, TskCoreException {
private void loadImageSources(SleuthkitCase tskDb, Map<Long, String> dataSourceMap) throws SQLException, TskCoreException {
//try block releases resources - exceptions are handled in done()
try (
SleuthkitCase.CaseDbQuery query = tskDb.executeQuery(SELECT_DATA_SOURCES_IMAGE);
@ -64,10 +63,12 @@ public class DataSourceLoader {
while (resultSet.next()) {
Long objectId = resultSet.getLong(1);
String dataSourceName = resultSet.getString(2);
File image = new File(dataSourceName);
String dataSourceNameTrimmed = image.getName();
dataSouceMap.put(objectId, dataSourceNameTrimmed);
if (!dataSourceMap.containsKey(objectId)) {
String dataSourceName = resultSet.getString(2);
File image = new File(dataSourceName);
String dataSourceNameTrimmed = image.getName();
dataSourceMap.put(objectId, dataSourceNameTrimmed);
}
}
}
}
@ -76,6 +77,7 @@ public class DataSourceLoader {
* Get a map of data source Ids to their string names for the current case.
*
* @return Map of Long (id) to String (name)
*
* @throws NoCurrentCaseException
* @throws TskCoreException
* @throws SQLException