This is an automated email from the ASF dual-hosted git repository. btellier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/james-project.git
commit fe72dfe9f46c13d66d2e259ce170ae3e746f54cc Author: Benoit Tellier <[email protected]> AuthorDate: Mon Sep 14 17:56:35 2020 +0700 JAMES-3373 Tiny indent fixes --- .../jmap/rfc8621/contract/DownloadContract.scala | 25 ++++++++++------------ .../apache/james/jmap/routes/DownloadRoutes.scala | 18 ++++++++-------- 2 files changed, 20 insertions(+), 23 deletions(-) diff --git a/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/DownloadContract.scala b/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/DownloadContract.scala index 02d8cee..5e0e753 100644 --- a/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/DownloadContract.scala +++ b/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/DownloadContract.scala @@ -117,7 +117,7 @@ trait DownloadContract { .replaceRights(path, BOB.asString(), new MailboxACL.Rfc4314Rights(Right.Read, Right.Lookup)) val response = `given` - .basePath("") + .basePath("") .header(ACCEPT.toString, ACCEPT_RFC8621_VERSION_HEADER) .when .get(s"/download/$accountId/${messageId.serialize()}") @@ -144,7 +144,7 @@ trait DownloadContract { .getMessageId `given` - .basePath("") + .basePath("") .header(ACCEPT.toString, ACCEPT_RFC8621_VERSION_HEADER) .when .get(s"/download/$accountId/${messageId.serialize()}") @@ -167,7 +167,7 @@ trait DownloadContract { .basePath("") .header(ACCEPT.toString, ACCEPT_RFC8621_VERSION_HEADER) .when - .get(s"/download/$accountId/${messageId.serialize()}_3").prettyPeek() + .get(s"/download/$accountId/${messageId.serialize()}_3") .`then` .statusCode(SC_OK) .contentType("text/plain") @@ -196,7 +196,7 @@ trait DownloadContract { .getMessageId `given` - .basePath("") + .basePath("") .header(ACCEPT.toString, ACCEPT_RFC8621_VERSION_HEADER) .when .get(s"/download/$accountId/${messageId.serialize()}_3") @@ -364,7 +364,7 @@ trait DownloadContract { .getMessageId `given` - .basePath("") + .basePath("") .header(ACCEPT.toString, ACCEPT_RFC8621_VERSION_HEADER) .when .get(s"/download/$accountId/${messageId.serialize()}_333") @@ -382,7 +382,7 @@ trait DownloadContract { .getMessageId `given` - .basePath("") + .basePath("") .header(ACCEPT.toString, ACCEPT_RFC8621_VERSION_HEADER) .when .get(s"/download/$accountId/${messageId.serialize()}_invalid") @@ -399,15 +399,12 @@ trait DownloadContract { ClassLoader.getSystemResourceAsStream("eml/multipart_simple.eml"))) `given` - .basePath("") + .basePath("") .header(ACCEPT.toString, ACCEPT_RFC8621_VERSION_HEADER) .when .get(s"/download/$accountId/invalid") .`then` .statusCode(SC_NOT_FOUND) - .extract - .body - .asString } @Test @@ -419,7 +416,7 @@ trait DownloadContract { ClassLoader.getSystemResourceAsStream("eml/multipart_simple.eml"))) `given` - .basePath("") + .basePath("") .header(ACCEPT.toString, ACCEPT_RFC8621_VERSION_HEADER) .when .get(s"/download/$accountId/${randomMessageId.serialize()}") @@ -436,7 +433,7 @@ trait DownloadContract { ClassLoader.getSystemResourceAsStream("eml/multipart_simple.eml"))) `given` - .basePath("") + .basePath("") .header(ACCEPT.toString, ACCEPT_RFC8621_VERSION_HEADER) .when .get(s"/download/$accountId/${randomMessageId.serialize()}_3") @@ -453,7 +450,7 @@ trait DownloadContract { ClassLoader.getSystemResourceAsStream("eml/multipart_simple.eml"))) `given` - .basePath("") + .basePath("") .header(ACCEPT.toString, ACCEPT_RFC8621_VERSION_HEADER) .when .get(s"/download/$accountId/${randomMessageId.serialize()}_2") @@ -471,7 +468,7 @@ trait DownloadContract { .getMessageId `given` - .basePath("") + .basePath("") .header(ACCEPT.toString, ACCEPT_RFC8621_VERSION_HEADER) .when .get(s"/download/$accountId/${messageId.serialize()}_3_3") diff --git a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/routes/DownloadRoutes.scala b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/routes/DownloadRoutes.scala index 25ed27f..cfb06fc 100644 --- a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/routes/DownloadRoutes.scala +++ b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/routes/DownloadRoutes.scala @@ -99,7 +99,7 @@ case class EmailBodyPartBlob(blobId: BlobId, part: EmailBodyPart) extends Blob { } class MessageBlobResolver @Inject()(val messageIdFactory: MessageId.Factory, - val messageIdManager: MessageIdManager) extends BlobResolver { + val messageIdManager: MessageIdManager) extends BlobResolver { override def resolve(blobId: BlobId, mailboxSession: MailboxSession): Option[SMono[Blob]] = { Try(messageIdFactory.fromString(blobId.value.value)) match { case Failure(_) => None @@ -112,7 +112,7 @@ class MessageBlobResolver @Inject()(val messageIdFactory: MessageId.Factory, } class MessagePartBlobResolver @Inject()(val messageIdFactory: MessageId.Factory, - val messageIdManager: MessageIdManager) extends BlobResolver { + val messageIdManager: MessageIdManager) extends BlobResolver { private def asMessageAndPartId(blobId: BlobId): Try[(MessageId, PartId)] = { blobId.value.value.split("_").toList match { case List(messageIdString, partIdString) => for { @@ -183,17 +183,17 @@ class DownloadRoutes @Inject()(@Named(InjectionKeys.RFC_8621) val authenticator: .map(ContentType.of) .getOrElse(blob.contentType), blob = blob)) - .`then`()) + .`then`) .onErrorResume { - case e: UnauthorizedException => SMono.fromPublisher(handleAuthenticationFailure(response, LOGGER, e)).`then`() - case _: BlobNotFoundException => SMono.fromPublisher(response.status(SC_NOT_FOUND).send).`then`() + case e: UnauthorizedException => SMono.fromPublisher(handleAuthenticationFailure(response, LOGGER, e)).`then` + case _: BlobNotFoundException => SMono.fromPublisher(response.status(SC_NOT_FOUND).send).`then` case e => LOGGER.error("Unexpected error", e) - SMono.fromPublisher(handleInternalError(response, LOGGER, e)).`then`() + SMono.fromPublisher(handleInternalError(response, LOGGER, e)).`then` } .subscribeOn(Schedulers.elastic) .asJava() - .`then`() + .`then` private def downloadBlob(optionalName: Option[String], response: HttpServerResponse, @@ -209,9 +209,9 @@ class DownloadRoutes @Inject()(@Named(InjectionKeys.RFC_8621) val authenticator: .send(ReactorUtils.toChunks(stream, BUFFER_SIZE) .map(Unpooled.wrappedBuffer(_)) .subscribeOn(Schedulers.elastic)) - .`then`(), + .`then`, asJavaConsumer[InputStream]((stream: InputStream) => stream.close()))) - .`then`() + .`then` private def addContentDispositionHeader(optionalName: Option[String]): HttpServerResponse => HttpServerResponse = resp => optionalName.map(addContentDispositionHeaderRegardingEncoding(_, resp)) --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
