altimmons
9/15/2019 - 5:51 AM

Try IO Action and Catch All With Logging

Expects a String fileName

        try {
  //code

        }catch(FileNotFoundException fnfE){
            App.log.warning( "FileNotFoundException trying to open file: " + Paths.get( fileName ).toAbsolutePath().toString() );
            App.log.warning( String.valueOf( fnfE.getStackTrace() ) );

        }catch( IOException ioE ){
            App.log.warning( "IO Exception trying to open file: " + Paths.get( fileName ).toAbsolutePath().toString() );
            App.log.warning( String.valueOf( ioE.getStackTrace() ) );

        }catch( IllegalArgumentException iaE ){
            App.log.warning( "IllegalArgumentException trying to open file: " + Paths.get( fileName ).toAbsolutePath().toString() );
            App.log.warning( String.valueOf( iaE.getStackTrace() ) );

        }catch(SecurityException sE){
            App.log.warning( "SecurityException trying to open file: " + Paths.get( fileName ).toAbsolutePath().toString() );
            App.log.warning( String.valueOf( sE.getStackTrace() ) );
        }catch(NullPointerException npE){
            App.log.warning( "NullPointerException! trying to open file: " + Paths.get( fileName ).toAbsolutePath().toString() );
            App.log.warning( String.valueOf( npE.getStackTrace() ) );
        }