Coverage Report - liquibase.util.LiquibaseUtil
 
Classes in this File Line Coverage Branch Coverage Complexity
LiquibaseUtil
64%
9/14
50%
2/4
7
 
 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  
 
 8  0
 public class LiquibaseUtil {
 9  
     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  
         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  0
         } catch (IOException e) {
 29  0
             return "UNKNOWN";
 30  
         }
 31  
     }
 32  
 }