Blame SOURCES/CheckVendor.java

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