0
Please observe the code;
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(getArquivo())));
File arquivoLeitura = new File(getArquivo());
LineNumberReader linhaLeitura = new LineNumberReader(new FileReader(arquivoLeitura));
linhaLeitura.skip(arquivoLeitura.length());
int qtdLinha = linhaLeitura.getLineNumber() + 1;
String linha = null;
for (int i = 1; i <= qtdLinha; i++) {
linha = reader.readLine();
String[] dadosUsuario = linha.split(VIRGULA);
System.out.println(Arrays.toString(dadosUsuario));
System.out.println( dadosUsuario[0]);
System.out.println( dadosUsuario[1]);
System.out.println( dadosUsuario[2]);
System.out.println( dadosUsuario[3]);
System.out.println( dadosUsuario[4]);
System.out.println(dadosUsuario[5]);
System.out.println("--------------------------");
if (pessoaJuridicaPublicaService.getPorId(Long.parseLong(dadosUsuario[1])) == null) {
int j = j + 1;
}
}
reader.close();
He’s making that mistake;
If it’s a csv file upload, when I upload files, it goes through all the lines in the csv file;
This line of code will check if one of the fields is empty, so I would like to count how many empty fields I can find in the data variable1.
The problem is that the FOR loop is not allowing me to place a counter within the IF condition. How do I fix this problem?