This is an automated email from the ASF dual-hosted git repository.
casion pushed a commit to branch dev-1.3.2
in repository https://gitbox.apache.org/repos/asf/incubator-linkis.git
The following commit(s) were added to refs/heads/dev-1.3.2 by this push:
new 8e5e4b963 Fix this issue of interface error returning status code 200
(#3712)
8e5e4b963 is described below
commit 8e5e4b963292fdb99a5aacc2dc468d4354465eb7
Author: peacewong <[email protected]>
AuthorDate: Wed Oct 26 17:44:52 2022 +0800
Fix this issue of interface error returning status code 200 (#3712)
---
.../linkis/server/restful/SpringRestfulCatchAOP.scala | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git
a/linkis-commons/linkis-module/src/main/scala/org/apache/linkis/server/restful/SpringRestfulCatchAOP.scala
b/linkis-commons/linkis-module/src/main/scala/org/apache/linkis/server/restful/SpringRestfulCatchAOP.scala
index 63d2f7997..3c03417b1 100644
---
a/linkis-commons/linkis-module/src/main/scala/org/apache/linkis/server/restful/SpringRestfulCatchAOP.scala
+++
b/linkis-commons/linkis-module/src/main/scala/org/apache/linkis/server/restful/SpringRestfulCatchAOP.scala
@@ -40,7 +40,10 @@ class SpringRestfulCatchAOP extends Logging {
@Around("springRestfulResponseCatch()")
def dealResponseRestful(proceedingJoinPoint: ProceedingJoinPoint): Object = {
val resp: Message = catchIt {
- return proceedingJoinPoint.proceed()
+ proceedingJoinPoint.proceed() match {
+ case message: Message => message
+ case _ => Message.error("Failed to dealResponse get null message")
+ }
}
// convert http status code
getCurrentHttpResponse.setStatus(Message.messageToHttpStatus(resp))
@@ -49,11 +52,12 @@ class SpringRestfulCatchAOP extends Logging {
def getCurrentHttpResponse: HttpServletResponse = {
val requestAttributes = RequestContextHolder.getRequestAttributes
- if (requestAttributes.isInstanceOf[ServletRequestAttributes]) {
- val response =
requestAttributes.asInstanceOf[ServletRequestAttributes].getResponse
- return response
+ requestAttributes match {
+ case attributes: ServletRequestAttributes =>
+ val response = attributes.getResponse
+ response
+ case _ => null
}
- null
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]