| Severity | 3 |
|---|---|
| Enabled | yes |
| Waivable | |
| Violation |
if (strToProc == null) {
int c = 0;
for (int i = 0; i < LOOP_CONST; i++)
c += i;
intVal = new Integer(c);
}
else if (strToProc.length() == 0)
intVal = new Integer(0);
else {
int a = 0;
int c = 0;
while (a < strToProc.length())
if (strToProc.charAt(a)==CHAR_A) {
c++;
}
a++;
intVal = new Integer(c);
}
|
| Fix |
if (strToProc == null) {
int c = 0;
for (int i = 0; i < LOOP_CONST; i++) {
c += i;
}
intVal = new Integer(c);
}
else if (strToProc.length() == 0) {
intVal = new Integer(0);
}
else {
int a = 0;
int c = 0;
while (a < strToProc.length()) {
if (strToProc.charAt(a)==CHAR_A) {
c++;
}
a++;
}
intVal = new Integer(c);
}
|