pessoal eu estou lendo um arquivo de texto e quando chega ao final ele não le o ultimo registro apenas diz que o ultimo registro é num e envia uma msg de erro, passei a tarde toda tentando encontrar o erro e não encontrei. se alguem puder ajudar eu agradeço.
public static void arquivoAgencia (String nomeArquivo)throws IOException
{
FileReader fr = new FileReader (nomeArquivo);
bf = new BufferedReader(fr);
}
public static void armazenaClientes( Agencias ag) throws IOException
{
String linha;
Clientes cliente;
try{
while ( bf.readLine() != null)
{
linha = bf.readLine();
cliente = new Clientes(linha);
ag.armazenaCliente(cliente);
}
System.out.println(ag.listaClientes.size());
}
catch(IOException e)
{
bf.close();
}
}
Ex: dos dados que eu vou ler
_ 1111.111-1 SEQUENCIA DE STRINGS 0000
_ 1111.111-1 SEQUENCIA DE STRINGS2 0000
_ 1111.111-1 SEQUENCIA DE STRINGS3 0000
_ 1111.111-1 SEQUENCIA DE STRINGS4 0000
_ 1111.111-Y SEQUENCIA DE STRINGS5 0000
_ 1111.111-1 SEQUENCIA DE STRINGS6 0000
_ 1111.111-1 SEQUENCIA DE STRINGS7 0000