Skip to content

Commit 91718a1

Browse files
authored
[servlet] Replace invalid isReady call with isInitialized() (Fix javalin#1752) (javalin#1831)
* [servlet] Replace invalid `isReady` call with `isInitialized()` (Fix javalin#1752) * [servlet] Add missing change
1 parent 4d01572 commit 91718a1

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

javalin/src/main/java/io/javalin/http/servlet/JavalinServlet.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ class JavalinServlet(val cfg: JavalinConfig) : HttpServlet() {
104104
} catch (throwable: Throwable) {
105105
exceptionMapper.handleUnexpectedThrowable(res(), throwable) // handle any unexpected error, e.g. write failure
106106
} finally {
107-
if (outputStreamWrapper.isReady) outputStream().close() // close initialized output wrappers
107+
if (outputStreamWrapper.isInitialized()) outputStream().close() // close initialized output wrappers
108108
if (isAsync()) req().asyncContext.complete() // guarantee completion of async context to eliminate the possibility of hanging connections
109109
}
110110
}

javalin/src/main/java/io/javalin/http/servlet/JavalinServletContext.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ class JavalinServletContext(
108108
private val queryParams by lazy { super.queryParamMap() }
109109
override fun queryParamMap(): Map<String, List<String>> = queryParams
110110

111-
internal val outputStreamWrapper by lazy { CompressedOutputStream(compressionStrategy, this) }
112-
override fun outputStream(): ServletOutputStream = outputStreamWrapper
111+
internal val outputStreamWrapper = lazy { CompressedOutputStream(compressionStrategy, this) }
112+
override fun outputStream(): ServletOutputStream = outputStreamWrapper.value
113113

114114
override fun redirect(location: String, status: HttpStatus) {
115115
header(Header.LOCATION, location).status(status).result("Redirected")

0 commit comments

Comments
 (0)