apache / dubbo-admin

@@ -19,7 +19,9 @@
Loading
19 19
20 20
import com.google.gson.Gson;
21 21
22 +
import com.google.gson.JsonParseException;
22 23
import org.apache.dubbo.admin.annotation.Authority;
24 +
import org.apache.dubbo.admin.common.exception.VersionValidationException;
23 25
import org.apache.dubbo.admin.common.util.Constants;
24 26
import org.apache.dubbo.admin.common.util.Tool;
25 27
import org.apache.dubbo.admin.model.domain.Consumer;
@@ -44,6 +46,7 @@
Loading
44 46
import java.util.List;
45 47
import java.util.Set;
46 48
import java.util.stream.Collectors;
49 +
47 50
@Authority(needLogin = true)
48 51
@RestController
49 52
@RequestMapping("/api/{env}")
@@ -60,7 +63,7 @@
Loading
60 63
        this.gson = new Gson();
61 64
    }
62 65
63 -
    @RequestMapping( value = "/service", method = RequestMethod.GET)
66 +
    @RequestMapping(value = "/service", method = RequestMethod.GET)
64 67
    public Page<ServiceDTO> searchService(@RequestParam String pattern,
65 68
                                          @RequestParam String filter,
66 69
                                          @PathVariable String env,
@@ -98,8 +101,14 @@
Loading
98 101
        serviceDetailDTO.setConsumers(consumers);
99 102
        serviceDetailDTO.setProviders(providers);
100 103
        if (metadata != null) {
101 -
            FullServiceDefinition serviceDefinition = gson.fromJson(metadata, FullServiceDefinition.class);
102 -
            serviceDetailDTO.setMetadata(serviceDefinition);
104 +
            try {
105 +
                // for dubbo version under 2.7, this metadata will represent as IP address, like 10.0.0.1.
106 +
                // So the json conversion will fail. 
107 +
                FullServiceDefinition serviceDefinition = gson.fromJson(metadata, FullServiceDefinition.class);
108 +
                serviceDetailDTO.setMetadata(serviceDefinition);
109 +
            } catch (JsonParseException e) {
110 +
                throw new VersionValidationException("dubbo 2.6 does not support metadata");
111 +
            }
103 112
        }
104 113
        serviceDetailDTO.setConsumers(consumers);
105 114
        serviceDetailDTO.setProviders(providers);
Files Complexity Coverage
dubbo-admin-server/src/main/java/org/apache/dubbo/admin 20.33% 22.00%
Project Totals (98 files) 20.33% 22.00%
Notifications are pending CI completion. Periodically Codecov will check the CI state, when complete notifications will be submitted. Push notifications now.

No yaml found.

Create your codecov.yml to customize your Codecov experience

Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading