cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject git commit: updated refs/heads/master to 226b193
Date Wed, 27 Nov 2013 13:21:15 GMT
Updated Branches:
  refs/heads/master de2c4ceeb -> 226b19348


Fix for Coverity issues CID_1116744, CID_1116718 and CID_1116682, all related to resource
leak

Signed-off-by: Daan Hoogland <daan@onecht.net>


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

Branch: refs/heads/master
Commit: 226b193488638dfeff7a003b8c1ca6c760e00cd1
Parents: de2c4ce
Author: wilderrodrigues <wrodrigues@schubegphilis.com>
Authored: Tue Nov 19 10:41:04 2013 +0100
Committer: Daan Hoogland <daan@onecht.net>
Committed: Wed Nov 27 14:20:29 2013 +0100

----------------------------------------------------------------------
 .../serializer/OnwireClassRegistry.java          |  8 ++++++--
 .../src/com/cloud/api/doc/ApiXmlDocWriter.java   | 19 +++++++++----------
 2 files changed, 15 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/226b1934/framework/ipc/src/org/apache/cloudstack/framework/serializer/OnwireClassRegistry.java
----------------------------------------------------------------------
diff --git a/framework/ipc/src/org/apache/cloudstack/framework/serializer/OnwireClassRegistry.java
b/framework/ipc/src/org/apache/cloudstack/framework/serializer/OnwireClassRegistry.java
index 177ae09..83c8a42 100644
--- a/framework/ipc/src/org/apache/cloudstack/framework/serializer/OnwireClassRegistry.java
+++ b/framework/ipc/src/org/apache/cloudstack/framework/serializer/OnwireClassRegistry.java
@@ -32,6 +32,8 @@ import java.util.Set;
 import java.util.jar.JarEntry;
 import java.util.jar.JarInputStream;
 
+import org.apache.commons.io.IOUtils;
+
 //
 // Finding classes in a given package code is taken and modified from
 // Credit: http://internna.blogspot.com/2007/11/java-5-retrieving-all-classes-from.html
@@ -39,7 +41,7 @@ import java.util.jar.JarInputStream;
 public class OnwireClassRegistry {
 
     private List<String> packages = new ArrayList<String>();
-    private Map<String, Class<?>> registry = new HashMap<String, Class<?>>();
+    private final Map<String, Class<?>> registry = new HashMap<String, Class<?>>();
 
     public OnwireClassRegistry() {
         registry.put("Object", Object.class);
@@ -166,13 +168,15 @@ public class OnwireClassRegistry {
                         }
                     }
                 }
+                IOUtils.closeQuietly(jarFile);
             }
         } while (jarEntry != null);
 
+        IOUtils.closeQuietly(jarFile);
         return classes;
     }
 
     static String stripFilenameExtension(String file) {
         return file.substring(0, file.lastIndexOf('.'));
     }
-}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/226b1934/server/src/com/cloud/api/doc/ApiXmlDocWriter.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/doc/ApiXmlDocWriter.java b/server/src/com/cloud/api/doc/ApiXmlDocWriter.java
index a91530b..d3a8ade 100644
--- a/server/src/com/cloud/api/doc/ApiXmlDocWriter.java
+++ b/server/src/com/cloud/api/doc/ApiXmlDocWriter.java
@@ -41,11 +41,6 @@ import java.util.TreeMap;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipOutputStream;
 
-import org.apache.log4j.Logger;
-
-import com.google.gson.annotations.SerializedName;
-import com.thoughtworks.xstream.XStream;
-
 import org.apache.cloudstack.api.APICommand;
 import org.apache.cloudstack.api.BaseAsyncCmd;
 import org.apache.cloudstack.api.BaseAsyncCreateCmd;
@@ -61,11 +56,14 @@ import org.apache.cloudstack.api.response.StoragePoolResponse;
 import org.apache.cloudstack.api.response.TemplateResponse;
 import org.apache.cloudstack.api.response.UserVmResponse;
 import org.apache.cloudstack.api.response.VolumeResponse;
+import org.apache.log4j.Logger;
 
 import com.cloud.alert.AlertManager;
 import com.cloud.serializer.Param;
 import com.cloud.utils.IteratorUtil;
 import com.cloud.utils.ReflectUtil;
+import com.google.gson.annotations.SerializedName;
+import com.thoughtworks.xstream.XStream;
 
 public class ApiXmlDocWriter {
     public static final Logger s_logger = Logger.getLogger(ApiXmlDocWriter.class.getName());
@@ -136,6 +134,7 @@ public class ApiXmlDocWriter {
             try {
                 FileInputStream in = new FileInputStream(fileName);
                 preProcessedCommands.load(in);
+                in.close();
             } catch (FileNotFoundException ex) {
                 System.out.println("Can't find file " + fileName);
                 System.exit(2);
@@ -395,13 +394,13 @@ public class ApiXmlDocWriter {
         // Generate request
         request.add(new Argument("username", "Username", true));
         request.add(new Argument(
-            "password",
-            "Hashed password (Default is MD5). If you wish to use any other hashing algorithm,
you would need to write a custom authentication adapter See Docs section.",
-            true));
+                "password",
+                "Hashed password (Default is MD5). If you wish to use any other hashing algorithm,
you would need to write a custom authentication adapter See Docs section.",
+                true));
         request.add(new Argument("domain",
-            "path of the domain that the user belongs to. Example: domain=/com/cloud/internal.
 If no domain is passed in, the ROOT domain is assumed.", false));
+                "path of the domain that the user belongs to. Example: domain=/com/cloud/internal.
 If no domain is passed in, the ROOT domain is assumed.", false));
         request.add(new Argument("domainId",
-            "id of the domain that the user belongs to. If both domain and domainId are passed
in, \"domainId\" parameter takes precendence", false));
+                "id of the domain that the user belongs to. If both domain and domainId are
passed in, \"domainId\" parameter takes precendence", false));
         apiCommand.setRequest(request);
 
         // Generate response


Mime
View raw message