Roy Golan has posted comments on this change.

Change subject: core, engine: servlet to support the console proxy
......................................................................


Patch Set 33:

(3 comments)

https://gerrit.ovirt.org/#/c/35887/33/backend/manager/modules/services/src/main/java/org/ovirt/engine/core/services/VMConsoleProxyServlet.java
File 
backend/manager/modules/services/src/main/java/org/ovirt/engine/core/services/VMConsoleProxyServlet.java:

Line 38: 
Line 39: public class VMConsoleProxyServlet extends HttpServlet {
Line 40: 
Line 41:     @Inject
Line 42:     private BackendInternal backend;
> It seems to work using the existing beans.xml, many thanks for the hint!
francesco++ :) no probs.  kudos for picking the CDI thing so quickly

I'm glad developers embrace CDI more and more
Line 43: 
Line 44:     private static final String VM_CONSOLE_PROXY_EKU = "1.2.1.1";
Line 45: 
Line 46:     private static final Logger log = 
LoggerFactory.getLogger(VMConsoleProxyServlet.class);


Line 110: // TODO: avoid one query per loop. Bulk query?
indeed pls create it.


Line 128:         return jsonVms;
Line 129:     }
Line 130: 
Line 131:     private String readBody(BufferedReader body) throws IOException {
Line 132:         StringBuilder buffer = new StringBuilder();
probably we should have a utility method somewhere for that, but anyhow, you 
should always close a buffer. it doesn't close when you go outside the scope of 
the method and the FD may leak.

so use the following construct to avoid it


try (BufferedReader reader = body) {
    ... now do whatever
}

https://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html
Line 133: 
Line 134:         int r;
Line 135:         while ((r = body.read()) != -1) {
Line 136:             buffer.append((char) r);


-- 
To view, visit https://gerrit.ovirt.org/35887
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I53c721da21cefcf4069d14c7016b6f7d97f9eac9
Gerrit-PatchSet: 33
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Vitor de Lima <vdel...@redhat.com>
Gerrit-Reviewer: Alon Bar-Lev <alo...@redhat.com>
Gerrit-Reviewer: Arik Hadas <aha...@redhat.com>
Gerrit-Reviewer: Eli Mesika <emes...@redhat.com>
Gerrit-Reviewer: Francesco Romani <from...@redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Omer Frenkel <ofren...@redhat.com>
Gerrit-Reviewer: Ravi Nori <rn...@redhat.com>
Gerrit-Reviewer: Roy Golan <rgo...@redhat.com>
Gerrit-Reviewer: Shahar Havivi <shav...@redhat.com>
Gerrit-Reviewer: Yair Zaslavsky <wallaroo1...@gmail.com>
Gerrit-Reviewer: automat...@ovirt.org
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to