Usando BufferedReader.readLine () en un bucle while correctamente

Así que tengo un problema al leer un archivo de texto en mi programa. Aquí está el código:

     try{
        InputStream fis=new FileInputStream(targetsFile);
        BufferedReader br=new BufferedReader(new InputStreamReader(fis));

        //while(br.readLine()!=null){
        for(int i=0;i<100;i++){
            String[] words=br.readLine().split(" ");
            int targetX=Integer.parseInt(words[0]);
            int targetY=Integer.parseInt(words[1]);
            int targetW=Integer.parseInt(words[2]);
            int targetH=Integer.parseInt(words[3]);
            int targetHits=Integer.parseInt(words[4]);
            Target a=new Target(targetX, targetY, targetW, targetH, targetHits);
            targets.add(a);
        }
        br.close();
    }
    catch(Exception e){
        System.err.println("Error: Target File Cannot Be Read");
    }

El archivo del que estoy leyendo es de 100 líneas de argumentos. Si utilizo un bucle for funciona perfectamente. Si utilizo la instrucción while (la que comento sobre el bucle for), se detiene en 50. Existe la posibilidad de que un usuario pueda ejecutar el programa con un archivo que tenga cualquier número de líneas, por lo que mi implementación actual para el bucle no será válida. t trabajo

Porque hace la lineawhile(br.readLine()!=null) parar a los 50? Revisé el archivo de texto y no hay nada que lo cuelgue.

No obtengo ningún error del try-catch cuando uso el bucle while, por lo que estoy perplejo. ¿Alguien tiene alguna idea?

Respuestas a la pregunta(6)

Su respuesta a la pregunta