Blame SOURCES/CheckVendor.java

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