Blame SOURCES/CheckVendor.java

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