Clean up error handling to make things slightly friendlier on an initial install.
[cfb.git] / prod / net / jaekl / cfb / CfbBundle.java
index 0cb7a4082cd574a27b04882d0314c0c92606e783..3914b6d2fe5a4b4e753c150069465d72b5d26ffb 100644 (file)
@@ -13,14 +13,19 @@ import net.jaekl.qd.QDBundleFactory;
 public class CfbBundle {
        public static final String ANALYSIS_FAILED = "analysis.failed";
        public static final String ANALYZED_AT = "analyzed.at";
+       public static final String BUG_CATEGORY_UNKNOWN = "bug.category.unknown";
+       public static final String BUG_TYPE_UNKNOWN = "bug.type.unknown";
        public static final String CANNOT_CONNECT = "cannot.connect.to.db";
        public static final String CANNOT_EXEC = "cannot.exec";
+       public static final String CANNOT_LOAD_FBMSG_FILE = "cannot.load.fbmsg.file";
        public static final String CANNOT_SEND_MAIL = "cannot.send.mail";
        public static final String CFB = "cfb";
        public static final String CFB_MAIL_SUBJECT = "cfb.mail.subject";
        public static final String CFB_REPORT = "cfb.report";
        public static final String COMPARING_RUNS = "comparing.runs";
        public static final String COMPARING_VERSIONS = "comparing.versions";
+       public static final String FINDBUGS_HOME_IS_NOT_SET = "findbugs.home.is.not.set";
+       public static final String FINDBUGS_HOME_IS_SET_TO = "findbugs.home.is.set.to";
        public static final String FIXED_BUGS = "fixed.bugs";
        public static final String NEW_BUGS = "new.bugs";
        public static final String NEW_VERSION = "new.version";
@@ -56,6 +61,11 @@ public class CfbBundle {
                m_bundle = QDBundleFactory.getInst().getBundle(BUNDLE_NAME, locale); 
        }
        
+       // This constructor is intended only for use during unit testing.
+       CfbBundle() {
+               m_bundle = null;
+       }
+       
        public String get(String key, Object... arguments) {
                try {
                        if (null != m_bundle) {
@@ -69,10 +79,15 @@ public class CfbBundle {
                        // Fall through to the fallback behaviour below
                }
                
+               return fallbackGet(key, arguments);
+       }
+       
+       String fallbackGet(String key, Object... arguments) {
                StringBuilder sb = new StringBuilder("[" + key + "]");
                for (Object obj : arguments) {
                        sb.append("[" + obj + "]");
                }
                return sb.toString();
+               
        }
 }