1 |
|
package liquibase.util; |
2 |
|
|
3 |
|
import java.io.IOException; |
4 |
|
import java.io.InputStream; |
5 |
|
import java.net.URL; |
6 |
|
import java.util.Properties; |
7 |
|
|
|
|
| 72.2% |
Uncovered Elements: 5 (18) |
Complexity: 4 |
Complexity Density: 0.31 |
|
8 |
|
public class LiquibaseUtil { |
|
|
| 70.6% |
Uncovered Elements: 5 (17) |
Complexity: 4 |
Complexity Density: 0.31 |
|
9 |
1
|
public static String getBuildVersion() {... |
10 |
1
|
Properties buildInfo = new Properties(); |
11 |
1
|
ClassLoader classLoader = LiquibaseUtil.class.getClassLoader(); |
12 |
|
|
13 |
1
|
URL buildInfoFile = classLoader.getResource("buildinfo.properties"); |
14 |
1
|
try { |
15 |
1
|
if (buildInfoFile == null) { |
16 |
0
|
return "UNKNOWN"; |
17 |
|
} else { |
18 |
1
|
InputStream in = buildInfoFile.openStream(); |
19 |
|
|
20 |
1
|
buildInfo.load(in); |
21 |
1
|
String o = (String) buildInfo.get("build.version"); |
22 |
1
|
if (o == null) { |
23 |
0
|
return "UNKNOWN"; |
24 |
|
} else { |
25 |
1
|
return o; |
26 |
|
} |
27 |
|
} |
28 |
|
} catch (IOException e) { |
29 |
0
|
return "UNKNOWN"; |
30 |
|
} |
31 |
|
} |
32 |
|
} |