0

I have this try-block

try {
      FileReader textFileReader = new FileReader(filename);
      BufferedReader textReader = new BufferedReader(textFileReader);
      
      String post = textReader.readLine();
      int weeknumber = Integer.valueOf(post);
      
      if (weeknumber != weeknmbr) {
       System.out.println("Wrong weeknumber.");
       return false;
      }
      
      post = textReader.readLine();
      while (post != null) {
        insertPost(post);
        post = textReader.readLine();
      }
      textReader.close();
    }

but I'm unsure which exceptions I should catch for it. I'm thinking IOException, but do I need one for weeknumber, and if so which? ArithmeticException maybe, or NumberFormatException or something?

1
Contributor
1
Reply
2
Views
5 Years
Discussion Span
Last Post by java.util
0

Nevermind, I guess I don't need that since I have the if-sentence.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.