Code review comment: if some partition has offset while others hasn't ?

Code under review:
private void checkKafkaProperties() throws AnalysisException {
        Optional<String> optional = dataSourceProperties.keySet().parallelStream()
                .filter(entity -> !KAFKA_PROPERTIES_SET.contains(entity)).findFirst();
        if (optional.isPresent()) {
            throw new AnalysisException(optional.get() + " is invalid kafka custom property");
        }

        
        kafkaBrokerList = Strings.nullToEmpty(dataSourceProperties.get(KAFKA_BROKER_LIST_PROPERTY)).replaceAll(" ", "");
        if (Strings.isNullOrEmpty(kafkaBrokerList)) {
            throw new AnalysisException(KAFKA_BROKER_LIST_PROPERTY + " is a required property");
        }
        String[] kafkaBrokerList = this.kafkaBrokerList.split(",");
        for (String broker : kafkaBrokerList) {
            if (!Pattern.matches(ENDPOINT_REGEX, broker)) {
                throw new AnalysisException(KAFKA_BROKER_LIST_PROPERTY + ":" + broker
                                                    + " not match pattern " + ENDPOINT_REGEX);
            }
        }

        
        kafkaTopic = Strings.nullToEmpty(dataSourceProperties.get(KAFKA_TOPIC_PROPERTY)).replaceAll(" ", "");
        if (Strings.isNullOrEmpty(kafkaTopic)) {
            throw new AnalysisException(KAFKA_TOPIC_PROPERTY + " is a required property");
        }

        
        final String kafkaPartitionsString = dataSourceProperties.get(KAFKA_PARTITIONS_PROPERTY);
        if (kafkaPartitionsString != null) {
            kafkaPartitionsString.replaceAll(" ", "");
            if (kafkaPartitionsString.isEmpty()) {
                throw new AnalysisException(KAFKA_PARTITIONS_PROPERTY + " could not be a empty string");
            }
            String[] kafkaPartionsStringList = kafkaPartitionsString.split(",");
            for (String s : kafkaPartionsStringList) {
                try {
                    kafkaPartitionOffsets.add(Pair.create(getIntegerValueFromString(s, KAFKA_PARTITIONS_PROPERTY), 0L));
                } catch (AnalysisException e) {
                    throw new AnalysisException(KAFKA_PARTITIONS_PROPERTY
                                                        + " must be a number string with comma-separated");
                }
            }
        }

        
        final String kafkaOffsetsString = dataSourceProperties.get(KAFKA_OFFSETS_PROPERTY);
        if (kafkaOffsetsString != null) {
            kafkaOffsetsString.replaceAll(" ", "");
            if (kafkaOffsetsString.isEmpty()) {
                throw new AnalysisException(KAFKA_OFFSETS_PROPERTY + " could not be a empty string");
            }
            String[] kafkaOffsetsStringList = kafkaOffsetsString.split(",");
            if (kafkaOffsetsStringList.length != kafkaPartitionOffsets.size()) {
                throw new AnalysisException("Partitions number should be equals to offsets number");
            }

            for (int i = 0; i < kafkaOffsetsStringList.length; i++) {
                kafkaPartitionOffsets.get(i).second = getLongValueFromString(kafkaOffsetsStringList[i],
                        KAFKA_OFFSETS_PROPERTY);
            }
        }
    }

Line commented on: if (kafkaOffsetsStringList.length != kafkaPartitionOffsets.size()) {

Revised code:
private void checkKafkaProperties() throws AnalysisException {
        Optional<String> optional = dataSourceProperties.keySet().parallelStream()
                .filter(entity -> !KAFKA_PROPERTIES_SET.contains(entity)).findFirst();
        if (optional.isPresent()) {
            throw new AnalysisException(optional.get() + " is invalid kafka custom property");
        }

        
        kafkaBrokerList = Strings.nullToEmpty(dataSourceProperties.get(KAFKA_BROKER_LIST_PROPERTY)).replaceAll(" ", "");
        if (Strings.isNullOrEmpty(kafkaBrokerList)) {
            throw new AnalysisException(KAFKA_BROKER_LIST_PROPERTY + " is a required property");
        }
        String[] kafkaBrokerList = this.kafkaBrokerList.split(",");
        for (String broker : kafkaBrokerList) {
            if (!Pattern.matches(ENDPOINT_REGEX, broker)) {
                throw new AnalysisException(KAFKA_BROKER_LIST_PROPERTY + ":" + broker
                                                    + " not match pattern " + ENDPOINT_REGEX);
            }
        }

        
        kafkaTopic = Strings.nullToEmpty(dataSourceProperties.get(KAFKA_TOPIC_PROPERTY)).replaceAll(" ", "");
        if (Strings.isNullOrEmpty(kafkaTopic)) {
            throw new AnalysisException(KAFKA_TOPIC_PROPERTY + " is a required property");
        }

        
        final String kafkaPartitionsString = dataSourceProperties.get(KAFKA_PARTITIONS_PROPERTY);
        if (kafkaPartitionsString != null) {
            kafkaPartitionsString.replaceAll(" ", "");
            if (kafkaPartitionsString.isEmpty()) {
                throw new AnalysisException(KAFKA_PARTITIONS_PROPERTY + " could not be a empty string");
            }
            String[] kafkaPartionsStringList = kafkaPartitionsString.split(",");
            for (String s : kafkaPartionsStringList) {
                try {
                    kafkaPartitionOffsets.add(Pair.create(getIntegerValueFromString(s, KAFKA_PARTITIONS_PROPERTY), 0L));
                } catch (AnalysisException e) {
                    throw new AnalysisException(KAFKA_PARTITIONS_PROPERTY
                                                        + " must be a number string with comma-separated");
                }
            }
        }

        
        final String kafkaOffsetsString = dataSourceProperties.get(KAFKA_OFFSETS_PROPERTY);
        if (kafkaOffsetsString != null) {
            kafkaOffsetsString.replaceAll(" ", "");
            if (kafkaOffsetsString.isEmpty()) {
                throw new AnalysisException(KAFKA_OFFSETS_PROPERTY + " could not be a empty string");
            }
            String[] kafkaOffsetsStringList = kafkaOffsetsString.split(",");
            if (kafkaOffsetsStringList.length != kafkaPartitionOffsets.size()) {
                throw new AnalysisException("Partitions number should be equals to offsets number");
            }

            for (int i = 0; i < kafkaOffsetsStringList.length; i++) {
                kafkaPartitionOffsets.get(i).second = getLongValueFromString(kafkaOffsetsStringList[i],
                        KAFKA_OFFSETS_PROPERTY);
            }
        }
    }