You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ko...@apache.org on 2014/05/02 21:20:56 UTC
[1/2] git commit: updated refs/heads/master to 726d8fc
Repository: cloudstack
Updated Branches:
refs/heads/master 59d0b75e7 -> 726d8fc3f
log exceptions in ConsoleProxyServlet
- Added exception to the logger method parameters to make stack trace available
- removed checking of debug level, it does not save temporary object creation here
Signed-off-by: Laszlo Hornyak <la...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/78507c07
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/78507c07
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/78507c07
Branch: refs/heads/master
Commit: 78507c07c8189e10762edd129a7385bc4aaa8eef
Parents: 59d0b75
Author: Laszlo Hornyak <la...@gmail.com>
Authored: Wed Apr 30 21:20:31 2014 +0200
Committer: Laszlo Hornyak <la...@gmail.com>
Committed: Fri May 2 21:19:48 2014 +0200
----------------------------------------------------------------------
server/src/com/cloud/servlet/ConsoleProxyServlet.java | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/78507c07/server/src/com/cloud/servlet/ConsoleProxyServlet.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/servlet/ConsoleProxyServlet.java b/server/src/com/cloud/servlet/ConsoleProxyServlet.java
index 16d7a32..ff8453b 100644
--- a/server/src/com/cloud/servlet/ConsoleProxyServlet.java
+++ b/server/src/com/cloud/servlet/ConsoleProxyServlet.java
@@ -237,9 +237,7 @@ public class ConsoleProxyServlet extends HttpServlet {
try {
resp.sendRedirect(composeThumbnailUrl(rootUrl, vm, host, w, h));
} catch (IOException e) {
- if (s_logger.isInfoEnabled()) {
- s_logger.info("Client may already close the connection");
- }
+ s_logger.info("Client may already close the connection", e);
}
}
@@ -501,9 +499,7 @@ public class ConsoleProxyServlet extends HttpServlet {
resp.setContentType("text/html");
resp.getWriter().print(content);
} catch (IOException e) {
- if (s_logger.isInfoEnabled()) {
- s_logger.info("Client may already close the connection");
- }
+ s_logger.info("Client may already close the connection", e);
}
}
[2/2] git commit: updated refs/heads/master to 726d8fc
Posted by ko...@apache.org.
test for escapeHTML
- test added
- StringBuffer replaced with StringBuilder
Signed-off-by: Laszlo Hornyak <la...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/726d8fc3
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/726d8fc3
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/726d8fc3
Branch: refs/heads/master
Commit: 726d8fc3fcb7afc393a767894d4997fad1e994a1
Parents: 78507c0
Author: Laszlo Hornyak <la...@gmail.com>
Authored: Wed Apr 30 21:32:56 2014 +0200
Committer: Laszlo Hornyak <la...@gmail.com>
Committed: Fri May 2 21:19:49 2014 +0200
----------------------------------------------------------------------
.../com/cloud/servlet/ConsoleProxyServlet.java | 2 +-
.../cloud/servlet/ConsoleProxyServletTest.java | 35 ++++++++++++++++++++
2 files changed, 36 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/726d8fc3/server/src/com/cloud/servlet/ConsoleProxyServlet.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/servlet/ConsoleProxyServlet.java b/server/src/com/cloud/servlet/ConsoleProxyServlet.java
index ff8453b..8e5dfbe 100644
--- a/server/src/com/cloud/servlet/ConsoleProxyServlet.java
+++ b/server/src/com/cloud/servlet/ConsoleProxyServlet.java
@@ -674,7 +674,7 @@ public class ConsoleProxyServlet extends HttpServlet {
if (content == null || content.isEmpty())
return content;
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
for (int i = 0; i < content.length(); i++) {
char c = content.charAt(i);
switch (c) {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/726d8fc3/server/test/com/cloud/servlet/ConsoleProxyServletTest.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/servlet/ConsoleProxyServletTest.java b/server/test/com/cloud/servlet/ConsoleProxyServletTest.java
new file mode 100644
index 0000000..1fc95d2
--- /dev/null
+++ b/server/test/com/cloud/servlet/ConsoleProxyServletTest.java
@@ -0,0 +1,35 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package com.cloud.servlet;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class ConsoleProxyServletTest {
+ @Test
+ public void escapeHTML() {
+ Assert.assertNull(ConsoleProxyServlet.escapeHTML(null));
+ Assert.assertEquals("", ConsoleProxyServlet.escapeHTML(""));
+ Assert.assertEquals("<strangevmname>",
+ ConsoleProxyServlet.escapeHTML("<strangevmname>"));
+ Assert.assertEquals(""strange vm"",
+ ConsoleProxyServlet.escapeHTML("\"strange vm\""));
+ Assert.assertEquals("Nothing-extraordinary-anyway.",
+ ConsoleProxyServlet.escapeHTML("Nothing-extraordinary-anyway."));
+ }
+}