Search in sources :

Example 1 with CouldNotReadHostException

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

the class MetFragRestController method readHost.

/**
 * @param processid
 * @return
 * @throws CouldNotReadHostException
 */
protected HostAssembler readHost(String processid) throws CouldNotReadHostException {
    File hostfile = new File(this.getResultFolderName(processid) + Constants.OS_SPECIFIC_FILE_SEPARATOR + HOST_FILE_NAME);
    if (hostfile.canRead()) {
        String host = "";
        try {
            BufferedReader breader = new BufferedReader(new FileReader(hostfile));
            host = breader.readLine();
            breader.close();
            return new HostAssembler("host", host);
        } catch (IOException e) {
            e.printStackTrace();
            throw new CouldNotReadHostException(processid);
        }
    }
    throw new CouldNotReadHostException(processid);
}
Also used : HostAssembler(de.ipbhalle.model.HostAssembler) BufferedReader(java.io.BufferedReader) FileReader(java.io.FileReader) IOException(java.io.IOException) File(java.io.File) CouldNotReadHostException(de.ipbhalle.exception.CouldNotReadHostException)

Aggregations

CouldNotReadHostException (de.ipbhalle.exception.CouldNotReadHostException)1 HostAssembler (de.ipbhalle.model.HostAssembler)1 BufferedReader (java.io.BufferedReader)1 File (java.io.File)1 FileReader (java.io.FileReader)1 IOException (java.io.IOException)1