@Override
public void createPartControl(@Nullable Composite parent) {
// Initialize
- fTableMap = new HashMap<>();
+ final Map<TmfPcapProtocol, Table> tables = new HashMap<>();
+ fTableMap = tables;
fCurrentTrace = TmfTraceManager.getInstance().getActiveTrace();
fCurrentStream = null;
@Override
public void widgetSelected(@Nullable SelectionEvent e) {
- Map<TmfPcapProtocol, Table> tables = fTableMap;
- if (tables == null || e == null) {
+ if (e == null) {
return;
}
TmfPcapProtocol protocol = (TmfPcapProtocol) e.item.getData(KEY_PROTOCOL);
});
- Map<TmfPcapProtocol, Table> tables = fTableMap;
- if (tables == null) {
- return;
- }
-
tables.put(protocol, table);
// Add right click menu
@Test
public void testGetElementInFile() {
File testXmlFile = TmfXmlTestFiles.VALID_FILE.getFile();
- if ((testXmlFile == null) || !testXmlFile.exists()) {
- fail("XML test file does not exist");
- }
- /*
- * This sounds useless, but I get a potential null pointer warning
- * otherwise
- */
- if (testXmlFile == null) {
- return;
- }
-
+ assertNotNull("XML test file does not exist", testXmlFile);
+ assertTrue("XML test file does not exist", testXmlFile.exists());
Element analysis = XmlUtils.getElementInFile(testXmlFile.getAbsolutePath(), TmfXmlStrings.STATE_PROVIDER, ANALYSIS_ID);
assertNotNull(analysis);
}
import java.util.List;
import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.common.core.NonNullUtils;
import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomEvent;
@Override
public String resolve(ITmfEvent event) {
if (event instanceof CustomEvent) {
- String ret = ((CustomEvent) event).getEventString(fIndex);
- return (ret == null ? EMPTY_STRING : ret);
+ return NonNullUtils.nullToEmptyString(((CustomEvent) event).getEventString(fIndex));
}
return EMPTY_STRING;
}