/usr/share/java/jFormatString.jar Dead store to local variable Dead store to c in edu.umd.cs.findbugs.formatStringChecker.FormatterCompileTimeTest.testBug1874856FalsePositive() At FormatterCompileTimeTest.java:[lines 13-102] In class edu.umd.cs.findbugs.formatStringChecker.FormatterCompileTimeTest In method edu.umd.cs.findbugs.formatStringChecker.FormatterCompileTimeTest.testBug1874856FalsePositive() Local variable named c At FormatterCompileTimeTest.java:[line 66] Dead store to local variable Dead store to c in edu.umd.cs.findbugs.formatStringChecker.FormatterCompileTimeTest.testBug1874856TruePositive() At FormatterCompileTimeTest.java:[lines 13-102] In class edu.umd.cs.findbugs.formatStringChecker.FormatterCompileTimeTest In method edu.umd.cs.findbugs.formatStringChecker.FormatterCompileTimeTest.testBug1874856TruePositive() Local variable named c At FormatterCompileTimeTest.java:[line 89] Method ignores return value return value of String.format(String, Object[]) ignored in edu.umd.cs.findbugs.formatStringChecker.FormatterRuntimeTest.testShouldWork() At FormatterRuntimeTest.java:[lines 16-92] In class edu.umd.cs.findbugs.formatStringChecker.FormatterRuntimeTest In method edu.umd.cs.findbugs.formatStringChecker.FormatterRuntimeTest.testShouldWork() Called method String.format(String, Object[]) At FormatterRuntimeTest.java:[line 19] Another occurrence at FormatterRuntimeTest.java:[line 21] Another occurrence at FormatterRuntimeTest.java:[line 22] Method ignores return value return value of String.format(String, Object[]) ignored in edu.umd.cs.findbugs.formatStringChecker.FormatterRuntimeTest.testFormatDateWithY() At FormatterRuntimeTest.java:[lines 16-92] In class edu.umd.cs.findbugs.formatStringChecker.FormatterRuntimeTest In method edu.umd.cs.findbugs.formatStringChecker.FormatterRuntimeTest.testFormatDateWithY() Called method String.format(String, Object[]) At FormatterRuntimeTest.java:[line 52] Method ignores return value return value of String.format(String, Object[]) ignored in edu.umd.cs.findbugs.formatStringChecker.FormatterRuntimeTest.testNotEnoughParameters() At FormatterRuntimeTest.java:[lines 16-92] In class edu.umd.cs.findbugs.formatStringChecker.FormatterRuntimeTest In method edu.umd.cs.findbugs.formatStringChecker.FormatterRuntimeTest.testNotEnoughParameters() Called method String.format(String, Object[]) At FormatterRuntimeTest.java:[line 36] Method ignores return value return value of String.format(String, Object[]) ignored in edu.umd.cs.findbugs.formatStringChecker.FormatterRuntimeTest.testStringWhereIntegerExpected() At FormatterRuntimeTest.java:[lines 16-92] In class edu.umd.cs.findbugs.formatStringChecker.FormatterRuntimeTest In method edu.umd.cs.findbugs.formatStringChecker.FormatterRuntimeTest.testStringWhereIntegerExpected() Called method String.format(String, Object[]) At FormatterRuntimeTest.java:[line 28] The type of a supplied argument doesn't match format specifier Argument of type String can't be handled by format specifier %tY in edu.umd.cs.findbugs.formatStringChecker.FormatterRuntimeTest.testDateMismatch() At FormatterRuntimeTest.java:[lines 16-92] In class edu.umd.cs.findbugs.formatStringChecker.FormatterRuntimeTest In method edu.umd.cs.findbugs.formatStringChecker.FormatterRuntimeTest.testDateMismatch() Called method java.io.PrintStream.printf(String, Object[]) At String.java:[lines 109-2985] Actual type String Format specifier "%tY" Format string "%tY\n" String constant "2008" At FormatterRuntimeTest.java:[line 88] The type of a supplied argument doesn't match format specifier Argument of type String can't be handled by format specifier %d in edu.umd.cs.findbugs.formatStringChecker.FormatterRuntimeTest.testStringWhereIntegerExpected() At FormatterRuntimeTest.java:[lines 16-92] In class edu.umd.cs.findbugs.formatStringChecker.FormatterRuntimeTest In method edu.umd.cs.findbugs.formatStringChecker.FormatterRuntimeTest.testStringWhereIntegerExpected() Called method String.format(String, Object[]) At String.java:[lines 109-2985] Actual type String Format specifier "%d" Format string "%d" String constant "test" At FormatterRuntimeTest.java:[line 28] Array formatted in useless way using format string Argument of type int[] formatted in useless way in edu.umd.cs.findbugs.formatStringChecker.FormatterRuntimeTest.testPassingAnArray() At FormatterRuntimeTest.java:[lines 16-92] In class edu.umd.cs.findbugs.formatStringChecker.FormatterRuntimeTest In method edu.umd.cs.findbugs.formatStringChecker.FormatterRuntimeTest.testPassingAnArray() Called method java.io.PrintStream.printf(String, Object[]) Actual type int[] Format specifier "%s" Format string "%s" At FormatterRuntimeTest.java:[line 43] Non-Boolean argument formatted using %b format specifier Non-Boolean argument formatted using %b format specifier in edu.umd.cs.findbugs.formatStringChecker.FormatterRuntimeTest.testPassingAnIntToABoolean() At FormatterRuntimeTest.java:[lines 16-92] In class edu.umd.cs.findbugs.formatStringChecker.FormatterRuntimeTest In method edu.umd.cs.findbugs.formatStringChecker.FormatterRuntimeTest.testPassingAnIntToABoolean() Called method java.io.PrintStream.printf(String, Object[]) At Integer.java:[lines 50-1177] Actual type Integer Format specifier "%b" Format string "%b" Return value of Integer.valueOf(int) At FormatterRuntimeTest.java:[line 47] Illegal format string Illegal format string "%Y" in edu.umd.cs.findbugs.formatStringChecker.FormatterRuntimeTest.testFormatDateWithY() At FormatterRuntimeTest.java:[lines 16-92] In class edu.umd.cs.findbugs.formatStringChecker.FormatterRuntimeTest In method edu.umd.cs.findbugs.formatStringChecker.FormatterRuntimeTest.testFormatDateWithY() Called method String.format(String, Object[]) Format string "%Y" At FormatterRuntimeTest.java:[line 52] Format string references missing argument format string "%s" needs argument 2 but only 1 are provided in edu.umd.cs.findbugs.formatStringChecker.FormatterRuntimeTest.testNotEnoughParameters() At FormatterRuntimeTest.java:[lines 16-92] In class edu.umd.cs.findbugs.formatStringChecker.FormatterRuntimeTest In method edu.umd.cs.findbugs.formatStringChecker.FormatterRuntimeTest.testNotEnoughParameters() Called method String.format(String, Object[]) Format specifier "%s" Format string "%s%s" Expected 2 arguments Found 1 arguments At FormatterRuntimeTest.java:[line 36] No previous argument for format string No previous argument for format string argument to String.format(String, Object[]) in edu.umd.cs.findbugs.formatStringChecker.FormatterRuntimeTest.testBug1874856TruePositive() At FormatterRuntimeTest.java:[lines 16-92] In class edu.umd.cs.findbugs.formatStringChecker.FormatterRuntimeTest In method edu.umd.cs.findbugs.formatStringChecker.FormatterRuntimeTest.testBug1874856TruePositive() Called method String.format(String, Object[]) Format specifier "%<te" Format string "s5 Duke's Birthday: %<te, %te %<tY %te %12$tm " At FormatterRuntimeTest.java:[line 78] Format string should use %n rather than \n Format string should use %n rather than \n in edu.umd.cs.findbugs.formatStringChecker.FormatterRuntimeTest.testDateMismatch() At FormatterRuntimeTest.java:[lines 16-92] In class edu.umd.cs.findbugs.formatStringChecker.FormatterRuntimeTest In method edu.umd.cs.findbugs.formatStringChecker.FormatterRuntimeTest.testDateMismatch() Called method java.io.PrintStream.printf(String, Object[]) Format string "%tY\n" At FormatterRuntimeTest.java:[line 88] Format string should use %n rather than \n Format string should use %n rather than \n in edu.umd.cs.findbugs.formatStringChecker.FormatterRuntimeTest.testShouldWork() At FormatterRuntimeTest.java:[lines 16-92] In class edu.umd.cs.findbugs.formatStringChecker.FormatterRuntimeTest In method edu.umd.cs.findbugs.formatStringChecker.FormatterRuntimeTest.testShouldWork() Called method String.format(String, Object[]) Format string "%d\n" At FormatterRuntimeTest.java:[line 21] Format string should use %n rather than \n Format string should use %n rather than \n in edu.umd.cs.findbugs.formatStringChecker.FormatterRuntimeTest.testShouldWork() At FormatterRuntimeTest.java:[lines 16-92] In class edu.umd.cs.findbugs.formatStringChecker.FormatterRuntimeTest In method edu.umd.cs.findbugs.formatStringChecker.FormatterRuntimeTest.testShouldWork() Called method String.format(String, Object[]) Format string "%f\n" At FormatterRuntimeTest.java:[line 22] Dodgy code Bad practice Correctness No previous argument for format string
The format string specifies a relative index to request that the argument for the previous format specifier be reused. However, there is no previous argument. For example,

