From 567c32833101ec2344decfb0463b532bee70dda1 Mon Sep 17 00:00:00 2001 From: str4d <str4d@mail.i2p> Date: Thu, 21 Nov 2013 05:58:54 +0000 Subject: [PATCH] org.cybergarage.*: type arguments, unused imports --- .../org/cybergarage/net/HostInterface.java | 30 +++++++++---------- .../java/src/org/cybergarage/upnp/Action.java | 8 ++--- .../src/org/cybergarage/upnp/ActionList.java | 2 +- .../cybergarage/upnp/AllowedValueList.java | 6 ++-- .../org/cybergarage/upnp/ArgumentList.java | 2 +- .../src/org/cybergarage/upnp/DeviceList.java | 2 +- .../src/org/cybergarage/upnp/IconList.java | 2 +- .../src/org/cybergarage/upnp/Service.java | 4 +-- .../src/org/cybergarage/upnp/ServiceList.java | 2 +- .../cybergarage/upnp/ServiceStateTable.java | 2 +- .../org/cybergarage/upnp/StateVariable.java | 4 +-- .../upnp/event/SubscriberList.java | 2 +- .../cybergarage/upnp/ssdp/HTTPMUSocket.java | 4 +-- .../upnp/ssdp/SSDPNotifySocket.java | 1 - .../upnp/ssdp/SSDPNotifySocketList.java | 2 +- .../ssdp/SSDPSearchResponseSocketList.java | 2 +- .../upnp/ssdp/SSDPSearchSocketList.java | 2 +- .../org/cybergarage/util/ListenerList.java | 2 +- .../org/cybergarage/xml/AttributeList.java | 2 +- router/java/src/org/cybergarage/xml/Node.java | 4 +-- .../src/org/cybergarage/xml/NodeList.java | 2 +- 21 files changed, 43 insertions(+), 44 deletions(-) diff --git a/router/java/src/org/cybergarage/net/HostInterface.java b/router/java/src/org/cybergarage/net/HostInterface.java index c82b6b6adf..8a909016d3 100644 --- a/router/java/src/org/cybergarage/net/HostInterface.java +++ b/router/java/src/org/cybergarage/net/HostInterface.java @@ -100,12 +100,12 @@ public class HostInterface int nHostAddrs = 0; try { - Enumeration nis = NetworkInterface.getNetworkInterfaces(); + Enumeration<NetworkInterface> nis = NetworkInterface.getNetworkInterfaces(); while (nis.hasMoreElements()){ - NetworkInterface ni = (NetworkInterface)nis.nextElement(); - Enumeration addrs = ni.getInetAddresses(); + NetworkInterface ni = nis.nextElement(); + Enumeration<InetAddress> addrs = ni.getInetAddresses(); while (addrs.hasMoreElements()) { - InetAddress addr = (InetAddress)addrs.nextElement(); + InetAddress addr = addrs.nextElement(); if (isUsableAddress(addr) == false) continue; nHostAddrs++; @@ -126,9 +126,9 @@ public class HostInterface * @since 1.8.0 */ public final static InetAddress[] getInetAddress(int ipfilter,String[] interfaces){ - Enumeration nis; + Enumeration<NetworkInterface> nis; if(interfaces!=null){ - Vector iflist = new Vector(); + Vector<NetworkInterface> iflist = new Vector<NetworkInterface>(); for (int i = 0; i < interfaces.length; i++) { NetworkInterface ni; try { @@ -147,12 +147,12 @@ public class HostInterface return null; } } - ArrayList addresses = new ArrayList(); + ArrayList<InetAddress> addresses = new ArrayList<InetAddress>(); while (nis.hasMoreElements()){ - NetworkInterface ni = (NetworkInterface)nis.nextElement(); - Enumeration addrs = ni.getInetAddresses(); + NetworkInterface ni = nis.nextElement(); + Enumeration<InetAddress> addrs = ni.getInetAddresses(); while (addrs.hasMoreElements()) { - InetAddress addr = (InetAddress)addrs.nextElement(); + InetAddress addr = addrs.nextElement(); if(((ipfilter & LOCAL_BITMASK)==0) && addr.isLoopbackAddress()) continue; @@ -163,7 +163,7 @@ public class HostInterface } } } - return (InetAddress[]) addresses.toArray(new InetAddress[]{}); + return addresses.toArray(new InetAddress[]{}); } @@ -174,12 +174,12 @@ public class HostInterface int hostAddrCnt = 0; try { - Enumeration nis = NetworkInterface.getNetworkInterfaces(); + Enumeration<NetworkInterface> nis = NetworkInterface.getNetworkInterfaces(); while (nis.hasMoreElements()){ - NetworkInterface ni = (NetworkInterface)nis.nextElement(); - Enumeration addrs = ni.getInetAddresses(); + NetworkInterface ni = nis.nextElement(); + Enumeration<InetAddress> addrs = ni.getInetAddresses(); while (addrs.hasMoreElements()) { - InetAddress addr = (InetAddress)addrs.nextElement(); + InetAddress addr = addrs.nextElement(); if (isUsableAddress(addr) == false) continue; if (hostAddrCnt < n) { diff --git a/router/java/src/org/cybergarage/upnp/Action.java b/router/java/src/org/cybergarage/upnp/Action.java index 1384608de4..a4a4bc7825 100644 --- a/router/java/src/org/cybergarage/upnp/Action.java +++ b/router/java/src/org/cybergarage/upnp/Action.java @@ -67,9 +67,9 @@ public class Action void setService(Service s){ serviceNode=s.getServiceNode(); /*To ensure integrity of the XML structure*/ - Iterator i = getArgumentList().iterator(); + Iterator<Argument> i = getArgumentList().iterator(); while (i.hasNext()) { - Argument arg = (Argument) i.next(); + Argument arg = i.next(); arg.setService(s); } } @@ -170,9 +170,9 @@ public class Action }else{ argumentListNode.removeAllNodes(); } - Iterator i = al.iterator(); + Iterator<Argument> i = al.iterator(); while (i.hasNext()) { - Argument a = (Argument) i.next(); + Argument a = i.next(); a.setService(getService()); argumentListNode.addNode(a.getArgumentNode()); } diff --git a/router/java/src/org/cybergarage/upnp/ActionList.java b/router/java/src/org/cybergarage/upnp/ActionList.java index f18130c46b..ad273a21ba 100644 --- a/router/java/src/org/cybergarage/upnp/ActionList.java +++ b/router/java/src/org/cybergarage/upnp/ActionList.java @@ -17,7 +17,7 @@ package org.cybergarage.upnp; import java.util.Vector; -public class ActionList extends Vector +public class ActionList extends Vector<Action> { //////////////////////////////////////////////// // Constants diff --git a/router/java/src/org/cybergarage/upnp/AllowedValueList.java b/router/java/src/org/cybergarage/upnp/AllowedValueList.java index a0b0b31316..851b9d5ff1 100644 --- a/router/java/src/org/cybergarage/upnp/AllowedValueList.java +++ b/router/java/src/org/cybergarage/upnp/AllowedValueList.java @@ -20,7 +20,7 @@ package org.cybergarage.upnp; import java.util.Iterator; import java.util.Vector; -public class AllowedValueList extends Vector +public class AllowedValueList extends Vector<AllowedValue> { //////////////////////////////////////////////// // Constants @@ -55,8 +55,8 @@ public class AllowedValueList extends Vector } public boolean isAllowed(String v){ - for (Iterator i = this.iterator(); i.hasNext();) { - AllowedValue av = (AllowedValue) i.next(); + for (Iterator<AllowedValue> i = this.iterator(); i.hasNext();) { + AllowedValue av = i.next(); if(av.getValue().equals(v)) return true; } diff --git a/router/java/src/org/cybergarage/upnp/ArgumentList.java b/router/java/src/org/cybergarage/upnp/ArgumentList.java index 3f1a5ec44e..c1251962d0 100644 --- a/router/java/src/org/cybergarage/upnp/ArgumentList.java +++ b/router/java/src/org/cybergarage/upnp/ArgumentList.java @@ -17,7 +17,7 @@ package org.cybergarage.upnp; import java.util.Vector; -public class ArgumentList extends Vector +public class ArgumentList extends Vector<Argument> { //////////////////////////////////////////////// // Constants diff --git a/router/java/src/org/cybergarage/upnp/DeviceList.java b/router/java/src/org/cybergarage/upnp/DeviceList.java index afa23ffc91..bce9a26eb8 100644 --- a/router/java/src/org/cybergarage/upnp/DeviceList.java +++ b/router/java/src/org/cybergarage/upnp/DeviceList.java @@ -17,7 +17,7 @@ package org.cybergarage.upnp; import java.util.Vector; -public class DeviceList extends Vector +public class DeviceList extends Vector<Device> { //////////////////////////////////////////////// // Constants diff --git a/router/java/src/org/cybergarage/upnp/IconList.java b/router/java/src/org/cybergarage/upnp/IconList.java index a78f810cc9..44082f07b9 100644 --- a/router/java/src/org/cybergarage/upnp/IconList.java +++ b/router/java/src/org/cybergarage/upnp/IconList.java @@ -17,7 +17,7 @@ package org.cybergarage.upnp; import java.util.Vector; -public class IconList extends Vector +public class IconList extends Vector<Icon> { //////////////////////////////////////////////// // Constants diff --git a/router/java/src/org/cybergarage/upnp/Service.java b/router/java/src/org/cybergarage/upnp/Service.java index e6d18882c4..59c5d3848d 100644 --- a/router/java/src/org/cybergarage/upnp/Service.java +++ b/router/java/src/org/cybergarage/upnp/Service.java @@ -501,9 +501,9 @@ public class Service } public void addAction(Action a){ - Iterator i = a.getArgumentList().iterator(); + Iterator<Argument> i = a.getArgumentList().iterator(); while (i.hasNext()) { - Argument arg = (Argument) i.next(); + Argument arg = i.next(); arg.setService(this); } diff --git a/router/java/src/org/cybergarage/upnp/ServiceList.java b/router/java/src/org/cybergarage/upnp/ServiceList.java index 55dee276f0..e0d6b63bfe 100644 --- a/router/java/src/org/cybergarage/upnp/ServiceList.java +++ b/router/java/src/org/cybergarage/upnp/ServiceList.java @@ -19,7 +19,7 @@ package org.cybergarage.upnp; import java.util.Vector; -public class ServiceList extends Vector +public class ServiceList extends Vector<Service> { //////////////////////////////////////////////// // Constants diff --git a/router/java/src/org/cybergarage/upnp/ServiceStateTable.java b/router/java/src/org/cybergarage/upnp/ServiceStateTable.java index daddfbf861..b7e15ea217 100644 --- a/router/java/src/org/cybergarage/upnp/ServiceStateTable.java +++ b/router/java/src/org/cybergarage/upnp/ServiceStateTable.java @@ -17,7 +17,7 @@ package org.cybergarage.upnp; import java.util.Vector; -public class ServiceStateTable extends Vector +public class ServiceStateTable extends Vector<StateVariable> { //////////////////////////////////////////////// // Constants diff --git a/router/java/src/org/cybergarage/upnp/StateVariable.java b/router/java/src/org/cybergarage/upnp/StateVariable.java index f58acabb34..0c54a32208 100644 --- a/router/java/src/org/cybergarage/upnp/StateVariable.java +++ b/router/java/src/org/cybergarage/upnp/StateVariable.java @@ -277,9 +277,9 @@ public class StateVariable extends NodeData getStateVariableNode().removeNode(AllowedValueList.ELEM_NAME); getStateVariableNode().removeNode(AllowedValueRange.ELEM_NAME); Node n = new Node(AllowedValueList.ELEM_NAME); - Iterator i=avl.iterator(); + Iterator<AllowedValue> i=avl.iterator(); while (i.hasNext()) { - AllowedValue av = (AllowedValue) i.next(); + AllowedValue av = i.next(); //n.addNode(new Node(AllowedValue.ELEM_NAME,av.getValue())); wrong! n.addNode(av.getAllowedValueNode()); //better (twa) } diff --git a/router/java/src/org/cybergarage/upnp/event/SubscriberList.java b/router/java/src/org/cybergarage/upnp/event/SubscriberList.java index 63bfdb7865..3bb32b3912 100644 --- a/router/java/src/org/cybergarage/upnp/event/SubscriberList.java +++ b/router/java/src/org/cybergarage/upnp/event/SubscriberList.java @@ -19,7 +19,7 @@ package org.cybergarage.upnp.event; import java.util.*; -public class SubscriberList extends Vector +public class SubscriberList extends Vector<Subscriber> { //////////////////////////////////////////////// // Constructor diff --git a/router/java/src/org/cybergarage/upnp/ssdp/HTTPMUSocket.java b/router/java/src/org/cybergarage/upnp/ssdp/HTTPMUSocket.java index 57c60d0099..93e8020973 100644 --- a/router/java/src/org/cybergarage/upnp/ssdp/HTTPMUSocket.java +++ b/router/java/src/org/cybergarage/upnp/ssdp/HTTPMUSocket.java @@ -83,9 +83,9 @@ public class HTTPMUSocket if (ssdpMultiGroup == null || ssdpMultiIf == null) return ""; InetAddress mcastAddr = ssdpMultiGroup.getAddress(); - Enumeration addrs = ssdpMultiIf.getInetAddresses(); + Enumeration<InetAddress> addrs = ssdpMultiIf.getInetAddresses(); while (addrs.hasMoreElements()) { - InetAddress addr = (InetAddress)addrs.nextElement(); + InetAddress addr = addrs.nextElement(); if (mcastAddr instanceof Inet6Address && addr instanceof Inet6Address) return addr.getHostAddress(); if (mcastAddr instanceof Inet4Address && addr instanceof Inet4Address) diff --git a/router/java/src/org/cybergarage/upnp/ssdp/SSDPNotifySocket.java b/router/java/src/org/cybergarage/upnp/ssdp/SSDPNotifySocket.java index 9d90ed9a5a..104cbf8c6d 100644 --- a/router/java/src/org/cybergarage/upnp/ssdp/SSDPNotifySocket.java +++ b/router/java/src/org/cybergarage/upnp/ssdp/SSDPNotifySocket.java @@ -33,7 +33,6 @@ import java.net.*; import java.io.IOException; import org.cybergarage.net.*; -import org.cybergarage.util.*; import org.cybergarage.http.*; import org.cybergarage.upnp.*; import org.cybergarage.util.Debug; diff --git a/router/java/src/org/cybergarage/upnp/ssdp/SSDPNotifySocketList.java b/router/java/src/org/cybergarage/upnp/ssdp/SSDPNotifySocketList.java index 64a2649650..491466efec 100644 --- a/router/java/src/org/cybergarage/upnp/ssdp/SSDPNotifySocketList.java +++ b/router/java/src/org/cybergarage/upnp/ssdp/SSDPNotifySocketList.java @@ -22,7 +22,7 @@ import org.cybergarage.net.*; import org.cybergarage.upnp.*; -public class SSDPNotifySocketList extends Vector +public class SSDPNotifySocketList extends Vector<SSDPNotifySocket> { //////////////////////////////////////////////// // Constructor diff --git a/router/java/src/org/cybergarage/upnp/ssdp/SSDPSearchResponseSocketList.java b/router/java/src/org/cybergarage/upnp/ssdp/SSDPSearchResponseSocketList.java index 077c63c232..06c1986c7f 100644 --- a/router/java/src/org/cybergarage/upnp/ssdp/SSDPSearchResponseSocketList.java +++ b/router/java/src/org/cybergarage/upnp/ssdp/SSDPSearchResponseSocketList.java @@ -24,7 +24,7 @@ import org.cybergarage.net.*; import org.cybergarage.upnp.*; -public class SSDPSearchResponseSocketList extends Vector +public class SSDPSearchResponseSocketList extends Vector<SSDPSearchResponseSocket> { //////////////////////////////////////////////// // Constructor diff --git a/router/java/src/org/cybergarage/upnp/ssdp/SSDPSearchSocketList.java b/router/java/src/org/cybergarage/upnp/ssdp/SSDPSearchSocketList.java index 185bb15fcc..f19bca3b85 100644 --- a/router/java/src/org/cybergarage/upnp/ssdp/SSDPSearchSocketList.java +++ b/router/java/src/org/cybergarage/upnp/ssdp/SSDPSearchSocketList.java @@ -24,7 +24,7 @@ import java.util.Vector; import org.cybergarage.net.HostInterface; import org.cybergarage.upnp.device.SearchListener; -public class SSDPSearchSocketList extends Vector +public class SSDPSearchSocketList extends Vector<SSDPSearchSocket> { //////////////////////////////////////////////// // Constructor diff --git a/router/java/src/org/cybergarage/util/ListenerList.java b/router/java/src/org/cybergarage/util/ListenerList.java index 19f5901a1b..7bcae9f2f5 100644 --- a/router/java/src/org/cybergarage/util/ListenerList.java +++ b/router/java/src/org/cybergarage/util/ListenerList.java @@ -17,7 +17,7 @@ package org.cybergarage.util; import java.util.Vector; -public class ListenerList extends Vector +public class ListenerList extends Vector<Object> { public boolean add(Object obj) { diff --git a/router/java/src/org/cybergarage/xml/AttributeList.java b/router/java/src/org/cybergarage/xml/AttributeList.java index 7a0e67091a..0a52ab8d34 100644 --- a/router/java/src/org/cybergarage/xml/AttributeList.java +++ b/router/java/src/org/cybergarage/xml/AttributeList.java @@ -17,7 +17,7 @@ package org.cybergarage.xml; import java.util.Vector; -public class AttributeList extends Vector +public class AttributeList extends Vector<Attribute> { public AttributeList() { diff --git a/router/java/src/org/cybergarage/xml/Node.java b/router/java/src/org/cybergarage/xml/Node.java index 7e34a084f7..8ed52ec616 100644 --- a/router/java/src/org/cybergarage/xml/Node.java +++ b/router/java/src/org/cybergarage/xml/Node.java @@ -275,9 +275,9 @@ public class Node public int getIndex(String name){ int index = -1; - for (Iterator i = nodeList.iterator(); i.hasNext();) { + for (Iterator<Node> i = nodeList.iterator(); i.hasNext();) { index++; - Node n = (Node) i.next(); + Node n = i.next(); if(n.getName().equals(name)) return index; } diff --git a/router/java/src/org/cybergarage/xml/NodeList.java b/router/java/src/org/cybergarage/xml/NodeList.java index 806b6f22c8..1a0deb81cd 100644 --- a/router/java/src/org/cybergarage/xml/NodeList.java +++ b/router/java/src/org/cybergarage/xml/NodeList.java @@ -17,7 +17,7 @@ package org.cybergarage.xml; import java.util.Vector; -public class NodeList extends Vector +public class NodeList extends Vector<Node> { public NodeList() { -- GitLab