diff --git a/router/java/src/org/cybergarage/net/HostInterface.java b/router/java/src/org/cybergarage/net/HostInterface.java index c82b6b6adf4c6d778f9186771371c80dbf55e1f6..8a909016d32666f62978b6b1402e6d669f3aa953 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 1384608de47c8acc43e64e597d3099f59e66af75..a4a4bc78259b8af322380241bcb9e1f4e93a1b19 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 f18130c46bb118ebbf4ca85985a129f815014a96..ad273a21baa2089b750c612be151833bb9c32144 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 a0b0b31316de4c28147b3a74e38d5da72476a259..851b9d5ff1da4acd294aa68a7a4c129fdfc85a74 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 3f1a5ec44e5149caa20bb6816081111fce190050..c1251962d07b2050253f17040e7821750b493ea2 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 afa23ffc914ee5692ffe76bf69cd3b79105e90f2..bce9a26eb807c7ba632a2d92cbe4f2002a0246f0 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 a78f810cc9d060f352f1f8b9a13d75301321eef4..44082f07b90098ef04c9d0df890948261abe5c6b 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 e6d18882c404c0d3cb19100527032112b7060261..59c5d3848d27f0aae97025d36748984703fd7132 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 55dee276f039372cabd56d56f5807fb67857090a..e0d6b63bfe1a34a1e5ded4ca1a407838294ec4d0 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 daddfbf861713e5c84e9e3f11851d58876bf941d..b7e15ea2177dd19d8513e6a51f23c7c2823561f1 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 f58acabb345ff0882d12f817b674aaeee8bb65ea..0c54a322088d646a4e6c054d4984501d98c9f985 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 63bfdb7865a459c8db73b45b11e54f169be93671..3bb32b39128ed84e3c954c8a2d102025dd9de6cb 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 57c60d0099db39c3132e6bede355a3fae24a0143..93e802097382db0be3b25298745f4a732fbea92c 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 9d90ed9a5a94d41cf2f27666ffae3aa11130f639..104cbf8c6dfe13f58aff6f8911ac18af9d1ec754 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 64a2649650e85c72d21602a08c2ae3646adf7dc7..491466efec77ba011f14b0654ad0f07243b57d7e 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 077c63c232381c2bd4e5a0541b80518a02d25c0a..06c1986c7f2afbcde082e40bcd2adb6a4f994642 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 185bb15fcc14499a212a68d2f624719d65388390..f19bca3b8541687fae3c65745c9a40863f450eed 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 19f5901a1b3d50a2824445c323f4a052c8e83e0a..7bcae9f2f52fb1337522cc442e23121629987bbe 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 7a0e67091ac7ece115e5ffbc8e3c74642640409a..0a52ab8d34522189b364618a39cce61896f9cbcc 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 7e34a084f7d35c3851dae420885da7f57248b21b..8ed52ec616c8765f488347cfba0a6859981de899 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 806b6f22c83a55bcf6c22173d4f43c436a7a0777..1a0deb81cdbd241dca380d269d644c22cdf775fe 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() {