Skip to content

Commit

Permalink
Initial tweaks in hopes of fixing channel pipeline NRE bug (Azure#456)
Browse files Browse the repository at this point in the history
  • Loading branch information
RikkiGibson authored Aug 1, 2018
1 parent 39ada0a commit f89125b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicReference;

import com.microsoft.rest.v2.util.FlowableUtil;
import org.reactivestreams.Subscriber;
import org.reactivestreams.Subscription;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -302,7 +303,10 @@ public void operationComplete(Future<? super Channel> cf) {
String contentLengthHeader = request.headers().value("content-length");
try {
long contentLength = Long.parseLong(contentLengthHeader);
request.body().compose(ensureLength(contentLength)).subscribe(requestSubscriber);
request.body()
.flatMap(bb -> bb.remaining() > 8192 ? FlowableUtil.split(bb, 8192) : Flowable.just(bb))
.compose(ensureLength(contentLength))
.subscribe(requestSubscriber);
} catch (NumberFormatException e) {
String message = String.format(
"Content-Length was expected to be a valid long but was \"%s\"", contentLengthHeader);
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</scm>

<properties>
<netty.version>4.1.25.Final</netty.version>
<netty.version>4.1.27.Final</netty.version>
<jackson.version>2.8.11</jackson.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<legal><![CDATA[[INFO] Any downloads listed may be third party software. Microsoft grants you no rights for third party software.]]></legal>
Expand Down

0 comments on commit f89125b

Please sign in to comment.