Blame SOURCES/CheckVendor.java

97e098
/* CheckVendor -- Check the vendor properties match specified values.
97e098
   Copyright (C) 2020 Red Hat, Inc.
97e098
97e098
This program is free software: you can redistribute it and/or modify
97e098
it under the terms of the GNU Affero General Public License as
97e098
published by the Free Software Foundation, either version 3 of the
97e098
License, or (at your option) any later version.
97e098
97e098
This program is distributed in the hope that it will be useful,
97e098
but WITHOUT ANY WARRANTY; without even the implied warranty of
97e098
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
97e098
GNU Affero General Public License for more details.
97e098
97e098
You should have received a copy of the GNU Affero General Public License
97e098
along with this program.  If not, see <http://www.gnu.org/licenses/>.
97e098
*/
97e098
97e098
/**
97e098
 * @test
97e098
 */
97e098
public class CheckVendor {
97e098
97e098
    public static void main(String[] args) {
97e098
	if (args.length < 3) {
97e098
	    System.err.println("CheckVendor <VENDOR> <VENDOR-URL> <VENDOR-BUG-URL>");
97e098
	    System.exit(1);
97e098
	}
97e098
97e098
	String vendor = System.getProperty("java.vendor");
97e098
	String expectedVendor = args[0];
97e098
	String vendorURL = System.getProperty("java.vendor.url");
97e098
	String expectedVendorURL = args[1];
97e098
	String vendorBugURL = System.getProperty("java.vendor.url.bug");
97e098
	String expectedVendorBugURL = args[2];
97e098
97e098
	if (!expectedVendor.equals(vendor)) {
97e098
	    System.err.printf("Invalid vendor %s, expected %s\n",
97e098
			      vendor, expectedVendor);
97e098
	    System.exit(2);
97e098
	}
97e098
97e098
	if (!expectedVendorURL.equals(vendorURL)) {
97e098
	    System.err.printf("Invalid vendor URL %s, expected %s\n",
97e098
			      vendorURL, expectedVendorURL);
97e098
	    System.exit(3);
97e098
	}
97e098
97e098
	if (!expectedVendorBugURL.equals(vendorBugURL)) {
97e098
	    System.err.printf("Invalid vendor bug URL%s, expected %s\n",
97e098
			      vendorBugURL, expectedVendorBugURL);
97e098
	    System.exit(4);
97e098
	}
97e098
97e098
	System.err.printf("Vendor information verified as %s, %s, %s\n",
97e098
			  vendor, vendorURL, vendorBugURL);
97e098
    }
97e098
}