You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by hu...@apache.org on 2013/09/21 09:33:22 UTC

[1/2] git commit: updated refs/heads/master to 8b6dcf8

Updated Branches:
  refs/heads/master da99f6552 -> 8b6dcf8b6


Fix a few xml wellformedness issues


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/d37b87d9
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/d37b87d9
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/d37b87d9

Branch: refs/heads/master
Commit: d37b87d97a19235b3cad8097eea2caf02882216f
Parents: da99f65
Author: Hugo Trippaers <ht...@schubergphilis.com>
Authored: Sat Sep 21 14:58:56 2013 +0800
Committer: Hugo Trippaers <ht...@schubergphilis.com>
Committed: Sat Sep 21 14:58:56 2013 +0800

----------------------------------------------------------------------
 engine/orchestration/test/resource/provisioningContext.xml  | 4 ++--
 engine/service/src/main/webapp/WEB-INF/beans.xml            | 4 ++--
 engine/service/src/main/webapp/WEB-INF/web.xml              | 9 +++------
 .../volume/solidfire/test/resource/storageContext.xml       | 2 +-
 4 files changed, 8 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d37b87d9/engine/orchestration/test/resource/provisioningContext.xml
----------------------------------------------------------------------
diff --git a/engine/orchestration/test/resource/provisioningContext.xml b/engine/orchestration/test/resource/provisioningContext.xml
index 6ed0ab5..0320be3 100644
--- a/engine/orchestration/test/resource/provisioningContext.xml
+++ b/engine/orchestration/test/resource/provisioningContext.xml
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
 <!--
   Licensed to the Apache Software Foundation (ASF) under one
   or more contributor license agreements. See the NOTICE file
@@ -15,8 +16,7 @@
   KIND, either express or implied. See the License for the
   specific language governing permissions and limitations
   under the License.
--->
-<?xml version="1.0" encoding="UTF-8"?>
+-->
 <beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
   xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop"

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d37b87d9/engine/service/src/main/webapp/WEB-INF/beans.xml
----------------------------------------------------------------------
diff --git a/engine/service/src/main/webapp/WEB-INF/beans.xml b/engine/service/src/main/webapp/WEB-INF/beans.xml
index e5bcb88..1be2c22 100644
--- a/engine/service/src/main/webapp/WEB-INF/beans.xml
+++ b/engine/service/src/main/webapp/WEB-INF/beans.xml
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
 <!--
   Licensed to the Apache Software Foundation (ASF) under one
   or more contributor license agreements. See the NOTICE file
@@ -15,8 +16,7 @@
   KIND, either express or implied. See the License for the
   specific language governing permissions and limitations
   under the License.
--->
-<?xml version="1.0" encoding="UTF-8"?>
+-->
 <beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxrs="http://cxf.apache.org/jaxrs"
   xmlns:context="http://www.springframework.org/schema/context"

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d37b87d9/engine/service/src/main/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/engine/service/src/main/webapp/WEB-INF/web.xml b/engine/service/src/main/webapp/WEB-INF/web.xml
index 6b8648a..c5bb44f 100644
--- a/engine/service/src/main/webapp/WEB-INF/web.xml
+++ b/engine/service/src/main/webapp/WEB-INF/web.xml
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
 <!--
   Licensed to the Apache Software Foundation (ASF) under one
   or more contributor license agreements. See the NOTICE file
@@ -15,11 +16,7 @@
   KIND, either express or implied. See the License for the
   specific language governing permissions and limitations
   under the License.
--->
-<!DOCTYPE web-app PUBLIC
- "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
- "http://java.sun.com/dtd/web-app_2_3.dtd" >
-
+-->
 <web-app xmlns="http://java.sun.com/xml/ns/javaee"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
@@ -38,8 +35,8 @@
     <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
   </listener>
   <servlet>
+    <display-name>CXF Servlet</display-name>
     <servlet-name>CXFServlet</servlet-name>
-    <display-name>CXF Servlet</display-name>
     <servlet-class>
       org.apache.cxf.transport.servlet.CXFServlet
     </servlet-class>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d37b87d9/plugins/storage/volume/solidfire/test/resource/storageContext.xml
