<commit_before>/**
 * Copyright (c) <NAME>, 2014
 * alessandro[at]perucchi[dot]org
 * All Rights Reserved
 * Eclipse Public License (EPLv1)
 * http://oshi.codeplex.com/license
 */
package oshi.software.os.linux.proc;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.Scanner;

import oshi.software.os.OperatingSystemVersion;

/**
 * Contains operating system version information. The information includes major
 * and minor version numbers, a build number, a platform identifier, and
 * descriptive text about the operating system.
 *
 * @author alessandro[at]perucchi[dot]org
 */
public class OSVersionInfoEx implements OperatingSystemVersion {

	private String _version = null;
	private String _codeName = null;
	private String version = null;

	public OSVersionInfoEx() {
		Scanner in = null;
		try {
			in = new Scanner(new FileReader("/etc/os-release"));
		} catch (FileNotFoundException e) {
			return;
		}
		in.useDelimiter("\n");
		while (in.hasNext()) {
			String[] splittedLine = in.next().split("=");
			if (splittedLine[0].equals("VERSION_ID")) {
				setVersion(splittedLine[1]);
			}
			if (splittedLine[0].equals("VERSION")) {
				// Check basically if the code is between parenthesis or after
				// the coma-space

				// Basically, until now, that seems to be the standard to use
				// parenthesis for the codename.
				String[] split = splittedLine[1].split("[()]");
				if (split.length <= 1)
					// We are probably with Ubuntu, so need to get that part
					// correctly.
					split = splittedLine[1].split(", ");

				if (split.length > 1)
					setCodeName(split[1]);
				else
					setCodeName(splittedLine[1]);
			}
		}
		in.close();
	}

	/**
	 * @return the _codeName
	 */
	public String getCodeName() {
		return _codeName;
	}

	/**
	 * @return the _version
	 */
	public String getVersion() {
		return _version;
	}

	/**
	 * @param _codeName
	 *            the _codeName to set
	 */
	public void setCodeName(String _codeName) {
		this._codeName = _codeName;
	}

	/**
	 * @param _version
	 *            the _version to set
	 */
	public void setVersion(String _version) {
		this._version = _version;
	}

	@Override
	public String toString() {
		if (version == null) {
			version = getVersion() + " (" + getCodeName() + ")";
		}
		return version;
	}

}
<commit_msg>Remove beginning and ending '"' characters on Linux /etc/os-release entries, etc from VERSION_ID="14.04"<commit_after>/**
 * Copyright (c) <NAME>, 2014
 * alessandro[at]perucchi[dot]org
 * All Rights Reserved
 * Eclipse Public License (EPLv1)
 * http://oshi.codeplex.com/license
 */
package oshi.software.os.linux.proc;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.Scanner;

import oshi.software.os.OperatingSystemVersion;

/**
 * Contains operating system version information. The information includes major
 * and minor version numbers, a build number, a platform identifier, and
 * descriptive text about the operating system.
 *
 * @author alessandro[at]perucchi[dot]org
 */
public class OSVersionInfoEx implements OperatingSystemVersion {

	private String _version = null;
	private String _codeName = null;
	private String version = null;

	public OSVersionInfoEx() {
		Scanner in = null;
		try {
			in = new Scanner(new FileReader("/etc/os-release"));
		} catch (FileNotFoundException e) {
			return;
		}
		in.useDelimiter("\n");
		while (in.hasNext()) {
			String[] splittedLine = in.next().split("=");
			if (splittedLine[0].equals("VERSION_ID")) {
				// remove beginning and ending '"' characters, etc from
				// VERSION_ID="14.04"
				setVersion(splittedLine[1].replaceAll("^\"|\"$", ""));
			}
			if (splittedLine[0].equals("VERSION")) {
				// remove beginning and ending '"' characters
				splittedLine[1] = splittedLine[1].replaceAll("^\"|\"$", "");

				// Check basically if the code is between parenthesis or after
				// the coma-space

				// Basically, until now, that seems to be the standard to use
				// parenthesis for the codename.
				String[] split = splittedLine[1].split("[()]");
				if (split.length <= 1)
					// We are probably with Ubuntu, so need to get that part
					// correctly.
					split = splittedLine[1].split(", ");

				if (split.length > 1)
					setCodeName(split[1]);
				else
					setCodeName(splittedLine[1]);
			}
		}
		in.close();
	}

	/**
	 * @return the _codeName
	 */
	public String getCodeName() {
		return _codeName;
	}

	/**
	 * @return the _version
	 */
	public String getVersion() {
		return _version;
	}

	/**
	 * @param _codeName
	 *            the _codeName to set
	 */
	public void setCodeName(String _codeName) {
		this._codeName = _codeName;
	}

	/**
	 * @param _version
	 *            the _version to set
	 */
	public void setVersion(String _version) {
		this._version = _version;
	}

	@Override
	public String toString() {
		if (version == null) {
			version = getVersion() + " (" + getCodeName() + ")";
		}
		return version;
	}

}

{'fraction_non_alphanumeric': 0.13430127041742287, 'fraction_numerical': 0.007662835249042145, 'mean_word_length': 3.2685025817555937, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5106263', 'n_tokens_mistral': 1794, 'n_tokens_neox': 1559, 'n_words': 426}