From af35ffd9f22c16f6162ec814f0acd93daeb94adf Mon Sep 17 00:00:00 2001
Message-Id:
<af35ffd9f22c16f6162ec814f0acd93daeb94adf.1350037981.git.cbley(a)av-test.de>
In-Reply-To: <cover.1350037981.git.cbley(a)av-test.de>
References:
<2DA6F4A3691599408358374D182280F9141CF6(a)xmb-rcd-x04.cisco.com> <cover.1350037981.git.cbley(a)av-test.de>
From: cbley(a)av-test.de (Claudio Bley)
Date: Fri, 17 Aug 2012 14:50:44 +0200
Subject: [PATCH 04/15] Make finalize() methods protected.
To: libvir-list(a)redhat.com
Organization: AV-Test GmbH, Germany
Reported by findbugs:
Finalizer should be protected, not public
A class's finalize() method should have protected access, not public.
Bug kind and pattern: FI - FI_PUBLIC_SHOULD_BE_PROTECTED
---
src/main/java/org/libvirt/Connect.java | 2 +-
src/main/java/org/libvirt/Device.java | 2 +-
src/main/java/org/libvirt/Domain.java | 2 +-
src/main/java/org/libvirt/DomainSnapshot.java | 2 +-
src/main/java/org/libvirt/Interface.java | 2 +-
src/main/java/org/libvirt/Network.java | 2 +-
src/main/java/org/libvirt/NetworkFilter.java | 2 +-
src/main/java/org/libvirt/Secret.java | 2 +-
src/main/java/org/libvirt/StoragePool.java | 2 +-
src/main/java/org/libvirt/StorageVol.java | 2 +-
src/main/java/org/libvirt/Stream.java | 2 +-
11 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/src/main/java/org/libvirt/Connect.java
b/src/main/java/org/libvirt/Connect.java
index 0a94976..5419e85 100644
--- a/src/main/java/org/libvirt/Connect.java
+++ b/src/main/java/org/libvirt/Connect.java
@@ -533,7 +533,7 @@ public class Connect {
}
@Override
- public void finalize() throws LibvirtException {
+ protected void finalize() throws LibvirtException {
close();
}
diff --git a/src/main/java/org/libvirt/Device.java
b/src/main/java/org/libvirt/Device.java
index 8a52e81..bc25258 100644
--- a/src/main/java/org/libvirt/Device.java
+++ b/src/main/java/org/libvirt/Device.java
@@ -68,7 +68,7 @@ public class Device {
}
@Override
- public void finalize() throws LibvirtException {
+ protected void finalize() throws LibvirtException {
free();
}
diff --git a/src/main/java/org/libvirt/Domain.java
b/src/main/java/org/libvirt/Domain.java
index fc1f665..f4f5225 100644
--- a/src/main/java/org/libvirt/Domain.java
+++ b/src/main/java/org/libvirt/Domain.java
@@ -284,7 +284,7 @@ public class Domain {
}
@Override
- public void finalize() throws LibvirtException {
+ protected void finalize() throws LibvirtException {
free();
}
diff --git a/src/main/java/org/libvirt/DomainSnapshot.java
b/src/main/java/org/libvirt/DomainSnapshot.java
index add6830..3083ca0 100644
--- a/src/main/java/org/libvirt/DomainSnapshot.java
+++ b/src/main/java/org/libvirt/DomainSnapshot.java
@@ -49,7 +49,7 @@ public class DomainSnapshot {
}
@Override
- public void finalize() throws LibvirtException {
+ protected void finalize() throws LibvirtException {
free();
}
diff --git a/src/main/java/org/libvirt/Interface.java
b/src/main/java/org/libvirt/Interface.java
index 1ae8b94..17c189d 100644
--- a/src/main/java/org/libvirt/Interface.java
+++ b/src/main/java/org/libvirt/Interface.java
@@ -68,7 +68,7 @@ public class Interface {
}
@Override
- public void finalize() throws LibvirtException {
+ protected void finalize() throws LibvirtException {
free();
}
diff --git a/src/main/java/org/libvirt/Network.java
b/src/main/java/org/libvirt/Network.java
index 9684cb4..acaef0e 100644
--- a/src/main/java/org/libvirt/Network.java
+++ b/src/main/java/org/libvirt/Network.java
@@ -65,7 +65,7 @@ public class Network {
}
@Override
- public void finalize() throws LibvirtException {
+ protected void finalize() throws LibvirtException {
free();
}
diff --git a/src/main/java/org/libvirt/NetworkFilter.java
b/src/main/java/org/libvirt/NetworkFilter.java
index 016cf1a..7bc07a5 100644
--- a/src/main/java/org/libvirt/NetworkFilter.java
+++ b/src/main/java/org/libvirt/NetworkFilter.java
@@ -28,7 +28,7 @@ public class NetworkFilter {
}
@Override
- public void finalize() throws LibvirtException {
+ protected void finalize() throws LibvirtException {
free();
}
diff --git a/src/main/java/org/libvirt/Secret.java
b/src/main/java/org/libvirt/Secret.java
index febd75b..888cdf3 100644
--- a/src/main/java/org/libvirt/Secret.java
+++ b/src/main/java/org/libvirt/Secret.java
@@ -36,7 +36,7 @@ public class Secret {
}
@Override
- public void finalize() throws LibvirtException {
+ protected void finalize() throws LibvirtException {
free();
}
diff --git a/src/main/java/org/libvirt/StoragePool.java
b/src/main/java/org/libvirt/StoragePool.java
index 0328d8c..29a18ed 100644
--- a/src/main/java/org/libvirt/StoragePool.java
+++ b/src/main/java/org/libvirt/StoragePool.java
@@ -116,7 +116,7 @@ public class StoragePool {
}
@Override
- public void finalize() throws LibvirtException {
+ protected void finalize() throws LibvirtException {
free();
}
diff --git a/src/main/java/org/libvirt/StorageVol.java
b/src/main/java/org/libvirt/StorageVol.java
index 1bed6e1..e2bc717 100644
--- a/src/main/java/org/libvirt/StorageVol.java
+++ b/src/main/java/org/libvirt/StorageVol.java
@@ -76,7 +76,7 @@ public class StorageVol {
}
@Override
- public void finalize() throws LibvirtException {
+ protected void finalize() throws LibvirtException {
free();
}
diff --git a/src/main/java/org/libvirt/Stream.java
b/src/main/java/org/libvirt/Stream.java
index 6374567..0056a78 100644
--- a/src/main/java/org/libvirt/Stream.java
+++ b/src/main/java/org/libvirt/Stream.java
@@ -61,7 +61,7 @@ public class Stream {
}
@Override
- public void finalize() throws LibvirtException {
+ protected void finalize() throws LibvirtException {
free();
}
--
AV-Test GmbH, Henricistraße 20, 04155 Leipzig, Germany
Phone: +49 341 265 310 19
Web:<http://www.av-test.org>
Eingetragen am / Registered at: Amtsgericht Stendal (HRB 114076)
Geschaeftsfuehrer (CEO): Andreas Marx, Guido Habicht, Maik Morgenstern