Add unit tests. Make DbStore handle cases where the bug type or category
[cfb.git] / test / net / jaekl / cfb / xml / MessagesXmlData.java
index 5b81dcadcef7bc483542e5a26c0f336622500442..94e3f09ff72454fd188af460fc254f56e2cf82a1 100644 (file)
@@ -5,7 +5,7 @@ public class MessagesXmlData {
                  "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
                + "<MessageCollection xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
                + "xsi:noNamespaceSchemaLocation=\"messagecollection.xsd\">\n"
-               + "<BugCategory category=\"CORRECTNESS\">\n"
+               + "  <BugCategory category=\"CORRECTNESS\">\n"
                + "    <Description>Correctness</Description>\n"
                + "    <Abbreviation>C</Abbreviation>\n"
                + "    <Details>Probable bug - an apparent coding mistake\n"
@@ -222,6 +222,41 @@ public class MessagesXmlData {
                + ""
                + "             ]]>"
                + "                 </Details>"
-               + "               </BugPattern>"
+               + "  </BugPattern>"
+               + "  <BugPattern type=\"VO_VOLATILE_INCREMENT\">"
+               + "    <ShortDescription>An increment to a volatile field isn't atomic</ShortDescription>"
+               + "    <LongDescription>Increment of volatile field {2} in {1}</LongDescription>"
+               + "    <Details>"
+               + "      <![CDATA["
+               + "        <p>This code increments a volatile field. Increments of volatile fields aren't"
+               + "          atomic. If more than one thread is incrementing the field at the same time,"
+               + "          increments could be lost."
+               + "        </p>"
+               + "      ]]>"
+           + "    </Details>"
+               + "  </BugPattern>   "
+               + "  <BugPattern type=\"DM_NUMBER_CTOR\">"
+               + "    <ShortDescription>Method invokes inefficient Number constructor; use static valueOf instead</ShortDescription>"
+               + "    <LongDescription>{1} invokes inefficient {2} constructor; use {3} instead</LongDescription>"
+               + "    <Details>"
+               + "      <![CDATA["
+               + "        <p>"
+               + "          Using <code>new Integer(int)</code> is guaranteed to always result in a new object whereas"
+               + "          <code>Integer.valueOf(int)</code> allows caching of values to be done by the compiler, class library, or JVM."
+               + "          Using of cached values avoids object allocation and the code will be faster."
+               + "        </p>"
+               + "        <p>"
+               + "          Values between -128 and 127 are guaranteed to have corresponding cached instances"
+               + "          and using <code>valueOf</code> is approximately 3.5 times faster than using constructor."
+               + "          For values outside the constant range the performance of both styles is the same."
+               + "        </p>"
+               + "        <p>"
+               + "          Unless the class must be compatible with JVMs predating Java 1.5,"
+               + "          use either autoboxing or the <code>valueOf()</code> method when creating instances of"
+               + "          <code>Long</code>, <code>Integer</code>, <code>Short</code>, <code>Character</code>, and <code>Byte</code>."
+               + "        </p>"
+               + "      ]]>"
+               + "    </Details>"
+               + "  </BugPattern>"
                + "</MessageCollection>";
 }