Source:
protected Object doExecute() throws Exception { printInitCommand("set Ipv4 address"); try { IResourceManager manager = getResourceManager(); if (manager == null) { printError("Error in manager."); printEndCommand(); return null; } String[] argsRouterName = new String[2]; try { argsRouterName = splitResourceName(resourceId); } catch (Exception e) { printError(e.getMessage()); printEndCommand(); return -1; } IResourceIdentifier resourceIdentifier = manager.getIdentifierFromResourceName(argsRouterName[0], argsRouterName[1]); if (resourceIdentifier == null) { printError("Could not get resource with name: " + argsRouterName[0] + ":" + argsRouterName[1]); printEndCommand(); return null; } IResource resource = manager.getResource(resourceIdentifier); validateResource(resource); LogicalDevice params = validateParams(resource); if (params == null) { printError("Interface " + interfaceName + " not found in model"); printEndCommand(); return null; } if (!validateIPAddress(ipv4)) { printError("Ip format incorrect. It must be [255..0].[255..0].[255..0].[255..0]"); printEndCommand(); return null; } if (!validateIPAddress(mask)) { printError("Mask format incorrect. It must be [255..0].[255..0].[255..0].[255..0]"); printEndCommand(); return null; } IIPCapability ipCapability = (IIPCapability) resource.getCapabilityByInterface(IIPCapability.class); ipCapability.setIPv4(params); } catch (ResourceException e) { printError(e); printEndCommand(); return null; } catch (Exception e) { printError("Error setting ip address in an interface."); printError(e); printEndCommand(); return null; } printEndCommand(); return null; }

Target:
protected Object doExecute() throws Exception { printInitCommand("set Ipv4 address"); try { IResourceManager manager = getResourceManager(); if (manager == null) { printError("Error in manager."); printEndCommand(); return null; } String[] argsRouterName = new String[2]; try { argsRouterName = splitResourceName(resourceId); } catch (Exception e) { printError(e.getMessage()); printEndCommand(); return -1; } IResourceIdentifier resourceIdentifier = manager.getIdentifierFromResourceName(argsRouterName[0], argsRouterName[1]); if (resourceIdentifier == null) { printError("Could not get resource with name: " + argsRouterName[0] + ":" + argsRouterName[1]); printEndCommand(); return null; } IResource resource = manager.getResource(resourceIdentifier); validateResource(resource); if (!validateIPAddress(ipv4)) { printError("Ip format incorrect. It must be [255..0].[255..0].[255..0].[255..0]"); printEndCommand(); return null; } if (!validateIPAddress(mask)) { printError("Mask format incorrect. It must be [255..0].[255..0].[255..0].[255..0]"); printEndCommand(); return null; } IPProtocolEndpoint ipProtocolEndpoint = new IPProtocolEndpoint(); NetworkPort networkPort = getNetworkPort(); if (networkPort == null) { printError("Interface " + interfaceName + " not found in model"); printEndCommand(); return null; } IIPCapability ipCapability = (IIPCapability) resource.getCapabilityByInterface(IIPCapability.class); ipCapability.setIPv4(networkPort, ipProtocolEndpoint); } catch (ResourceException e) { printError(e); printEndCommand(); return null; } catch (Exception e) { printError("Error setting ip address in an interface."); printError(e); printEndCommand(); return null; } printEndCommand(); return null; }