legge finche non avviene un inserimento corretto

public int leggiInt(String msg){

BufferedReader console = new BufferedReader(new InputStreamReader(System.in));

System.out.print(msg);
int datoInt=0;
boolean inserimentoOk=false;
while(inserimentoOk==false)
try{
String s=console.readLine();
datoInt=Integer.parseInt(s);
inserimentoOk=true;
}catch(IOException ioe){
ioe.toString();
}
catch(NumberFormatException nfe){
System.out.println(" Numero non valido!.");
System.out.print(" Reinserisci: ");
}
return datoInt;
}
ciao Marco