Skip to content

Commit

Permalink
Fix a bug caused by failing to get the host name.
Browse files Browse the repository at this point in the history
  • Loading branch information
fcyu committed Feb 7, 2018
1 parent 7ae3fe1 commit 0c60e56
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/main/java/proteomics/ECL2.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,21 @@ public static void main(String[] args) {
logger.info("Author: Fengchao Yu. Email: fyuab@connect.ust.hk");

String dbName = null;
String hostName = "unknown-host";
try {
String hostName = InetAddress.getLocalHost().getHostName();
hostName = InetAddress.getLocalHost().getHostName();
logger.info("Computer: {}.", hostName);
} catch (UnknownHostException ex) {
logger.warn("Cannot get the computer's name.");
}

try {
dbName = String.format(Locale.US, "ECL2.%s.%s.temp.db", hostName, new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss").format(Calendar.getInstance().getTime()));

logger.info("Parameter file: {}.", parameter_path);
logger.info("Spectra file: {}.", spectra_path);

new ECL2(parameter_path, spectra_path, dbName);
} catch (UnknownHostException ex) {
logger.warn("Cannot get the computer's name.");
} catch (IOException | MzXMLParsingException | JMzReaderException | ExecutionException | InterruptedException | ClassNotFoundException | IllegalAccessException | InstantiationException | SQLException ex) {
ex.printStackTrace();
logger.error(ex.toString());
Expand Down

0 comments on commit 0c60e56

Please sign in to comment.