Skip to content

Commit

Permalink
Duplicate code identified and factored out. (#8515)
Browse files Browse the repository at this point in the history
  • Loading branch information
KoenDG authored and marcospereira committed Jul 13, 2018
1 parent 9e24bec commit aaf166b
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions framework/src/play/src/main/java/play/mvc/BodyParser.java
Expand Up @@ -457,17 +457,7 @@ public DelegatingBodyParser(play.api.mvc.BodyParser<B> delegate, Function<B, A>

@Override
public Accumulator<ByteString, F.Either<Result, A>> apply(Http.RequestHeader request) {
Accumulator<ByteString, scala.util.Either<play.api.mvc.Result, B>> javaAccumulator = delegate.apply(request.asScala()).asJava();

return javaAccumulator.map(result -> {
if (result.isLeft()) {
return F.Either.Left(result.left().get().asJava());
} else {
return F.Either.Right(transform.apply(result.right().get()));
}
},
JavaParsers.trampoline()
);
return BodyParsers.delegate(delegate, transform, request);
}
}

Expand Down

0 comments on commit aaf166b

Please sign in to comment.