1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2025-09-10 18:59:41 +02:00

Code cleanup: unused imports, values, blocks, etc.

This commit is contained in:
Florian Schmaus 2014-02-16 11:01:51 +01:00
parent 6dd64da930
commit 2e11470aee
26 changed files with 47 additions and 45 deletions

View file

@ -43,7 +43,6 @@ import java.util.List;
import java.util.Map;
import java.util.WeakHashMap;
import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Logger;
/**
* An AdHocCommandManager is responsible for keeping the list of available

View file

@ -33,7 +33,6 @@ public class DiscoverInfoProvider implements IQProvider {
public IQ parseIQ(XmlPullParser parser) throws Exception {
DiscoverInfo discoverInfo = new DiscoverInfo();
boolean done = false;
DiscoverInfo.Feature feature = null;
DiscoverInfo.Identity identity = null;
String category = "";
String name = "";

View file

@ -23,7 +23,6 @@ import org.jivesoftware.smack.ConnectionListener;
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.packet.IQ;
import org.jivesoftware.smack.packet.Packet;
@ -56,7 +55,6 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
import java.util.WeakHashMap;

View file

@ -17,7 +17,12 @@
package org.jivesoftware.smackx.iqlast;
import org.jivesoftware.smack.*;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.ConnectionCreationListener;
import org.jivesoftware.smack.PacketCollector;
import org.jivesoftware.smack.PacketListener;
import org.jivesoftware.smack.SmackConfiguration;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.filter.AndFilter;
import org.jivesoftware.smack.filter.IQTypeFilter;
import org.jivesoftware.smack.filter.PacketIDFilter;
@ -113,6 +118,8 @@ public class LastActivityManager {
// We assume that only a switch to available and chat indicates user activity
// since other mode changes could be also a result of some sort of automatism
resetIdleTime();
default:
break;
}
}
}, new PacketTypeFilter(Presence.class));

View file

@ -32,13 +32,6 @@ import org.jivesoftware.smack.packet.Packet;
* @author Larry Kirschner
*/
class ConnectionDetachedPacketCollector {
/**
* Max number of packets that any one collector can hold. After the max is
* reached, older packets will be automatically dropped from the queue as
* new packets are added.
*/
private int maxPackets = SmackConfiguration.getPacketCollectorSize();
private ArrayBlockingQueue<Packet> resultQueue;
/**

View file

@ -21,8 +21,6 @@ import org.jivesoftware.smackx.disco.packet.DiscoverInfo;
import org.jivesoftware.smackx.xdata.Form;
import org.jivesoftware.smackx.xdata.FormField;
import java.util.Iterator;
/**
* Represents the room information that was discovered using Service Discovery. It's possible to
* obtain information about a room before joining the room but only for rooms that are public (i.e.

View file

@ -24,7 +24,7 @@ import java.util.List;
*/
public class AffiliationsExtension extends NodeExtension
{
protected List<Affiliation> items = Collections.EMPTY_LIST;
protected List<Affiliation> items = Collections.emptyList();
public AffiliationsExtension()
{

View file

@ -49,7 +49,7 @@ public class ConfigurationEvent extends NodeExtension implements EmbeddedPacketE
public List<PacketExtension> getExtensions()
{
if (getConfiguration() == null)
return Collections.EMPTY_LIST;
return Collections.emptyList();
else
return Arrays.asList(((PacketExtension)getConfiguration().getDataFormToSend()));
}

View file

@ -23,7 +23,7 @@ import java.util.List;
*/
public class ItemDeleteEvent extends SubscriptionEvent
{
private List<String> itemIds = Collections.EMPTY_LIST;
private List<String> itemIds = Collections.emptyList();
/**
* Constructs an <tt>ItemDeleteEvent</tt> that indicates the the supplied

View file

@ -124,6 +124,7 @@ public class ItemsExtension extends NodeExtension implements EmbeddedPacketExten
return type;
}
@SuppressWarnings("unchecked")
public List<PacketExtension> getExtensions()
{
return (List<PacketExtension>)getItems();

View file

@ -63,6 +63,7 @@ public class LeafNode extends Node
*
* @throws XMPPException
*/
@SuppressWarnings("unchecked")
public <T extends Item> List<T> getItems()
throws XMPPException
{
@ -84,6 +85,7 @@ public class LeafNode extends Node
*
* @throws XMPPException
*/
@SuppressWarnings("unchecked")
public <T extends Item> List<T> getItems(String subscriptionId)
throws XMPPException
{
@ -107,6 +109,7 @@ public class LeafNode extends Node
*
* @throws XMPPException
*/
@SuppressWarnings("unchecked")
public <T extends Item> List<T> getItems(Collection<String> ids)
throws XMPPException
{
@ -132,6 +135,7 @@ public class LeafNode extends Node
*
* @throws XMPPException
*/
@SuppressWarnings("unchecked")
public <T extends Item> List<T> getItems(int maxItems)
throws XMPPException
{
@ -154,6 +158,7 @@ public class LeafNode extends Node
*
* @throws XMPPException
*/
@SuppressWarnings("unchecked")
public <T extends Item> List<T> getItems(int maxItems, String subscriptionId)
throws XMPPException
{
@ -198,6 +203,7 @@ public class LeafNode extends Node
*
* @param item - The item being sent
*/
@SuppressWarnings("unchecked")
public <T extends Item> void publish(T item)
{
Collection<T> items = new ArrayList<T>(1);
@ -268,6 +274,7 @@ public class LeafNode extends Node
*
* @throws XMPPException
*/
@SuppressWarnings("unchecked")
public <T extends Item> void send(T item)
throws XMPPException
{

View file

@ -149,6 +149,7 @@ final public class PubSubManager
* @return the node
* @throws XMPPException The node does not exist
*/
@SuppressWarnings("unchecked")
public <T extends Node> T getNode(String id)
throws XMPPException
{

View file

@ -14,7 +14,6 @@
package org.jivesoftware.smackx.pubsub;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;

View file

@ -23,7 +23,7 @@ import java.util.List;
*/
abstract public class SubscriptionEvent extends NodeEvent
{
private List<String> subIds = Collections.EMPTY_LIST;
private List<String> subIds = Collections.emptyList();
/**
* Construct an event with no subscription id's. This can

View file

@ -23,7 +23,7 @@ import java.util.List;
*/
public class SubscriptionsExtension extends NodeExtension
{
protected List<Subscription> items = Collections.EMPTY_LIST;
protected List<Subscription> items = Collections.emptyList();
/**
* Subscriptions to the root node

View file

@ -29,6 +29,7 @@ import org.jivesoftware.smackx.pubsub.AffiliationsExtension;
* @author Robin Collier
*/public class AffiliationsProvider extends EmbeddedExtensionProvider
{
@SuppressWarnings("unchecked")
@Override
protected PacketExtension createReturnExtension(String currentElement, String currentNamespace, Map<String, String> attributeMap, List<? extends PacketExtension> content)
{

View file

@ -29,6 +29,7 @@ import org.jivesoftware.smackx.pubsub.SubscriptionsExtension;
*/
public class SubscriptionsProvider extends EmbeddedExtensionProvider
{
@SuppressWarnings("unchecked")
@Override
protected PacketExtension createReturnExtension(String currentElement, String currentNamespace, Map<String, String> attributeMap, List<? extends PacketExtension> content)
{

View file

@ -30,7 +30,7 @@ public class HeadersExtension implements PacketExtension
{
public static final String NAMESPACE = "http://jabber.org/protocol/shim";
private Collection<Header> headers = Collections.EMPTY_LIST;
private Collection<Header> headers = Collections.emptyList();
public HeadersExtension(Collection<Header> headerList)
{

View file

@ -29,6 +29,7 @@ import org.jivesoftware.smackx.shim.packet.HeadersExtension;
*/
public class HeadersProvider extends EmbeddedExtensionProvider
{
@SuppressWarnings("unchecked")
@Override
protected PacketExtension createReturnExtension(String currentElement, String currentNamespace, Map<String, String> attributeMap, List<? extends PacketExtension> content)
{

View file

@ -98,7 +98,7 @@ public class StreamInitiationProvider implements IQProvider {
Date fileDate = new Date();
if (date != null) {
try {
fileDate = StringUtils.parseXEP0082Date(date);
fileDate = StringUtils.parseDate(date);
} catch (ParseException e) {
// couldn't parse date, use current date-time
}

View file

@ -42,7 +42,6 @@ public class DataFormProvider implements PacketExtensionProvider {
public PacketExtension parseExtension(XmlPullParser parser) throws Exception {
boolean done = false;
StringBuilder buffer = null;
DataForm dataForm = new DataForm(parser.getAttributeValue("", "type"));
while (!done) {
int eventType = parser.next();