1 23 package org.hammurapi.inspectors.testcases.fixes; 24 25 import java.io.FileReader ; 26 import java.io.IOException ; 27 import java.io.Reader ; 28 29 import org.hammurapi.inspectors.testcases.HammurapiTestCasesException; 30 31 36 public class EmptyCatchBlockRuleFixTestCase { 37 38 private static org.apache.log4j.Logger logger = 39 org.apache.log4j.Logger.getRootLogger(); 40 41 private static final String FILE_ERROR_TXT = "File error"; 42 private static final String FILE_ERROR2_TXT = "File not found error"; 43 44 45 public int getFirstByte(final String fName) 46 throws HammurapiTestCasesException { 47 48 try { 49 Reader r = new FileReader (fName); 50 return r.read(); 51 52 } catch (java.io.FileNotFoundException e) { 53 54 logger.fatal(FILE_ERROR2_TXT, e); 56 throw new HammurapiTestCasesException(e); 57 58 } catch (IOException e) { 59 logger.fatal(FILE_ERROR_TXT, e); 60 throw new HammurapiTestCasesException(e); 61 } 62 } 63 } 64 65 | Popular Tags |