@@ -49,19 +49,19 @@ private TimeLineModule() {
49
49
}
50
50
51
51
/**
52
- * Get instance of the controller for the current case
52
+ * Get instance of the controller for the current case.
53
+ * The controller instance is initialized from a case open event.
53
54
*
54
55
* @return the controller for the current case.
55
56
*
56
- * @throws NoCurrentCaseException If there is no case open.
57
57
* @throws TskCoreException If there was a problem accessing the case
58
58
* database.
59
59
*
60
60
*/
61
- public static TimeLineController getController () throws NoCurrentCaseException , TskCoreException {
61
+ public static TimeLineController getController () throws TskCoreException {
62
62
synchronized (controllerLock ) {
63
63
if (controller == null ) {
64
- controller = new TimeLineController ( Case . getCurrentCaseThrows () );
64
+ throw new TskCoreException ( "Timeline controller not initialized" );
65
65
}
66
66
return controller ;
67
67
}
@@ -100,13 +100,22 @@ public void propertyChange(PropertyChangeEvent evt) {
100
100
}
101
101
controller = null ;
102
102
}
103
+ } else {
104
+ // Case is opening - create the controller now
105
+ synchronized (controllerLock ) {
106
+ try {
107
+ controller = new TimeLineController (Case .getCurrentCaseThrows ());
108
+ } catch (TskCoreException | NoCurrentCaseException ex ) {
109
+ logger .log (Level .SEVERE , "Error creating Timeline controller" , ex );
110
+ }
111
+ }
103
112
}
104
113
} else {
105
114
try {
106
115
getController ().handleCaseEvent (evt );
107
- } catch (NoCurrentCaseException ignored ) {
108
116
} catch (TskCoreException ex ) {
109
- logger .log (Level .SEVERE , "Error handling application event" , ex );
117
+ // The call to getController() will only fail due to case closing, so do
118
+ // not record the error.
110
119
}
111
120
}
112
121
}
@@ -121,12 +130,9 @@ static private class IngestModuleEventListener implements PropertyChangeListener
121
130
public void propertyChange (PropertyChangeEvent evt ) {
122
131
try {
123
132
getController ().handleIngestModuleEvent (evt );
124
- } catch (NoCurrentCaseException ex ) {
125
- // ignore
126
- return ;
127
133
} catch (TskCoreException ex ) {
128
- MessageNotifyUtil . Message . error ( "Error creating timeline controller." );
129
- logger . log ( Level . SEVERE , "Error creating timeline controller" , ex );
134
+ // The call to getController() will only fail due to case closing, so do
135
+ // not record the error.
130
136
}
131
137
}
132
138
}
0 commit comments