SDA SE Wiki

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

User Tools

Site Tools


Bug Cor112

Replace all placeholder words (written with underscores) by their suitable counterparts in the context of your Bug.

Inspired by

Original Description

“The code contains a conditional test is performed twice, one right after the other (e.g., x == 0 || x == 0). Perhaps the second occurrence is intended to be something else (e.g., x == 0 || y == 0).” – 2013-10-28

Detailed Description

In the given statement one cannot have same conditional tests performed twice, whereas the second occurrence of the condition is intended to perform some other conditional test.

Sample Problem Scenario

<code Java> public class BugCor112 {

int x;

int y;
String result;

void findRpc()
{
	if (x == 0 || x == 0)
	{
		result = "Error: Repeated Conditional Test";
	}
}

</Code>

Sample Fix

<code Java> public class BugCor112 {

int x;

int y;
String result;

void findRpc()
{
	if (x == 0)
	{
		result = "Good: No Repeated Conditional Test";
	}
}

</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-cor112.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2024