fix (Sonarlint) warnings

This commit is contained in:
Eyck Jentzsch 2021-01-14 23:36:07 +01:00
parent 16de83616a
commit 5bae086712
5 changed files with 12 additions and 20 deletions

View File

@ -11,8 +11,6 @@
package com.minres.scviewer.database.sqlite;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
@ -41,7 +39,7 @@ abstract class AbstractTxStream extends HierNode implements IWaveform {
private List<RelationType> usedRelationsList;
public AbstractTxStream(IDatabase database, String name, long streamId) {
protected AbstractTxStream(IDatabase database, String name, long streamId) {
super(name);
this.database=database;
this.streamId=streamId;

View File

@ -18,7 +18,6 @@ import java.util.Map.Entry;
import java.util.NavigableMap;
import java.util.TreeMap;
import com.minres.scviewer.database.EventKind;
import com.minres.scviewer.database.HierNode;
import com.minres.scviewer.database.IEvent;
import com.minres.scviewer.database.IWaveform;

View File

@ -29,8 +29,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.TreeSet;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.zip.GZIPInputStream;
@ -147,11 +145,10 @@ public class TextDbLoader implements IWaveformDbLoader {
if (txCache.containsKey(txId))
return txCache.get(txId);
if(transactions.containsKey(txId)) {
Tx tx = new Tx(this, txId);
Tx tx = new Tx(this, transactions.get(txId));
txCache.put(txId, tx);
return tx;
} else {
Set<Long> keys = new TreeSet<>(transactions.keySet());
throw new IllegalArgumentException();
}
}
@ -256,10 +253,8 @@ public class TextDbLoader implements IWaveformDbLoader {
TextDbParser parser = new TextDbParser(this);
try {
// parser.txSink = mapDb.treeMap("transactions", Serializer.LONG, Serializer.JAVA).createFromSink();
parser.txSink = mapDb.hashMap("transactions", Serializer.LONG, Serializer.JAVA).create();
parser.parseInput(gzipped ? new GZIPInputStream(new FileInputStream(file)) : new FileInputStream(file));
// transactions = parser.txSink.create();
transactions = parser.txSink;
} catch (IllegalArgumentException | ArrayIndexOutOfBoundsException e) {
} catch (Exception e) {

View File

@ -23,7 +23,6 @@ import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Display;
import com.minres.scviewer.database.EventKind;
import com.minres.scviewer.database.IEvent;
import com.minres.scviewer.database.IHierNode;
import com.minres.scviewer.database.IWaveform;
@ -143,14 +142,16 @@ public class ArrowPainter implements IPainter {
}
}
}
int height = waveCanvas.styleProvider.getTrackHeight();
return new Rectangle(
(int) (otherTx.getBeginTime() / scaleFactor),
waveCanvas.rulerHeight + painter.getVerticalOffset() + height * getConcurrencyIndex(otherTx),
(int) ((otherTx.getEndTime() - otherTx.getBeginTime()) / scaleFactor),
height);
} else
return null;
if(painter!=null) {
int height = waveCanvas.styleProvider.getTrackHeight();
return new Rectangle(
(int) (otherTx.getBeginTime() / scaleFactor),
waveCanvas.rulerHeight + painter.getVerticalOffset() + height * getConcurrencyIndex(otherTx),
(int) ((otherTx.getEndTime() - otherTx.getBeginTime()) / scaleFactor),
height);
}
}
return null;
}
@Override

View File

@ -95,7 +95,6 @@ public class DatabaseServicesTest {
assertNotNull(waveformDb);
assertEquals(3, waveformDb.getAllWaves().size());
assertEquals(1, waveformDb.getChildNodes().size());
while(!waveformDb.isLoaded()) Thread.sleep(10);
}
@Test