Unverified Commit b5384538 authored by Niklaus Giger's avatar Niklaus Giger Committed by GitHub

[20669] Show correct elexis version when starting from Eclipse-IDE (#399)

parent 37a33293
Pipeline #15432 passed with stages
in 5 minutes and 28 seconds
......@@ -5,30 +5,31 @@ import java.io.InputStream;
import java.net.URL;
import java.util.Properties;
import org.osgi.framework.FrameworkUtil;
import org.slf4j.LoggerFactory;
public final class Elexis {
public static final String VERSION;
public static final String APPLICATION_NAME = "Elexis Core"; //$NON-NLS-1$
static {
VERSION = initElexisBuildVersion();
}
private static String initElexisBuildVersion(){
Properties prop = new Properties();
private static String initElexisBuildVersion() {
String version = FrameworkUtil.getBundle(Elexis.class).getVersion().toString();
String url_name = "platform:/plugin/ch.elexis.core.data/rsc/version.properties";
try (InputStream inputStream = new URL(url_name).openConnection().getInputStream()) {
if (inputStream != null) {
Properties prop = new Properties();
prop.load(inputStream);
return prop.getProperty("elexis.version").replace("-SNAPSHOT", "");
version = prop.getProperty("elexis.version");
LoggerFactory.getLogger(Elexis.class).trace("set version from " + url_name + " to " + version);
}
} catch (IOException e) {
LoggerFactory.getLogger(Elexis.class).error("Init error", e);
e.printStackTrace();
return "error";
}
return "unknown";
LoggerFactory.getLogger(Elexis.class).info(url_name + " not found", e);
};
return version;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment