From b12db14b9feacf1dd07a1669eb186f7a44626f8b Mon Sep 17 00:00:00 2001 From: mikeworks Date: Sat, 24 Jul 2010 13:48:45 +0000 Subject: [PATCH] Added Generics to new net.yacy.upnp.* classes to eliminate compiler warnings Added @Deprecated for deprecated functions getIPDevices and getPPPDevices in class InternetGatewayDevice Changed debug statement in Domains.java and corrected filename in comments header git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@6993 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- source/net/yacy/kelondro/util/Domains.java | 8 ++++-- source/net/yacy/upnp/Discovery.java | 4 +-- .../net/yacy/upnp/DiscoveryAdvertisement.java | 28 +++++++++---------- source/net/yacy/upnp/DiscoveryListener.java | 9 +++--- source/net/yacy/upnp/HttpResponse.java | 6 ++-- .../yacy/upnp/ServiceEventMessageParser.java | 4 +-- source/net/yacy/upnp/ServicesEventing.java | 2 +- source/net/yacy/upnp/devices/UPNPDevice.java | 20 ++++++------- .../net/yacy/upnp/devices/UPNPRootDevice.java | 6 ++-- .../upnp/impls/InternetGatewayDevice.java | 4 ++- .../net/yacy/upnp/messages/ActionMessage.java | 4 +-- .../yacy/upnp/messages/ActionResponse.java | 10 +++---- .../net/yacy/upnp/services/ServiceAction.java | 4 +-- .../upnp/services/ServiceStateVariable.java | 2 +- .../net/yacy/upnp/services/UPNPService.java | 18 ++++++------ 15 files changed, 67 insertions(+), 62 deletions(-) diff --git a/source/net/yacy/kelondro/util/Domains.java b/source/net/yacy/kelondro/util/Domains.java index 2b85d3817..9d8b0e3ca 100644 --- a/source/net/yacy/kelondro/util/Domains.java +++ b/source/net/yacy/kelondro/util/Domains.java @@ -1,8 +1,10 @@ -// serverDNSCache.java +// Domains.java // ----------------------------- // (C) 2007 by Michael Peter Christen; mc@yacy.net, Frankfurt a. M., Germany // first published 23.07.2007 on http://yacy.net // +// This is a part of YaCy, a peer-to-peer based web search engine +// // $LastChangedDate: 2006-04-02 22:40:07 +0200 (So, 02 Apr 2006) $ // $LastChangedRevision: 1986 $ // $LastChangedBy: orbiter $ @@ -539,9 +541,9 @@ public class Domains { } public static InetAddress myPublicLocalIP() { + new localHostAddressLookup().start(); // list all addresses - // for (int i = 0; i < ia.length; i++) System.out.println("IP: " + - // ia[i].getHostAddress()); // DEBUG + // for (int i = 0; i < localHostAddresses.length; i++) System.out.println("IP: " + localHostAddresses[i].getHostAddress()); // DEBUG if (localHostAddresses.length == 0) { return localHostAddress; } diff --git a/source/net/yacy/upnp/Discovery.java b/source/net/yacy/upnp/Discovery.java index b48eddd0a..d281f325a 100644 --- a/source/net/yacy/upnp/Discovery.java +++ b/source/net/yacy/upnp/Discovery.java @@ -160,7 +160,7 @@ public class Discovery { throw new IllegalArgumentException( "Illegal searchTarget" ); } - final Map devices = new HashMap(); + final Map devices = new HashMap(); DiscoveryResultsHandler handler = new DiscoveryResultsHandler() { @@ -171,7 +171,7 @@ public class Discovery { UPNPRootDevice device = new UPNPRootDevice( location, maxAge, firmware, usn, udn ); devices.put( usn, device ); } catch ( Exception ex ) { - log.error( "Error occured during upnp root device object creation from location " + location, ex ); + log.error( "Error occured during upnp root device object creation from location " + location, ex ); } } } diff --git a/source/net/yacy/upnp/DiscoveryAdvertisement.java b/source/net/yacy/upnp/DiscoveryAdvertisement.java index 7672df727..cc939ef5b 100644 --- a/source/net/yacy/upnp/DiscoveryAdvertisement.java +++ b/source/net/yacy/upnp/DiscoveryAdvertisement.java @@ -83,9 +83,9 @@ public class DiscoveryAdvertisement implements Runnable { private final static String NTS_SSDP_BYE_BYE = "ssdp:byebye"; private final static String NT_ALL_EVENTS = "DiscoveryAdvertisement:nt:allevents"; - private Map byeByeRegistered = new HashMap(); - private Map aliveRegistered = new HashMap(); - private Map USNPerIP = new HashMap(); + private Map> byeByeRegistered = new HashMap>(); + private Map> aliveRegistered = new HashMap>(); + private Map USNPerIP = new HashMap(); private final Object REGISTRATION_PROCESS = new Object(); @@ -121,16 +121,16 @@ public class DiscoveryAdvertisement implements Runnable { if ( !inService ) startDevicesListenerThread(); if ( nt == null ) nt = NT_ALL_EVENTS; if ( notificationEvent == EVENT_SSDP_ALIVE ) { - Set handlers = (Set)aliveRegistered.get( nt ); + Set handlers = aliveRegistered.get( nt ); if ( handlers == null ) { - handlers = new HashSet(); + handlers = new HashSet(); aliveRegistered.put( nt, handlers ); } handlers.add( eventHandler ); } else if ( notificationEvent == EVENT_SSDP_BYE_BYE ) { - Set handlers = (Set)byeByeRegistered.get( nt ); + Set handlers = byeByeRegistered.get( nt ); if ( handlers == null ) { - handlers = new HashSet(); + handlers = new HashSet(); byeByeRegistered.put( nt, handlers ); } handlers.add( eventHandler ); @@ -152,7 +152,7 @@ public class DiscoveryAdvertisement implements Runnable { synchronized( REGISTRATION_PROCESS ) { if ( nt == null ) nt = NT_ALL_EVENTS; if ( notificationEvent == EVENT_SSDP_ALIVE ) { - Set handlers = (Set)aliveRegistered.get( nt ); + Set handlers = aliveRegistered.get( nt ); if ( handlers != null ) { handlers.remove( eventHandler ); if ( handlers.size() == 0 ) { @@ -160,7 +160,7 @@ public class DiscoveryAdvertisement implements Runnable { } } } else if ( notificationEvent == EVENT_SSDP_BYE_BYE ) { - Set handlers = (Set)byeByeRegistered.get( nt ); + Set handlers = byeByeRegistered.get( nt ); if ( handlers != null ) { handlers.remove( eventHandler ); if ( handlers.size() == 0 ) { @@ -304,14 +304,14 @@ public class DiscoveryAdvertisement implements Runnable { int index = udn.indexOf( "::" ); if ( index != -1 ) udn = udn.substring( 0, index ); synchronized( REGISTRATION_PROCESS ) { - Set handlers = (Set)aliveRegistered.get( NT_ALL_EVENTS ); + Set handlers = aliveRegistered.get( NT_ALL_EVENTS ); if ( handlers != null ) { for ( Iterator i = handlers.iterator(); i.hasNext(); ) { DiscoveryEventHandler eventHandler = (DiscoveryEventHandler)i.next(); eventHandler.eventSSDPAlive( usn, udn, nt, maxAge, loc ); } } - handlers = (Set)aliveRegistered.get( nt ); + handlers = aliveRegistered.get( nt ); if ( handlers != null ) { for ( Iterator i = handlers.iterator(); i.hasNext(); ) { DiscoveryEventHandler eventHandler = (DiscoveryEventHandler)i.next(); @@ -331,7 +331,7 @@ public class DiscoveryAdvertisement implements Runnable { return; } - InetAddress originalAliveSenderIp = (InetAddress)USNPerIP.get( usn ); + InetAddress originalAliveSenderIp = USNPerIP.get( usn ); if ( originalAliveSenderIp != null ) { // we check that the sender ip of message for the usn // match the sender ip of the alive message for wich the usn @@ -347,14 +347,14 @@ public class DiscoveryAdvertisement implements Runnable { int index = udn.indexOf( "::" ); if ( index != -1 ) udn = udn.substring( 0, index ); synchronized( REGISTRATION_PROCESS ) { - Set handlers = (Set)byeByeRegistered.get( NT_ALL_EVENTS ); + Set handlers = byeByeRegistered.get( NT_ALL_EVENTS ); if ( handlers != null ) { for ( Iterator i = handlers.iterator(); i.hasNext(); ) { DiscoveryEventHandler eventHandler = (DiscoveryEventHandler)i.next(); eventHandler.eventSSDPByeBye( usn, udn, nt ); } } - handlers = (Set)byeByeRegistered.get( nt ); + handlers = byeByeRegistered.get( nt ); if ( handlers != null ) { for ( Iterator i = handlers.iterator(); i.hasNext(); ) { DiscoveryEventHandler eventHandler = (DiscoveryEventHandler)i.next(); diff --git a/source/net/yacy/upnp/DiscoveryListener.java b/source/net/yacy/upnp/DiscoveryListener.java index bd0acd398..219b016ba 100644 --- a/source/net/yacy/upnp/DiscoveryListener.java +++ b/source/net/yacy/upnp/DiscoveryListener.java @@ -73,7 +73,7 @@ public class DiscoveryListener implements Runnable { private static final int DEFAULT_TIMEOUT = 250; - private Map registeredHandlers = new HashMap(); + private Map registeredHandlers = new HashMap(); private final Object REGISTRATION_PROCESS = new Object(); @@ -106,10 +106,11 @@ public class DiscoveryListener implements Runnable { * @param searchTarget the search target * @throws IOException if some errors occurs during SSDP search response messages listener thread startup */ + @SuppressWarnings("unchecked") public void registerResultsHandler( DiscoveryResultsHandler resultsHandler, String searchTarget ) throws IOException { synchronized( REGISTRATION_PROCESS ) { if ( !inService ) startDevicesListenerThread(); - Set handlers = (Set)registeredHandlers.get( searchTarget ); + Set handlers = registeredHandlers.get( searchTarget ); if ( handlers == null ) { handlers = new HashSet(); registeredHandlers.put( searchTarget, handlers ); @@ -125,7 +126,7 @@ public class DiscoveryListener implements Runnable { */ public void unRegisterResultsHandler( DiscoveryResultsHandler resultsHandler, String searchTarget ) { synchronized( REGISTRATION_PROCESS ) { - Set handlers = (Set)registeredHandlers.get( searchTarget ); + Set handlers = registeredHandlers.get( searchTarget ); if ( handlers != null ) { handlers.remove( resultsHandler ); if ( handlers.size() == 0 ) { @@ -266,7 +267,7 @@ public class DiscoveryListener implements Runnable { int index = udn.indexOf( "::" ); if ( index != -1 ) udn = udn.substring( 0, index ); synchronized( REGISTRATION_PROCESS ) { - Set handlers = (Set)registeredHandlers.get( st ); + Set handlers = registeredHandlers.get( st ); if ( handlers != null ) { for ( Iterator i = handlers.iterator(); i.hasNext(); ) { DiscoveryResultsHandler handler = (DiscoveryResultsHandler)i.next(); diff --git a/source/net/yacy/upnp/HttpResponse.java b/source/net/yacy/upnp/HttpResponse.java index 894c95d56..5b3d888ad 100644 --- a/source/net/yacy/upnp/HttpResponse.java +++ b/source/net/yacy/upnp/HttpResponse.java @@ -58,7 +58,7 @@ import java.util.*; public class HttpResponse { private String header; - private Map fields; + private Map fields; private String body; @@ -73,7 +73,7 @@ public class HttpResponse { } boolean bodyParsing = false; StringBuffer bodyParsed = new StringBuffer(); - fields = new HashMap(); + fields = new HashMap(); String[] lines = rawHttpResponse.split( "\\r\\n" ); this.header = lines[0].trim(); @@ -132,7 +132,7 @@ public class HttpResponse { } public String getHTTPHeaderField( String fieldName ) throws IllegalArgumentException { - String field = (String)fields.get( fieldName.toUpperCase() ); + String field = fields.get( fieldName.toUpperCase() ); if ( field == null ) { throw new IllegalArgumentException( "HTTP field " + fieldName + " is not present"); } diff --git a/source/net/yacy/upnp/ServiceEventMessageParser.java b/source/net/yacy/upnp/ServiceEventMessageParser.java index fa9b168de..5c9e773e5 100644 --- a/source/net/yacy/upnp/ServiceEventMessageParser.java +++ b/source/net/yacy/upnp/ServiceEventMessageParser.java @@ -64,7 +64,7 @@ public class ServiceEventMessageParser extends org.xml.sax.helpers.DefaultHandle private String currentPropName = null; - private Map changedStateVars = new HashMap(); + private Map changedStateVars = new HashMap(); protected ServiceEventMessageParser() { } @@ -75,7 +75,7 @@ public class ServiceEventMessageParser extends org.xml.sax.helpers.DefaultHandle public void characters( char[] ch, int start, int length ) { if ( currentPropName != null ) { - String origChars = (String)changedStateVars.get( currentPropName ); + String origChars = changedStateVars.get( currentPropName ); String newChars = new String( ch, start, length ); if ( origChars == null ) { changedStateVars.put( currentPropName, newChars ); diff --git a/source/net/yacy/upnp/ServicesEventing.java b/source/net/yacy/upnp/ServicesEventing.java index 3ad5677d1..b46fce865 100644 --- a/source/net/yacy/upnp/ServicesEventing.java +++ b/source/net/yacy/upnp/ServicesEventing.java @@ -79,7 +79,7 @@ public class ServicesEventing implements Runnable { private ServerSocket server = null; - private List registered = new ArrayList(); + private List registered = new ArrayList(); private ServicesEventing() { } diff --git a/source/net/yacy/upnp/devices/UPNPDevice.java b/source/net/yacy/upnp/devices/UPNPDevice.java index 8c87873b6..77dfe6ddf 100644 --- a/source/net/yacy/upnp/devices/UPNPDevice.java +++ b/source/net/yacy/upnp/devices/UPNPDevice.java @@ -80,9 +80,9 @@ public class UPNPDevice { protected String USN; protected long UPC; - protected List deviceIcons; - protected List services; - protected List childDevices; + protected ArrayList deviceIcons; + protected ArrayList services; + protected ArrayList childDevices; protected UPNPDevice parent; @@ -160,13 +160,13 @@ public class UPNPDevice { * UPNPDevice objects for this device. * @return the generated list or null if no child devices bound */ - public List getChildDevices() { + public ArrayList getChildDevices() { if ( childDevices == null ) return null; - List rtrVal = new ArrayList(); + ArrayList rtrVal = new ArrayList(); for ( Iterator itr = childDevices.iterator(); itr.hasNext(); ) { UPNPDevice device = (UPNPDevice)itr.next(); rtrVal.add( device ); - List found = device.getChildDevices(); + ArrayList found = device.getChildDevices(); if ( found != null ) { rtrVal.addAll( found ); } @@ -182,7 +182,7 @@ public class UPNPDevice { */ public List getTopLevelChildDevices() { if ( childDevices == null ) return null; - List rtrVal = new ArrayList(); + List rtrVal = new ArrayList(); for ( Iterator itr = childDevices.iterator(); itr.hasNext(); ) { UPNPDevice device = (UPNPDevice)itr.next(); rtrVal.add( device ); @@ -223,9 +223,9 @@ public class UPNPDevice { * Looks for all UPNP device service definitions objects * @return A list of all device services */ - public List getServices() { + public ArrayList getServices() { if ( services == null ) return null; - List rtrVal = new ArrayList(); + ArrayList rtrVal = new ArrayList(); rtrVal.addAll( services ); return rtrVal; } @@ -273,7 +273,7 @@ public class UPNPDevice { */ public List getServices( String serviceURI ) { if ( services == null ) return null; - List rtrVal = new ArrayList(); + List rtrVal = new ArrayList(); if ( log.isDebugEnabled() ) log.debug( "searching for services URI:" + serviceURI ); for ( Iterator itr = services.iterator(); itr.hasNext(); ) { UPNPService service = (UPNPService)itr.next(); diff --git a/source/net/yacy/upnp/devices/UPNPRootDevice.java b/source/net/yacy/upnp/devices/UPNPRootDevice.java index ff4b9f129..867042dcb 100644 --- a/source/net/yacy/upnp/devices/UPNPRootDevice.java +++ b/source/net/yacy/upnp/devices/UPNPRootDevice.java @@ -297,7 +297,7 @@ public class UPNPRootDevice extends UPNPDevice { JXPathContext deviceListCtx = deviceCtx.getRelativeContext( deviceListPtr ); deviceListCtx.registerNamespace("upnp", "urn:schemas-upnp-org:device-1-0"); Double arraySize = (Double)deviceListCtx.getValue( "count( upnp:device )" ); - device.childDevices = new ArrayList(); + device.childDevices = new ArrayList(); if ( log.isDebugEnabled() ) log.debug( "child devices count is " + arraySize ); for ( int i = 1; i <= arraySize.intValue(); i++ ) { Pointer devicePtr = deviceListCtx.getPointer( "upnp:device[" + i + "]" ); @@ -344,7 +344,7 @@ public class UPNPRootDevice extends UPNPDevice { serviceListCtx.registerNamespace("upnp", "urn:schemas-upnp-org:device-1-0"); Double arraySize = (Double)serviceListCtx.getValue( "count( upnp:service )" ); if ( log.isDebugEnabled() ) log.debug( "device services count is " + arraySize ); - device.services = new ArrayList(); + device.services = new ArrayList(); for ( int i = 1; i <= arraySize.intValue(); i++ ) { Pointer servicePtr = serviceListCtx.getPointer( "upnp:service["+i+"]" ); @@ -378,7 +378,7 @@ public class UPNPRootDevice extends UPNPDevice { iconListCtx.registerNamespace("upnp", "urn:schemas-upnp-org:device-1-0"); Double arraySize = (Double)iconListCtx.getValue( "count( upnp:icon )" ); if ( log.isDebugEnabled() ) log.debug( "device icons count is " + arraySize ); - device.deviceIcons = new ArrayList(); + device.deviceIcons = new ArrayList(); for ( int i = 1; i <= arraySize.intValue(); i++ ) { DeviceIcon ico = new DeviceIcon(); diff --git a/source/net/yacy/upnp/impls/InternetGatewayDevice.java b/source/net/yacy/upnp/impls/InternetGatewayDevice.java index 7833a3800..11dc8b2d2 100644 --- a/source/net/yacy/upnp/impls/InternetGatewayDevice.java +++ b/source/net/yacy/upnp/impls/InternetGatewayDevice.java @@ -226,6 +226,7 @@ public class InternetGatewayDevice { * @deprecated use generic {@link #getDevices(int)} or {@link #getDevices(int, int, int, NetworkInterface)} methods since this one is not * usable with all IGD devices ( will only work with devices implementing the urn:schemas-upnp-org:service:WANIPConnection:1 service ) */ + @Deprecated public static InternetGatewayDevice[] getIPDevices( int timeout ) throws IOException { return lookupDeviceDevices( timeout, Discovery.DEFAULT_TTL, Discovery.DEFAULT_MX, true, false, null ); } @@ -238,6 +239,7 @@ public class InternetGatewayDevice { * @deprecated use generic {@link #getDevices(int)} or {@link #getDevices(int, int, int, NetworkInterface)} methods since this one is not * usable with all IGD devices ( will only work with devices implementing the urn:schemas-upnp-org:service:WANPPPConnection:1 service ) */ + @Deprecated public static InternetGatewayDevice[] getPPPDevices( int timeout ) throws IOException { return lookupDeviceDevices( timeout, Discovery.DEFAULT_TTL, Discovery.DEFAULT_MX, false, true, null ); } @@ -252,7 +254,7 @@ public class InternetGatewayDevice { } if ( devices != null ) { - Set valid = new HashSet(); + Set valid = new HashSet(); for ( int i = 0; i < devices.length; i++ ) { try { valid.add( new InternetGatewayDevice( devices[i], WANIPConnection, WANPPPConnection ) ); diff --git a/source/net/yacy/upnp/messages/ActionMessage.java b/source/net/yacy/upnp/messages/ActionMessage.java index 42baf9d66..b0b1d5820 100644 --- a/source/net/yacy/upnp/messages/ActionMessage.java +++ b/source/net/yacy/upnp/messages/ActionMessage.java @@ -73,7 +73,7 @@ public class ActionMessage { private UPNPService service; private ServiceAction serviceAction; - private List inputParameters; + private List inputParameters; /** * Protected constuctor so that only messages factories can build it @@ -84,7 +84,7 @@ public class ActionMessage { this.service = service; this.serviceAction = serviceAction; if ( serviceAction.getInputActionArguments() != null ) { - inputParameters = new ArrayList(); + inputParameters = new ArrayList(); } } diff --git a/source/net/yacy/upnp/messages/ActionResponse.java b/source/net/yacy/upnp/messages/ActionResponse.java index 8c20cc4e9..8ad2d6165 100644 --- a/source/net/yacy/upnp/messages/ActionResponse.java +++ b/source/net/yacy/upnp/messages/ActionResponse.java @@ -58,18 +58,18 @@ import java.util.*; */ public class ActionResponse { - private Map outArguments = new HashMap(); - private Map outArgumentsVals = new HashMap(); + private Map outArguments = new HashMap(); + private Map outArgumentsVals = new HashMap(); protected ActionResponse() { } public ServiceActionArgument getOutActionArgument( String actionArgumentName ) { - return (ServiceActionArgument)outArguments.get( actionArgumentName ); + return outArguments.get( actionArgumentName ); } public String getOutActionArgumentValue( String actionArgumentName ) { - return (String)outArgumentsVals.get( actionArgumentName ); + return outArgumentsVals.get( actionArgumentName ); } public Set getOutActionArgumentNames() { @@ -91,7 +91,7 @@ public class ActionResponse { StringBuffer rtrVal = new StringBuffer(); for ( Iterator i = outArguments.keySet().iterator(); i.hasNext(); ) { String name = (String)i.next(); - String value = (String)outArgumentsVals.get( name ); + String value = outArgumentsVals.get( name ); rtrVal.append( name ).append( "=" ).append( value ); if ( i.hasNext() ) rtrVal.append( "\n" ); } diff --git a/source/net/yacy/upnp/services/ServiceAction.java b/source/net/yacy/upnp/services/ServiceAction.java index 5539e132a..784c20a83 100644 --- a/source/net/yacy/upnp/services/ServiceAction.java +++ b/source/net/yacy/upnp/services/ServiceAction.java @@ -176,7 +176,7 @@ public class ServiceAction { private List getListForActionArgument( List args, String direction ) { if ( args == null ) return null; - List rtrVal = new ArrayList(); + List rtrVal = new ArrayList(); for ( Iterator itr = args.iterator(); itr.hasNext(); ) { ServiceActionArgument actArg = (ServiceActionArgument)itr.next(); if ( actArg.getDirection() == direction ) { @@ -189,7 +189,7 @@ public class ServiceAction { private List getListForActionArgumentNames( List args, String direction ) { if ( args == null ) return null; - List rtrVal = new ArrayList(); + List rtrVal = new ArrayList(); for ( Iterator itr = args.iterator(); itr.hasNext(); ) { ServiceActionArgument actArg = (ServiceActionArgument)itr.next(); if ( actArg.getDirection() == direction ) { diff --git a/source/net/yacy/upnp/services/ServiceStateVariable.java b/source/net/yacy/upnp/services/ServiceStateVariable.java index 1d6b8cf52..a0876ff80 100644 --- a/source/net/yacy/upnp/services/ServiceStateVariable.java +++ b/source/net/yacy/upnp/services/ServiceStateVariable.java @@ -74,7 +74,7 @@ public class ServiceStateVariable implements ServiceStateVariableTypes { protected String minimumRangeValue; protected String maximumRangeValue; protected String stepRangeValue; - protected Set allowedvalues; + protected Set allowedvalues; protected UPNPService parent; protected ServiceStateVariable() { diff --git a/source/net/yacy/upnp/services/UPNPService.java b/source/net/yacy/upnp/services/UPNPService.java index 317166f89..a6ab06310 100644 --- a/source/net/yacy/upnp/services/UPNPService.java +++ b/source/net/yacy/upnp/services/UPNPService.java @@ -74,8 +74,8 @@ public class UPNPService { protected URL eventSubURL; protected UPNPDevice serviceOwnerDevice; - protected Map UPNPServiceActions; - protected Map UPNPServiceStateVariables; + protected Map UPNPServiceActions; + protected Map UPNPServiceStateVariables; private String USN; private boolean parsedSCPD = false; @@ -136,7 +136,7 @@ public class UPNPService { */ public ServiceAction getUPNPServiceAction( String actionName ) { lazyInitiate(); - return (ServiceAction)UPNPServiceActions.get( actionName ); + return UPNPServiceActions.get( actionName ); } /** @@ -146,7 +146,7 @@ public class UPNPService { */ public ServiceStateVariable getUPNPServiceStateVariable( String stateVariableName ) { lazyInitiate(); - return (ServiceStateVariable)UPNPServiceStateVariables.get( stateVariableName ); + return UPNPServiceStateVariables.get( stateVariableName ); } public Iterator getAvailableActionsName() { @@ -188,7 +188,7 @@ public class UPNPService { JXPathContext actionsListCtx = context.getRelativeContext( actionsListPtr ); actionsListCtx.registerNamespace("scpdns", "urn:schemas-upnp-org:service-1-0"); Double arraySize = (Double)actionsListCtx.getValue( "count( scpdns:action )" ); - UPNPServiceActions = new HashMap(); + UPNPServiceActions = new HashMap(); for ( int i = 1; i <= arraySize.intValue(); i++ ) { ServiceAction action = new ServiceAction(); action.name = (String)actionsListCtx.getValue( "scpdns:action["+i+"]/scpdns:name" ); @@ -204,14 +204,14 @@ public class UPNPService { argumentListCtx.registerNamespace("scpdns", "urn:schemas-upnp-org:service-1-0"); Double arraySizeArgs = (Double)argumentListCtx.getValue( "count( scpdns:argument )" ); - List orderedActionArguments = new ArrayList(); + List orderedActionArguments = new ArrayList(); for ( int z = 1; z <= arraySizeArgs.intValue(); z++ ) { ServiceActionArgument arg = new ServiceActionArgument(); arg.name = (String)argumentListCtx.getValue( "scpdns:argument["+z+"]/scpdns:name" ); String direction = (String)argumentListCtx.getValue( "scpdns:argument["+z+"]/scpdns:direction" ); arg.direction = direction.equals( ServiceActionArgument.DIRECTION_IN ) ? ServiceActionArgument.DIRECTION_IN : ServiceActionArgument.DIRECTION_OUT; String stateVarName = (String)argumentListCtx.getValue( "scpdns:argument["+z+"]/scpdns:relatedStateVariable" ); - ServiceStateVariable stateVar = (ServiceStateVariable)UPNPServiceStateVariables.get( stateVarName ); + ServiceStateVariable stateVar = UPNPServiceStateVariables.get( stateVarName ); if ( stateVar == null ) { throw new IllegalArgumentException( "Unable to find any state variable named " + stateVarName + " for service " + getServiceId() + " action " + action.name + " argument " + arg.name ); } @@ -237,7 +237,7 @@ public class UPNPService { JXPathContext serviceStateTableCtx = rootContext.getRelativeContext( serviceStateTablePtr ); serviceStateTableCtx.registerNamespace("scpdns", "urn:schemas-upnp-org:service-1-0"); Double arraySize = (Double)serviceStateTableCtx.getValue( "count( scpdns:stateVariable )" ); - UPNPServiceStateVariables = new HashMap(); + UPNPServiceStateVariables = new HashMap(); for ( int i = 1; i <= arraySize.intValue(); i++ ) { ServiceStateVariable srvStateVar = new ServiceStateVariable(); String sendEventsLcl = null; @@ -266,7 +266,7 @@ public class UPNPService { JXPathContext allowedValuesCtx = serviceStateTableCtx.getRelativeContext( allowedValuesPtr ); allowedValuesCtx.registerNamespace("scpdns", "urn:schemas-upnp-org:service-1-0"); Double arraySizeAllowed = (Double)allowedValuesCtx.getValue( "count( scpdns:allowedValue )" ); - srvStateVar.allowedvalues = new HashSet(); + srvStateVar.allowedvalues = new HashSet(); for ( int z = 1; z <= arraySizeAllowed.intValue(); z++ ) { String allowedValue = (String)allowedValuesCtx.getValue( "scpdns:allowedValue["+z+"]" ); srvStateVar.allowedvalues.add( allowedValue );