fix (Sonarlint) warnings
This commit is contained in:
parent
16de83616a
commit
5bae086712
|
@ -11,8 +11,6 @@
|
||||||
package com.minres.scviewer.database.sqlite;
|
package com.minres.scviewer.database.sqlite;
|
||||||
|
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
@ -41,7 +39,7 @@ abstract class AbstractTxStream extends HierNode implements IWaveform {
|
||||||
|
|
||||||
private List<RelationType> usedRelationsList;
|
private List<RelationType> usedRelationsList;
|
||||||
|
|
||||||
public AbstractTxStream(IDatabase database, String name, long streamId) {
|
protected AbstractTxStream(IDatabase database, String name, long streamId) {
|
||||||
super(name);
|
super(name);
|
||||||
this.database=database;
|
this.database=database;
|
||||||
this.streamId=streamId;
|
this.streamId=streamId;
|
||||||
|
|
|
@ -18,7 +18,6 @@ import java.util.Map.Entry;
|
||||||
import java.util.NavigableMap;
|
import java.util.NavigableMap;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
|
||||||
import com.minres.scviewer.database.EventKind;
|
|
||||||
import com.minres.scviewer.database.HierNode;
|
import com.minres.scviewer.database.HierNode;
|
||||||
import com.minres.scviewer.database.IEvent;
|
import com.minres.scviewer.database.IEvent;
|
||||||
import com.minres.scviewer.database.IWaveform;
|
import com.minres.scviewer.database.IWaveform;
|
||||||
|
|
|
@ -29,8 +29,6 @@ import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Set;
|
|
||||||
import java.util.TreeSet;
|
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import java.util.zip.GZIPInputStream;
|
import java.util.zip.GZIPInputStream;
|
||||||
|
@ -147,11 +145,10 @@ public class TextDbLoader implements IWaveformDbLoader {
|
||||||
if (txCache.containsKey(txId))
|
if (txCache.containsKey(txId))
|
||||||
return txCache.get(txId);
|
return txCache.get(txId);
|
||||||
if(transactions.containsKey(txId)) {
|
if(transactions.containsKey(txId)) {
|
||||||
Tx tx = new Tx(this, txId);
|
Tx tx = new Tx(this, transactions.get(txId));
|
||||||
txCache.put(txId, tx);
|
txCache.put(txId, tx);
|
||||||
return tx;
|
return tx;
|
||||||
} else {
|
} else {
|
||||||
Set<Long> keys = new TreeSet<>(transactions.keySet());
|
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -256,10 +253,8 @@ public class TextDbLoader implements IWaveformDbLoader {
|
||||||
TextDbParser parser = new TextDbParser(this);
|
TextDbParser parser = new TextDbParser(this);
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// parser.txSink = mapDb.treeMap("transactions", Serializer.LONG, Serializer.JAVA).createFromSink();
|
|
||||||
parser.txSink = mapDb.hashMap("transactions", Serializer.LONG, Serializer.JAVA).create();
|
parser.txSink = mapDb.hashMap("transactions", Serializer.LONG, Serializer.JAVA).create();
|
||||||
parser.parseInput(gzipped ? new GZIPInputStream(new FileInputStream(file)) : new FileInputStream(file));
|
parser.parseInput(gzipped ? new GZIPInputStream(new FileInputStream(file)) : new FileInputStream(file));
|
||||||
// transactions = parser.txSink.create();
|
|
||||||
transactions = parser.txSink;
|
transactions = parser.txSink;
|
||||||
} catch (IllegalArgumentException | ArrayIndexOutOfBoundsException e) {
|
} catch (IllegalArgumentException | ArrayIndexOutOfBoundsException e) {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
@ -23,7 +23,6 @@ import org.eclipse.swt.graphics.Point;
|
||||||
import org.eclipse.swt.graphics.Rectangle;
|
import org.eclipse.swt.graphics.Rectangle;
|
||||||
import org.eclipse.swt.widgets.Display;
|
import org.eclipse.swt.widgets.Display;
|
||||||
|
|
||||||
import com.minres.scviewer.database.EventKind;
|
|
||||||
import com.minres.scviewer.database.IEvent;
|
import com.minres.scviewer.database.IEvent;
|
||||||
import com.minres.scviewer.database.IHierNode;
|
import com.minres.scviewer.database.IHierNode;
|
||||||
import com.minres.scviewer.database.IWaveform;
|
import com.minres.scviewer.database.IWaveform;
|
||||||
|
@ -143,14 +142,16 @@ public class ArrowPainter implements IPainter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int height = waveCanvas.styleProvider.getTrackHeight();
|
if(painter!=null) {
|
||||||
return new Rectangle(
|
int height = waveCanvas.styleProvider.getTrackHeight();
|
||||||
(int) (otherTx.getBeginTime() / scaleFactor),
|
return new Rectangle(
|
||||||
waveCanvas.rulerHeight + painter.getVerticalOffset() + height * getConcurrencyIndex(otherTx),
|
(int) (otherTx.getBeginTime() / scaleFactor),
|
||||||
(int) ((otherTx.getEndTime() - otherTx.getBeginTime()) / scaleFactor),
|
waveCanvas.rulerHeight + painter.getVerticalOffset() + height * getConcurrencyIndex(otherTx),
|
||||||
height);
|
(int) ((otherTx.getEndTime() - otherTx.getBeginTime()) / scaleFactor),
|
||||||
} else
|
height);
|
||||||
return null;
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -95,7 +95,6 @@ public class DatabaseServicesTest {
|
||||||
assertNotNull(waveformDb);
|
assertNotNull(waveformDb);
|
||||||
assertEquals(3, waveformDb.getAllWaves().size());
|
assertEquals(3, waveformDb.getAllWaves().size());
|
||||||
assertEquals(1, waveformDb.getChildNodes().size());
|
assertEquals(1, waveformDb.getChildNodes().size());
|
||||||
while(!waveformDb.isLoaded()) Thread.sleep(10);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in New Issue