Ver Mensaje Individual
  #4 (permalink)  
Antiguo 23/04/2015, 01:15
Avatar de Profesor_Falken
Profesor_Falken
 
Fecha de Ingreso: agosto-2014
Ubicación: Mountain View
Mensajes: 1.323
Antigüedad: 9 años, 8 meses
Puntos: 182
Respuesta: Eliminar archivo temporal

Buenas,

Estas intentando eliminar el fichero mientras lo tienes abierto:

Código Java:
Ver original
  1. while ((cadena=b.readLine())!=null)
  2.             {
  3.               if(cadena.indexOf(isbn)!=-1)
  4.                 {
  5.                     EliminarLibro(cadena);
  6.                 }
  7.  
  8.             }
  9.             b.close();
  10.         }

Te recomiendo que utilices un flag:
Código Java:
Ver original
  1. boolean eliminarLibro = false;
  2. while ((cadena=b.readLine())!=null)
  3.             {
  4.               if(cadena.indexOf(isbn)!=-1)
  5.                 {
  6.                     eliminarLibro = true;
  7.                     break;                    
  8.                 }
  9.  
  10.             }
  11.             b.close();
  12.         }
  13.  
  14. if (eliminarLibro == true)
  15.     EliminarLibro(cadena);

Un saludo
__________________
If to err is human, then programmers are the most human of us