Skip to content

Commit

Permalink
ZCS-7500 Fixing null parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
rupalid committed Jul 4, 2019
1 parent bc4dbb4 commit a25acca
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions store/src/java/com/zimbra/cs/zimlet/ZimletUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -1702,7 +1702,7 @@ private String postAttachment(String uploadURL, String name, byte[] data, String
cookie.setSecure(false);
cookie.setExpiryDate(null);
cookieStore.addCookie(cookie);

}
clientBuilder.setDefaultCookieStore(cookieStore);

Expand All @@ -1716,20 +1716,21 @@ private String postAttachment(String uploadURL, String name, byte[] data, String
(int) TimeUnit.MILLISECONDS.convert(LC.zimlet_deploy_timeout.intValue(),
TimeUnit.SECONDS)).build();
clientBuilder.setDefaultSocketConfig(config);

int statusCode = -1;
try {
String contentType = URLConnection.getFileNameMap().getContentTypeFor(name);
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
builder.addBinaryBody("upfile", data, ContentType.create(contentType), null);
builder.addBinaryBody("upfile", data, ContentType.create(contentType), name);
HttpEntity httpEntity = builder.build();
post.setEntity(httpEntity);
HttpClient client = clientBuilder.build();

HttpResponse httpResp = HttpClientUtil.executeMethod(client, post);
statusCode = httpResp.getStatusLine().getStatusCode();
if (statusCode == 200) {
String response = EntityUtils.toString(httpResp.getEntity());

// "raw" response should be of the format
// 200,'null','aac04dac-b3c8-4c26-b9c2-c2534f1d6ba1:79d2722f-d4c7-4304-9961-e7bcb146fc32'
String[] responseParts = response.split(",", 3);
Expand Down

0 comments on commit a25acca

Please sign in to comment.