Blame SOURCES/CheckVendor.java

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