----------------------------------------------------------------------
diff --git a/plugins/storage/volume/solidfire/test/resource/storageContext.xml b/plugins/storage/volume/solidfire/test/resource/storageContext.xml
index e4ba986..8187f29 100644
--- a/plugins/storage/volume/solidfire/test/resource/storageContext.xml
+++ b/plugins/storage/volume/solidfire/test/resource/storageContext.xml
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
 <!--
   Licensed to the Apache Software Foundation (ASF) under one
   or more contributor license agreements. See the NOTICE file
@@ -16,7 +17,6 @@
   specific language governing permissions and limitations
   under the License.
 -->
-<?xml version="1.0" encoding="UTF-8"?>
 <beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
   xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop"


[2/2] git commit: updated refs/heads/master to 8b6dcf8

Posted by hu...@apache.org.
Clean out a few warnings on potential resource leakage


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/8b6dcf8b
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/8b6dcf8b
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/8b6dcf8b

Branch: refs/heads/master
Commit: 8b6dcf8b6e85b7164dbc5a3cc33b3ddc7b4da17d
Parents: d37b87d
Author: Hugo Trippaers <ht...@schubergphilis.com>
Authored: Sat Sep 21 15:32:52 2013 +0800
Committer: Hugo Trippaers <ht...@schubergphilis.com>
Committed: Sat Sep 21 15:32:52 2013 +0800

----------------------------------------------------------------------
 utils/src/com/cloud/utils/NumbersUtil.java      | 10 +++++--
 utils/test/com/cloud/utils/NumbersUtilTest.java | 31 ++++++++++++++++++++
 2 files changed, 38 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8b6dcf8b/utils/src/com/cloud/utils/NumbersUtil.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/NumbersUtil.java b/utils/src/com/cloud/utils/NumbersUtil.java
index d9b06b7..e7e1f76 100755
--- a/utils/src/com/cloud/utils/NumbersUtil.java
+++ b/utils/src/com/cloud/utils/NumbersUtil.java
@@ -199,25 +199,29 @@ public class NumbersUtil {
     public static String toReadableSize(long bytes) {
         if (bytes <= KB && bytes >= 0) {
             return Long.toString(bytes) + " bytes";
-        } else if (bytes <= MB) {
+        } else if (bytes < MB) {
             StringBuilder builder = new StringBuilder();
             Formatter format = new Formatter(builder);
             format.format("%.2f KB", (float)bytes / (float)KB);
+            format.close();
             return builder.toString();
-        } else if (bytes <= GB) {
+        } else if (bytes < GB) {
             StringBuilder builder = new StringBuilder();
             Formatter format = new Formatter(builder);
             format.format("%.2f MB", (float)bytes / (float)MB);
+            format.close();
             return builder.toString();
-        } else if (bytes <= TB) {
+        } else if (bytes < TB) {
             StringBuilder builder = new StringBuilder();
             Formatter format = new Formatter(builder);
             format.format("%.2f GB", (float)bytes / (float)GB);
+            format.close();
             return builder.toString();
         } else {
             StringBuilder builder = new StringBuilder();
             Formatter format = new Formatter(builder);
             format.format("%.4f TB", (float)bytes / (float)TB);
+            format.close();
             return builder.toString();
         }
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8b6dcf8b/utils/test/com/cloud/utils/NumbersUtilTest.java
----------------------------------------------------------------------
diff --git a/utils/test/com/cloud/utils/NumbersUtilTest.java b/utils/test/com/cloud/utils/NumbersUtilTest.java
new file mode 100644
index 0000000..711cc22
--- /dev/null
+++ b/utils/test/com/cloud/utils/NumbersUtilTest.java
@@ -0,0 +1,31 @@
+// 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
+// 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.utils;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class NumbersUtilTest {
+
+    @Test
+    public void formattingCheck() {
+        long size = 1024*1024*1024;
+        String formatted = NumbersUtil.toReadableSize(size);
+        assertEquals("1.00 GB", formatted);
+    }
+}