I had a while loop in a run method, and in the while loop were a series of if stements. the series of if statments were in a try. my hope was if any if statement conked out it would catch the error, and continue the while loop ( the catch is in the while loop) and if there is more data it would try fresh and maybe that if statements routine if() { routine} wouldnt throw an exception. but what happens is if i do something wrong the whole run method stops doing anything. i was looking up an array at array[-1] by mistake in some cases. here is the code.

public void run()
		int a=1;

	newBoardData temp = new newBoardData();
	if(temp != null)

// other if statements looking at temp.dg ==

if(temp.dg == 13 || temp.dg == 16 || temp.dg == 19)// 13 16 19result

							//writeToConsole("in dg 13 16 19 result");
							int gamenum=getGameBoard(temp.arg1);
// this line was my error. if gamenum == -1 dont want to do myboards[gamenum]!=null, should be next line if statmeent to check that if we know its not -1	
if(gamenum==-1 || myboards[gamenum]== null)
							myboards[gamenum].gameEnded(temp.arg1); // pass game number
							updateGameTabs("W", gamenum);
	try {

	catch(Exception e)
}// end no data

}// end try
catch(Exception e)

} // end while
}// end run

Edited 6 Years Ago by adams161: cleaning spacing in code

I think i figured it out. my method is returning on error. so i leave the run. i put the series of if statements in anotehr method that is called from the while loop so it can return but continue the while loop.


This question has already been answered. Start a new discussion instead.