Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
pavel-stastny committed Aug 1, 2024
2 parents b267d60 + c066c90 commit 83b67e8
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions search/src/java/cz/incad/Kramerius/StartupServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,10 @@ public void init() throws ServletException {
* e1.getMessage(),e1); }
**/

Connection connection = this.connectionProvider.get();
Connection connection = null;
try {
connection = this.connectionProvider.get();

// read previous db version
VersionDbInitializer.initDatabase(connection);

Expand Down Expand Up @@ -110,20 +112,17 @@ public void init() throws ServletException {
versionService.updateVersionIfOutdated();

this.pdfService.init();
} catch (IOException e) {
LOGGER.log(Level.SEVERE, e.getMessage(), e);
} catch (SQLException e) {
LOGGER.log(Level.SEVERE, e.getMessage(), e);

this.lifecycleRegistry.startNotification();

} catch (Throwable e) {
LOGGER.log(Level.SEVERE, e.getMessage(), e);
throw new RuntimeException("Failed to start Kramerius", e);
} finally {
if (connection != null) {
DatabaseUtils.tryClose(connection);
}
}

this.lifecycleRegistry.startNotification();

}

@Override
Expand Down

0 comments on commit 83b67e8

Please sign in to comment.