(Finally) reach the point where we have some useful, if basic, functionality.
[cfb.git] / prod / net / jaekl / cfb / xml / BugInstance.java
index 96a815e5aaa41089beafd6599878a83d0e922e3a..0683a7d23c83dd1437b08ebe77bd545d01a830f4 100644 (file)
@@ -57,9 +57,11 @@ public class BugInstance extends ParseResult {
                m_id = id;
                m_category = category;
                m_type = type;
-               m_classes = null;
-               m_methods = null;
-               m_lines = null;
+               
+               m_classes = new ArrayList<BugClass>();
+               m_methods = new ArrayList<BugMethod>();
+               m_lines = new ArrayList<SourceLine>();
+
                m_locations = new ArrayList<Location>(Arrays.asList(locations));
                m_locals = new ArrayList<LocalVariable>(Arrays.asList(variables));
        }
@@ -138,11 +140,18 @@ public class BugInstance extends ParseResult {
                        bm.dump(pw, childIndent);
                }
                for (LocalVariable lv : m_locals) {
-                       lv.dump(pw, childIndent);
+                       if (null != lv) {
+                               lv.dump(pw, childIndent);
+                       }
                }
                for (SourceLine sl : m_lines) {
                        sl.dump(pw, childIndent);
                }
+               for (Location loc : m_locations) {
+                       if (null != loc) {
+                               loc.dump(pw, childIndent);
+                       }
+               }
        }
        
        // Note that this is a heuristic, "fuzzy", equals.
@@ -180,18 +189,11 @@ public class BugInstance extends ParseResult {
                                }
                        }
                        else {
-                               if (! Util.objsAreEqual(thisLoc.getClassName(), thatLoc.getClassName())) {
-                                       return false;
-                               }
-                               if (! Util.objsAreEqual(thisLoc.getMethodName(), thatLoc.getMethodName())) {
+                               if (! thisLoc.fuzzyEquals(thatLoc)) {
                                        return false;
                                }
                        }
                        
-                       if (! Util.objsAreEqual(this.getVariables(), that.getVariables())) {
-                               return false;
-                       }
-                       
                        return true;
                }
                return false;
@@ -201,9 +203,8 @@ public class BugInstance extends ParseResult {
        public int hashCode() 
        {
                int code = Util.objHashCode(m_type)
-                                * Util.objHashCode(m_category)
-                                * Util.objHashCode(getPrincipalLocation())
-                                * Util.objHashCode(getVariables());
+                                ^ Util.objHashCode(m_category)
+                                ^ Util.objHashCode(getPrincipalLocation());
                return code;
        }