Search in sources :

Example 1 with CouldNotReadStatusException

use of de.ipbhalle.exception.CouldNotReadStatusException in project MetFragRelaunched by ipb-halle.

the class MetFragRestController method readStatus.

/**
 * @param processid
 * @return
 * @throws CouldNotReadStatusException
 */
private StatusAssembler readStatus(String processid) throws CouldNotReadStatusException {
    File statusfile = new File(this.getResultFolderName(processid) + Constants.OS_SPECIFIC_FILE_SEPARATOR + STATUS_FILE_NAME);
    if (statusfile.canRead()) {
        String status = "";
        try {
            BufferedReader breader = new BufferedReader(new FileReader(statusfile));
            status = breader.readLine();
            breader.close();
            return new StatusAssembler("status", status);
        } catch (IOException e) {
            e.printStackTrace();
            throw new CouldNotReadStatusException(processid);
        }
    }
    throw new CouldNotReadStatusException(processid);
}
Also used : BufferedReader(java.io.BufferedReader) StatusAssembler(de.ipbhalle.model.StatusAssembler) FileReader(java.io.FileReader) IOException(java.io.IOException) File(java.io.File) CouldNotReadStatusException(de.ipbhalle.exception.CouldNotReadStatusException)

Aggregations

CouldNotReadStatusException (de.ipbhalle.exception.CouldNotReadStatusException)1 StatusAssembler (de.ipbhalle.model.StatusAssembler)1 BufferedReader (java.io.BufferedReader)1 File (java.io.File)1 FileReader (java.io.FileReader)1 IOException (java.io.IOException)1