Source:
private void validateMachine(MachineConfig machineCfg, String envName) throws BadRequestException { checkArgument(!isNullOrEmpty(machineCfg.getName()), "Environment %s contains machine with null or empty name", envName); checkNotNull(machineCfg.getSource(), "Environment " + envName + " contains machine without source"); if (apiEndpoint.startsWith("https://") && machineCfg.getSource().getLocation() != null) { checkArgument(!machineCfg.getSource().getLocation().startsWith("http://"), "Environment '%s' contains source with http location, which is not allowed", envName); } checkArgument(!(machineCfg.getSource().getContent() == null && machineCfg.getSource().getLocation() == null), "Environment " + envName + " contains machine with source but this source doesn't define a location or content"); checkArgument(machineInstanceProviders.hasProvider(machineCfg.getType()), "Type %s of machine %s in environment %s is not supported. Supported values: %s.", machineCfg.getType(), machineCfg.getName(), envName, Joiner.on(", ").join(machineInstanceProviders.getProviderTypes())); for (ServerConf serverConf : machineCfg.getServers()) { checkArgument(serverConf.getPort() != null && SERVER_PORT.matcher(serverConf.getPort()).matches(), "Machine %s contains server conf with invalid port %s", machineCfg.getName(), serverConf.getPort()); checkArgument(serverConf.getProtocol() == null || SERVER_PROTOCOL.matcher(serverConf.getProtocol()).matches(), "Machine %s contains server conf with invalid protocol %s", machineCfg.getName(), serverConf.getProtocol()); } for (Map.Entry<String, String> envVariable : machineCfg.getEnvVariables().entrySet()) { checkArgument(!isNullOrEmpty(envVariable.getKey()), "Machine %s contains environment variable with null or empty name"); checkNotNull(envVariable.getValue(), "Machine %s contains environment variable with null value"); } }

Target:
private void validateMachine(MachineConfig machineCfg, String envName) throws BadRequestException { checkArgument(!isNullOrEmpty(machineCfg.getName()), "Environment %s contains machine with null or empty name", envName); checkNotNull(machineCfg.getSource(), "Environment " + envName + " contains machine without source"); if (apiEndpoint.startsWith("https://") && machineCfg.getSource().getType() == "dockerfile" && machineCfg.getSource().getLocation() != null) { checkArgument(machineCfg.getSource().getLocation().startsWith("https://"), "Environment '%s' contains source recipe with http location, which is not allowed", envName); } checkArgument(!(machineCfg.getSource().getContent() == null && machineCfg.getSource().getLocation() == null), "Environment " + envName + " contains machine with source but this source doesn't define a location or content"); checkArgument(machineInstanceProviders.hasProvider(machineCfg.getType()), "Type %s of machine %s in environment %s is not supported. Supported values: %s.", machineCfg.getType(), machineCfg.getName(), envName, Joiner.on(", ").join(machineInstanceProviders.getProviderTypes())); for (ServerConf serverConf : machineCfg.getServers()) { checkArgument(serverConf.getPort() != null && SERVER_PORT.matcher(serverConf.getPort()).matches(), "Machine %s contains server conf with invalid port %s", machineCfg.getName(), serverConf.getPort()); checkArgument(serverConf.getProtocol() == null || SERVER_PROTOCOL.matcher(serverConf.getProtocol()).matches(), "Machine %s contains server conf with invalid protocol %s", machineCfg.getName(), serverConf.getProtocol()); } for (Map.Entry<String, String> envVariable : machineCfg.getEnvVariables().entrySet()) { checkArgument(!isNullOrEmpty(envVariable.getKey()), "Machine %s contains environment variable with null or empty name"); checkNotNull(envVariable.getValue(), "Machine %s contains environment variable with null value"); } }