Source:
<code>public JcloudsLocation newLocationFromString(Map locationFlags, String spec, brooklyn.location.LocationRegistry registry) { Map globalProperties = registry.getProperties(); JcloudsSpecParser details = JcloudsSpecParser.parse(spec, false); String namedLocation = (String) locationFlags.get(LocationInternal.NAMED_SPEC_NAME.getName()); boolean isProvider = details.isProvider(); String providerOrApi = details.providerOrApi; isProvider = isProvider || "google-compute-engine".equals(providerOrApi); if (Strings.isEmpty(providerOrApi)) { throw new IllegalArgumentException("Cloud provider/API type not specified in spec \""+spec+"\""); } if (!isProvider && !details.isApi()) { throw new NoSuchElementException("Cloud provider/API type "+providerOrApi+" is not supported by jclouds"); } Map allProperties = getAllProperties(registry, globalProperties); String regionOrEndpoint = details.parameter; if (regionOrEndpoint==null && isProvider) regionOrEndpoint = (String)locationFlags.get(LocationConfigKeys.CLOUD_REGION_ID.getName()); Map jcloudsProperties = new JcloudsPropertiesFromBrooklynProperties().getJcloudsProperties(providerOrApi, regionOrEndpoint, namedLocation, allProperties); jcloudsProperties.putAll(locationFlags); if (regionOrEndpoint!=null) { if (isProvider) { if (regionOrEndpoint!=null && Strings.isBlank(Strings.toString(jcloudsProperties.get(JcloudsLocationConfig.CLOUD_REGION_ID.getName())))) jcloudsProperties.put(JcloudsLocationConfig.CLOUD_REGION_ID.getName(), regionOrEndpoint); } else { <START> if (regionOrEndpoint!=null && Strings.isBlank(Strings.toString(jcloudsProperties.get(JcloudsLocationConfig.CLOUD_ENDPOINT.getName())))) <END> jcloudsProperties.put(JcloudsLocationConfig.CLOUD_ENDPOINT.getName(), regionOrEndpoint); } } return managementContext.getLocationManager().createLocation(LocationSpec.create(JcloudsLocation.class) .configure(LocationConfigUtils.finalAndOriginalSpecs(spec, jcloudsProperties, globalProperties, namedLocation)) .configure(jcloudsProperties) ); }</code><technical_language>!= null needed above</technical_language>

Target:
public JcloudsLocation newLocationFromString(Map locationFlags, String spec, brooklyn.location.LocationRegistry registry) { Map globalProperties = registry.getProperties(); JcloudsSpecParser details = JcloudsSpecParser.parse(spec, false); String namedLocation = (String) locationFlags.get(LocationInternal.NAMED_SPEC_NAME.getName()); boolean isProvider = details.isProvider(); String providerOrApi = details.providerOrApi; isProvider = isProvider || "google-compute-engine".equals(providerOrApi); if (Strings.isEmpty(providerOrApi)) { throw new IllegalArgumentException("Cloud provider/API type not specified in spec \""+spec+"\""); } if (!isProvider && !details.isApi()) { throw new NoSuchElementException("Cloud provider/API type "+providerOrApi+" is not supported by jclouds"); } Map allProperties = getAllProperties(registry, globalProperties); String regionOrEndpoint = details.parameter; if (regionOrEndpoint==null && isProvider) regionOrEndpoint = (String)locationFlags.get(LocationConfigKeys.CLOUD_REGION_ID.getName()); Map jcloudsProperties = new JcloudsPropertiesFromBrooklynProperties().getJcloudsProperties(providerOrApi, regionOrEndpoint, namedLocation, allProperties); jcloudsProperties.putAll(locationFlags); if (regionOrEndpoint!=null) { if (isProvider) { if (Strings.isBlank(Strings.toString(jcloudsProperties.get(JcloudsLocationConfig.CLOUD_REGION_ID.getName())))) jcloudsProperties.put(JcloudsLocationConfig.CLOUD_REGION_ID.getName(), regionOrEndpoint); } else { if (Strings.isBlank(Strings.toString(jcloudsProperties.get(JcloudsLocationConfig.CLOUD_ENDPOINT.getName())))) jcloudsProperties.put(JcloudsLocationConfig.CLOUD_ENDPOINT.getName(), regionOrEndpoint); } } return managementContext.getLocationManager().createLocation(LocationSpec.create(JcloudsLocation.class) .configure(LocationConfigUtils.finalAndOriginalSpecs(spec, jcloudsProperties, globalProperties, namedLocation)) .configure(jcloudsProperties) ); }