mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2025-09-11 19:29:41 +02:00
SMACK-363 Applied code cleanup patches for many generics related issues.
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@13325 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
6dc64671e2
commit
e08c8afe44
109 changed files with 577 additions and 605 deletions
|
@ -202,7 +202,7 @@ public class DataForm implements PacketExtension {
|
|||
if (getTitle() != null) {
|
||||
buf.append("<title>").append(getTitle()).append("</title>");
|
||||
}
|
||||
for (Iterator it=getInstructions(); it.hasNext();) {
|
||||
for (Iterator<String> it=getInstructions(); it.hasNext();) {
|
||||
buf.append("<instructions>").append(it.next()).append("</instructions>");
|
||||
}
|
||||
// Append the list of fields returned from a search
|
||||
|
@ -210,13 +210,13 @@ public class DataForm implements PacketExtension {
|
|||
buf.append(getReportedData().toXML());
|
||||
}
|
||||
// Loop through all the items returned from a search and append them to the string buffer
|
||||
for (Iterator i = getItems(); i.hasNext();) {
|
||||
Item item = (Item) i.next();
|
||||
for (Iterator<Item> i = getItems(); i.hasNext();) {
|
||||
Item item = i.next();
|
||||
buf.append(item.toXML());
|
||||
}
|
||||
// Loop through all the form fields and append them to the string buffer
|
||||
for (Iterator i = getFields(); i.hasNext();) {
|
||||
FormField field = (FormField) i.next();
|
||||
for (Iterator<FormField> i = getFields(); i.hasNext();) {
|
||||
FormField field = i.next();
|
||||
buf.append(field.toXML());
|
||||
}
|
||||
buf.append("</").append(getElementName()).append(">");
|
||||
|
@ -250,8 +250,8 @@ public class DataForm implements PacketExtension {
|
|||
StringBuilder buf = new StringBuilder();
|
||||
buf.append("<reported>");
|
||||
// Loop through all the form items and append them to the string buffer
|
||||
for (Iterator i = getFields(); i.hasNext();) {
|
||||
FormField field = (FormField) i.next();
|
||||
for (Iterator<FormField> i = getFields(); i.hasNext();) {
|
||||
FormField field = i.next();
|
||||
buf.append(field.toXML());
|
||||
}
|
||||
buf.append("</reported>");
|
||||
|
@ -285,8 +285,8 @@ public class DataForm implements PacketExtension {
|
|||
StringBuilder buf = new StringBuilder();
|
||||
buf.append("<item>");
|
||||
// Loop through all the form items and append them to the string buffer
|
||||
for (Iterator i = getFields(); i.hasNext();) {
|
||||
FormField field = (FormField) i.next();
|
||||
for (Iterator<FormField> i = getFields(); i.hasNext();) {
|
||||
FormField field = i.next();
|
||||
buf.append(field.toXML());
|
||||
}
|
||||
buf.append("</item>");
|
||||
|
|
|
@ -51,7 +51,7 @@ public class DefaultPrivateData implements PrivateData {
|
|||
|
||||
private String elementName;
|
||||
private String namespace;
|
||||
private Map map;
|
||||
private Map<String, String> map;
|
||||
|
||||
/**
|
||||
* Creates a new generic private data object.
|
||||
|
@ -85,8 +85,8 @@ public class DefaultPrivateData implements PrivateData {
|
|||
public String toXML() {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append("<").append(elementName).append(" xmlns=\"").append(namespace).append("\">");
|
||||
for (Iterator i=getNames(); i.hasNext(); ) {
|
||||
String name = (String)i.next();
|
||||
for (Iterator<String> i=getNames(); i.hasNext(); ) {
|
||||
String name = i.next();
|
||||
String value = getValue(name);
|
||||
buf.append("<").append(name).append(">");
|
||||
buf.append(value);
|
||||
|
@ -102,11 +102,11 @@ public class DefaultPrivateData implements PrivateData {
|
|||
*
|
||||
* @return an Iterator for the names.
|
||||
*/
|
||||
public synchronized Iterator getNames() {
|
||||
public synchronized Iterator<String> getNames() {
|
||||
if (map == null) {
|
||||
return Collections.EMPTY_LIST.iterator();
|
||||
return Collections.<String>emptyList().iterator();
|
||||
}
|
||||
return Collections.unmodifiableMap(new HashMap(map)).keySet().iterator();
|
||||
return Collections.unmodifiableSet(map.keySet()).iterator();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -130,7 +130,7 @@ public class DefaultPrivateData implements PrivateData {
|
|||
*/
|
||||
public synchronized void setValue(String name, String value) {
|
||||
if (map == null) {
|
||||
map = new HashMap();
|
||||
map = new HashMap<String,String>();
|
||||
}
|
||||
map.put(name, value);
|
||||
}
|
||||
|
|
|
@ -19,13 +19,13 @@
|
|||
*/
|
||||
|
||||
package org.jivesoftware.smackx.packet;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
|
||||
/**
|
||||
* IQ packet that serves for kicking users, granting and revoking voice, banning users,
|
||||
* modifying the ban list, granting and revoking membership and granting and revoking
|
||||
|
@ -36,7 +36,7 @@ import java.util.List;
|
|||
*/
|
||||
public class MUCAdmin extends IQ {
|
||||
|
||||
private List items = new ArrayList();
|
||||
private List<Item> items = new ArrayList<Item>();
|
||||
|
||||
/**
|
||||
* Returns an Iterator for item childs that holds information about roles, affiliation,
|
||||
|
@ -45,9 +45,9 @@ public class MUCAdmin extends IQ {
|
|||
* @return an Iterator for item childs that holds information about roles, affiliation,
|
||||
* jids and nicks.
|
||||
*/
|
||||
public Iterator getItems() {
|
||||
public Iterator<Item> getItems() {
|
||||
synchronized (items) {
|
||||
return Collections.unmodifiableList(new ArrayList(items)).iterator();
|
||||
return Collections.unmodifiableList(new ArrayList<Item>(items)).iterator();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ public class MUCAdmin extends IQ {
|
|||
buf.append("<query xmlns=\"http://jabber.org/protocol/muc#admin\">");
|
||||
synchronized (items) {
|
||||
for (int i = 0; i < items.size(); i++) {
|
||||
Item item = (Item) items.get(i);
|
||||
Item item = items.get(i);
|
||||
buf.append(item.toXML());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ import java.util.List;
|
|||
*/
|
||||
public class MUCOwner extends IQ {
|
||||
|
||||
private List items = new ArrayList();
|
||||
private List<Item> items = new ArrayList<Item>();
|
||||
private Destroy destroy;
|
||||
|
||||
/**
|
||||
|
@ -45,9 +45,9 @@ public class MUCOwner extends IQ {
|
|||
* @return an Iterator for item childs that holds information about affiliation,
|
||||
* jids and nicks.
|
||||
*/
|
||||
public Iterator getItems() {
|
||||
public Iterator<Item> getItems() {
|
||||
synchronized (items) {
|
||||
return Collections.unmodifiableList(new ArrayList(items)).iterator();
|
||||
return Collections.unmodifiableList(new ArrayList<Item>(items)).iterator();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -167,8 +167,8 @@ public class MessageEvent implements PacketExtension {
|
|||
*
|
||||
* @return an iterator over all the types of events of the MessageEvent.
|
||||
*/
|
||||
public Iterator getEventTypes() {
|
||||
ArrayList allEvents = new ArrayList();
|
||||
public Iterator<String> getEventTypes() {
|
||||
ArrayList<String> allEvents = new ArrayList<String>();
|
||||
if (isDelivered()) {
|
||||
allEvents.add(MessageEvent.DELIVERED);
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ public class MultipleAddresses implements PacketExtension {
|
|||
public static final String TO = "to";
|
||||
|
||||
|
||||
private List addresses = new ArrayList();
|
||||
private List<Address> addresses = new ArrayList<Address>();
|
||||
|
||||
/**
|
||||
* Adds a new address to which the packet is going to be sent or was sent.
|
||||
|
@ -84,9 +84,9 @@ public class MultipleAddresses implements PacketExtension {
|
|||
* @param type Examples of address type are: TO, CC, BCC, etc.
|
||||
* @return the list of addresses that matches the specified type.
|
||||
*/
|
||||
public List getAddressesOfType(String type) {
|
||||
List answer = new ArrayList(addresses.size());
|
||||
for (Iterator it = addresses.iterator(); it.hasNext();) {
|
||||
public List<Address> getAddressesOfType(String type) {
|
||||
List<Address> answer = new ArrayList<Address>(addresses.size());
|
||||
for (Iterator<Address> it = addresses.iterator(); it.hasNext();) {
|
||||
Address address = (Address) it.next();
|
||||
if (address.getType().equals(type)) {
|
||||
answer.add(address);
|
||||
|
@ -109,7 +109,7 @@ public class MultipleAddresses implements PacketExtension {
|
|||
buf.append("<").append(getElementName());
|
||||
buf.append(" xmlns=\"").append(getNamespace()).append("\">");
|
||||
// Loop through all the addresses and append them to the string buffer
|
||||
for (Iterator i = addresses.iterator(); i.hasNext();) {
|
||||
for (Iterator<Address> i = addresses.iterator(); i.hasNext();) {
|
||||
Address address = (Address) i.next();
|
||||
buf.append(address.toXML());
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ import java.util.List;
|
|||
*/
|
||||
public class OfflineMessageRequest extends IQ {
|
||||
|
||||
private List items = new ArrayList();
|
||||
private List<Item> items = new ArrayList<Item>();
|
||||
private boolean purge = false;
|
||||
private boolean fetch = false;
|
||||
|
||||
|
@ -48,9 +48,9 @@ public class OfflineMessageRequest extends IQ {
|
|||
* @return an Iterator for item childs that holds information about offline messages to
|
||||
* view or delete.
|
||||
*/
|
||||
public Iterator getItems() {
|
||||
public Iterator<Item> getItems() {
|
||||
synchronized (items) {
|
||||
return Collections.unmodifiableList(new ArrayList(items)).iterator();
|
||||
return Collections.unmodifiableList(new ArrayList<Item>(items)).iterator();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -106,7 +106,7 @@ public class OfflineMessageRequest extends IQ {
|
|||
buf.append("<offline xmlns=\"http://jabber.org/protocol/offline\">");
|
||||
synchronized (items) {
|
||||
for (int i = 0; i < items.size(); i++) {
|
||||
Item item = (Item) items.get(i);
|
||||
Item item = items.get(i);
|
||||
buf.append(item.toXML());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ import java.util.List;
|
|||
*/
|
||||
public class RosterExchange implements PacketExtension {
|
||||
|
||||
private List remoteRosterEntries = new ArrayList();
|
||||
private List<RemoteRosterEntry> remoteRosterEntries = new ArrayList<RemoteRosterEntry>();
|
||||
|
||||
/**
|
||||
* Creates a new empty roster exchange package.
|
||||
|
@ -132,9 +132,9 @@ public class RosterExchange implements PacketExtension {
|
|||
*
|
||||
* @return an Iterator for the roster entries in the packet.
|
||||
*/
|
||||
public Iterator getRosterEntries() {
|
||||
public Iterator<RemoteRosterEntry> getRosterEntries() {
|
||||
synchronized (remoteRosterEntries) {
|
||||
List entries = Collections.unmodifiableList(new ArrayList(remoteRosterEntries));
|
||||
List<RemoteRosterEntry> entries = Collections.unmodifiableList(new ArrayList<RemoteRosterEntry>(remoteRosterEntries));
|
||||
return entries.iterator();
|
||||
}
|
||||
}
|
||||
|
@ -170,8 +170,8 @@ public class RosterExchange implements PacketExtension {
|
|||
buf.append("<").append(getElementName()).append(" xmlns=\"").append(getNamespace()).append(
|
||||
"\">");
|
||||
// Loop through all roster entries and append them to the string buffer
|
||||
for (Iterator i = getRosterEntries(); i.hasNext();) {
|
||||
RemoteRosterEntry remoteRosterEntry = (RemoteRosterEntry) i.next();
|
||||
for (Iterator<RemoteRosterEntry> i = getRosterEntries(); i.hasNext();) {
|
||||
RemoteRosterEntry remoteRosterEntry = i.next();
|
||||
buf.append(remoteRosterEntry.toXML());
|
||||
}
|
||||
buf.append("</").append(getElementName()).append(">");
|
||||
|
|
|
@ -19,21 +19,21 @@ import java.util.List;
|
|||
*/
|
||||
public class SharedGroupsInfo extends IQ {
|
||||
|
||||
private List groups = new ArrayList();
|
||||
private List<String> groups = new ArrayList<String>();
|
||||
|
||||
/**
|
||||
* Returns a collection with the shared group names returned from the server.
|
||||
*
|
||||
* @return collection with the shared group names returned from the server.
|
||||
*/
|
||||
public List getGroups() {
|
||||
public List<String> getGroups() {
|
||||
return groups;
|
||||
}
|
||||
|
||||
public String getChildElementXML() {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append("<sharedgroup xmlns=\"http://www.jivesoftware.org/protocol/sharedgroup\">");
|
||||
for (Iterator it=groups.iterator(); it.hasNext();) {
|
||||
for (Iterator<String> it=groups.iterator(); it.hasNext();) {
|
||||
buf.append("<group>").append(it.next()).append("</group>");
|
||||
}
|
||||
buf.append("</sharedgroup>");
|
||||
|
|
|
@ -20,16 +20,6 @@
|
|||
|
||||
package org.jivesoftware.smackx.packet;
|
||||
|
||||
import org.jivesoftware.smack.PacketCollector;
|
||||
import org.jivesoftware.smack.SmackConfiguration;
|
||||
import org.jivesoftware.smack.Connection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.filter.PacketIDFilter;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.Packet;
|
||||
import org.jivesoftware.smack.packet.XMPPError;
|
||||
import org.jivesoftware.smack.util.StringUtils;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
|
@ -42,6 +32,17 @@ import java.security.NoSuchAlgorithmException;
|
|||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.jivesoftware.smack.Connection;
|
||||
import org.jivesoftware.smack.PacketCollector;
|
||||
import org.jivesoftware.smack.SmackConfiguration;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.filter.PacketIDFilter;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.Packet;
|
||||
import org.jivesoftware.smack.packet.XMPPError;
|
||||
import org.jivesoftware.smack.util.StringUtils;
|
||||
|
||||
/**
|
||||
* A VCard class for use with the
|
||||
|
@ -740,14 +741,14 @@ public class VCard extends IQ {
|
|||
}
|
||||
|
||||
private void appendPhones(Map<String, String> phones, final String code) {
|
||||
Iterator it = phones.entrySet().iterator();
|
||||
Iterator<Map.Entry<String, String>> it = phones.entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
final Map.Entry entry = (Map.Entry) it.next();
|
||||
final Map.Entry<String,String> entry = it.next();
|
||||
appendTag("TEL", true, new ContentBuilder() {
|
||||
public void addTagContent() {
|
||||
appendEmptyTag(entry.getKey());
|
||||
appendEmptyTag(code);
|
||||
appendTag("NUMBER", StringUtils.escapeForXML((String) entry.getValue()));
|
||||
appendTag("NUMBER", StringUtils.escapeForXML(entry.getValue()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -759,10 +760,10 @@ public class VCard extends IQ {
|
|||
public void addTagContent() {
|
||||
appendEmptyTag(code);
|
||||
|
||||
Iterator it = addr.entrySet().iterator();
|
||||
Iterator<Map.Entry<String, String>> it = addr.entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
final Map.Entry entry = (Map.Entry) it.next();
|
||||
appendTag((String) entry.getKey(), StringUtils.escapeForXML((String) entry.getValue()));
|
||||
final Entry<String, String> entry = it.next();
|
||||
appendTag(entry.getKey(), StringUtils.escapeForXML(entry.getValue()));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -774,17 +775,17 @@ public class VCard extends IQ {
|
|||
}
|
||||
|
||||
private void appendGenericFields() {
|
||||
Iterator it = otherSimpleFields.entrySet().iterator();
|
||||
Iterator<Map.Entry<String, String>> it = otherSimpleFields.entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
Map.Entry entry = (Map.Entry) it.next();
|
||||
Map.Entry<String, String> entry = it.next();
|
||||
appendTag(entry.getKey().toString(),
|
||||
StringUtils.escapeForXML((String) entry.getValue()));
|
||||
StringUtils.escapeForXML(entry.getValue()));
|
||||
}
|
||||
|
||||
it = otherUnescapableFields.entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
Map.Entry entry = (Map.Entry) it.next();
|
||||
appendTag(entry.getKey().toString(), (String) entry.getValue());
|
||||
Map.Entry<String, String> entry = it.next();
|
||||
appendTag(entry.getKey().toString(),entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ import java.util.List;
|
|||
*/
|
||||
public class XHTMLExtension implements PacketExtension {
|
||||
|
||||
private List bodies = new ArrayList();
|
||||
private List<String> bodies = new ArrayList<String>();
|
||||
|
||||
/**
|
||||
* Returns the XML element name of the extension sub-packet root element.
|
||||
|
@ -85,8 +85,8 @@ public class XHTMLExtension implements PacketExtension {
|
|||
buf.append("<").append(getElementName()).append(" xmlns=\"").append(getNamespace()).append(
|
||||
"\">");
|
||||
// Loop through all the bodies and append them to the string buffer
|
||||
for (Iterator i = getBodies(); i.hasNext();) {
|
||||
buf.append((String) i.next());
|
||||
for (Iterator<String> i = getBodies(); i.hasNext();) {
|
||||
buf.append(i.next());
|
||||
}
|
||||
buf.append("</").append(getElementName()).append(">");
|
||||
return buf.toString();
|
||||
|
@ -97,9 +97,9 @@ public class XHTMLExtension implements PacketExtension {
|
|||
*
|
||||
* @return an Iterator for the bodies in the packet.
|
||||
*/
|
||||
public Iterator getBodies() {
|
||||
public Iterator<String> getBodies() {
|
||||
synchronized (bodies) {
|
||||
return Collections.unmodifiableList(new ArrayList(bodies)).iterator();
|
||||
return Collections.unmodifiableList(new ArrayList<String>(bodies)).iterator();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue