[jira] [Commented] (SCB-579) NullPointerException is thrown when consumer upload null

2018-05-20 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-579?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16482110#comment-16482110
 ] 

ASF GitHub Bot commented on SCB-579:


liubao68 closed pull request #714: [SCB-579] fix NullPointerException when 
consumer upload null file
URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/714
 
 
   

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/common/common-rest/src/main/java/org/apache/servicecomb/common/rest/codec/param/RestClientRequestImpl.java
 
b/common/common-rest/src/main/java/org/apache/servicecomb/common/rest/codec/param/RestClientRequestImpl.java
index 1158bc116..c6bb7e94f 100644
--- 
a/common/common-rest/src/main/java/org/apache/servicecomb/common/rest/codec/param/RestClientRequestImpl.java
+++ 
b/common/common-rest/src/main/java/org/apache/servicecomb/common/rest/codec/param/RestClientRequestImpl.java
@@ -83,6 +83,10 @@ public Buffer getBodyBuffer() throws Exception {
 
   @Override
   public void attach(String name, Part part) {
+if (null == part) {
+  LOGGER.debug("null file is ignored, file name = [{}]", name);
+  return;
+}
 uploads.put(name, part);
   }
 
diff --git 
a/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/codec/param/TestRestClientRequestImpl.java
 
b/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/codec/param/TestRestClientRequestImpl.java
index 2f5607138..d14c10e36 100644
--- 
a/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/codec/param/TestRestClientRequestImpl.java
+++ 
b/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/codec/param/TestRestClientRequestImpl.java
@@ -16,17 +16,22 @@
  */
 package org.apache.servicecomb.common.rest.codec.param;
 
+import java.util.Map;
+
 import javax.servlet.http.Part;
 import javax.ws.rs.core.MediaType;
 
+import org.hamcrest.Matchers;
 import org.junit.Assert;
 import org.junit.Test;
+import org.mockito.Mockito;
 
 import io.vertx.core.MultiMap;
 import io.vertx.core.buffer.Buffer;
 import io.vertx.core.http.CaseInsensitiveHeaders;
 import io.vertx.core.http.HttpClientRequest;
 import io.vertx.core.http.HttpHeaders;
+import mockit.Deencapsulation;
 import mockit.Expectations;
 import mockit.Mock;
 import mockit.MockUp;
@@ -34,7 +39,7 @@
 
 public class TestRestClientRequestImpl {
   @Mocked
-  HttpClientRequest request;
+  private HttpClientRequest request;
 
   @Test
   public void testForm() throws Exception {
@@ -113,4 +118,27 @@ public void 
fileBoundaryInfo_validSubmittedFileName(@Mocked Part part) {
 "Content-Transfer-Encoding: binary\r\n" +
 "\r\n", buffer.toString());
   }
+
+  @Test
+  public void testAttach() {
+RestClientRequestImpl restClientRequest = new 
RestClientRequestImpl(request, null, null);
+Part part = Mockito.mock(Part.class);
+String fileName = "fileName";
+
+restClientRequest.attach(fileName, part);
+
+Map uploads = Deencapsulation.getField(restClientRequest, 
"uploads");
+Assert.assertEquals(1, uploads.size());
+Assert.assertThat(uploads, Matchers.hasEntry(fileName, part));
+  }
+
+  @Test
+  public void testAttachOnPartIsNull() {
+RestClientRequestImpl restClientRequest = new 
RestClientRequestImpl(request, null, null);
+
+restClientRequest.attach("fileName", null);
+
+Map uploads = Deencapsulation.getField(restClientRequest, 
"uploads");
+Assert.assertTrue(uploads.isEmpty());
+  }
 }
diff --git 
a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/http/VertxServerRequestToHttpServletRequest.java
 
b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/http/VertxServerRequestToHttpServletRequest.java
index 94bc41cb6..31b3892cc 100644
--- 
a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/http/VertxServerRequestToHttpServletRequest.java
+++ 
b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/http/VertxServerRequestToHttpServletRequest.java
@@ -17,7 +17,6 @@
 
 package org.apache.servicecomb.foundation.vertx.http;
 
-import java.io.IOException;
 import java.util.Collections;
 import java.util.Enumeration;
 import java.util.HashMap;
@@ -27,7 +26,6 @@
 import java.util.Set;
 
 import javax.servlet.AsyncContext;
-import javax.servlet.ServletException;
 import javax.servlet.ServletInputStream;
 import javax.servlet.http.Cookie;
 import javax.servlet.http.Part;
@@ -106,7 +104,6 @@ public String getParameter(String name) {
 return this.vertxRequest.getParam(name);
   }
 
-
   @Override
   public String[] getParameterValues(String name) {
 List paramList 

[jira] [Commented] (SCB-579) NullPointerException is thrown when consumer upload null

2018-05-18 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-579?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16480354#comment-16480354
 ] 

ASF GitHub Bot commented on SCB-579:


coveralls commented on issue #714: [SCB-579] fix NullPointerException when 
consumer upload null file
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/714#issuecomment-389939918
 
 
   
   [![Coverage 
Status](https://coveralls.io/builds/17049390/badge)](https://coveralls.io/builds/17049390)
   
   Coverage decreased (-0.02%) to 87.557% when pulling 
**e36628f0af21964511a6a4237830aee7711127fc on 
yhs0092:NullPointerException_is_thrown_when_null_file_is_uploaded** into 
**bb8c7ffc4eb069c2118941291acf1ed884a56b83 on apache:master**.
   


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


> NullPointerException is thrown when consumer upload null
> 
>
> Key: SCB-579
> URL: https://issues.apache.org/jira/browse/SCB-579
> Project: Apache ServiceComb
>  Issue Type: Bug
>  Components: Java-Chassis
>Reporter: YaoHaishi
>Assignee: YaoHaishi
>Priority: Major
> Fix For: java-chassis-1.0.0-m2
>
>
> When consumer upload null file, there is a NullPointerException
> {quote}
> Caused by: java.lang.NullPointerException
> at 
> org.apache.servicecomb.common.rest.codec.param.RestClientRequestImpl.attachFile(RestClientRequestImpl.java:172)
> at 
> org.apache.servicecomb.common.rest.codec.param.RestClientRequestImpl.attachFiles(RestClientRequestImpl.java:157)
> at 
> org.apache.servicecomb.common.rest.codec.param.RestClientRequestImpl.doEndWithUpload(RestClientRequestImpl.java:109)
> at 
> org.apache.servicecomb.common.rest.codec.param.RestClientRequestImpl.end(RestClientRequestImpl.java:94)
> at 
> org.apache.servicecomb.transport.rest.client.http.VertxHttpMethod.lambda$doMethod$1(VertxHttpMethod.java:101)
> ... 7 more
> {quote}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-579) NullPointerException is thrown when consumer upload null

2018-05-18 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-579?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16480318#comment-16480318
 ] 

ASF GitHub Bot commented on SCB-579:


yhs0092 commented on a change in pull request #714: [SCB-579] fix 
NullPointerException when consumer upload null file
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/714#discussion_r189192248
 
 

 ##
 File path: 
common/common-rest/src/main/java/org/apache/servicecomb/common/rest/codec/param/RestClientRequestImpl.java
 ##
 @@ -169,6 +173,10 @@ private void attachFile(String boundary, 
Iterator> uploadsIt
 // because pojo consumer not easy to set name to part
 String name = entry.getKey();
 Part part = entry.getValue();
+if (null == part) {
 
 Review comment:
   Redundant null check has been removed. Please review again.


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


> NullPointerException is thrown when consumer upload null
> 
>
> Key: SCB-579
> URL: https://issues.apache.org/jira/browse/SCB-579
> Project: Apache ServiceComb
>  Issue Type: Bug
>  Components: Java-Chassis
>Reporter: YaoHaishi
>Assignee: YaoHaishi
>Priority: Major
> Fix For: java-chassis-1.0.0-m2
>
>
> When consumer upload null file, there is a NullPointerException
> {quote}
> Caused by: java.lang.NullPointerException
> at 
> org.apache.servicecomb.common.rest.codec.param.RestClientRequestImpl.attachFile(RestClientRequestImpl.java:172)
> at 
> org.apache.servicecomb.common.rest.codec.param.RestClientRequestImpl.attachFiles(RestClientRequestImpl.java:157)
> at 
> org.apache.servicecomb.common.rest.codec.param.RestClientRequestImpl.doEndWithUpload(RestClientRequestImpl.java:109)
> at 
> org.apache.servicecomb.common.rest.codec.param.RestClientRequestImpl.end(RestClientRequestImpl.java:94)
> at 
> org.apache.servicecomb.transport.rest.client.http.VertxHttpMethod.lambda$doMethod$1(VertxHttpMethod.java:101)
> ... 7 more
> {quote}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-579) NullPointerException is thrown when consumer upload null

2018-05-18 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-579?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16480221#comment-16480221
 ] 

ASF GitHub Bot commented on SCB-579:


liubao68 commented on a change in pull request #714: [SCB-579] fix 
NullPointerException when consumer upload null file
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/714#discussion_r189174251
 
 

 ##
 File path: 
common/common-rest/src/main/java/org/apache/servicecomb/common/rest/codec/param/RestClientRequestImpl.java
 ##
 @@ -169,6 +173,10 @@ private void attachFile(String boundary, 
Iterator> uploadsIt
 // because pojo consumer not easy to set name to part
 String name = entry.getKey();
 Part part = entry.getValue();
+if (null == part) {
 
 Review comment:
   Since uploads do not have null entries, this is redundant null check.


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


> NullPointerException is thrown when consumer upload null
> 
>
> Key: SCB-579
> URL: https://issues.apache.org/jira/browse/SCB-579
> Project: Apache ServiceComb
>  Issue Type: Bug
>  Components: Java-Chassis
>Reporter: YaoHaishi
>Assignee: YaoHaishi
>Priority: Major
> Fix For: java-chassis-1.0.0-m2
>
>
> When consumer upload null file, there is a NullPointerException
> {quote}
> Caused by: java.lang.NullPointerException
> at 
> org.apache.servicecomb.common.rest.codec.param.RestClientRequestImpl.attachFile(RestClientRequestImpl.java:172)
> at 
> org.apache.servicecomb.common.rest.codec.param.RestClientRequestImpl.attachFiles(RestClientRequestImpl.java:157)
> at 
> org.apache.servicecomb.common.rest.codec.param.RestClientRequestImpl.doEndWithUpload(RestClientRequestImpl.java:109)
> at 
> org.apache.servicecomb.common.rest.codec.param.RestClientRequestImpl.end(RestClientRequestImpl.java:94)
> at 
> org.apache.servicecomb.transport.rest.client.http.VertxHttpMethod.lambda$doMethod$1(VertxHttpMethod.java:101)
> ... 7 more
> {quote}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-579) NullPointerException is thrown when consumer upload null

2018-05-17 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-579?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16480033#comment-16480033
 ] 

ASF GitHub Bot commented on SCB-579:


yhs0092 commented on issue #714: [SCB-579] fix NullPointerException when 
consumer upload null file
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/714#issuecomment-390074524
 
 
   @WillemJiang  This PR deal with the situation that the uploaded file is null 
(Instead of file name).
   Users may write operations that their parameters contains both uploaded 
files and other params like string and int. Sometimes people may call these 
operations but they don't want to upload files.
   So we should ensure that when the uploaded file is null, the microservice 
instances still work well.


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


> NullPointerException is thrown when consumer upload null
> 
>
> Key: SCB-579
> URL: https://issues.apache.org/jira/browse/SCB-579
> Project: Apache ServiceComb
>  Issue Type: Bug
>  Components: Java-Chassis
>Reporter: YaoHaishi
>Assignee: YaoHaishi
>Priority: Major
> Fix For: java-chassis-1.0.0-m2
>
>
> When consumer upload null file, there is a NullPointerException
> {quote}
> Caused by: java.lang.NullPointerException
> at 
> org.apache.servicecomb.common.rest.codec.param.RestClientRequestImpl.attachFile(RestClientRequestImpl.java:172)
> at 
> org.apache.servicecomb.common.rest.codec.param.RestClientRequestImpl.attachFiles(RestClientRequestImpl.java:157)
> at 
> org.apache.servicecomb.common.rest.codec.param.RestClientRequestImpl.doEndWithUpload(RestClientRequestImpl.java:109)
> at 
> org.apache.servicecomb.common.rest.codec.param.RestClientRequestImpl.end(RestClientRequestImpl.java:94)
> at 
> org.apache.servicecomb.transport.rest.client.http.VertxHttpMethod.lambda$doMethod$1(VertxHttpMethod.java:101)
> ... 7 more
> {quote}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-579) NullPointerException is thrown when consumer upload null

