X-Git-Url: http://jaekl.net/gitweb/?p=cfb.git;a=blobdiff_plain;f=prod%2Fnet%2Fjaekl%2Fcfb%2Fstore%2FDbStore.java;h=ed22291387c14c8047593d7b1a11932633df6361;hp=3860ca5637e5c2fd31f93bec95b1d59900dec6d5;hb=e8190c8189a5270ada70aaa478409db6dbf1efae;hpb=6032315cf7e150bcda88c9d6e6b35fc244217d54 diff --git a/prod/net/jaekl/cfb/store/DbStore.java b/prod/net/jaekl/cfb/store/DbStore.java index 3860ca5..ed22291 100644 --- a/prod/net/jaekl/cfb/store/DbStore.java +++ b/prod/net/jaekl/cfb/store/DbStore.java @@ -3,7 +3,9 @@ package net.jaekl.cfb.store; import java.sql.Connection; import java.sql.SQLException; import java.util.List; +import java.util.Locale; +import net.jaekl.cfb.CfbBundle; import net.jaekl.cfb.analyze.Analysis; import net.jaekl.cfb.db.CfbSchema; import net.jaekl.cfb.db.Column; @@ -17,6 +19,8 @@ import net.jaekl.cfb.db.driver.DbDriver; import net.jaekl.cfb.xml.BugCollection; import net.jaekl.cfb.xml.BugInstance; import net.jaekl.cfb.xml.LocalVariable; +import net.jaekl.cfb.xml.messages.BugCategory; +import net.jaekl.cfb.xml.messages.BugPattern; import net.jaekl.cfb.xml.messages.MessageCollection; public class DbStore { @@ -42,7 +46,9 @@ public class DbStore { return getAnalysis(priorId); } - public boolean put(Analysis analysis) throws SQLException, TypeMismatchException { + public boolean put(Analysis analysis) throws SQLException, TypeMismatchException, StoreException { + CfbBundle bundle = CfbBundle.getInst(Locale.getDefault()); + if (null == analysis) { return false; } @@ -82,6 +88,13 @@ public class DbStore { Location secondLoc = (locs.size() > 1) ? locs.get(1) : null; Location thirdLoc = (locs.size() > 2) ? locs.get(2) : null; + if (BugPattern.UNKNOWN.getId() == bugId) { + throw new StoreException(bundle.get(CfbBundle.BUG_TYPE_UNKNOWN, ""+bug.getType())); + } + if (BugCategory.UNKNOWN.getId() == categoryId) { + throw new StoreException(bundle.get(CfbBundle.BUG_CATEGORY_UNKNOWN, ""+bug.getCategory())); + } + values[row][0] = foundId; values[row][1] = runId; values[row][2] = bugId;