private void checkErrorStream ( Process process ) throws Exception { // rrdtool should use platform encoding (unless you did something // very strange with your installation of rrdtool). So let's be // explicit and use the presumed correct encoding to read errors. try ( InputStream is = process . getErrorStream ( ) ; InputStreamReader isr = new InputStreamReader ( is , Charset . defaultCharset ( ) ) ; BufferedReader br = new BufferedReader ( isr ) ) { StringBuilder sb = new StringBuilder ( ) ; String line ; while ( ( line = br . readLine ( ) ) != null ) { sb . append ( line ) ; } if ( sb . length ( ) > 0 ) { throw new RuntimeException ( sb . toString ( ) ) ; } } }
Check to see if there was an error processing an rrdtool command