Fixed #20 - NPE gets caught when opening a damaged file and info popup
is shown
This commit is contained in:
parent
52f3f7b348
commit
7b2db09585
|
@ -80,6 +80,7 @@ public class TextDbLoader implements IWaveformDbLoader{
|
|||
.allocateStartSize(64*1024*1024)
|
||||
.allocateIncrement(64*1024*1024)
|
||||
.make()
|
||||
// NPE here --->
|
||||
parseInput(gzipped?new GZIPInputStream(new FileInputStream(file)):new FileInputStream(file))
|
||||
calculateConcurrencyIndicees()
|
||||
return true
|
||||
|
@ -87,6 +88,7 @@ public class TextDbLoader implements IWaveformDbLoader{
|
|||
} catch(EOFException e) {
|
||||
return true;
|
||||
} catch(Exception e) {
|
||||
System.out.println("---->>> Exception caught while loading database. StackTrace following... ");
|
||||
e.printStackTrace()
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -158,6 +158,7 @@ public class WaveformViewer implements IWaveformViewer {
|
|||
|
||||
@Override
|
||||
public void mouseUp(MouseEvent e) {
|
||||
if(start==null) return;
|
||||
if((e.stateMask&SWT.MODIFIER_MASK&~SWT.SHIFT)!=0) return; //don't react on modifier
|
||||
if (e.button == 1 && ((e.stateMask&SWT.SHIFT)==0)) {
|
||||
if(Math.abs(e.x-start.x)<3 && Math.abs(e.y-start.y)<3){
|
||||
|
|
|
@ -74,7 +74,8 @@ import org.eclipse.swt.widgets.Composite;
|
|||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Event;
|
||||
import org.eclipse.swt.widgets.Listener;
|
||||
import org.eclipse.swt.widgets.TypedListener;
|
||||
import org.eclipse.swt.widgets.MessageBox;
|
||||
|
||||
import com.minres.scviewer.database.ITx;
|
||||
import com.minres.scviewer.database.ITxEvent;
|
||||
import com.minres.scviewer.database.ITxRelation;
|
||||
|
@ -489,7 +490,17 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
|||
job.addJobChangeListener(new JobChangeAdapter() {
|
||||
@Override
|
||||
public void done(IJobChangeEvent event) {
|
||||
if (event.getResult().getCode() != Status.OK_STATUS.getCode()) return;
|
||||
IStatus result = event.getResult();
|
||||
if( (!result.isMultiStatus() && result.getCode() != Status.OK_STATUS.getCode() ) ||
|
||||
(result.isMultiStatus() && result.getChildren().length > 0 && result.getChildren()[0].getCode() != Status.OK_STATUS.getCode() ) ){
|
||||
// kill editor and pop up warning for user
|
||||
sync.asyncExec(() -> {
|
||||
final Display display = myParent.getDisplay();
|
||||
MessageDialog.openWarning(display.getActiveShell(), "Error loading database", "Database cannot be loaded. Aborting...");
|
||||
ePartService.hidePart(myPart, true);
|
||||
});
|
||||
return;
|
||||
}
|
||||
sync.asyncExec(()->{
|
||||
waveformPane.setMaxTime(database.getMaxTime());
|
||||
if (state != null)
|
||||
|
|
Loading…
Reference in New Issue