Source:
public NSState createNodeSource(@HeaderParam("sessionid") String sessionId, @FormParam("nodeSourceName") String nodeSourceName, @FormParam("infrastructureType") String infrastructureType, @FormParam("infrastructureParameters") String[] infrastructureParameters, @FormParam("infrastructureFileParameters") String[] infrastructureFileParameters, @FormParam("policyType") String policyType, @FormParam("policyParameters") String[] policyParameters, @FormParam("policyFileParameters") String[] policyFileParameters) throws NotConnectedException { ResourceManager rm = checkAccess(sessionId); Object[] infraParams = new Object[infrastructureParameters.length + infrastructureFileParameters.length]; Object[] policyParams = new Object[policyParameters.length + policyFileParameters.length]; NSState nsState = new NSState(); for (PluginDescriptor infra : rm.getSupportedNodeSourceInfrastructures()) { if (infra.getPluginName().equals(infrastructureType)) { int i = 0, j = 0, k = 0; for (ConfigurableField field : infra.getConfigurableFields()) { if (field.getMeta().credential() || field.getMeta().fileBrowser()) { infraParams[i] = infrastructureFileParameters[k].getBytes(); k++; } else { infraParams[i] = infrastructureParameters[j]; j++; } i++; } } } for (PluginDescriptor pol : rm.getSupportedNodeSourcePolicies()) { if (pol.getPluginName().equals(policyType)) { int i = 0, j = 0, k = 0; for (ConfigurableField field : pol.getConfigurableFields()) { if (field.getMeta().credential() || field.getMeta().password()) { policyParams[i] = policyFileParameters[k].getBytes(); k++; } else { policyParams[i] = policyParameters[j]; j++; } i++; } } } try { nsState.setResult(rm.createNodeSource(nodeSourceName, infrastructureType, infraParams, policyType, policyParams) .getBooleanValue()); return nsState; } catch (RuntimeException ex) { nsState.setResult(false); nsState.setErrorMessage(cleanDisplayedErrorMessage(ex.getMessage())); nsState.setStackTrace(getStackTrace(ex)); return nsState; } }

Target:
public NSState createNodeSource(@HeaderParam("sessionid") String sessionId, @FormParam("nodeSourceName") String nodeSourceName, @FormParam("infrastructureType") String infrastructureType, @FormParam("infrastructureParameters") String[] infrastructureParameters, @FormParam("infrastructureFileParameters") String[] infrastructureFileParameters, @FormParam("policyType") String policyType, @FormParam("policyParameters") String[] policyParameters, @FormParam("policyFileParameters") String[] policyFileParameters) throws NotConnectedException { ResourceManager rm = checkAccess(sessionId); Object[] infraParams = new Object[infrastructureParameters.length + infrastructureFileParameters.length]; Object[] policyParams = new Object[policyParameters.length + policyFileParameters.length]; NSState nsState = new NSState(); for (PluginDescriptor infra : rm.getSupportedNodeSourceInfrastructures()) { if (infra.getPluginName().equals(infrastructureType)) { int i = 0, j = 0, k = 0; for (ConfigurableField field : infra.getConfigurableFields()) { if (field.getMeta().credential() || field.getMeta().fileBrowser()) { infraParams[i] = infrastructureFileParameters[k].getBytes(); k++; } else { infraParams[i] = infrastructureParameters[j]; j++; } i++; } } } for (PluginDescriptor pol : rm.getSupportedNodeSourcePolicies()) { if (pol.getPluginName().equals(policyType)) { int i = 0, j = 0, k = 0; for (ConfigurableField field : pol.getConfigurableFields()) { if (field.getMeta().credential() || field.getMeta().password()) { policyParams[i] = policyFileParameters[k].getBytes(); k++; } else { policyParams[i] = policyParameters[j]; j++; } i++; } } } try { nsState.setResult(rm.createNodeSource(nodeSourceName, infrastructureType, infraParams, policyType, policyParams) .getBooleanValue()); } catch (RuntimeException ex) { nsState.setResult(false); nsState.setErrorMessage(cleanDisplayedErrorMessage(ex.getMessage())); nsState.setStackTrace(StringEscapeUtils.escapeJson(getStackTrace(ex))); } finally { return nsState; } }