public void printToStandardStream ( ) throws FileNotFoundException { System . out . println ( "I'm gonna print to the command line" ) ; // Violates rule not to write to standard streams System . err . println ( "I'm gonna print to the command line" ) ; // Violates rule not to write to standard streams new SomeCustomException ( ) . printStackTrace ( ) ; // Violates rule not to write to standard streams new SomeCustomException ( ) . printStackTrace ( new PrintStream ( "/some/file" ) ) ; // this is okay, since it's a custom PrintStream new SomeCustomException ( ) . printStackTrace ( new PrintWriter ( "/some/file" ) ) ; // this is okay, since it's a custom PrintWriter }
Violates rules not to use java . util . logging & that loggers should be private static final