Source:
private void configureNetworking(String group, GoogleComputeEngineTemplateOptions options, Location location) { String networkName = null; Network network = null; String net = null; boolean isFullURI = false; if (options.getNetworks().isEmpty()) { networkName = DEFAULT_NETWORK_NAME; } else { Iterator<String> iterator = options.getNetworks().iterator(); net = iterator.next(); if (net.startsWith("projects")) { isFullURI = true; } networkName = nameFromNetworkString(net); checkArgument(!iterator.hasNext(), "Error: Please specify only one network/subnetwork in TemplateOptions when using GCE."); } String region = ZONE == location.getScope() ? location.getParent().getId() : location.getId(); Optional<Subnetwork> subnet; subnet = isFullURI ? Optional.fromNullable(resources.subnetwork(URI.create(net))) : subnetworksMap.getUnchecked(fromRegionAndName(region, networkName)); if (subnet.isPresent()) { network = resources.network(subnet.get().network()); options.networks(ImmutableSet.of(subnet.get().selfLink().toString())); logger.debug(">> attaching nodes to subnet(%s) in region(%s)", subnet.get().name(), region); } else { logger.warn(">> subnet(%s) was not found in region(%s). Trying to find a matching legacy network...", networkName, region); network = api.networks().get(networkName); options.networks(ImmutableSet.of(network.selfLink().toString())); logger.debug(">> attaching nodes to legacy network(%s)", network.name()); } checkArgument(network != null, "Error: no network with name %s was found", networkName); getOrCreateFirewalls(options, network, subnet, firewallTagNamingConvention.get(group)); }

Target:
private void configureNetworking(String group, GoogleComputeEngineTemplateOptions options, Location location) { String networkName = null; Network network = null; String net = null; boolean isFullURI = false; if (options.getNetworks().isEmpty()) { networkName = DEFAULT_NETWORK_NAME; } else { Iterator<String> iterator = options.getNetworks().iterator(); net = iterator.next(); isFullURI = net.startsWith("projects"); networkName = nameFromNetworkString(net); checkArgument(!iterator.hasNext(), "Error: Please specify only one network/subnetwork in TemplateOptions when using GCE."); } String region = ZONE == location.getScope() ? location.getParent().getId() : location.getId(); Optional<Subnetwork> subnet; subnet = isFullURI ? Optional.fromNullable(resources.subnetwork(URI.create(net))) : subnetworksMap.getUnchecked(fromRegionAndName(region, networkName)); if (subnet.isPresent()) { network = resources.network(subnet.get().network()); options.networks(ImmutableSet.of(subnet.get().selfLink().toString())); logger.debug(">> attaching nodes to subnet(%s) in region(%s)", subnet.get().name(), region); } else { logger.warn(">> subnet(%s) was not found in region(%s). Trying to find a matching legacy network...", networkName, region); network = api.networks().get(networkName); options.networks(ImmutableSet.of(network.selfLink().toString())); logger.debug(">> attaching nodes to legacy network(%s)", network.name()); } checkArgument(network != null, "Error: no network with name %s was found", networkName); getOrCreateFirewalls(options, network, subnet, firewallTagNamingConvention.get(group)); }