Source:
<code>DataNodeConfig convert(InstanceConfig instanceConfig) { int schemaVersion = getSchemaVersion(instanceConfig); if (schemaVersion != 0) { LOGGER.warn("Unknown InstanceConfig schema version in {}. Ignoring.", schemaVersion, instanceConfig); return null; } DataNodeConfig dataNodeConfig = new DataNodeConfig(instanceConfig.getInstanceName(), instanceConfig.getHostName(), Integer.parseInt(instanceConfig.getPort()), getDcName(instanceConfig), getSslPortStr(instanceConfig), getHttp2PortStr(instanceConfig), getRackId(instanceConfig), getXid(instanceConfig)); dataNodeConfig.getSealedReplicas().addAll(getSealedReplicas(instanceConfig)); dataNodeConfig.getStoppedReplicas().addAll(getStoppedReplicas(instanceConfig)); dataNodeConfig.getDisabledReplicas().addAll(getDisabledReplicas(instanceConfig)); instanceConfig.getRecord().getMapFields().forEach((mountPath, diskProps) -> { if (diskProps.get(DISK_STATE) == null) { LOGGER.warn("{} field does not contain disk info on {}. Skip it and continue on next one.", mountPath, instanceConfig.getInstanceName()); } else { DataNodeConfig.DiskConfig disk = new DataNodeConfig.DiskConfig( diskProps.get(DISK_STATE).equals(AVAILABLE_STR) ? HardwareState.AVAILABLE : HardwareState.UNAVAILABLE, Long.parseLong(diskProps.get(DISK_CAPACITY_STR))); String replicasStr = diskProps.get(REPLICAS_STR); <START> if (!replicasStr.isEmpty()) { <END> for (String replicaStr : replicasStr.split(REPLICAS_DELIM_STR)) { String[] replicaStrParts = replicaStr.split(REPLICAS_STR_SEPARATOR); String partitionName = replicaStrParts[0]; long replicaCapacity = Long.parseLong(replicaStrParts[1]); String partitionClass = replicaStrParts.length > 2 ? replicaStrParts[2] : clusterMapConfig.clusterMapDefaultPartitionClass; disk.getReplicaConfigs() .put(partitionName, new DataNodeConfig.ReplicaConfig(replicaCapacity, partitionClass)); } } dataNodeConfig.getDiskConfigs().put(mountPath, disk); } }); return dataNodeConfig; }</code><technical_language>Do need check if replicasStr is null in this situation</technical_language>

Target:
DataNodeConfig convert(InstanceConfig instanceConfig) { int schemaVersion = getSchemaVersion(instanceConfig); if (schemaVersion != 0) { LOGGER.warn("Unknown InstanceConfig schema version in {}. Ignoring.", schemaVersion, instanceConfig); return null; } DataNodeConfig dataNodeConfig = new DataNodeConfig(instanceConfig.getInstanceName(), instanceConfig.getHostName(), Integer.parseInt(instanceConfig.getPort()), getDcName(instanceConfig), getSslPortStr(instanceConfig), getHttp2PortStr(instanceConfig), getRackId(instanceConfig), getXid(instanceConfig)); dataNodeConfig.getSealedReplicas().addAll(getSealedReplicas(instanceConfig)); dataNodeConfig.getStoppedReplicas().addAll(getStoppedReplicas(instanceConfig)); dataNodeConfig.getDisabledReplicas().addAll(getDisabledReplicas(instanceConfig)); instanceConfig.getRecord().getMapFields().forEach((mountPath, diskProps) -> { if (diskProps.get(DISK_STATE) == null) { LOGGER.warn("{} field does not contain disk info on {}. Skip it and continue on next one.", mountPath, instanceConfig.getInstanceName()); } else { DataNodeConfig.DiskConfig disk = new DataNodeConfig.DiskConfig( diskProps.get(DISK_STATE).equals(AVAILABLE_STR) ? HardwareState.AVAILABLE : HardwareState.UNAVAILABLE, Long.parseLong(diskProps.get(DISK_CAPACITY_STR))); String replicasStr = diskProps.get(REPLICAS_STR); if (!Utils.isNullOrEmpty(replicasStr)) { for (String replicaStr : replicasStr.split(REPLICAS_DELIM_STR)) { String[] replicaStrParts = replicaStr.split(REPLICAS_STR_SEPARATOR); String partitionName = replicaStrParts[0]; long replicaCapacity = Long.parseLong(replicaStrParts[1]); String partitionClass = replicaStrParts.length > 2 ? replicaStrParts[2] : clusterMapConfig.clusterMapDefaultPartitionClass; disk.getReplicaConfigs() .put(partitionName, new DataNodeConfig.ReplicaConfig(replicaCapacity, partitionClass)); } } dataNodeConfig.getDiskConfigs().put(mountPath, disk); } }); return dataNodeConfig; }