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-cor92 [2014/01/29 14:27]
malte.mauelshagen
teaching:labs:mdse:2013:bug_descriptions:jt-bug-cor92 [2018/05/09 01:59] (current)
Line 1: Line 1:
 +====== Bug Cor 92 ======
  
 +
 +===== Inspired by =====
 +
 +NP: Method call passes null for nonnull parameter (NP_NULL_PARAM_DEREF)
 +
 +===== Original Description =====
 +
 +This method call passes a null value for a nonnull method parameter. Either the parameter is annotated as a parameter that should always be nonnull, or analysis has shown that it will always be dereferenced.
 +
 +===== Detailed Description =====
 +
 +The structure described for method should match with the call of the method. Therefore, is necessary to use the same structure defined for the method such as in the annotations for the parameters.
 +During the execution of the code is probably that variable passed to the method has not been initialized or the value assigned has taken a null value.
 +
 +===== Sample Problem Scenario =====
 +
 +<code Java>
 +public class FindBugs {
 +
 + public static void main(String[] args) {
 + String str = null;
 + myMethod(str);​
 + }
 +
 + static String myMethod(@NonNull String myString){
 + System.out.print(myString);​
 + return myString;
 + }
 +}
 +
 +</​Code>​
 +
 +===== Sample Fix =====
 +
 +<code Java>
 +public class FindBugs {
 +
 + public static void main(String[] args) {
 +
 +   String str = "​myText";​
 +
 +   if(str != null){
 +   myMethod(str);​
 +   }else{
 +   throw new NullPointerException("​NUll parametrer"​);​
 +   }
 +
 + }
 +
 + static String myMethod(@NonNull String myString) {
 + System.out.print(myString);​
 + return myString;
 + }
 +}
 +
 +</​Code>​
 +
 +===== Evaluation Results =====
 +
 +
 +^  Benchmark project ​ ^  Precision ​             ^^^  Recall ​               ^^^
 +|                     ​| ​ FB    |  JT    |  Delta  |  FB    |  JT    |  Delta |
 +|  Apache Tomcat ​      | 100% (1) | 0%  |  -100  |  100%  |  100%  |  0%  |  ​
 +|  Argo UML         | 100% (2) | 0%  |  -100  |  100%  |  100%  |  0%  | 
 +|  AWT        | 100%  | 100%  |  0  |  100%  |  100%  |  0%  |  ​
 +|  Jakarta ​       | 100% (2) | 0%  |  -100  |  100%  |  100%  |  0%  |  ​
 +|  Java IO         | 100% (2) | 0%  |  -100  |  100%  |  100%  |  0%  | 
 +|  JHotDraw ​       | 100% (1) | 0%  |  -100  |  100%  |  100%  |  0%  |  ​
 +|  jrefactory ​      | 100% (1) | 0%  |  -100  |  100%  |  100%  |  0%  |
 +|  JServlet ​       | 100%  | 100%  |  0  |  100%  |  100%  |  0%  |  ​
 +|  JUnit        | 100%  | 100%  |  0  |  100%  |  100%  |  0%  |  ​
 +|  Lexi       | 100%  | 100%  |  0  |  100%  |  100%  |  0%  |  ​
 +|  Mapper XML       | 100%  | 100%  |  0  |  100%  |  100%  |  0%  |  ​
 +|  nutch        | 100%  | 100%  |  0  |  100%  |  100%  |  0%  |  ​
 +|  PMD        | 100%  | 100%  |  0  |  100%  |  100%  |  0%  |  ​
 +|  quickuml ​       | 100%  | 100%  |  0  |  100%  |  100%  |  0%  |  ​
 +FB = FindBugs, JT = JTransformer,​ Delta = JTransformer - FindBug
 + 
teaching/labs/mdse/2013/bug_descriptions/jt-bug-cor92.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2019