#25 Infinte Loop

open
nobody
Core (2)
5
2009-07-30
2009-07-30
Anonymous
No

I am running into the problem of infinite loop while running jester.
> Jester is changing a condition in a for loop which is causing an
> infinite loop while running unit tests.

Here is the code: So when jester changes nested for loop inside switch from ++cIdx to --cIdx, it goes into infinite loop

StringBuffer argBuf = new StringBuffer();

for ( int cIdx = 0 ; cIdx < argStr.length() ; ) {
char ch = argStr.charAt( cIdx );

switch ( ch ) {
case '$':
StringBuffer nameBuf = new StringBuffer();
for ( ++cIdx ; cIdx < argStr.length() ; ++cIdx ) {
ch = argStr.charAt( cIdx );
if ( ch == '_' || Character.isLetterOrDigit( ch ) )
nameBuf.append( ch );
else
break;
}

if ( nameBuf.length() > 0 ) {
String value = (String)
vars.get( nameBuf.toString() );

if ( value != null ) {
argBuf.append( value );
}
}
break;

default:
argBuf.append( ch );
++cIdx;
break;
}
}

Discussion


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks