You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@eventmesh.apache.org by mi...@apache.org on 2022/11/11 07:23:23 UTC

[incubator-eventmesh] branch master updated: Update RedirectClientByPathHandler.java

This is an automated email from the ASF dual-hosted git repository.

mikexue pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-eventmesh.git


The following commit(s) were added to refs/heads/master by this push:
     new edd08526 Update RedirectClientByPathHandler.java
     new 42b1520e Merge pull request #2162 from sandaoliu1/master
edd08526 is described below

commit edd08526f9673a59d97e9a380f65c725277adae8
Author: sandaoliu1 <34...@users.noreply.github.com>
AuthorDate: Thu Nov 10 20:08:45 2022 +0800

    Update RedirectClientByPathHandler.java
    
    Use try-with-resources to manage resources
---
 .../runtime/admin/handler/RedirectClientByPathHandler.java | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/RedirectClientByPathHandler.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/RedirectClientByPathHandler.java
index a2b09364..a843d683 100644
--- a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/RedirectClientByPathHandler.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/RedirectClientByPathHandler.java
@@ -55,8 +55,7 @@ public class RedirectClientByPathHandler implements HttpHandler {
     @Override
     public void handle(HttpExchange httpExchange) throws IOException {
         String result = "";
-        OutputStream out = httpExchange.getResponseBody();
-        try {
+        try (OutputStream out = httpExchange.getResponseBody()) {
             String queryString = httpExchange.getRequestURI().getQuery();
             Map<String, String> queryStringInfo = NetUtils.formData2Dic(queryString);
             String path = queryStringInfo.get(EventMeshConstants.MANAGE_PATH);
@@ -108,15 +107,6 @@ public class RedirectClientByPathHandler implements HttpHandler {
             out.write(result.getBytes(Constants.DEFAULT_CHARSET));
         } catch (Exception e) {
             logger.error("redirectClientByPath fail...", e);
-        } finally {
-            if (out != null) {
-                try {
-                    out.close();
-                } catch (IOException e) {
-                    logger.warn("out close failed...", e);
-                }
-            }
         }
-
     }
-}
\ No newline at end of file
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: commits-help@eventmesh.apache.org