branch : master , version : 2.7.0-SNAPSHOT
ServiceConfig#doExportUrlsFor1Protocol , line 482

<img width="890" alt="image" src="https://user-images.githubusercontent.com/6971152/41273922-035827c2-6e4e-11e8-8a72-71562d138cf9.png">

The type of Constant.SCOPE_Xxx is String already , no need to call toString() again
if (portToBind == null || portToBind == 0) {
                portToBind = defaultPort;
            }
            if (portToBind == null || portToBind <= 0) {
                portToBind = getRandomPort(name);
                if (portToBind == null || portToBind < 0) {
                    portToBind = getAvailablePort(defaultPort);
                    putRandomPort(name, portToBind);
                }
                logger.warn("Use random available port(" + portToBind + ") for protocol " + name);
            }
        }
        
        map.put(Constants.BIND_PORT_KEY, String.valueOf(portToBind));
        
        String portToRegistryStr = getValueFromConfig(protocolConfig, Constants.DUBBO_PORT_TO_REGISTRY);
        Integer portToRegistry = parsePort(portToRegistryStr);
        if (portToRegistry == null) {
            portToRegistry = portToBind;
        }
        return portToRegistry;
    }
    private Integer parsePort(String configPort) {
        Integer port = null;
        if (configPort != null && configPort.length() > 0) {
            try {
                Integer intPort = Integer.parseInt(configPort);
                if (isInvalidPort(intPort)) {
                    throw new IllegalArgumentException("Specified invalid port from env value:" + configPort);
                }