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-cor81 [2013/11/18 23:04]
narges.tvs
teaching:labs:mdse:2013:bug_descriptions:jt-bug-cor81 [2018/05/09 01:59] (current)
Line 1: Line 1:
 +====== Bug core 87 ======
  
 +
 +
 +===== Inspired by =====
 +
 +   * [[http://​findbugs.sourceforge.net/​bugDescriptions.html#​NP_NULL_ON_SOME_PATH]]
 +
 +===== Original Description =====
 +
 +There is a branch of statement that, if executed, guarantees that a null value will be dereferenced,​ which would generate a NullPointerException when the code is executed. Of course, the problem might be that the branch or statement is infeasible and that the null pointer exception can't ever be executed; deciding that is beyond the ability of FindBugs.
 +
 +-- 2013-11-18 ​
 +
 +
 +===== Detailed Description =====
 +as its name shows,"​possible"​ null pointer is detected ,in the sample code the condition in wich obj is null but elt is not null, a null value will be dereferenced by the second part of "​OR"​ operation.
 +
 +===== Sample Problem Scenario =====
 +<Code lang-java>​
 +public static void possibleNullPointer(Object elt,Object Obj) {
 +
 + if ((Obj == null && elt == null) || Obj.equals(elt)) {
 + //​dosomthing
 +     }
 + }
 +</​Code>​
 +
 +===== Sample Fix =====
 +
 +
 +<code Java>
 + ​public static void fixPossibleNullPointer(Object elt,Object Obj) {
 +
 + if ((Obj == null && elt == null) || (Obj != null && Obj.equals(elt))) {
 + //​dosomthing
 +     }
 +
 + }
 +</​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-cor81.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2019