formatter.format("%<s %s", "a", "b")

would throw a MissingFormatArgumentException when executed.

]]>
Array formatted in useless way using format string
One of the arguments being formatted with a format string is an array. This will be formatted using a fairly useless format, such as [I@304282, which doesn't actually show the contents of the array. Consider wrapping the array using Arrays.asList(...) before handling it off to a formatted.

]]>
Non-Boolean argument formatted using %b format specifier
An argument not of type Boolean is being formatted with a %b format specifier. This won't throw an exception; instead, it will print true for any nonnull value, and false for null. This feature of format strings is strange, and may not be what you intended.

]]>
The type of a supplied argument doesn't match format specifier
One of the arguments is uncompatible with the corresponding format string specifier. As a result, this will generate a runtime exception when executed. For example, String.format("%d", "1") will generate an exception, since the String "1" is incompatible with the format specifier %d.

]]>
Format string should use %n rather than \n
This format string include a newline character (\n). In format strings, it is generally preferable better to use %n, which will produce the platform-specific line separator.

]]>
Format string references missing argument
Not enough arguments are passed to satisfy a placeholder in the format string. A runtime exception will occur when this statement is executed.

]]>
Illegal format string
The format string is syntactically invalid, and a runtime exception will occur when this statement is executed.

]]>
Method ignores return value
The return value of this method should be checked. One common cause of this warning is to invoke a method on an immutable object, thinking that it updates the object. For example, in the following code fragment,

String dateString = getHeaderField(name);
dateString.trim();

the programmer seems to be thinking that the trim() method will update the String referenced by dateString. But since Strings are immutable, the trim() function returns a new String value, which is being ignored here. The code should be corrected to:

String dateString = getHeaderField(name);
dateString = dateString.trim();
]]>
Dead store to local variable
This instruction assigns a value to a local variable, but the value is not read or used in any subsequent instruction. Often, this indicates an error, because the value computed is never used.

Note that Sun's javac compiler often generates dead stores for final local variables. Because FindBugs is a bytecode-based tool, there is no easy way to eliminate these false positives.

]]>
Format string problem Bad use of return value from method Useless/non-informative string generated Dead local store junit.framework.Assert junit.framework.TestCase