[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [libeufin] branch master updated: refactor 'if' into 'when'
From: |
gnunet |
Subject: |
[GNUnet-SVN] [libeufin] branch master updated: refactor 'if' into 'when' |
Date: |
Wed, 25 Sep 2019 15:09:39 +0200 |
This is an automated email from the git hooks/post-receive script.
dold pushed a commit to branch master
in repository libeufin.
The following commit(s) were added to refs/heads/master by this push:
new 3a1e451 refactor 'if' into 'when'
3a1e451 is described below
commit 3a1e451d2610bcbb8cb8e1dfdc2f7ad145630bc4
Author: Florian Dold <address@hidden>
AuthorDate: Wed Sep 25 15:09:34 2019 +0200
refactor 'if' into 'when'
---
src/main/kotlin/Main.kt | 46 ++++++++++++++++++++++++----------------------
1 file changed, 24 insertions(+), 22 deletions(-)
diff --git a/src/main/kotlin/Main.kt b/src/main/kotlin/Main.kt
index 812139c..90f0282 100644
--- a/src/main/kotlin/Main.kt
+++ b/src/main/kotlin/Main.kt
@@ -69,30 +69,32 @@ fun main() {
}
logger.info(bodyDocument.documentElement.localName)
- if ("ebicsHEVRequest" ==
bodyDocument.documentElement.localName) {
- val hevResponse = HEVResponse(
- "000000",
- "EBICS_OK",
- arrayOf(
- ProtocolAndVersion("H003", "02.40"),
- ProtocolAndVersion("H004", "02.50")
+ when (bodyDocument.documentElement.localName) {
+ "ebicsHEVRequest" -> {
+ val hevResponse = HEVResponse(
+ "000000",
+ "EBICS_OK",
+ arrayOf(
+ ProtocolAndVersion("H003", "02.40"),
+ ProtocolAndVersion("H004", "02.50")
+ )
)
- )
-
- val jaxbHEV: JAXBElement<HEVResponseDataType> =
hevResponse.makeHEVResponse()
- val responseText: String? =
xmlProcess.getStringFromJaxb(jaxbHEV)
- // FIXME: check if String is actually non-NULL!
- call.respondText(contentType = ContentType.Application.Xml,
- status = HttpStatusCode.OK) {responseText.toString()}
- return@post
+
+ val jaxbHEV: JAXBElement<HEVResponseDataType> =
hevResponse.makeHEVResponse()
+ val responseText: String? =
xmlProcess.getStringFromJaxb(jaxbHEV)
+ // FIXME: check if String is actually non-NULL!
+ call.respondText(contentType =
ContentType.Application.Xml,
+ status = HttpStatusCode.OK)
{responseText.toString()}
+ return@post
+ }
+ else -> {
+ /* Log to console and return "unknown type" */
+ logger.info("Unknown message, just logging it!")
+ call.respondText(contentType =
ContentType.Application.Xml,
+ status = HttpStatusCode.NotFound) {"Not found"}
+ return@post
+ }
}
-
- /* Log to console and return "unknown type" */
- logger.info("Unknown message, just logging it!")
- call.respondText(contentType = ContentType.Application.Xml,
- status = HttpStatusCode.NotFound) {"Not found"}
- return@post
-
}
}
}
--
To stop receiving notification emails like this one, please contact
address@hidden.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [libeufin] branch master updated: refactor 'if' into 'when',
gnunet <=