[kotlin][spring] Fix ApiUtil compilation (#6084)

This commit is contained in:
sylvainmoindron 2020-06-05 03:29:40 +02:00 committed by GitHub
parent dc9a898e11
commit 388218bdf9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 9 deletions

View File

@ -12,9 +12,9 @@ object ApiUtil {
fun setExampleResponse(req: NativeWebRequest, contentType: String, example: String) { fun setExampleResponse(req: NativeWebRequest, contentType: String, example: String) {
try { try {
val res = req.getNativeResponse(HttpServletResponse::class.java) val res = req.getNativeResponse(HttpServletResponse::class.java)
res.setCharacterEncoding("UTF-8") res?.characterEncoding = "UTF-8"
res.addHeader("Content-Type", contentType) res?.addHeader("Content-Type", contentType)
res.getWriter().print(example) res?.writer?.print(example)
} catch (e: IOException) { } catch (e: IOException) {
throw RuntimeException(e) throw RuntimeException(e)
} }

View File

@ -9,9 +9,9 @@ object ApiUtil {
fun setExampleResponse(req: NativeWebRequest, contentType: String, example: String) { fun setExampleResponse(req: NativeWebRequest, contentType: String, example: String) {
try { try {
val res = req.getNativeResponse(HttpServletResponse::class.java) val res = req.getNativeResponse(HttpServletResponse::class.java)
res.setCharacterEncoding("UTF-8") res?.characterEncoding = "UTF-8"
res.addHeader("Content-Type", contentType) res?.addHeader("Content-Type", contentType)
res.getWriter().print(example) res?.writer?.print(example)
} catch (e: IOException) { } catch (e: IOException) {
throw RuntimeException(e) throw RuntimeException(e)
} }

View File

@ -9,9 +9,9 @@ object ApiUtil {
fun setExampleResponse(req: NativeWebRequest, contentType: String, example: String) { fun setExampleResponse(req: NativeWebRequest, contentType: String, example: String) {
try { try {
val res = req.getNativeResponse(HttpServletResponse::class.java) val res = req.getNativeResponse(HttpServletResponse::class.java)
res.setCharacterEncoding("UTF-8") res?.characterEncoding = "UTF-8"
res.addHeader("Content-Type", contentType) res?.addHeader("Content-Type", contentType)
res.getWriter().print(example) res?.writer?.print(example)
} catch (e: IOException) { } catch (e: IOException) {
throw RuntimeException(e) throw RuntimeException(e)
} }