Extracted hard coded strings. Commented strings that shouldn't be extracted using NON-NLS. Used @NbBundle.Messages() style annotations for strings.

This commit is contained in:
Nick Davis 2016-02-02 17:40:47 -05:00
parent c8841d7314
commit 8afdd0d6c3
19 changed files with 162 additions and 153 deletions

View File

@ -85,16 +85,16 @@ public class FXMLConstructor {
try { try {
fxmlLoader.load(); fxmlLoader.load();
} catch (IOException exception) { } catch (IOException exception) {
LOGGER.log(Level.SEVERE, "FXMLConstructor was unable to load FXML, falling back on default Class Loader, and trying again.", exception); LOGGER.log(Level.SEVERE, "FXMLConstructor was unable to load FXML, falling back on default Class Loader, and trying again.", exception); //NON-NLS
try { try {
fxmlLoader.setClassLoader(FXMLLoader.getDefaultClassLoader()); fxmlLoader.setClassLoader(FXMLLoader.getDefaultClassLoader());
fxmlLoader.load(); fxmlLoader.load();
} catch (IOException ex) { } catch (IOException ex) {
LOGGER.log(Level.SEVERE, "FXMLConstructor was unable to load FXML, node initialization may not be complete.", ex); LOGGER.log(Level.SEVERE, "FXMLConstructor was unable to load FXML, node initialization may not be complete.", ex); //NON-NLS
} }
} }
} catch (MalformedURLException ex) { } catch (MalformedURLException ex) {
LOGGER.log(Level.SEVERE, "FXMLConstructor was unable to load FXML, node initialization may not be complete.", ex); LOGGER.log(Level.SEVERE, "FXMLConstructor was unable to load FXML, node initialization may not be complete.", ex); //NON-NLS
} }
} }

View File

@ -63,7 +63,7 @@ public class PromptDialogManager {
try { try {
x = new Image(new URL("nbresloc:/org/netbeans/core/startup/frame.gif").openStream()); //NOI18N x = new Image(new URL("nbresloc:/org/netbeans/core/startup/frame.gif").openStream()); //NOI18N
} catch (IOException ex) { } catch (IOException ex) {
LOGGER.log(Level.WARNING, "Failed to load branded icon for progress dialog.", ex); //NOI18N LOGGER.log(Level.WARNING, "Failed to load branded icon for progress dialog.", ex); //NOI18N NON-NLS
} }
LOGO = x; LOGO = x;
} }

View File

