liubao68 commented on a change in pull request #817: [SCB-754] add null pointer 
check on AbstractRestInvocation.invocation
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/817#discussion_r203289391
 
 

 ##########
 File path: 
common/common-rest/src/test/java/org/apache/servicecomb/common/rest/TestAbstractRestInvocation.java
 ##########
 @@ -440,6 +440,26 @@ protected void sendResponse(Response response) {
     // just log, check nothing
   }
 
+  @Test
+  public void sendResponseQuietlyExceptionOnNullInvocation(@Mocked Response 
response) {
+    restInvocation = new AbstractRestInvocationForTest() {
+      @Override
+      protected void doInvoke() {
+      }
+
+      @Override
+      protected void sendResponse(Response response) {
+        throw new Error("");
+      }
+    };
+    initRestInvocation();
+    restInvocation.invocation = null;
+
+    restInvocation.sendResponseQuietly(response);
+
+    // just log, check nothing, and should not throw NPE
 
 Review comment:
   Can we add an integration test for this scenario? Define a filter may not 
throw null and call a not exists service and got a 404. 

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to