1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package com.hack23.cia.service.data.impl.liquidbase;
20
21 import org.apache.commons.lang3.exception.ExceptionUtils;
22 import org.slf4j.Logger;
23 import org.slf4j.LoggerFactory;
24
25 import liquibase.exception.LiquibaseException;
26 import liquibase.integration.spring.SpringLiquibase;
27
28
29
30
31 public final class SpringLiquidBaseFailSafe extends SpringLiquibase {
32
33
34 private static final Logger LOGGER = LoggerFactory
35 .getLogger(SpringLiquidBaseFailSafe.class);
36
37
38 @Override
39 public void afterPropertiesSet() throws LiquibaseException {
40 try {
41 super.afterPropertiesSet();
42 } catch (final LiquibaseException | RuntimeException e) {
43 final String stackTrace = ExceptionUtils.getStackTrace(e);
44 if(stackTrace.contains("Connection was already closed - calling hashCode is no longer allowed")) {
45 LOGGER.warn("Problem after executing liquidbase, failed removing closed atomikos connection");
46 } else {
47 LOGGER.warn("Problem executing liquidbase", e);
48 }
49
50 }
51 }
52
53 }