spring-cloud / spring-cloud-consul

Spring Cloud Consul
http://cloud.spring.io/spring-cloud-consul/
Apache License 2.0
808 stars 540 forks source link

2.2.x release ConsulReactiveDiscoveryClient getMetaData NPE bug #756

Closed yimiaoxiehou closed 1 year ago

yimiaoxiehou commented 2 years ago

ConsulReactiveDiscoveryClient.java

ConsulReactiveDiscoveryClient.class

private ServiceInstance mapToServiceInstance(HealthService service,
            String serviceId) {
        String host = findHost(service);
        Map<String, String> metadata = getMetadata(service,
                properties.isTagsAsMetadata());
        boolean secure = false;
        if (metadata.containsKey("secure")) {  //  this will make a NPE 
            secure = Boolean.parseBoolean(metadata.get("secure"));
        }
        return new DefaultServiceInstance(service.getService().getId(), serviceId, host,
                service.getService().getPort(), secure, metadata);
    }

this bug is same as #719

yimiaoxiehou commented 2 years ago

@spencergibb

yimiaoxiehou commented 2 years ago

ConsulServerList.class #transformResponse getMetaData also make NPE

图片

spencergibb commented 1 year ago

2.x is no longer supported. Please upgrade to 3.1.x or 4.0.x where the problem is fixed.