From 8a86b4f5551a4b950d18794a11c8db48b67d8f43 Mon Sep 17 00:00:00 2001 From: Rajesh Battala Date: Fri, 17 Aug 2012 12:40:50 +0530 Subject: [PATCH] CS-15778: Fetching thumbnail modified with review comments --- .../consoleproxy/ConsoleProxyAjaxImageHandler.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/console-proxy/src/com/cloud/consoleproxy/ConsoleProxyAjaxImageHandler.java b/console-proxy/src/com/cloud/consoleproxy/ConsoleProxyAjaxImageHandler.java index e855432688a..6b666ea7510 100644 --- a/console-proxy/src/com/cloud/consoleproxy/ConsoleProxyAjaxImageHandler.java +++ b/console-proxy/src/com/cloud/consoleproxy/ConsoleProxyAjaxImageHandler.java @@ -80,9 +80,10 @@ public class ConsoleProxyAjaxImageHandler implements HttpHandler { throw new IllegalArgumentException(e); } - try { - key = Integer.parseInt(keyStr); - } catch (NumberFormatException e) { + try { + if (keyStr != null) + key = Integer.parseInt(keyStr); + } catch (NumberFormatException e) { s_logger.warn("Invalid numeric parameter in query string: " + keyStr); throw new IllegalArgumentException(e); } @@ -97,9 +98,9 @@ public class ConsoleProxyAjaxImageHandler implements HttpHandler { param.setClientTunnelSession(console_host_session); ConsoleProxyClient viewer = ConsoleProxy.getVncViewer(param); - AjaxFIFOImageCache imageCache =viewer.getAjaxImageCache(); + AjaxFIFOImageCache imageCache = viewer.getAjaxImageCache(); - byte[] img = imageCache.getImage(0); + byte[] img = imageCache.getImage(key); if(img != null) { Headers hds = t.getResponseHeaders();