Changeset 31586


Ignore:
Timestamp:
2017-04-06T21:16:02+12:00 (7 years ago)
Author:
ak19
Message:

Exceptions are now no longer handled by SafeProcess at all times, but only if no exception hander was registered.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/gli/src/org/greenstone/gatherer/util/SafeProcess.java

    r31585 r31586  
    184184       
    185185    } catch(IOException ioe) {
    186         //logger.error("IOexception: " + ioe.getMessage(), ioe);
    187         System.err.println("IOexception " + ioe.getMessage());
    188         ioe.printStackTrace();
    189         if(exceptionHandler != null) exceptionHandler.gotException(ioe);
     186        if(exceptionHandler != null) {
     187        exceptionHandler.gotException(ioe);
     188        } else {
     189        //logger.error("IOexception: " + ioe.getMessage(), ioe);
     190        System.err.println("IOexception " + ioe.getMessage());
     191        ioe.printStackTrace();
     192        }
    190193    } catch(InterruptedException ie) {
    191         //logger.error("Process InterruptedException: " + ie.getMessage(), ie);
    192         System.err.println("Process InterruptedException " + ie.getMessage());
    193         ie.printStackTrace();
    194 
    195         if(exceptionHandler != null) exceptionHandler.gotException(ie);
     194        if(exceptionHandler != null) {
     195        exceptionHandler.gotException(ie);
     196        } else {
     197        //logger.error("Process InterruptedException: " + ie.getMessage(), ie);
     198        System.err.println("Process InterruptedException " + ie.getMessage());
     199        //ie.printStackTrace(); // an interrupt here is not an error, it can be a cancel action
     200        }
     201
    196202
    197203        // propagate interrupts to worker threads here?
     
    311317        }
    312318    } catch (IOException ioe) {
    313         //logger.error("Exception when reading from a process' stdout/stderr stream: ", ioe);
    314         //ioe.printStackTrace();
    315 
    316         if(lineByLineHandler != null) lineByLineHandler.gotException(ioe);     
     319        if(lineByLineHandler != null) {
     320        lineByLineHandler.gotException(ioe);
     321        } else {
     322        //logger.error("Exception when reading from a process' stdout/stderr stream: ", ioe);
     323        ioe.printStackTrace();
     324        }
    317325       
    318326    } finally {
     
    377385        */
    378386    } catch (IOException ioe) {
    379         //logger.error("Exception writing to SafeProcess' inputstream: ", ioe);     
    380         ioe.printStackTrace();
    381 
    382         if (this.exceptionHandler != null) this.exceptionHandler.gotException(ioe);
     387        if (this.exceptionHandler != null) {
     388        this.exceptionHandler.gotException(ioe);
     389        } else {
     390        //logger.error("Exception writing to SafeProcess' inputstream: ", ioe);     
     391        ioe.printStackTrace();
     392        }       
    383393       
    384394    } finally {
Note: See TracChangeset for help on using the changeset viewer.