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-cor048 [2013/12/16 14:18]
harshit.raikar
teaching:labs:mdse:2013:bug_descriptions:jt-bug-cor048 [2018/05/09 01:59] (current)
Line 1: Line 1:
 +====== Bug 048 ======
  
 +//Replace all placeholder words (written with underscores) by their suitable counterparts in the context of your Bug.//
 +
 +===== Inspired by =====
 +
 +  * [[http://​findbugs.sourceforge.net/​bugDescriptions.html#​VA_FORMAT_STRING_BAD_CONVERSION | FS: The type of a supplied argument doesn'​t match format specifier (VA_FORMAT_STRING_BAD_CONVERSION)]]
 +
 +===== Original Description =====
 +
 +"One of the arguments is incompatible with the corresponding format string specifier. As a result, this will generate a run-time exception when executed. For example, String.format("​%d",​ "​1"​) will generate an exception, since the String "​1"​ is incompatible with the format specifier %d." -- 2013-12-02 ​
 +
 +
 +===== Detailed Description =====
 +
 +Due to incompatible format specifier for integer and float, during the execution of the program it generates run-time exception. Whereas the IDE does not recognize the error.
 +
 +===== Sample Problem Scenario =====
 + 
 +<code Java>
 + public static void main(String[] args) {
 +
 + String.format("​%d","​1"​);​
 + String.format("​%f","​1"​);​
 + String.format("​%d",​ 1.5);
 +
 + }
 +</​Code>​
 +
 +
 +===== Sample Fix =====
 +
 +Change the format specifier according to the given argument
 +<code Java>
 + public static void main(String[] args) {
 +
 +                String.format("​%s","​1"​);​
 +                String.format("​%s","​1"​);​
 +         String.format("​%f",​ 1.5);
 +
 + }
 +</​Code>​
 +
 +
 +
 +===== 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-cor048.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2019