Commit bc216a78 by 段启岩

关闭trace输出流

parent fad1f8f0
......@@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.RestControllerAdvice;
import javax.servlet.http.HttpServletRequest;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;
/**
......@@ -39,7 +40,13 @@ public class GlobalExceptionHandler {
if (debugMode) {
ByteArrayOutputStream byteBuff = new ByteArrayOutputStream();
e.printStackTrace(new PrintStream(byteBuff));
return Response.error(ErrorCode.OPERATION_FAILED.code(), byteBuff.toString());
String errTrace = byteBuff.toString();
try {
byteBuff.close();
} catch (IOException ex) {
ex.printStackTrace();
}
return Response.error(ErrorCode.OPERATION_FAILED.code(), errTrace);
} else {
return Response.error();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment