/*
(non-Javadoc)
@see org.overture.ide.utility.IVdmProject1#getLanguageVersion()
338657
public Release getLanguageVersion() throws CoreException
	{
		if (!hasBuilder())
			return Release.DEFAULT;
		else
		{
			Object languageVersion = getBuilderArguemnt(LANGUAGE_VERSION_ARGUMENT_KEY);
			if (languageVersion != null
					&& Release.lookup(languageVersion.toString()) != null)
				return Release.lookup(languageVersion.toString());

		}
		return Release.DEFAULT;
	}
643029
public static VersionInfo getCLDRVersion() {
        // fetching this data should be idempotent.
        if(gCLDRVersion == null) {
            // from ZoneMeta.java
            UResourceBundle supplementalDataBundle = UResourceBundle.getBundleInstance(ICUData.ICU_BASE_NAME, "supplementalData", ICUResourceBundle.ICU_DATA_CLASS_LOADER);
            UResourceBundle cldrVersionBundle = supplementalDataBundle.get("cldrVersion");
            gCLDRVersion = VersionInfo.getInstance(cldrVersionBundle.getString());
        }
        return gCLDRVersion;
    }
231221
public String getVersion()
	{
		String str = null;

		if ((version >= 0) && (version < versionLabels.length))
		{
			str = versionLabels[version];
		}

		return str;
	}
533558
private static String getVersion(final Class<?> clazz) {
		CodeSource source = clazz.getProtectionDomain().getCodeSource();
		URL location = source.getLocation();

		try {
			Path path = Paths.get(location.toURI());
			return Files.isRegularFile(path) ? getVersionFromJar(path) : getVersionFromPom(path);
		} catch (URISyntaxException ex) {
			Logger.error(ex, "Unknown location: \"{}\"", location);
			return null;
		}
	}
1054522
private String getVersion(final ClassLoader classLoader, final String className, final String methodName) {
    log.trace("Getting version; class-loader: {}, class-name: {}, method-name: {}",
        classLoader, className, methodName);

    try {
      Class<?> type = classLoader.loadClass(className);
      Method method = type.getMethod(methodName);
      Object result = method.invoke(null);
      if (result != null) {
        return result.toString();
      }
    }
    catch (Throwable e) {
      log.trace("Unable determine version from: {}", className);
    }

    return null;
  }
1254063
@GET
  @Produces(TEXT_PLAIN)
  @Timed
  @ExceptionMetered
  public String version() {
    // wrap in double quotes to make valid json
    return String.format("\"%s\"", Version.POM_VERSION);
  }
1115014
protected String getCurrentReleaseVersion() {
        HttpURLConnection conn = null;
        try {
            final String str = settings.getString(Settings.KEYS.ENGINE_VERSION_CHECK_URL, "http://jeremylong.github.io/DependencyCheck/current.txt");
            final URL url = new URL(str);
            final URLConnectionFactory factory = new URLConnectionFactory(settings);
            conn = factory.createHttpURLConnection(url);
            conn.connect();
            if (conn.getResponseCode() != 200) {
                return null;
            }
            final String releaseVersion = IOUtils.toString(conn.getInputStream(), StandardCharsets.UTF_8);
            if (releaseVersion != null) {
                return releaseVersion.trim();
            }
        } catch (MalformedURLException ex) {
            LOGGER.debug("Unable to retrieve current release version of dependency-check - malformed url?");
        } catch (URLConnectionFailureException ex) {
            LOGGER.debug("Unable to retrieve current release version of dependency-check - connection failed");
        } catch (IOException ex) {
            LOGGER.debug("Unable to retrieve current release version of dependency-check - i/o exception");
        } finally {
            if (conn != null) {
                conn.disconnect();
            }
        }
        return null;
    }
1278835
private static int getJavaVersion() {
		String version = System.getProperty("java.version");
		if (version == null) {
			return -1;
		} else {
			int index = version.indexOf('.');
			if (index > 0) {
				version = version.substring(0, index);
			}

			try {
				return Integer.parseInt(version);
			} catch (NumberFormatException ex) {
				return -1;
			}
		}
	}
1057354
public static String getVersion() {
        String version = null;

        // try to load from maven properties first
        try {
            Properties p = new Properties();
            InputStream is = VersionHelper.class.getResourceAsStream("/META-INF/maven/io.redlink/redlink-sdk-java/pom.properties");
            if (is != null) {
                p.load(is);
                version = p.getProperty("version", "");
            }
        } catch (Exception e) {
            // ignore
        }

        // fallback to using Java API
        if (version == null) {
            Package aPackage = VersionHelper.class.getPackage();
            if (aPackage != null) {
                version = aPackage.getImplementationVersion();
                if (version == null) {
                    version = aPackage.getSpecificationVersion();
                }
            }
        }

        // fallback to read pom.xml on testing
        if (version == null) {
            final MavenXpp3Reader reader = new MavenXpp3Reader();
            try {
                Model model = reader.read(new FileReader(new File("pom.xml")));
                version = model.getVersion();
            } catch (IOException | XmlPullParserException e) {
                // ignore
            }
        }

        return version;
    }
117362
public int getVersion() throws SQLException {
        try {
            return this.submit(new VersionCallable()).get();
        } catch (InterruptedException e) {
            logger.log(Level.SEVERE, "Failed to get database version", e);
            throw new SQLException(e);
        } catch (ExecutionException e) {
            logger.log(Level.SEVERE, "Failed to get database version", e);
            throw new SQLException(e);
        }
    }
1267279
private static String getVersionFromPom() {

        final String absolutePath = new File(BuildVersion.class.getResource(BuildVersion.class
                .getSimpleName() + ".class").getPath())
                .getParentFile().getParentFile().getParentFile().getParentFile().getParentFile()
                .getParentFile().getParentFile().getAbsolutePath();

        final File file = new File(absolutePath + "/pom.xml");

        try (InputStreamReader reader = new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8)) {

            final MavenXpp3Reader xpp3Reader = new MavenXpp3Reader();
            Model model = xpp3Reader.read(reader);
            return model.getVersion();

        } catch (NoClassDefFoundError e) {
            // if you want to get the version possibly in development add in to your pom
            // pax-url-aether.jar
            return null;
        } catch (Exception e) {
            return null;
        }
    }
225077
public static String getVersionInfo() {
        String info = versionInfo.get();
        if (info == null) {
            info = String.format(Locale.ENGLISH, VERSION_INFO, getLibInfo(), getSysInfo());

            versionInfo.compareAndSet(null, info);
        }

        return info;
    }
273150
public ProtocolVersion getVersion() 
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "getVersion");
    
    // The ProtocolVersion to be returned
    ProtocolVersion version = ProtocolVersion.UNKNOWN;
    // Get the MetaData out of the connection
    ConnectionMetaData connMetaData = connection.getMetaData();
    
    // If the MetaData is non-null we can retrieve a version.
    if(connMetaData != null)
      version = connMetaData.getProtocolVersion();
    
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "getVersion", version);
  
    return version;
  }
1129916
public static String getVersionCode(Context context) {
        if (sVersion == null) {
            try {
                sVersion = context.getPackageManager().getPackageInfo(
                        context.getPackageName(), 0).versionName;
            } catch (PackageManager.NameNotFoundException e) {
                // Can't find version; just leave it blank.
                Log.e(TAG, "Error finding package " + context.getApplicationInfo().packageName);
            }
        }
        return sVersion;
    }
339367
protected String getVersion() throws IOException {
        InputStream stream = null;
        try {
            Properties version = new Properties();
            stream = Cob2XsdMain.class.getResourceAsStream(VERSION_FILE_NAME);
            version.load(stream);
            return version.getProperty("version");
        } finally {
            if (stream != null) {
                stream.close();
            }
        }
    }
1140547
@Override
    public VersionInfo getVersion() {
        int version = tailoring.version;
        int rtVersion = VersionInfo.UCOL_RUNTIME_VERSION.getMajor();
        return VersionInfo.getInstance(
                (version >>> 24) + (rtVersion << 4) + (rtVersion >> 4),
                ((version >> 16) & 0xff), ((version >> 8) & 0xff), (version & 0xff));
    }
187559
@Override
	public String getBrowserVersion() {
		if (wd != null) {
			Capabilities capabilities = ((HasCapabilities) wd)
					.getCapabilities();
			if (capabilities != null) {
				return capabilities.getVersion();
			}
			return null;
		}
		return null;
	}