readLine() of BufferedReader

0
Hi, I am trying to read a file line by line in Java action using BufferedReader, but the session hangs at readLine(). Strange issue, it was working earlier. Not sure what happed. Please comment.   InputStream inputStream = Core.getFileDocumentContent(getContext(), this.cdiFile.getMendixObject()); BufferedReader br = new BufferedReader(new InputStreamReader(inputStream)); String line = ""; while ((line = br.readLine()) != null) {     System.out.println(line); }  
asked
1 answers
0

When did it work? What happened since? Did you upgrade? Is the input file the same as in previous successful runs?

You might get more insight into the result of the readLine if you would change it to this code:

String line = "";

while (line != null) {
    System.out.println(line);
    try{
        line = br.readLine();
    }
    catch (IOException e) {
        System.err.println("Caught IOException: " + e.getMessage());
    }
    catch(Exception e){
        //Handle the other error(s)
    }
}

Hope it helps.

answered