SDA SE Wiki

Software Engineering for Smart Data Analytics & Smart Data Analytics for Software Engineering

User Tools

Site Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
teaching:labs:mdse:2013:bug_descriptions:jt-bug-cor047 [2013/12/16 14:06]
priyanka.dank
teaching:labs:mdse:2013:bug_descriptions:jt-bug-cor047 [2018/05/09 01:59] (current)
Line 1: Line 1:
 +====== Bug 047 ======
  
 +Format string placeholder incompatible with passed argument (VA_FORMAT_STRING_BAD_ARGUMENT)
 +===== Inspired by =====
 +
 +  * [[http://​findbugs.sourceforge.net/​bugDescriptions.html#​VA_FORMAT_STRING_BAD_CONVERSION]]
 +
 +===== Original Description =====
 +
 +"The format string placeholder is incompatible with the corresponding argument. For example, System.out.printf("​%d\n",​ "​hello"​);​
 +The %d placeholder requires a numeric argument, but a string value is passed instead. A runtime exception will occur when this statement is executed."​ -- 2013-12-02 ​
 +
 +===== Detailed Description =====
 +If the format string passed to the printf() method is not compatible with the argument in printf() method, it should detect the error at compilation time instead of throwing run-time exception (which is currently done by IDE). 
 +
 +
 +===== Sample Problem Scenario =====
 +
 + class Sample {
 +                public static void main(String[] args){ ​    
 +                System.out.printf("​%d\n","​hello"​);​
 +        ​
 +              }       
 +        }
 +
 +
 +
 +       
 +===== Sample Fix =====
 +It is possible to correct the code by replacing the format string with correct one as shown in following example
 +      class Sample {
 +                public static void main(String[] args){ ​    
 +                System.out.printf("​%s\n","​hello"​);​
 +        ​
 +              }       
 +        }
 +
 +
 +===== Evaluation Results =====
 +
 +^  Benchmark project ​ ^  Precision ​             ^^^  Recall ​               ^^^
 +|                     ​| ​ FB    |  JT    |  Delta  |  FB    |  JT    |  Delta |
 +|  Project ...        |  ...%  |  ...%  |  ...%   ​| ​ ...%  |  ...%  |  ...%  |  ​
 +|  Project ...        |  ...%  |  ...%  |  ...%   ​| ​ ...%  |  ...%  |  ...%  |   
 +FB = FindBugs, JT = JTransformer,​ Delta = JTransformer - FindBugs
 + 
teaching/labs/mdse/2013/bug_descriptions/jt-bug-cor047.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2019