Add unit tests. Make DbStore handle cases where the bug type or category
[cfb.git] / prod / net / jaekl / cfb / xml / messages / MessageCollection.java
index ba4b97ca7b45797b214b6959987e14bdf2bd803f..560e04e267bec04f8f9e07af63ddc796c4b572a0 100644 (file)
@@ -23,10 +23,22 @@ public class MessageCollection extends ParseResult {
        }
        
        public Collection<BugCategory> getCategories() { return m_categories.values(); }
-       public BugCategory getCategory(String category) { return m_categories.get(category); }
+       public BugCategory getCategory(String category) { 
+               BugCategory cat = m_categories.get(category); 
+               if (null == cat) {
+                       cat = BugCategory.UNKNOWN;
+               }
+               return cat;
+       }
        
        public Collection<BugPattern> getPatterns() { return m_patterns.values(); }
-       public BugPattern getPattern(String type) { return m_patterns.get(type); }
+       public BugPattern getPattern(String type) { 
+               BugPattern pat = m_patterns.get(type);
+               if (null == pat) {
+                       pat = BugPattern.UNKNOWN;
+               }
+               return pat;
+       }
 
        @Override
        public void endContents(String uri, String localName, String qName, String chars)