2018-05-17 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-579?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16479926#comment-16479926
 ] 

ASF GitHub Bot commented on SCB-579:


WillemJiang commented on issue #714: [SCB-579] fix NullPointerException when 
consumer upload null file
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/714#issuecomment-390052022
 
 
   Not sure if the file name is null is common use case. If it is not, we'd 
better to use Info to tell the system operator there is something is abnormal. 


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


> NullPointerException is thrown when consumer upload null
> 
>
> Key: SCB-579
> URL: https://issues.apache.org/jira/browse/SCB-579
> Project: Apache ServiceComb
>  Issue Type: Bug
>  Components: Java-Chassis
>Reporter: YaoHaishi
>Assignee: YaoHaishi
>Priority: Major
> Fix For: java-chassis-1.0.0-m2
>
>
> When consumer upload null file, there is a NullPointerException
> {quote}
> Caused by: java.lang.NullPointerException
> at 
> org.apache.servicecomb.common.rest.codec.param.RestClientRequestImpl.attachFile(RestClientRequestImpl.java:172)
> at 
> org.apache.servicecomb.common.rest.codec.param.RestClientRequestImpl.attachFiles(RestClientRequestImpl.java:157)
> at 
> org.apache.servicecomb.common.rest.codec.param.RestClientRequestImpl.doEndWithUpload(RestClientRequestImpl.java:109)
> at 
> org.apache.servicecomb.common.rest.codec.param.RestClientRequestImpl.end(RestClientRequestImpl.java:94)
> at 
> org.apache.servicecomb.transport.rest.client.http.VertxHttpMethod.lambda$doMethod$1(VertxHttpMethod.java:101)
> ... 7 more
> {quote}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-579) NullPointerException is thrown when consumer upload null

