<commit_before>package net.hyperic.sigar.cmd;

import net.hyperic.sigar.Mem;
import net.hyperic.sigar.Swap;
import net.hyperic.sigar.SigarException;

import java.io.File;
import java.io.FilenameFilter;
import java.io.FileReader;
import java.io.BufferedReader;
import java.io.IOException;

/**
 * Display System Information
 */
public class SysInfo extends SigarCommandBase {

    public SysInfo(Shell shell) {
        super(shell);
    }

    public SysInfo() {
        super();
    }

    public String getUsageShort() {
        return "Display system information";
    }

    public void output(String[] args) throws SigarException {
        String osName = System.getProperty("os.name");

        /**
         * OS info
         */
        this.out.println(osName + " " +
            System.getProperty("os.version") + " " +
            System.getProperty("os.arch"));

        /**
         * craziness to try to determine the linux distro
         */
        if (osName.equals("Linux")) {
            File etc = new File("/etc");
            File[] release = etc.listFiles(new FilenameFilter()
            {
                public boolean accept(File dir, String name)
                {
                    boolean distroFile =
                        name.toLowerCase().matches(".*elease.*");
                    if (!distroFile) {
                        distroFile = name.toLowerCase().matches(".*ersion.*");
                    }
                    return distroFile;
                }
            });

            if (release.length != 1) {
                this.out.println("Cannot determine Linux distribution!");
                if (release.length > 1) {<commit_msg>String.matches is not in jdk 1.3, use String.indexOf instead<commit_after>package net.hyperic.sigar.cmd;

import net.hyperic.sigar.Mem;
import net.hyperic.sigar.Swap;
import net.hyperic.sigar.SigarException;

import java.io.File;
import java.io.FilenameFilter;
import java.io.FileReader;
import java.io.BufferedReader;
import java.io.IOException;

/**
 * Display System Information
 */
public class SysInfo extends SigarCommandBase {

    public SysInfo(Shell shell) {
        super(shell);
    }

    public SysInfo() {
        super();
    }

    public String getUsageShort() {
        return "Display system information";
    }

    private static boolean contains(String value, String substr) {
        //matches does not work w/ jre 1.3
        //value.toLowerCase().matches(".*" + substr + ".*");
        return value.toLowerCase().indexOf(substr) != -1;
    }

    public void output(String[] args) throws SigarException {
        String osName = System.getProperty("os.name");

        /**
         * OS info
         */
        this.out.println(osName + " " +
            System.getProperty("os.version") + " " +
            System.getProperty("os.arch"));

        /**
         * craziness to try to determine the linux distro
         */
        if (osName.equals("Linux")) {
            File etc = new File("/etc");
            File[] release = etc.listFiles(new FilenameFilter()
            {
                public boolean accept(File dir, String name)
                {
                    boolean distroFile = contains(name, "elease");

                    if (!distroFile) {
                        distroFile = contains(name, "ersion");
                    }
                    return distroFile;
                }
            });

            if (release.length != 1) {
                this.out.println("Cannot determine Linux distribution!");
                if (release.length > 1) {
{'fraction_non_alphanumeric': 0.1171875, 'fraction_numerical': 0.0025111607142857145, 'mean_word_length': 1.7704791344667696, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '6608870', 'n_tokens_mistral': 981, 'n_tokens_neox': 941, 'n_words': 223}