public void execute()

in enforcer-rules/src/main/java/org/apache/maven/enforcer/rules/RequireOS.java [93:124]


    public void execute() throws EnforcerRuleException {

        displayOSInfo();

        if (allParamsEmpty()) {
            throw new EnforcerRuleError("All parameters can not be empty. "
                    + "You must pick at least one of (family, name, version, arch), "
                    + "you can use mvn --version to see the current OS information.");
        }

        if (isValidFamily(this.family)) {
            if (!isAllowed()) {
                String message = getMessage();
                if (message == null || message.isEmpty()) {
                    // @formatter:off
                    message = "OS Arch: "
                            + Os.OS_ARCH + " Family: "
                            + Os.OS_FAMILY + " Name: "
                            + Os.OS_NAME + " Version: "
                            + Os.OS_VERSION + " is not allowed by" + (arch != null ? " Arch=" + arch : "")
                            + (family != null ? " Family=" + family : "")
                            + (name != null ? " Name=" + name : "")
                            + (version != null ? " Version=" + version : "");
                    // @formatter:on
                }
                throw new EnforcerRuleException(message);
            }
        } else {
            String validFamilies = String.join(",", Os.getValidFamilies());
            throw new EnforcerRuleError("Invalid Family type used. Valid family types are: " + validFamilies);
        }
    }