2018-05-17 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-579?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16479397#comment-16479397
 ] 

ASF GitHub Bot commented on SCB-579:


coveralls commented on issue #714: [SCB-579] fix NullPointerException when 
consumer upload null file
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/714#issuecomment-389939918
 
 
   
   [![Coverage 
Status](https://coveralls.io/builds/17037680/badge)](https://coveralls.io/builds/17037680)
   
   Coverage decreased (-0.03%) to 87.345% when pulling 
**a93e627a8e56af655508e8503a0b1f87bb52d3df on 
yhs0092:NullPointerException_is_thrown_when_null_file_is_uploaded** into 
**61cda009b7ac8539364bd0f1d1855d804ea4dd27 on apache:master**.
   


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


> NullPointerException is thrown when consumer upload null
> 
>
> Key: SCB-579
> URL: https://issues.apache.org/jira/browse/SCB-579
> Project: Apache ServiceComb
>  Issue Type: Bug
>  Components: Java-Chassis
>Reporter: YaoHaishi
>Assignee: YaoHaishi
>Priority: Major
> Fix For: java-chassis-1.0.0-m2
>
>
> When consumer upload null file, there is a NullPointerException
> {quote}
> Caused by: java.lang.NullPointerException
> at 
> org.apache.servicecomb.common.rest.codec.param.RestClientRequestImpl.attachFile(RestClientRequestImpl.java:172)
> at 
> org.apache.servicecomb.common.rest.codec.param.RestClientRequestImpl.attachFiles(RestClientRequestImpl.java:157)
> at 
> org.apache.servicecomb.common.rest.codec.param.RestClientRequestImpl.doEndWithUpload(RestClientRequestImpl.java:109)
> at 
> org.apache.servicecomb.common.rest.codec.param.RestClientRequestImpl.end(RestClientRequestImpl.java:94)
> at 
> org.apache.servicecomb.transport.rest.client.http.VertxHttpMethod.lambda$doMethod$1(VertxHttpMethod.java:101)
> ... 7 more
> {quote}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-579) NullPointerException is thrown when consumer upload null

2018-05-17 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-579?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16479295#comment-16479295
 ] 

