1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-23 06:42:05 +01:00

make finalize method protected

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@11025 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Michael Will 2009-06-04 13:09:25 +00:00 committed by michael.will
parent 1edc69780b
commit 37a00e98d1
5 changed files with 73 additions and 26 deletions

View file

@ -351,6 +351,7 @@
</taskdef> </taskdef>
<pmd shortFilenames="true"> <pmd shortFilenames="true">
<ruleset>migrating</ruleset> <ruleset>migrating</ruleset>
<ruleset>finalizers</ruleset>
<formatter type="html" toFile="target/pmd_report.html" toConsole="true" /> <formatter type="html" toFile="target/pmd_report.html" toConsole="true" />
<fileset dir="source/"> <fileset dir="source/">
<include name="**/*.java" /> <include name="**/*.java" />

View file

@ -22,12 +22,17 @@ package org.jivesoftware.smackx;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.*; import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.jivesoftware.smack.*; import org.jivesoftware.smack.PacketListener;
import org.jivesoftware.smack.filter.*; import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.packet.*; import org.jivesoftware.smack.filter.PacketExtensionFilter;
import org.jivesoftware.smackx.packet.*; import org.jivesoftware.smack.filter.PacketFilter;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.packet.Packet;
import org.jivesoftware.smackx.packet.MessageEvent;
/** /**
* Manages message events requests and notifications. A MessageEventManager provides a high * Manages message events requests and notifications. A MessageEventManager provides a high
@ -38,8 +43,8 @@ import org.jivesoftware.smackx.packet.*;
*/ */
public class MessageEventManager { public class MessageEventManager {
private List messageEventNotificationListeners = new ArrayList(); private List<MessageEventNotificationListener> messageEventNotificationListeners = new ArrayList<MessageEventNotificationListener>();
private List messageEventRequestListeners = new ArrayList(); private List<MessageEventRequestListener> messageEventRequestListeners = new ArrayList<MessageEventRequestListener>();
private XMPPConnection con; private XMPPConnection con;
@ -298,7 +303,8 @@ public class MessageEventManager {
} }
} }
public void finalize() { protected void finalize() throws Throwable {
destroy(); destroy();
super.finalize();
} }
} }

View file

@ -151,7 +151,8 @@ public class PEPManager {
} }
public void finalize() { protected void finalize() throws Throwable {
destroy(); destroy();
super.finalize();
} }
} }

View file

@ -20,11 +20,19 @@
package org.jivesoftware.smackx; package org.jivesoftware.smackx;
import java.util.*; import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.jivesoftware.smack.*; import org.jivesoftware.smack.PacketListener;
import org.jivesoftware.smack.filter.*; import org.jivesoftware.smack.Roster;
import org.jivesoftware.smack.packet.*; import org.jivesoftware.smack.RosterEntry;
import org.jivesoftware.smack.RosterGroup;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.filter.PacketExtensionFilter;
import org.jivesoftware.smack.filter.PacketFilter;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.packet.Packet;
import org.jivesoftware.smackx.packet.RosterExchange; import org.jivesoftware.smackx.packet.RosterExchange;
/** /**
@ -38,7 +46,7 @@ import org.jivesoftware.smackx.packet.RosterExchange;
*/ */
public class RosterExchangeManager { public class RosterExchangeManager {
private List rosterExchangeListeners = new ArrayList(); private List<RosterExchangeListener> rosterExchangeListeners = new ArrayList<RosterExchangeListener>();
private XMPPConnection con; private XMPPConnection con;
@ -172,7 +180,8 @@ public class RosterExchangeManager {
con.removePacketListener(packetListener); con.removePacketListener(packetListener);
} }
public void finalize() { protected void finalize() throws Throwable {
destroy(); destroy();
super.finalize();
} }
} }

View file

@ -20,20 +20,50 @@
package org.jivesoftware.smackx.muc; package org.jivesoftware.smackx.muc;
import org.jivesoftware.smack.*;
import org.jivesoftware.smack.filter.*;
import org.jivesoftware.smack.packet.*;
import org.jivesoftware.smackx.Form;
import org.jivesoftware.smackx.NodeInformationProvider;
import org.jivesoftware.smackx.ServiceDiscoveryManager;
import org.jivesoftware.smackx.packet.*;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.*; import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.WeakHashMap;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import org.jivesoftware.smack.Chat;
import org.jivesoftware.smack.ConnectionCreationListener;
import org.jivesoftware.smack.ConnectionListener;
import org.jivesoftware.smack.MessageListener;
import org.jivesoftware.smack.PacketCollector;
import org.jivesoftware.smack.PacketInterceptor;
import org.jivesoftware.smack.PacketListener;
import org.jivesoftware.smack.SmackConfiguration;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.filter.AndFilter;
import org.jivesoftware.smack.filter.FromMatchesFilter;
import org.jivesoftware.smack.filter.MessageTypeFilter;
import org.jivesoftware.smack.filter.PacketExtensionFilter;
import org.jivesoftware.smack.filter.PacketFilter;
import org.jivesoftware.smack.filter.PacketIDFilter;
import org.jivesoftware.smack.filter.PacketTypeFilter;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.packet.Packet;
import org.jivesoftware.smack.packet.Presence;
import org.jivesoftware.smack.packet.Registration;
import org.jivesoftware.smackx.Form;
import org.jivesoftware.smackx.NodeInformationProvider;
import org.jivesoftware.smackx.ServiceDiscoveryManager;
import org.jivesoftware.smackx.packet.DiscoverInfo;
import org.jivesoftware.smackx.packet.DiscoverItems;
import org.jivesoftware.smackx.packet.MUCAdmin;
import org.jivesoftware.smackx.packet.MUCInitialPresence;
import org.jivesoftware.smackx.packet.MUCOwner;
import org.jivesoftware.smackx.packet.MUCUser;
/** /**
* A MultiUserChat is a conversation that takes place among many users in a virtual * A MultiUserChat is a conversation that takes place among many users in a virtual
* room. A room could have many occupants with different affiliation and roles. * room. A room could have many occupants with different affiliation and roles.
@ -2500,8 +2530,7 @@ public class MultiUserChat {
} }
} }
public void finalize() throws Throwable { protected void finalize() throws Throwable {
super.finalize();
try { try {
if (connection != null) { if (connection != null) {
roomListenerMultiplexor.removeRoom(room); roomListenerMultiplexor.removeRoom(room);
@ -2514,6 +2543,7 @@ public class MultiUserChat {
catch (Exception e) { catch (Exception e) {
// Do nothing // Do nothing
} }
super.finalize();
} }
/** /**