tmf: Fix some Sonar warnings in the state system code
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.core / src / org / eclipse / linuxtools / internal / tmf / core / statesystem / backends / historytree / HTInterval.java
index 49100da9b3b1aa6d4610e4450d065aeeadf56fc7..886640ea1e31530e754266b6120d4079c12c2fc9 100644 (file)
@@ -296,7 +296,7 @@ final class HTInterval implements ITmfStateInterval, Comparable<HTInterval> {
      * @return
      */
     int getIntervalSize() {
-        return stringsEntrySize + HTNode.getDataEntrySize();
+        return stringsEntrySize + HTNode.DATA_ENTRY_SIZE;
     }
 
     private int computeStringsEntrySize() {
@@ -314,12 +314,12 @@ final class HTInterval implements ITmfStateInterval, Comparable<HTInterval> {
                 return sv.unboxStr().getBytes().length + 2;
             } catch (StateValueTypeException e) {
                 /* We're inside a switch/case for the string type, can't happen */
-                throw new RuntimeException();
+                throw new IllegalStateException(e);
             }
         default:
             /* It's very important that we know how to write the state value in
              * the file!! */
-            throw new RuntimeException();
+            throw new IllegalStateException();
         }
     }
 
@@ -340,10 +340,9 @@ final class HTInterval implements ITmfStateInterval, Comparable<HTInterval> {
 
     @Override
     public boolean equals(Object other) {
-        if (other instanceof HTInterval) {
-            if (this.compareTo((HTInterval) other) == 0) {
-                return true;
-            }
+        if (other instanceof HTInterval &&
+                this.compareTo((HTInterval) other) == 0) {
+            return true;
         }
         return false;
     }
@@ -388,7 +387,7 @@ final class HTInterval implements ITmfStateInterval, Comparable<HTInterval> {
             return TYPE_LONG;
         default:
             /* Should not happen if the switch is fully covered */
-            throw new RuntimeException();
+            throw new IllegalStateException();
         }
     }
 }
This page took 0.024496 seconds and 5 git commands to generate.