ASF GitHub Bot commented on SCB-579:


yhs0092 opened a new pull request #714: [SCB-579] fix NullPointerException when 
consumer upload null file
URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/714
 
 
   Follow this checklist to help us incorporate your contribution quickly and 
easily:
   
- [ ] Make sure there is a [JIRA 
issue](https://issues.apache.org/jira/browse/SCB) filed for the change (usually 
before you start working on it).  Trivial changes like typos do not require a 
JIRA issue.  Your pull request should address just this issue, without pulling 
in other changes.
- [ ] Each commit in the pull request should have a meaningful subject line 
and body.
- [ ] Format the pull request title like `[SCB-XXX] Fixes bug in 
ApproximateQuantiles`, where you replace `SCB-XXX` with the appropriate JIRA 
issue.
- [ ] Write a pull request description that is detailed enough to 
understand what the pull request does, how, and why.
- [ ] Run `mvn clean install` to make sure basic checks pass. A more 
thorough check will be performed on your pull request automatically.
- [ ] If this contribution is large, please file an Apache [Individual 
Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   ---
   See details in [SCB-579](https://issues.apache.org/jira/browse/SCB-579)


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


> NullPointerException is thrown when consumer upload null
> 
>
> Key: SCB-579
> URL: https://issues.apache.org/jira/browse/SCB-579
> Project: Apache ServiceComb
>  Issue Type: Bug
>  Components: Java-Chassis
>Reporter: YaoHaishi
>Assignee: YaoHaishi
>Priority: Major
> Fix For: java-chassis-1.0.0-m2
>
>
> When consumer upload null file, there is a NullPointerException
> {quote}
> Caused by: java.lang.NullPointerException
> at 
> org.apache.servicecomb.common.rest.codec.param.RestClientRequestImpl.attachFile(RestClientRequestImpl.java:172)
> at 
> org.apache.servicecomb.common.rest.codec.param.RestClientRequestImpl.attachFiles(RestClientRequestImpl.java:157)
> at 
> org.apache.servicecomb.common.rest.codec.param.RestClientRequestImpl.doEndWithUpload(RestClientRequestImpl.java:109)
> at 
> org.apache.servicecomb.common.rest.codec.param.RestClientRequestImpl.end(RestClientRequestImpl.java:94)
> at 
> org.apache.servicecomb.transport.rest.client.http.VertxHttpMethod.lambda$doMethod$1(VertxHttpMethod.java:101)
> ... 7 more
> {quote}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)