Source:
<code>private void registerComputeService(final ConfigurationAdmin configurationAdmin,final String name, final String provider, final String api, final String identity, final String credential, final String endpoint, final Map<String, String> props) throws Exception { Runnable registrationTask = new Runnable() { @Override public void run() { try { Configuration configuration = findOrCreateFactoryConfiguration(configurationAdmin, "org.jclouds.compute", name, provider, api); if (configuration != null) { @SuppressWarnings("unchecked") Dictionary<String, Object> dictionary = configuration.getProperties(); if (dictionary == null) { dictionary = new Hashtable<String, Object>(); } String providerValue = EnvHelper.getComputeProvider(provider); String apiValue = EnvHelper.getComputeApi(api); String identityValue = EnvHelper.getComputeIdentity(identity); String endpointValue = EnvHelper.getComputeEndpoint(endpoint); String credentialValue = EnvHelper.getComputeCredential(credential); if (providerValue != null && credentialValue != null && providerValue.equals("google-compute-engine")) { <START> credentialValue = EnvHelper.getGoogleCredentialFromJsonFile(credentialValue); <END> } if (name != null) { dictionary.put(Constants.NAME, name); } if (providerValue != null) { dictionary.put(Constants.PROVIDER, providerValue); } if (apiValue != null) { dictionary.put(Constants.API, apiValue); } if (endpointValue != null) { dictionary.put(Constants.ENDPOINT, endpointValue); } if (credentialValue != null) { dictionary.put(Constants.CREDENTIAL, credentialValue); } if (identityValue != null) { dictionary.put(Constants.IDENTITY, identityValue); } for (Map.Entry<String, String> entry : props.entrySet()) { String key = entry.getKey(); String value = entry.getValue(); dictionary.put(key, value); } configuration.update(dictionary); } } catch (Exception ex) { } } }; new Thread(registrationTask).start(); }</code><technical_language>If I understand this correctly, effectively adding fallback logic - "try normal first, if work, try JSON file". Is sequence in provide? Is some property determine front of options is used? Also, a minor change, check credentialValue != null first</technical_language>

Target:
private void registerComputeService(final ConfigurationAdmin configurationAdmin,final String name, final String provider, final String api, final String identity, final String credential, final String endpoint, final Map<String, String> props) throws Exception { Runnable registrationTask = new Runnable() { @Override public void run() { try { Configuration configuration = findOrCreateFactoryConfiguration(configurationAdmin, "org.jclouds.compute", name, provider, api); if (configuration != null) { Dictionary<String, Object> dictionary = configuration.getProperties(); if (dictionary == null) { dictionary = new Hashtable<String, Object>(); } String providerValue = EnvHelper.getComputeProvider(provider); String apiValue = EnvHelper.getComputeApi(api); String identityValue = EnvHelper.getComputeIdentity(identity); String endpointValue = EnvHelper.getComputeEndpoint(endpoint); String credentialValue = EnvHelper.getComputeCredential(credential); if (credentialValue != null && providerValue != null && providerValue.startsWith("google")) { credentialValue = EnvHelper.getGoogleCredentialFromJsonFileIfPath(credentialValue); } if (name != null) { dictionary.put(Constants.NAME, name); } if (providerValue != null) { dictionary.put(Constants.PROVIDER, providerValue); } if (apiValue != null) { dictionary.put(Constants.API, apiValue); } if (endpointValue != null) { dictionary.put(Constants.ENDPOINT, endpointValue); } if (credentialValue != null) { dictionary.put(Constants.CREDENTIAL, credentialValue); } if (identityValue != null) { dictionary.put(Constants.IDENTITY, identityValue); } for (Map.Entry<String, String> entry : props.entrySet()) { String key = entry.getKey(); String value = entry.getValue(); dictionary.put(key, value); } configuration.update(dictionary); } } catch (Exception ex) { } } }; new Thread(registrationTask).start(); }