@ -29,7 +29,7 @@ import org.sleuthkit.autopsy.timeline.TimeLineController;
*/ */
public class ZoomIn extends Action { public class ZoomIn extends Action {
private static final Image MAGNIFIER_IN = new Image("/org/sleuthkit/autopsy/timeline/images/magnifier-zoom-in-green.png"); //NOI18N private static final Image MAGNIFIER_IN = new Image("/org/sleuthkit/autopsy/timeline/images/magnifier-zoom-in-green.png"); //NOI18N NON-NLS
@NbBundle.Messages({"ZoomIn.longText=Zoom in to view about half as much time.", @NbBundle.Messages({"ZoomIn.longText=Zoom in to view about half as much time.",
"ZoomIn.action.text=Zoom in"}) "ZoomIn.action.text=Zoom in"})

View File

@ -31,7 +31,7 @@ import org.sleuthkit.autopsy.timeline.datamodel.FilteredEventsModel;
*/ */
public class ZoomOut extends Action { public class ZoomOut extends Action {
private static final Image MAGNIFIER_OUT = new Image("/org/sleuthkit/autopsy/timeline/images/magnifier-zoom-out-red.png"); //NOI18N private static final Image MAGNIFIER_OUT = new Image("/org/sleuthkit/autopsy/timeline/images/magnifier-zoom-out-red.png"); //NOI18N NON-NLS
@NbBundle.Messages({"ZoomOut.longText=Zoom out to view about 50% more time.", @NbBundle.Messages({"ZoomOut.longText=Zoom out to view about 50% more time.",
"ZoomOut.action.text=Zoom out"}) "ZoomOut.action.text=Zoom out"})

View File

@ -31,7 +31,7 @@ import org.sleuthkit.autopsy.timeline.datamodel.FilteredEventsModel;
*/ */
public class ZoomToEvents extends Action { public class ZoomToEvents extends Action {
private static final Image MAGNIFIER_OUT = new Image("/org/sleuthkit/autopsy/timeline/images/magnifier-zoom-out-red.png", 16, 16, true, true); //NOI18N private static final Image MAGNIFIER_OUT = new Image("/org/sleuthkit/autopsy/timeline/images/magnifier-zoom-out-red.png", 16, 16, true, true); //NOI18N NON-NLS
@NbBundle.Messages({"ZoomToEvents.action.text=Zoom to events", @NbBundle.Messages({"ZoomToEvents.action.text=Zoom to events",
"ZoomToEvents.longText=Zoom out to show the nearest events."}) "ZoomToEvents.longText=Zoom out to show the nearest events."})

View File

@ -191,6 +191,6 @@ public final class EventStripe implements EventBundle<EventCluster> {
@Override @Override
public String toString() { public String toString() {
return "EventStripe{" + "description=" + description + ", eventIDs=" + eventIDs.size() + '}'; return "EventStripe{" + "description=" + description + ", eventIDs=" + eventIDs.size() + '}'; //NON-NLS
} }
} }

View File

@ -111,7 +111,7 @@ public final class FilteredEventsModel {
@GuardedBy("this") @GuardedBy("this")
private final ReadOnlyObjectWrapper<ZoomParams> requestedZoomParamters = new ReadOnlyObjectWrapper<>(); private final ReadOnlyObjectWrapper<ZoomParams> requestedZoomParamters = new ReadOnlyObjectWrapper<>();
private final EventBus eventbus = new EventBus("Event_Repository_EventBus"); private final EventBus eventbus = new EventBus("Event_Repository_EventBus"); //NON-NLS
/** /**
* The underlying repo for events. Atomic access to repo is synchronized * The underlying repo for events. Atomic access to repo is synchronized
@ -374,7 +374,7 @@ public final class FilteredEventsModel {
Set<Long> updatedEventIDs = repo.deleteTag(content.getId(), null, deletedTagInfo.getTagID(), tagged); Set<Long> updatedEventIDs = repo.deleteTag(content.getId(), null, deletedTagInfo.getTagID(), tagged);
return postTagsUpdated(updatedEventIDs); return postTagsUpdated(updatedEventIDs);
} catch (TskCoreException ex) { } catch (TskCoreException ex) {
LOGGER.log(Level.SEVERE, "unable to determine tagged status of content.", ex); LOGGER.log(Level.SEVERE, "unable to determine tagged status of content.", ex); //NON-NLS
} }
return false; return false;
} }
@ -387,7 +387,7 @@ public final class FilteredEventsModel {
Set<Long> updatedEventIDs = repo.deleteTag(artifact.getObjectID(), artifact.getArtifactID(), deletedTagInfo.getTagID(), tagged); Set<Long> updatedEventIDs = repo.deleteTag(artifact.getObjectID(), artifact.getArtifactID(), deletedTagInfo.getTagID(), tagged);
return postTagsUpdated(updatedEventIDs); return postTagsUpdated(updatedEventIDs);
} catch (TskCoreException ex) { } catch (TskCoreException ex) {
LOGGER.log(Level.SEVERE, "unable to determine tagged status of artifact.", ex); LOGGER.log(Level.SEVERE, "unable to determine tagged status of artifact.", ex); //NON-NLS
} }
return false; return false;
} }

View File

@ -137,7 +137,7 @@ public enum MiscTypes implements EventType, ArtifactEventType {
return file.getName(); return file.getName();
} }
} catch (TskCoreException ex) { } catch (TskCoreException ex) {
Logger.getLogger(MiscTypes.class.getName()).log(Level.SEVERE, "Exif event type failed to look up backing file name", ex); Logger.getLogger(MiscTypes.class.getName()).log(Level.SEVERE, "Exif event type failed to look up backing file name", ex); //NON-NLS
} }
return " error loading file name"; // NON-NLS return " error loading file name"; // NON-NLS
}), }),

View File

@ -232,7 +232,7 @@ public class EventDB {
return rs.getInt("count"); // NON-NLS return rs.getInt("count"); // NON-NLS
} }
} catch (SQLException ex) { } catch (SQLException ex) {
LOGGER.log(Level.SEVERE, "Error counting all events", ex); LOGGER.log(Level.SEVERE, "Error counting all events", ex); //NON-NLS
} finally { } finally {
DBLock.unlock(); DBLock.unlock();
} }
@ -270,15 +270,15 @@ public class EventDB {
HashMap<String, Long> counts = new HashMap<>(); HashMap<String, Long> counts = new HashMap<>();
DBLock.lock(); DBLock.lock();
try (Statement createStatement = con.createStatement(); try (Statement createStatement = con.createStatement();
ResultSet rs = createStatement.executeQuery("SELECT tag_name_display_name, COUNT(DISTINCT tag_id) AS count FROM tags" ResultSet rs = createStatement.executeQuery("SELECT tag_name_display_name, COUNT(DISTINCT tag_id) AS count FROM tags" //NON-NLS
+ " WHERE event_id IN (" + StringUtils.join(eventIDsWithTags, ", ") + ")" + " WHERE event_id IN (" + StringUtils.join(eventIDsWithTags, ", ") + ")" //NON-NLS
+ " GROUP BY tag_name_id" + " GROUP BY tag_name_id" //NON-NLS
+ " ORDER BY tag_name_display_name");) { + " ORDER BY tag_name_display_name");) { //NON-NLS
while (rs.next()) { while (rs.next()) {
counts.put(rs.getString("tag_name_display_name"), rs.getLong("count")); counts.put(rs.getString("tag_name_display_name"), rs.getLong("count")); //NON-NLS
} }
} catch (SQLException ex) { } catch (SQLException ex) {
LOGGER.log(Level.SEVERE, "Failed to get tag counts by tag name.", ex); LOGGER.log(Level.SEVERE, "Failed to get tag counts by tag name.", ex); //NON-NLS
} finally { } finally {
DBLock.unlock(); DBLock.unlock();
} }
@ -327,7 +327,7 @@ public class EventDB {
final String sqlWhere = SQLHelper.getSQLWhere(filter); final String sqlWhere = SQLHelper.getSQLWhere(filter);
DBLock.lock(); DBLock.lock();
try (Statement stmt = con.createStatement(); //can't use prepared statement because of complex where clause try (Statement stmt = con.createStatement(); //can't use prepared statement because of complex where clause
ResultSet rs = stmt.executeQuery(" SELECT (SELECT Max(time) FROM events " + useHashHitTablesHelper(filter) + useTagTablesHelper(filter) + " WHERE time <=" + start + " AND " + sqlWhere + ") AS start," ResultSet rs = stmt.executeQuery(" SELECT (SELECT Max(time) FROM events " + useHashHitTablesHelper(filter) + useTagTablesHelper(filter) + " WHERE time <=" + start + " AND " + sqlWhere + ") AS start," //NON-NLS
+ "(SELECT Min(time) FROM events" + useHashHitTablesHelper(filter) + useTagTablesHelper(filter) + " WHERE time >= " + end + " AND " + sqlWhere + ") AS end")) { // NON-NLS + "(SELECT Min(time) FROM events" + useHashHitTablesHelper(filter) + useTagTablesHelper(filter) + " WHERE time >= " + end + " AND " + sqlWhere + ") AS end")) { // NON-NLS
while (rs.next()) { while (rs.next()) {
@ -382,7 +382,7 @@ public class EventDB {
try (Statement stmt = con.createStatement(); try (Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(query)) { ResultSet rs = stmt.executeQuery(query)) {
while (rs.next()) { while (rs.next()) {
resultIDs.add(rs.getLong("event_id")); resultIDs.add(rs.getLong("event_id")); //NON-NLS
} }
} catch (SQLException sqlEx) { } catch (SQLException sqlEx) {
@ -416,7 +416,7 @@ public class EventDB {
DBLock.lock(); DBLock.lock();
try (ResultSet rs = getDataSourceIDsStmt.executeQuery()) { try (ResultSet rs = getDataSourceIDsStmt.executeQuery()) {
while (rs.next()) { while (rs.next()) {
long datasourceID = rs.getLong("datasource_id"); long datasourceID = rs.getLong("datasource_id"); //NON-NLS
hashSet.add(datasourceID); hashSet.add(datasourceID);
} }
} catch (SQLException ex) { } catch (SQLException ex) {
@ -432,8 +432,8 @@ public class EventDB {
DBLock.lock(); DBLock.lock();
try (ResultSet rs = getHashSetNamesStmt.executeQuery();) { try (ResultSet rs = getHashSetNamesStmt.executeQuery();) {
while (rs.next()) { while (rs.next()) {
long hashSetID = rs.getLong("hash_set_id"); long hashSetID = rs.getLong("hash_set_id"); //NON-NLS
String hashSetName = rs.getString("hash_set_name"); String hashSetName = rs.getString("hash_set_name"); //NON-NLS
hashSets.put(hashSetID, hashSetName); hashSets.put(hashSetID, hashSetName);
} }
} catch (SQLException ex) { } catch (SQLException ex) {
@ -447,7 +447,7 @@ public class EventDB {
void analyze() { void analyze() {
DBLock.lock(); DBLock.lock();
try (Statement createStatement = con.createStatement()) { try (Statement createStatement = con.createStatement()) {
boolean b = createStatement.execute("analyze; analyze sqlite_master;"); boolean b = createStatement.execute("analyze; analyze sqlite_master;"); //NON-NLS
} catch (SQLException ex) { } catch (SQLException ex) {
LOGGER.log(Level.SEVERE, "Failed to analyze events db.", ex); // NON-NLS LOGGER.log(Level.SEVERE, "Failed to analyze events db.", ex); // NON-NLS
} finally { } finally {
@ -575,35 +575,35 @@ public class EventDB {
} }
try (Statement stmt = con.createStatement()) { try (Statement stmt = con.createStatement()) {
String sql = "CREATE TABLE if not exists hash_sets " String sql = "CREATE TABLE if not exists hash_sets " //NON-NLS
+ "( hash_set_id INTEGER primary key," + "( hash_set_id INTEGER primary key," //NON-NLS
+ " hash_set_name VARCHAR(255) UNIQUE NOT NULL)"; + " hash_set_name VARCHAR(255) UNIQUE NOT NULL)"; //NON-NLS
stmt.execute(sql); stmt.execute(sql);
} catch (SQLException ex) { } catch (SQLException ex) {
LOGGER.log(Level.SEVERE, "problem creating hash_sets table", ex); LOGGER.log(Level.SEVERE, "problem creating hash_sets table", ex); //NON-NLS
} }
try (Statement stmt = con.createStatement()) { try (Statement stmt = con.createStatement()) {
String sql = "CREATE TABLE if not exists hash_set_hits " String sql = "CREATE TABLE if not exists hash_set_hits " //NON-NLS
+ "(hash_set_id INTEGER REFERENCES hash_sets(hash_set_id) not null, " + "(hash_set_id INTEGER REFERENCES hash_sets(hash_set_id) not null, " //NON-NLS
+ " event_id INTEGER REFERENCES events(event_id) not null, " + " event_id INTEGER REFERENCES events(event_id) not null, " //NON-NLS
+ " PRIMARY KEY (hash_set_id, event_id))"; + " PRIMARY KEY (hash_set_id, event_id))"; //NON-NLS
stmt.execute(sql); stmt.execute(sql);
} catch (SQLException ex) { } catch (SQLException ex) {
LOGGER.log(Level.SEVERE, "problem creating hash_set_hits table", ex); LOGGER.log(Level.SEVERE, "problem creating hash_set_hits table", ex); //NON-NLS
} }
initializeTagsTable(); initializeTagsTable();
createIndex("events", Arrays.asList("datasource_id")); createIndex("events", Arrays.asList("datasource_id")); //NON-NLS
createIndex("events", Arrays.asList("event_id", "hash_hit")); createIndex("events", Arrays.asList("event_id", "hash_hit")); //NON-NLS
createIndex("events", Arrays.asList("event_id", "tagged")); createIndex("events", Arrays.asList("event_id", "tagged")); //NON-NLS
createIndex("events", Arrays.asList("file_id")); createIndex("events", Arrays.asList("file_id")); //NON-NLS
createIndex("events", Arrays.asList("artifact_id")); createIndex("events", Arrays.asList("artifact_id")); //NON-NLS
createIndex("events", Arrays.asList("sub_type", "short_description", "time")); createIndex("events", Arrays.asList("sub_type", "short_description", "time")); //NON-NLS
createIndex("events", Arrays.asList("base_type", "short_description", "time")); createIndex("events", Arrays.asList("base_type", "short_description", "time")); //NON-NLS
createIndex("events", Arrays.asList("time")); createIndex("events", Arrays.asList("time")); //NON-NLS
createIndex("events", Arrays.asList("known_state")); createIndex("events", Arrays.asList("known_state")); //NON-NLS
try { try {
insertRowStmt = prepareStatement( insertRowStmt = prepareStatement(
@ -616,19 +616,19 @@ public class EventDB {
getEventByIDStmt = prepareStatement("SELECT * FROM events WHERE event_id = ?"); // NON-NLS getEventByIDStmt = prepareStatement("SELECT * FROM events WHERE event_id = ?"); // NON-NLS
recordDBInfoStmt = prepareStatement("INSERT OR REPLACE INTO db_info (key, value) values (?, ?)"); // NON-NLS recordDBInfoStmt = prepareStatement("INSERT OR REPLACE INTO db_info (key, value) values (?, ?)"); // NON-NLS
getDBInfoStmt = prepareStatement("SELECT value FROM db_info WHERE key = ?"); // NON-NLS getDBInfoStmt = prepareStatement("SELECT value FROM db_info WHERE key = ?"); // NON-NLS
insertHashSetStmt = prepareStatement("INSERT OR IGNORE INTO hash_sets (hash_set_name) values (?)"); insertHashSetStmt = prepareStatement("INSERT OR IGNORE INTO hash_sets (hash_set_name) values (?)"); //NON-NLS
selectHashSetStmt = prepareStatement("SELECT hash_set_id FROM hash_sets WHERE hash_set_name = ?"); selectHashSetStmt = prepareStatement("SELECT hash_set_id FROM hash_sets WHERE hash_set_name = ?"); //NON-NLS
insertHashHitStmt = prepareStatement("INSERT OR IGNORE INTO hash_set_hits (hash_set_id, event_id) values (?,?)"); insertHashHitStmt = prepareStatement("INSERT OR IGNORE INTO hash_set_hits (hash_set_id, event_id) values (?,?)"); //NON-NLS
insertTagStmt = prepareStatement("INSERT OR IGNORE INTO tags (tag_id, tag_name_id,tag_name_display_name, event_id) values (?,?,?,?)"); insertTagStmt = prepareStatement("INSERT OR IGNORE INTO tags (tag_id, tag_name_id,tag_name_display_name, event_id) values (?,?,?,?)"); //NON-NLS
deleteTagStmt = prepareStatement("DELETE FROM tags WHERE tag_id = ?"); deleteTagStmt = prepareStatement("DELETE FROM tags WHERE tag_id = ?"); //NON-NLS
countAllEventsStmt = prepareStatement("SELECT count(*) AS count FROM events"); countAllEventsStmt = prepareStatement("SELECT count(*) AS count FROM events"); //NON-NLS
dropEventsTableStmt = prepareStatement("DROP TABLE IF EXISTS events"); dropEventsTableStmt = prepareStatement("DROP TABLE IF EXISTS events"); //NON-NLS
dropHashSetHitsTableStmt = prepareStatement("DROP TABLE IF EXISTS hash_set_hits"); dropHashSetHitsTableStmt = prepareStatement("DROP TABLE IF EXISTS hash_set_hits"); //NON-NLS
dropHashSetsTableStmt = prepareStatement("DROP TABLE IF EXISTS hash_sets"); dropHashSetsTableStmt = prepareStatement("DROP TABLE IF EXISTS hash_sets"); //NON-NLS
dropTagsTableStmt = prepareStatement("DROP TABLE IF EXISTS tags"); dropTagsTableStmt = prepareStatement("DROP TABLE IF EXISTS tags"); //NON-NLS
dropDBInfoTableStmt = prepareStatement("DROP TABLE IF EXISTS db_ino"); dropDBInfoTableStmt = prepareStatement("DROP TABLE IF EXISTS db_ino"); //NON-NLS
selectNonArtifactEventIDsByObjectIDStmt = prepareStatement("SELECT event_id FROM events WHERE file_id == ? AND artifact_id IS NULL"); selectNonArtifactEventIDsByObjectIDStmt = prepareStatement("SELECT event_id FROM events WHERE file_id == ? AND artifact_id IS NULL"); //NON-NLS
selectEventIDsBYObjectAndArtifactIDStmt = prepareStatement("SELECT event_id FROM events WHERE file_id == ? AND artifact_id = ?"); selectEventIDsBYObjectAndArtifactIDStmt = prepareStatement("SELECT event_id FROM events WHERE file_id == ? AND artifact_id = ?"); //NON-NLS
} catch (SQLException sQLException) { } catch (SQLException sQLException) {
LOGGER.log(Level.SEVERE, "failed to prepareStatment", sQLException); // NON-NLS LOGGER.log(Level.SEVERE, "failed to prepareStatment", sQLException); // NON-NLS
} }
@ -643,15 +643,15 @@ public class EventDB {
*/ */
private void initializeTagsTable() { private void initializeTagsTable() {
try (Statement stmt = con.createStatement()) { try (Statement stmt = con.createStatement()) {
String sql = "CREATE TABLE IF NOT EXISTS tags " String sql = "CREATE TABLE IF NOT EXISTS tags " //NON-NLS
+ "(tag_id INTEGER NOT NULL," + "(tag_id INTEGER NOT NULL," //NON-NLS
+ " tag_name_id INTEGER NOT NULL, " + " tag_name_id INTEGER NOT NULL, " //NON-NLS
+ " tag_name_display_name TEXT NOT NULL, " + " tag_name_display_name TEXT NOT NULL, " //NON-NLS
+ " event_id INTEGER REFERENCES events(event_id) NOT NULL, " + " event_id INTEGER REFERENCES events(event_id) NOT NULL, " //NON-NLS
+ " PRIMARY KEY (event_id, tag_name_id))"; + " PRIMARY KEY (event_id, tag_name_id))"; //NON-NLS
stmt.execute(sql); stmt.execute(sql);
} catch (SQLException ex) { } catch (SQLException ex) {
LOGGER.log(Level.SEVERE, "problem creating tags table", ex); LOGGER.log(Level.SEVERE, "problem creating tags table", ex); //NON-NLS
} }
} }
@ -662,7 +662,7 @@ public class EventDB {
*/ */
private void createIndex(final String tableName, final List<String> columnList) { private void createIndex(final String tableName, final List<String> columnList) {
String indexColumns = columnList.stream().collect(Collectors.joining(",", "(", ")")); String indexColumns = columnList.stream().collect(Collectors.joining(",", "(", ")"));
String indexName = tableName + "_" + StringUtils.join(columnList, "_") + "_idx"; String indexName = tableName + "_" + StringUtils.join(columnList, "_") + "_idx"; //NON-NLS
try (Statement stmt = con.createStatement()) { try (Statement stmt = con.createStatement()) {
String sql = "CREATE INDEX IF NOT EXISTS " + indexName + " ON " + tableName + indexColumns; // NON-NLS String sql = "CREATE INDEX IF NOT EXISTS " + indexName + " ON " + tableName + indexColumns; // NON-NLS
@ -680,7 +680,7 @@ public class EventDB {
private boolean hasDBColumn(@Nonnull final String dbColumn) { private boolean hasDBColumn(@Nonnull final String dbColumn) {
try (Statement stmt = con.createStatement()) { try (Statement stmt = con.createStatement()) {
ResultSet executeQuery = stmt.executeQuery("PRAGMA table_info(events)"); ResultSet executeQuery = stmt.executeQuery("PRAGMA table_info(events)"); //NON-NLS
while (executeQuery.next()) { while (executeQuery.next()) {
if (dbColumn.equals(executeQuery.getString("name"))) { if (dbColumn.equals(executeQuery.getString("name"))) {
return true; return true;
@ -693,15 +693,15 @@ public class EventDB {
} }
private boolean hasDataSourceIDColumn() { private boolean hasDataSourceIDColumn() {
return hasDBColumn("datasource_id"); return hasDBColumn("datasource_id"); //NON-NLS
} }
private boolean hasTaggedColumn() { private boolean hasTaggedColumn() {
return hasDBColumn("tagged"); return hasDBColumn("tagged"); //NON-NLS
} }
private boolean hasHashHitColumn() { private boolean hasHashHitColumn() {
return hasDBColumn("hash_hit"); return hasDBColumn("hash_hit"); //NON-NLS
} }
void insertEvent(long time, EventType type, long datasourceID, long objID, void insertEvent(long time, EventType type, long datasourceID, long objID,
@ -764,7 +764,7 @@ public class EventDB {
try (ResultSet generatedKeys = insertRowStmt.getGeneratedKeys()) { try (ResultSet generatedKeys = insertRowStmt.getGeneratedKeys()) {
while (generatedKeys.next()) { while (generatedKeys.next()) {
long eventID = generatedKeys.getLong("last_insert_rowid()"); long eventID = generatedKeys.getLong("last_insert_rowid()"); //NON-NLS
for (String name : hashSetNames) { for (String name : hashSetNames) {
// "insert or ignore into hash_sets (hash_set_name) values (?)" // "insert or ignore into hash_sets (hash_set_name) values (?)"
@ -776,7 +776,7 @@ public class EventDB {
selectHashSetStmt.setString(1, name); selectHashSetStmt.setString(1, name);
try (ResultSet rs = selectHashSetStmt.executeQuery()) { try (ResultSet rs = selectHashSetStmt.executeQuery()) {
while (rs.next()) { while (rs.next()) {
int hashsetID = rs.getInt("hash_set_id"); int hashsetID = rs.getInt("hash_set_id"); //NON-NLS
//"insert or ignore into hash_set_hits (hash_set_id, obj_id) values (?,?)"; //"insert or ignore into hash_set_hits (hash_set_id, obj_id) values (?,?)";
insertHashHitStmt.setInt(1, hashsetID); insertHashHitStmt.setInt(1, hashsetID);
insertHashHitStmt.setLong(2, eventID); insertHashHitStmt.setLong(2, eventID);
@ -925,14 +925,14 @@ public class EventDB {
HashSet<Long> eventIDs = new HashSet<>(); HashSet<Long> eventIDs = new HashSet<>();
try (ResultSet executeQuery = selectStmt.executeQuery();) { try (ResultSet executeQuery = selectStmt.executeQuery();) {
while (executeQuery.next()) { while (executeQuery.next()) {
eventIDs.add(executeQuery.getLong("event_id")); eventIDs.add(executeQuery.getLong("event_id")); //NON-NLS
} }
} }
//update tagged state for all event with selected ids //update tagged state for all event with selected ids
try (Statement updateStatement = con.createStatement();) { try (Statement updateStatement = con.createStatement();) {
updateStatement.executeUpdate("UPDATE events SET tagged = " + (tagged ? 1 : 0) updateStatement.executeUpdate("UPDATE events SET tagged = " + (tagged ? 1 : 0) //NON-NLS
+ " WHERE event_id IN (" + StringUtils.join(eventIDs, ",") + ")"); + " WHERE event_id IN (" + StringUtils.join(eventIDs, ",") + ")"); //NON-NLS
} }
return eventIDs; return eventIDs;
@ -986,22 +986,22 @@ public class EventDB {
SQLiteJDBCLoader.getVersion(), SQLiteJDBCLoader.isNativeMode() SQLiteJDBCLoader.getVersion(), SQLiteJDBCLoader.isNativeMode()
? "native" : "pure-java")); // NON-NLS ? "native" : "pure-java")); // NON-NLS
} catch (Exception exception) { } catch (Exception exception) {
LOGGER.log(Level.SEVERE, "Failed to determine if sqlite-jdbc is loaded in native or pure-java mode.", exception); LOGGER.log(Level.SEVERE, "Failed to determine if sqlite-jdbc is loaded in native or pure-java mode.", exception); //NON-NLS
} }
} }
private TimeLineEvent constructTimeLineEvent(ResultSet rs) throws SQLException { private TimeLineEvent constructTimeLineEvent(ResultSet rs) throws SQLException {
return new TimeLineEvent(rs.getLong("event_id"), return new TimeLineEvent(rs.getLong("event_id"), //NON-NLS
rs.getLong("datasource_id"), rs.getLong("datasource_id"), //NON-NLS
rs.getLong("file_id"), rs.getLong("file_id"), //NON-NLS
rs.getLong("artifact_id"), rs.getLong("artifact_id"), //NON-NLS
rs.getLong("time"), RootEventType.allTypes.get(rs.getInt("sub_type")), rs.getLong("time"), RootEventType.allTypes.get(rs.getInt("sub_type")), //NON-NLS
rs.getString("full_description"), rs.getString("full_description"), //NON-NLS
rs.getString("med_description"), rs.getString("med_description"), //NON-NLS
rs.getString("short_description"), rs.getString("short_description"), //NON-NLS
TskData.FileKnown.valueOf(rs.getByte("known_state")), TskData.FileKnown.valueOf(rs.getByte("known_state")), //NON-NLS
rs.getInt("hash_hit") != 0, rs.getInt("hash_hit") != 0, //NON-NLS
rs.getInt("tagged") != 0); rs.getInt("tagged") != 0); //NON-NLS
} }
/** /**
@ -1031,7 +1031,7 @@ public class EventDB {
final boolean useSubTypes = (zoomLevel == EventTypeZoomLevel.SUB_TYPE); final boolean useSubTypes = (zoomLevel == EventTypeZoomLevel.SUB_TYPE);
//get some info about the range of dates requested //get some info about the range of dates requested
final String queryString = "SELECT count(DISTINCT events.event_id) AS count, " + typeColumnHelper(useSubTypes) final String queryString = "SELECT count(DISTINCT events.event_id) AS count, " + typeColumnHelper(useSubTypes) //NON-NLS
+ " FROM events" + useHashHitTablesHelper(filter) + useTagTablesHelper(filter) + " WHERE time >= " + startTime + " AND time < " + endTime + " AND " + SQLHelper.getSQLWhere(filter) // NON-NLS + " FROM events" + useHashHitTablesHelper(filter) + useTagTablesHelper(filter) + " WHERE time >= " + startTime + " AND time < " + endTime + " AND " + SQLHelper.getSQLWhere(filter) // NON-NLS
+ " GROUP BY " + typeColumnHelper(useSubTypes); // NON-NLS + " GROUP BY " + typeColumnHelper(useSubTypes); // NON-NLS
@ -1040,8 +1040,8 @@ public class EventDB {
ResultSet rs = stmt.executeQuery(queryString);) { ResultSet rs = stmt.executeQuery(queryString);) {
while (rs.next()) { while (rs.next()) {
EventType type = useSubTypes EventType type = useSubTypes
? RootEventType.allTypes.get(rs.getInt("sub_type")) ? RootEventType.allTypes.get(rs.getInt("sub_type")) //NON-NLS
: BaseTypes.values()[rs.getInt("base_type")]; : BaseTypes.values()[rs.getInt("base_type")]; //NON-NLS
typeMap.put(type, rs.getLong("count")); // NON-NLS typeMap.put(type, rs.getLong("count")); // NON-NLS
} }
@ -1090,9 +1090,9 @@ public class EventDB {
//compose query string, the new-lines are only for nicer formatting if printing the entire query //compose query string, the new-lines are only for nicer formatting if printing the entire query
String query = "SELECT strftime('" + strfTimeFormat + "',time , 'unixepoch'" + timeZone + ") AS interval," // NON-NLS String query = "SELECT strftime('" + strfTimeFormat + "',time , 'unixepoch'" + timeZone + ") AS interval," // NON-NLS
+ "\n group_concat(events.event_id) as event_ids," + "\n group_concat(events.event_id) as event_ids," //NON-NLS
+ "\n group_concat(CASE WHEN hash_hit = 1 THEN events.event_id ELSE NULL END) as hash_hits," + "\n group_concat(CASE WHEN hash_hit = 1 THEN events.event_id ELSE NULL END) as hash_hits," //NON-NLS
+ "\n group_concat(CASE WHEN tagged = 1 THEN events.event_id ELSE NULL END) as taggeds," + "\n group_concat(CASE WHEN tagged = 1 THEN events.event_id ELSE NULL END) as taggeds," //NON-NLS
+ "\n min(time), max(time), " + typeColumn + ", " + descriptionColumn // NON-NLS + "\n min(time), max(time), " + typeColumn + ", " + descriptionColumn // NON-NLS
+ "\n FROM events" + useHashHitTablesHelper(filter) + useTagTablesHelper(filter) // NON-NLS + "\n FROM events" + useHashHitTablesHelper(filter) + useTagTablesHelper(filter) // NON-NLS
+ "\n WHERE time >= " + start + " AND time < " + end + " AND " + SQLHelper.getSQLWhere(filter) // NON-NLS + "\n WHERE time >= " + start + " AND time < " + end + " AND " + SQLHelper.getSQLWhere(filter) // NON-NLS
@ -1101,7 +1101,7 @@ public class EventDB {
switch (Version.getBuildType()) { switch (Version.getBuildType()) {
case DEVELOPMENT: case DEVELOPMENT:
LOGGER.log(Level.INFO, "executing timeline query: {0}", query); LOGGER.log(Level.INFO, "executing timeline query: {0}", query); //NON-NLS
break; break;
case RELEASE: case RELEASE:
default: default:
@ -1145,8 +1145,8 @@ public class EventDB {
String description = rs.getString(SQLHelper.getDescriptionColumn(descriptionLOD)); String description = rs.getString(SQLHelper.getDescriptionColumn(descriptionLOD));
EventType type = useSubTypes ? RootEventType.allTypes.get(rs.getInt("sub_type")) : BaseTypes.values()[rs.getInt("base_type")];// NON-NLS EventType type = useSubTypes ? RootEventType.allTypes.get(rs.getInt("sub_type")) : BaseTypes.values()[rs.getInt("base_type")];// NON-NLS
Set<Long> hashHits = SQLHelper.unGroupConcat(rs.getString("hash_hits"), Long::valueOf); Set<Long> hashHits = SQLHelper.unGroupConcat(rs.getString("hash_hits"), Long::valueOf); //NON-NLS
Set<Long> tagged = SQLHelper.unGroupConcat(rs.getString("taggeds"), Long::valueOf); Set<Long> tagged = SQLHelper.unGroupConcat(rs.getString("taggeds"), Long::valueOf); //NON-NLS
return new EventCluster(interval, type, eventIDs, hashHits, tagged, return new EventCluster(interval, type, eventIDs, hashHits, tagged,
description, descriptionLOD); description, descriptionLOD);
@ -1217,7 +1217,7 @@ public class EventDB {
} }
private static String typeColumnHelper(final boolean useSubTypes) { private static String typeColumnHelper(final boolean useSubTypes) {
return useSubTypes ? "sub_type" : "base_type"; return useSubTypes ? "sub_type" : "base_type"; //NON-NLS
} }
private long getDBInfo(DBInfoKey key, long defaultValue) { private long getDBInfo(DBInfoKey key, long defaultValue) {

View File

@ -97,7 +97,7 @@ public class EventsRepository {
private final static Logger LOGGER = Logger.getLogger(EventsRepository.class.getName()); private final static Logger LOGGER = Logger.getLogger(EventsRepository.class.getName());
private final Executor workerExecutor = Executors.newSingleThreadExecutor(new ThreadFactoryBuilder().setNameFormat("eventrepository-worker-%d").build()); private final Executor workerExecutor = Executors.newSingleThreadExecutor(new ThreadFactoryBuilder().setNameFormat("eventrepository-worker-%d").build()); //NON-NLS
private DBPopulationWorker dbWorker; private DBPopulationWorker dbWorker;
private final EventDB eventDB; private final EventDB eventDB;
private final Case autoCase; private final Case autoCase;
@ -218,7 +218,7 @@ public class EventsRepository {
try { try {
return eventStripeCache.get(params); return eventStripeCache.get(params);
} catch (ExecutionException ex) { } catch (ExecutionException ex) {
LOGGER.log(Level.SEVERE, "Failed to load Event Stripes from cache for " + params.toString(), ex); LOGGER.log(Level.SEVERE, "Failed to load Event Stripes from cache for " + params.toString(), ex); //NON-NLS
return Collections.emptyList(); return Collections.emptyList();
} }
} }
@ -275,7 +275,7 @@ public class EventsRepository {
try { try {
datasourcesMap.putIfAbsent(id, skCase.getContentById(id).getDataSource().getName()); datasourcesMap.putIfAbsent(id, skCase.getContentById(id).getDataSource().getName());
} catch (TskCoreException ex) { } catch (TskCoreException ex) {
LOGGER.log(Level.SEVERE, "Failed to get datasource by ID.", ex); LOGGER.log(Level.SEVERE, "Failed to get datasource by ID.", ex); //NON-NLS
} }
} }
@ -283,7 +283,7 @@ public class EventsRepository {
//should this only be tags applied to files or event bearing artifacts? //should this only be tags applied to files or event bearing artifacts?
tagNames.setAll(skCase.getTagNamesInUse()); tagNames.setAll(skCase.getTagNamesInUse());
} catch (TskCoreException ex) { } catch (TskCoreException ex) {
LOGGER.log(Level.SEVERE, "Failed to get tag names in use.", ex); LOGGER.log(Level.SEVERE, "Failed to get tag names in use.", ex); //NON-NLS
} }
} }
@ -310,7 +310,7 @@ public class EventsRepository {
try { try {
tagNames.setAll(autoCase.getSleuthkitCase().getTagNamesInUse()); tagNames.setAll(autoCase.getSleuthkitCase().getTagNamesInUse());
} catch (TskCoreException ex) { } catch (TskCoreException ex) {
LOGGER.log(Level.SEVERE, "Failed to get tag names in use.", ex); LOGGER.log(Level.SEVERE, "Failed to get tag names in use.", ex); //NON-NLS
} }
} }
@ -368,7 +368,7 @@ public class EventsRepository {
*/ */
@ThreadConfined(type = ThreadConfined.ThreadType.JFX) @ThreadConfined(type = ThreadConfined.ThreadType.JFX)
private CancellationProgressTask<Void> rebuildRepository(final DBPopulationMode mode) { private CancellationProgressTask<Void> rebuildRepository(final DBPopulationMode mode) {
LOGGER.log(Level.INFO, "(re)starting {0} db population task", mode); LOGGER.log(Level.INFO, "(re)starting {0} db population task", mode); //NON-NLS
if (dbWorker != null) { if (dbWorker != null) {
dbWorker.cancel(); dbWorker.cancel();
} }
@ -481,7 +481,7 @@ public class EventsRepository {
//reset database //TODO: can we do more incremental updates? -jm //reset database //TODO: can we do more incremental updates? -jm
eventDB.reInitializeDB(); eventDB.reInitializeDB();
//grab ids of all files //grab ids of all files
List<Long> fileIDs = skCase.findAllFileIdsWhere("name != '.' AND name != '..'"); List<Long> fileIDs = skCase.findAllFileIdsWhere("name != '.' AND name != '..'"); //NON-NLS
final int numFiles = fileIDs.size(); final int numFiles = fileIDs.size();
trans = eventDB.beginTransaction(); trans = eventDB.beginTransaction();
@ -635,7 +635,7 @@ public class EventsRepository {
try { try {
get(); get();
} catch (CancellationException ex) { } catch (CancellationException ex) {
LOGGER.log(Level.WARNING, "Timeline database population was cancelled by the user. " LOGGER.log(Level.WARNING, "Timeline database population was cancelled by the user. " //NON-NLS
+ " Not all events may be present or accurate."); // NON-NLS + " Not all events may be present or accurate."); // NON-NLS
} catch (Exception ex) { } catch (Exception ex) {
LOGGER.log(Level.WARNING, "Unexpected exception while populating database.", ex); // NON-NLS LOGGER.log(Level.WARNING, "Unexpected exception while populating database.", ex); // NON-NLS

View File

@ -62,12 +62,12 @@ class SQLHelper {
static String useHashHitTablesHelper(RootFilter filter) { static String useHashHitTablesHelper(RootFilter filter) {
HashHitsFilter hashHitFilter = filter.getHashHitsFilter(); HashHitsFilter hashHitFilter = filter.getHashHitsFilter();
return hashHitFilter.isActive() ? " LEFT JOIN hash_set_hits " : " "; return hashHitFilter.isActive() ? " LEFT JOIN hash_set_hits " : " "; //NON-NLS
} }
static String useTagTablesHelper(RootFilter filter) { static String useTagTablesHelper(RootFilter filter) {
TagsFilter tagsFilter = filter.getTagsFilter(); TagsFilter tagsFilter = filter.getTagsFilter();
return tagsFilter.isActive() ? " LEFT JOIN tags " : " "; return tagsFilter.isActive() ? " LEFT JOIN tags " : " "; //NON-NLS
} }
/** /**
@ -93,13 +93,13 @@ class SQLHelper {
return filter.getSubFilters().stream() return filter.getSubFilters().stream()
.filter(Filter::isSelected) .filter(Filter::isSelected)
.map(SQLHelper::getSQLWhere) .map(SQLHelper::getSQLWhere)
.collect(Collectors.joining(" and ", "( ", ")")); .collect(Collectors.joining(" and ", "( ", ")")); //NON-NLS
} }
private static String getSQLWhere(UnionFilter<?> filter) { private static String getSQLWhere(UnionFilter<?> filter) {
return filter.getSubFilters().stream() return filter.getSubFilters().stream()
.filter(Filter::isSelected).map(SQLHelper::getSQLWhere) .filter(Filter::isSelected).map(SQLHelper::getSQLWhere)
.collect(Collectors.joining(" or ", "( ", ")")); .collect(Collectors.joining(" or ", "( ", ")")); //NON-NLS
} }
static String getSQLWhere(RootFilter filter) { static String getSQLWhere(RootFilter filter) {
@ -143,7 +143,7 @@ class SQLHelper {
} else { } else {
throw new IllegalArgumentException("getSQLWhere not defined for " + filter.getClass().getCanonicalName()); throw new IllegalArgumentException("getSQLWhere not defined for " + filter.getClass().getCanonicalName());
} }
result = StringUtils.deleteWhitespace(result).equals("(1and1and1)") ? "1" : result; result = StringUtils.deleteWhitespace(result).equals("(1and1and1)") ? "1" : result; //NON-NLS
result = StringUtils.deleteWhitespace(result).equals("()") ? "1" : result; result = StringUtils.deleteWhitespace(result).equals("()") ? "1" : result;
return result; return result;
} }
@ -158,7 +158,7 @@ class SQLHelper {
private static String getSQLWhere(DescriptionFilter filter) { private static String getSQLWhere(DescriptionFilter filter) {
if (filter.isActive()) { if (filter.isActive()) {
String likeOrNotLike = (filter.getFilterMode() == DescriptionFilter.FilterMode.INCLUDE ? "" : " NOT") + " LIKE '"; String likeOrNotLike = (filter.getFilterMode() == DescriptionFilter.FilterMode.INCLUDE ? "" : " NOT") + " LIKE '"; //NON-NLS
return "(" + getDescriptionColumn(filter.getDescriptionLoD()) + likeOrNotLike + filter.getDescription() + "' )"; // NON-NLS return "(" + getDescriptionColumn(filter.getDescriptionLoD()) + likeOrNotLike + filter.getDescription() + "' )"; // NON-NLS
} else { } else {
return "1"; return "1";
@ -172,8 +172,8 @@ class SQLHelper {
.filter((TagNameFilter t) -> t.isSelected() && !t.isDisabled()) .filter((TagNameFilter t) -> t.isSelected() && !t.isDisabled())
.map((TagNameFilter t) -> String.valueOf(t.getTagName().getId())) .map((TagNameFilter t) -> String.valueOf(t.getTagName().getId()))
.collect(Collectors.joining(", ", "(", ")")); .collect(Collectors.joining(", ", "(", ")"));
return "(events.event_id == tags.event_id AND " return "(events.event_id == tags.event_id AND " //NON-NLS
+ "tags.tag_name_id IN " + tagNameIDs + ") "; + "tags.tag_name_id IN " + tagNameIDs + ") "; //NON-NLS
} else { } else {
return "1"; return "1";
} }
@ -187,7 +187,7 @@ class SQLHelper {
.filter((HashSetFilter t) -> t.isSelected() && !t.isDisabled()) .filter((HashSetFilter t) -> t.isSelected() && !t.isDisabled())
.map((HashSetFilter t) -> String.valueOf(t.getHashSetID())) .map((HashSetFilter t) -> String.valueOf(t.getHashSetID()))
.collect(Collectors.joining(", ", "(", ")")); .collect(Collectors.joining(", ", "(", ")"));
return "(hash_set_hits.hash_set_id IN " + hashSetIDs + " AND hash_set_hits.event_id == events.event_id)"; return "(hash_set_hits.hash_set_id IN " + hashSetIDs + " AND hash_set_hits.event_id == events.event_id)"; //NON-NLS
} else { } else {
return "1"; return "1";
} }
@ -195,14 +195,14 @@ class SQLHelper {
private static String getSQLWhere(DataSourceFilter filter) { private static String getSQLWhere(DataSourceFilter filter) {
if (filter.isActive()) { if (filter.isActive()) {
return "(datasource_id = '" + filter.getDataSourceID() + "')"; return "(datasource_id = '" + filter.getDataSourceID() + "')"; //NON-NLS
} else { } else {
return "1"; return "1";
} }
} }
private static String getSQLWhere(DataSourcesFilter filter) { private static String getSQLWhere(DataSourcesFilter filter) {
return (filter.isActive()) ? "(datasource_id in (" return (filter.isActive()) ? "(datasource_id in (" //NON-NLS
+ filter.getSubFilters().stream() + filter.getSubFilters().stream()
.filter(AbstractFilter::isActive) .filter(AbstractFilter::isActive)
.map((dataSourceFilter) -> String.valueOf(dataSourceFilter.getDataSourceID())) .map((dataSourceFilter) -> String.valueOf(dataSourceFilter.getDataSourceID()))
@ -215,9 +215,9 @@ class SQLHelper {
return "1"; return "1";
} }
String strippedFilterText = StringUtils.strip(filter.getText()); String strippedFilterText = StringUtils.strip(filter.getText());
return "((med_description like '%" + strippedFilterText + "%')" return "((med_description like '%" + strippedFilterText + "%')" //NON-NLS
+ " or (full_description like '%" + strippedFilterText + "%')" + " or (full_description like '%" + strippedFilterText + "%')" //NON-NLS
+ " or (short_description like '%" + strippedFilterText + "%'))"; + " or (short_description like '%" + strippedFilterText + "%'))"; //NON-NLS
} else { } else {
return "1"; return "1";
} }
@ -240,7 +240,7 @@ class SQLHelper {
return "1"; //then collapse clause to true return "1"; //then collapse clause to true
} }
} }
return "(sub_type IN (" + StringUtils.join(getActiveSubTypes(typeFilter), ",") + "))"; return "(sub_type IN (" + StringUtils.join(getActiveSubTypes(typeFilter), ",") + "))"; //NON-NLS
} }
private static List<Integer> getActiveSubTypes(TypeFilter filter) { private static List<Integer> getActiveSubTypes(TypeFilter filter) {
@ -288,12 +288,12 @@ class SQLHelper {
static String getDescriptionColumn(DescriptionLoD lod) { static String getDescriptionColumn(DescriptionLoD lod) {
switch (lod) { switch (lod) {
case FULL: case FULL:
return "full_description"; return "full_description"; //NON-NLS
case MEDIUM: case MEDIUM:
return "med_description"; return "med_description"; //NON-NLS
case SHORT: case SHORT:
default: default:
return "short_description"; return "short_description"; //NON-NLS
} }
} }

View File

@ -78,7 +78,7 @@ class EventNode extends DisplayableItemNode {
try { try {
timePropery.setValue(getDateTimeString()); timePropery.setValue(getDateTimeString());
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) { } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) {
LOGGER.log(Level.SEVERE, "unexpected error setting date/time property on EventNode explorer node", ex); LOGGER.log(Level.SEVERE, "unexpected error setting date/time property on EventNode explorer node", ex); //NON-NLS
} }
}); });

View File

@ -53,8 +53,8 @@ import org.sleuthkit.autopsy.timeline.TimeLineController;
*/ */
public abstract class IntervalSelector<X> extends BorderPane { public abstract class IntervalSelector<X> extends BorderPane {
private static final Image ClEAR_INTERVAL_ICON = new Image("/org/sleuthkit/autopsy/timeline/images/cross-script.png", 16, 16, true, true, true); private static final Image ClEAR_INTERVAL_ICON = new Image("/org/sleuthkit/autopsy/timeline/images/cross-script.png", 16, 16, true, true, true); //NON-NLS
private static final Image ZOOM_TO_INTERVAL_ICON = new Image("/org/sleuthkit/autopsy/timeline/images/magnifier-zoom-fit.png", 16, 16, true, true, true); private static final Image ZOOM_TO_INTERVAL_ICON = new Image("/org/sleuthkit/autopsy/timeline/images/magnifier-zoom-fit.png", 16, 16, true, true, true); //NON-NLS
private static final double STROKE_WIDTH = 3; private static final double STROKE_WIDTH = 3;
private static final double HALF_STROKE = STROKE_WIDTH / 2; private static final double HALF_STROKE = STROKE_WIDTH / 2;

View File

@ -84,10 +84,11 @@ import org.sleuthkit.datamodel.TskCoreException;
/** /**
* *
*/ */
@NbBundle.Messages({"EventBundleNodeBase.toolTip.loading=loading..."})
public abstract class EventBundleNodeBase<BundleType extends EventBundle<ParentType>, ParentType extends EventBundle<BundleType>, ParentNodeType extends EventBundleNodeBase<ParentType, BundleType, ?>> extends StackPane { public abstract class EventBundleNodeBase<BundleType extends EventBundle<ParentType>, ParentType extends EventBundle<BundleType>, ParentNodeType extends EventBundleNodeBase<ParentType, BundleType, ?>> extends StackPane {
private static final Logger LOGGER = Logger.getLogger(EventBundleNodeBase.class.getName()); private static final Logger LOGGER = Logger.getLogger(EventBundleNodeBase.class.getName());
private static final Image HASH_PIN = new Image("/org/sleuthkit/autopsy/images/hashset_hits.png"); //NOI18N private static final Image HASH_PIN = new Image("/org/sleuthkit/autopsy/images/hashset_hits.png"); //NOI18N NON-NLS
private static final Image TAG = new Image("/org/sleuthkit/autopsy/images/green-tag-icon-16.png"); // NON-NLS //NOI18N private static final Image TAG = new Image("/org/sleuthkit/autopsy/images/green-tag-icon-16.png"); // NON-NLS //NOI18N
static final CornerRadii CORNER_RADII_3 = new CornerRadii(3); static final CornerRadii CORNER_RADII_3 = new CornerRadii(3);
@ -131,7 +132,7 @@ public abstract class EventBundleNodeBase<BundleType extends EventBundle<ParentT
final ImageView tagIV = new ImageView(TAG); final ImageView tagIV = new ImageView(TAG);
final HBox infoHBox = new HBox(5, descrLabel, countLabel, hashIV, tagIV); final HBox infoHBox = new HBox(5, descrLabel, countLabel, hashIV, tagIV);
private final Tooltip tooltip = new Tooltip("loading..."); private final Tooltip tooltip = new Tooltip(Bundle.EventBundleNodeBase_toolTip_loading());
private Timeline timeline; private Timeline timeline;
public EventBundleNodeBase(EventDetailsChart chart, BundleType eventBundle, ParentNodeType parentNode) { public EventBundleNodeBase(EventDetailsChart chart, BundleType eventBundle, ParentNodeType parentNode) {
@ -226,13 +227,18 @@ public abstract class EventBundleNodeBase<BundleType extends EventBundle<ParentT
"# {2} - description", "# {2} - description",
"# {3} - start date/time", "# {3} - start date/time",
"# {4} - end date/time", "# {4} - end date/time",
"EventBundleNodeBase.tooltip.text={0} {1} events\n{2}\nbetween\t{3}\nand \t{4}"}) "EventBundleNodeBase.tooltip.text={0} {1} events\n{2}\nbetween\t{3}\nand \t{4}",
"EventBundleNodeBase.toolTip.loading2=loading tooltip",
"# {0} - hash set count string",
"EventBundleNodeBase.toolTip.hashSetHits=\n\nHash Set Hits\n{0}",
"# {0} - tag count string",
"EventBundleNodeBase.toolTip.tags=\n\nTags\n{0}"})
@ThreadConfined(type = ThreadConfined.ThreadType.JFX) @ThreadConfined(type = ThreadConfined.ThreadType.JFX)
private void installTooltip() { private void installTooltip() {
if (tooltip.getText().equalsIgnoreCase("loading...")) { if (tooltip.getText().equalsIgnoreCase(Bundle.EventBundleNodeBase_toolTip_loading())) {
final Task<String> tooltTipTask = new Task<String>() { final Task<String> tooltTipTask = new Task<String>() {
{ {
updateTitle("loading tooltip"); updateTitle(Bundle.EventBundleNodeBase_toolTip_loading2());
} }
@Override @Override
@ -248,7 +254,7 @@ public abstract class EventBundleNodeBase<BundleType extends EventBundle<ParentT
} }
} }
} catch (TskCoreException ex) { } catch (TskCoreException ex) {
LOGGER.log(Level.SEVERE, "Error getting hashset hit info for event.", ex); LOGGER.log(Level.SEVERE, "Error getting hashset hit info for event.", ex); //NON-NLS
} }
} }
String hashSetCountsString = hashSetCounts.entrySet().stream() String hashSetCountsString = hashSetCounts.entrySet().stream()
@ -266,8 +272,8 @@ public abstract class EventBundleNodeBase<BundleType extends EventBundle<ParentT
return Bundle.EventBundleNodeBase_tooltip_text(getEventIDs().size(), getEventType(), getDescription(), return Bundle.EventBundleNodeBase_tooltip_text(getEventIDs().size(), getEventType(), getDescription(),
TimeLineController.getZonedFormatter().print(getStartMillis()), TimeLineController.getZonedFormatter().print(getStartMillis()),
TimeLineController.getZonedFormatter().print(getEndMillis() + 1000)) TimeLineController.getZonedFormatter().print(getEndMillis() + 1000))
+ (hashSetCountsString.isEmpty() ? "" : "\n\nHash Set Hits\n" + hashSetCountsString) + (hashSetCountsString.isEmpty() ? "" : Bundle.EventBundleNodeBase_toolTip_hashSetHits(hashSetCountsString))
+ (tagCountsString.isEmpty() ? "" : "\n\nTags\n" + tagCountsString); + (tagCountsString.isEmpty() ? "" : Bundle.EventBundleNodeBase_toolTip_tags(tagCountsString));
} }
@Override @Override
@ -277,7 +283,7 @@ public abstract class EventBundleNodeBase<BundleType extends EventBundle<ParentT
tooltip.setText(get()); tooltip.setText(get());
tooltip.setGraphic(null); tooltip.setGraphic(null);
} catch (InterruptedException | ExecutionException ex) { } catch (InterruptedException | ExecutionException ex) {
LOGGER.log(Level.SEVERE, "Tooltip generation failed.", ex); LOGGER.log(Level.SEVERE, "Tooltip generation failed.", ex); //NON-NLS
} }
} }
}; };

View File

@ -207,7 +207,7 @@ final public class EventClusterNode extends EventBundleNodeBase<EventCluster, Ev
descLOD.set(loadedDescriptionLoD); descLOD.set(loadedDescriptionLoD);
} }
} catch (InterruptedException | ExecutionException ex) { } catch (InterruptedException | ExecutionException ex) {
LOGGER.log(Level.SEVERE, "Error loading subnodes", ex); LOGGER.log(Level.SEVERE, "Error loading subnodes", ex); //NON-NLS
} }
chart.requestChartLayout(); chart.requestChartLayout();
chart.setCursor(null); chart.setCursor(null);

View File

@ -96,10 +96,10 @@ import org.sleuthkit.autopsy.timeline.zooming.DescriptionLoD;
*/ */
public final class EventDetailsChart extends XYChart<DateTime, EventStripe> implements TimeLineChart<DateTime> { public final class EventDetailsChart extends XYChart<DateTime, EventStripe> implements TimeLineChart<DateTime> {
private static final String styleSheet = GuideLine.class.getResource("EventsDetailsChart.css").toExternalForm(); private static final String styleSheet = GuideLine.class.getResource("EventsDetailsChart.css").toExternalForm(); //NON-NLS
private static final Image HIDE = new Image("/org/sleuthkit/autopsy/timeline/images/eye--minus.png"); // NON-NLS private static final Image HIDE = new Image("/org/sleuthkit/autopsy/timeline/images/eye--minus.png"); // NON-NLS
private static final Image SHOW = new Image("/org/sleuthkit/autopsy/timeline/images/eye--plus.png"); // NON-NLS private static final Image SHOW = new Image("/org/sleuthkit/autopsy/timeline/images/eye--plus.png"); // NON-NLS
private static final Image MARKER = new Image("/org/sleuthkit/autopsy/timeline/images/marker.png", 16, 16, true, true, true); private static final Image MARKER = new Image("/org/sleuthkit/autopsy/timeline/images/marker.png", 16, 16, true, true, true); //NON-NLS
private static final int PROJECTED_LINE_Y_OFFSET = 5; private static final int PROJECTED_LINE_Y_OFFSET = 5;
private static final int PROJECTED_LINE_STROKE_WIDTH = 5; private static final int PROJECTED_LINE_STROKE_WIDTH = 5;
private static final int MINIMUM_EVENT_NODE_GAP = 4; private static final int MINIMUM_EVENT_NODE_GAP = 4;
@ -725,11 +725,13 @@ public final class EventDetailsChart extends XYChart<DateTime, EventStripe> impl
} }
} }
@NbBundle.Messages({"HideDescriptionAction.displayName=Hide",
"HideDescriptionAction.displayMsg=Hide this group from the details view."})
class HideDescriptionAction extends Action { class HideDescriptionAction extends Action {
HideDescriptionAction(String description, DescriptionLoD descriptionLoD) { HideDescriptionAction(String description, DescriptionLoD descriptionLoD) {
super("Hide"); super(Bundle.HideDescriptionAction_displayName());
setLongText("Hide this group from the details view."); setLongText(Bundle.HideDescriptionAction_displayMsg());
setGraphic(new ImageView(HIDE)); setGraphic(new ImageView(HIDE));
setEventHandler((ActionEvent t) -> { setEventHandler((ActionEvent t) -> {
final DescriptionFilter testFilter = new DescriptionFilter( final DescriptionFilter testFilter = new DescriptionFilter(
@ -749,10 +751,11 @@ public final class EventDetailsChart extends XYChart<DateTime, EventStripe> impl
} }
} }
@NbBundle.Messages({"UnhideDescriptionAction.displayName=Unhide"})
class UnhideDescriptionAction extends Action { class UnhideDescriptionAction extends Action {
UnhideDescriptionAction(String description, DescriptionLoD descriptionLoD) { UnhideDescriptionAction(String description, DescriptionLoD descriptionLoD) {
super("Unhide"); super(Bundle.UnhideDescriptionAction_displayName());
setGraphic(new ImageView(SHOW)); setGraphic(new ImageView(SHOW));
setEventHandler((ActionEvent t) -> setEventHandler((ActionEvent t) ->
getController().getQuickHideFilters().stream() getController().getQuickHideFilters().stream()

View File

@ -53,7 +53,7 @@ class GuideLine extends Line {
Axis<DateTime> xAxis = chart.getXAxis(); Axis<DateTime> xAxis = chart.getXAxis();
endYProperty().bind(chart.heightProperty().subtract(xAxis.heightProperty().subtract(xAxis.tickLengthProperty()))); endYProperty().bind(chart.heightProperty().subtract(xAxis.heightProperty().subtract(xAxis.tickLengthProperty())));
getStyleClass().add("guide-line"); getStyleClass().add("guide-line"); //NON-NLS
Tooltip.install(this, tooltip); Tooltip.install(this, tooltip);
tooltip.setOnShowing(showing -> tooltip.setText(Bundle.GuideLine_tooltip_text(getDateTimeAsString()))); tooltip.setOnShowing(showing -> tooltip.setText(Bundle.GuideLine_tooltip_text(getDateTimeAsString())));

View File

@ -53,9 +53,6 @@ import org.sleuthkit.autopsy.timeline.filters.DescriptionFilter;
import org.sleuthkit.autopsy.timeline.filters.Filter; import org.sleuthkit.autopsy.timeline.filters.Filter;
import org.sleuthkit.autopsy.timeline.filters.RootFilter; import org.sleuthkit.autopsy.timeline.filters.RootFilter;
import org.sleuthkit.autopsy.timeline.filters.TypeFilter; import org.sleuthkit.autopsy.timeline.filters.TypeFilter;
import static org.sleuthkit.autopsy.timeline.ui.filtering.Bundle.Timeline_ui_filtering_menuItem_none;
import static org.sleuthkit.autopsy.timeline.ui.filtering.Bundle.Timeline_ui_filtering_menuItem_only;
import static org.sleuthkit.autopsy.timeline.ui.filtering.Bundle.Timeline_ui_filtering_menuItem_select;
/** /**
* The FXML controller for the filter ui. * The FXML controller for the filter ui.
@ -65,7 +62,7 @@ import static org.sleuthkit.autopsy.timeline.ui.filtering.Bundle.Timeline_ui_fil
*/ */
final public class FilterSetPanel extends BorderPane { final public class FilterSetPanel extends BorderPane {
private static final Image TICK = new Image("org/sleuthkit/autopsy/timeline/images/tick.png"); private static final Image TICK = new Image("org/sleuthkit/autopsy/timeline/images/tick.png"); //NON-NLS
@FXML @FXML
private Button applyButton; private Button applyButton;
@ -103,7 +100,9 @@ final public class FilterSetPanel extends BorderPane {
"Timeline.ui.filtering.menuItem.none=none", "Timeline.ui.filtering.menuItem.none=none",
"Timeline.ui.filtering.menuItem.only=only", "Timeline.ui.filtering.menuItem.only=only",
"Timeline.ui.filtering.menuItem.others=others", "Timeline.ui.filtering.menuItem.others=others",
"Timeline.ui.filtering.menuItem.select=select"}) "Timeline.ui.filtering.menuItem.select=select",
"FilterSetPanel.hiddenDescriptionsListView.unhideAndRm=Unhide and remove from list",
"FilterSetPanel.hiddenDescriptionsListView.remove=Remove from list"})
void initialize() { void initialize() {
assert applyButton != null : "fx:id=\"applyButton\" was not injected: check your FXML file 'FilterSetPanel.fxml'."; // NON-NLS assert applyButton != null : "fx:id=\"applyButton\" was not injected: check your FXML file 'FilterSetPanel.fxml'."; // NON-NLS
@ -123,14 +122,14 @@ final public class FilterSetPanel extends BorderPane {
t.getValue().setSelected(Boolean.TRUE); t.getValue().setSelected(Boolean.TRUE);
}); });
}); });
MenuItem none = new MenuItem(Timeline_ui_filtering_menuItem_none()); MenuItem none = new MenuItem(Bundle.Timeline_ui_filtering_menuItem_none());
none.setOnAction(e -> { none.setOnAction(e -> {
row.getTreeItem().getParent().getChildren().forEach((TreeItem<Filter> t) -> { row.getTreeItem().getParent().getChildren().forEach((TreeItem<Filter> t) -> {
t.getValue().setSelected(Boolean.FALSE); t.getValue().setSelected(Boolean.FALSE);
}); });
}); });
MenuItem only = new MenuItem(Timeline_ui_filtering_menuItem_only()); MenuItem only = new MenuItem(Bundle.Timeline_ui_filtering_menuItem_only());
only.setOnAction(e -> { only.setOnAction(e -> {
row.getTreeItem().getParent().getChildren().forEach((TreeItem<Filter> t) -> { row.getTreeItem().getParent().getChildren().forEach((TreeItem<Filter> t) -> {
if (t == row.getTreeItem()) { if (t == row.getTreeItem()) {
@ -151,7 +150,7 @@ final public class FilterSetPanel extends BorderPane {
}); });
}); });
final ContextMenu rowMenu = new ContextMenu(); final ContextMenu rowMenu = new ContextMenu();
Menu select = new Menu(Timeline_ui_filtering_menuItem_select()); Menu select = new Menu(Bundle.Timeline_ui_filtering_menuItem_select());
select.setOnAction(e -> { select.setOnAction(e -> {
row.getItem().setSelected(!row.getItem().isSelected()); row.getItem().setSelected(!row.getItem().isSelected());
}); });
@ -212,9 +211,9 @@ final public class FilterSetPanel extends BorderPane {
private void configureText(Boolean newValue) { private void configureText(Boolean newValue) {
if (newValue) { if (newValue) {
setText("Unhide and remove from list"); setText(Bundle.FilterSetPanel_hiddenDescriptionsListView_unhideAndRm());
} else { } else {
setText("Remove from list"); setText(Bundle.FilterSetPanel_hiddenDescriptionsListView_remove());
} }
} }
})); }));
@ -257,12 +256,13 @@ final public class FilterSetPanel extends BorderPane {
}); });
} }
@NbBundle.Messages({"FilterSetPanel.applyButton.text=Apply"}) @NbBundle.Messages({"FilterSetPanel.applyButton.text=Apply",
"FilterSetPanel.applyButton.longText=(Re)Apply filters"})
private class ApplyFiltersAction extends Action { private class ApplyFiltersAction extends Action {
ApplyFiltersAction() { ApplyFiltersAction() {
super(Bundle.FilterSetPanel_applyButton_text()); super(Bundle.FilterSetPanel_applyButton_text());
setLongText("(Re)Apply filters"); setLongText(Bundle.FilterSetPanel_applyButton_longText());
setGraphic(new ImageView(TICK)); setGraphic(new ImageView(TICK));
setEventHandler((ActionEvent t) -> { setEventHandler((ActionEvent t) -> {
applyFilters(); applyFilters();

View File

@ -130,7 +130,7 @@ public class ZoomParams {
@Override @Override
public String toString() { public String toString() {
return "ZoomParams{" + "timeRange=" + timeRange + ", typeZoomLevel=" + typeZoomLevel + ", filter=" + filter + ", descrLOD=" + descrLOD + '}'; return "ZoomParams{" + "timeRange=" + timeRange + ", typeZoomLevel=" + typeZoomLevel + ", filter=" + filter + ", descrLOD=" + descrLOD + '}'; //NON-NLS
} }
} }