Created
September 6, 2021 13:47
-
-
Save gauravssnl/5ba6485e3edecdd61711ee08be7a0a4c to your computer and use it in GitHub Desktop.
ExceptionTranslation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Exception translation | |
public | |
class ExceptionTranslation { | |
public | |
String readTheFile(String f) { | |
try | |
(BufferedReader is = new BufferedReader(new FileReader(f))) { | |
String line = is.readLine(); | |
return line; | |
} | |
catch (FileNotFoundException fnf) { | |
throw new RuntimeException("Could not open file " + f, fnf); | |
} catch (IOException ex) { | |
throw new RuntimeException("Problem reading file " + f, ex); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment