WillemJiang closed pull request #729: [SCB-562] fix NPE when had empty
interface (not have any method)
URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/729
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git
a/core/src/main/java/org/apache/servicecomb/core/definition/SchemaMeta.java
b/core/src/main/java/org/apache/servicecomb/core/definition/SchemaMeta.java
index 565290479..1a4e6f91d 100644
--- a/core/src/main/java/org/apache/servicecomb/core/definition/SchemaMeta.java
+++ b/core/src/main/java/org/apache/servicecomb/core/definition/SchemaMeta.java
@@ -83,6 +83,12 @@ public String getPackageName() {
}
private void initOperations() {
+ if (swagger.getPaths() == null) {
+ LOGGER.warn(swagger.getInfo().getTitle() + " with path " +
swagger.getBasePath()
+ + " is an empty interface, please delete it or fill with one
method!");
+ return;
+ }
+
for (Entry<String, Path> entry : swagger.getPaths().entrySet()) {
String strPath = entry.getKey();
Path path = entry.getValue();
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services