Revert all changes to the org/cybergarage library

in the 2009-08-11 whitespace cleanup at ef1c23821d433903124f7612cbc46ac096fc985b
to make merging with the newer library easier.
This commit is contained in:
zzz
2012-05-25 19:52:39 +00:00
parent 3fbff71861
commit b033db969c
27 changed files with 2253 additions and 2267 deletions

View File

@ -136,15 +136,15 @@ public class Date
public String getDateString()
{
// Thanks for Theo Beisch (10/20/04)
Calendar _cal = getCalendar();
Calendar cal = getCalendar();
return
toWeekString(_cal.get(Calendar.DAY_OF_WEEK)) +", " +
toTimeString(_cal.get(Calendar.DATE)) + " " +
toMonthString(_cal.get(Calendar.MONTH)) + " " +
Integer.toString(_cal.get(Calendar.YEAR)) + " " +
toTimeString(_cal.get(Calendar.HOUR_OF_DAY)) + ":" +
toTimeString(_cal.get(Calendar.MINUTE)) + ":" +
toTimeString(_cal.get(Calendar.SECOND)) + " GMT";
toWeekString(cal.get(Calendar.DAY_OF_WEEK)) +", " +
toTimeString(cal.get(Calendar.DATE)) + " " +
toMonthString(cal.get(Calendar.MONTH)) + " " +
Integer.toString(cal.get(Calendar.YEAR)) + " " +
toTimeString(cal.get(Calendar.HOUR_OF_DAY)) + ":" +
toTimeString(cal.get(Calendar.MINUTE)) + ":" +
toTimeString(cal.get(Calendar.SECOND)) + " GMT";
}
////////////////////////////////////////////////
@ -154,11 +154,11 @@ public class Date
public String getTimeString()
{
// Thanks for Theo Beisch (10/20/04)
Calendar _cal = getCalendar();
Calendar cal = getCalendar();
return
toDateString(_cal.get(Calendar.HOUR_OF_DAY)) +
(((_cal.get(Calendar.SECOND) % 2) == 0) ? ":" : " ") +
toDateString(_cal.get(Calendar.MINUTE));
toDateString(cal.get(Calendar.HOUR_OF_DAY)) +
(((cal.get(Calendar.SECOND) % 2) == 0) ? ":" : " ") +
toDateString(cal.get(Calendar.MINUTE));
}
}

View File

@ -42,10 +42,10 @@ public class HTTPHeader
int colonIdx = lineStr.indexOf(':');
if (colonIdx < 0)
return;
String _name = new String(lineStr.getBytes(), 0, colonIdx);
String _value = new String(lineStr.getBytes(), colonIdx+1, lineStr.length()-colonIdx-1);
setName(_name.trim());
setValue(_value.trim());
String name = new String(lineStr.getBytes(), 0, colonIdx);
String value = new String(lineStr.getBytes(), colonIdx+1, lineStr.length()-colonIdx-1);
setName(name.trim());
setValue(value.trim());
}
////////////////////////////////////////////////

View File

@ -134,13 +134,13 @@ public class HTTPPacket
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
String _firstLine = reader.readLine();
if (_firstLine == null || _firstLine.length() <= 0)
String firstLine = reader.readLine();
if (firstLine == null || firstLine.length() <= 0)
return false;
setFirstLine(_firstLine);
setFirstLine(firstLine);
// Thanks for Giordano Sassaroli <sassarol@cefriel.it> (09/03/03)
HTTPStatus httpStatus = new HTTPStatus(_firstLine);
HTTPStatus httpStatus = new HTTPStatus(firstLine);
int statCode = httpStatus.getStatusCode();
if (statCode == HTTPStatus.CONTINUE){
//ad hoc code for managing iis non-standard behaviour
@ -186,7 +186,7 @@ public class HTTPPacket
String chunkSizeLine = reader.readLine();
contentLen = Long.parseLong(new String(chunkSizeLine.getBytes(), 0, chunkSizeLine.length()-2));
}
catch (Exception e) {}
catch (Exception e) {};
}
else
contentLen = getContentLength();
@ -231,7 +231,7 @@ public class HTTPPacket
}
catch (Exception e) {
contentLen = 0;
}
};
}
else
contentLen = 0;
@ -650,21 +650,21 @@ public class HTTPPacket
try {
range[0] = Long.parseLong(firstPosStr);
}
catch (NumberFormatException e) {}
catch (NumberFormatException e) {};
if (strToken.hasMoreTokens() == false)
return range;
String lastPosStr = strToken.nextToken("-/");
try {
range[1] = Long.parseLong(lastPosStr);
}
catch (NumberFormatException e) {}
catch (NumberFormatException e) {};
if (strToken.hasMoreTokens() == false)
return range;
String lengthStr = strToken.nextToken("/");
try {
range[2] = Long.parseLong(lengthStr);
}
catch (NumberFormatException e) {}
catch (NumberFormatException e) {};
return range;
}

View File

@ -166,17 +166,17 @@ public class HTTPRequest extends HTTPPacket
public ParameterList getParameterList()
{
ParameterList paramList = new ParameterList();
String _uri = getURI();
if (_uri == null)
String uri = getURI();
if (uri == null)
return paramList;
int paramIdx = _uri.indexOf('?');
int paramIdx = uri.indexOf('?');
if (paramIdx < 0)
return paramList;
while (0 < paramIdx) {
int eqIdx = _uri.indexOf('=', (paramIdx+1));
String name = _uri.substring(paramIdx+1, eqIdx);
int nextParamIdx = _uri.indexOf('&', (eqIdx+1));
String value = _uri.substring(eqIdx+1, (0 < nextParamIdx) ? nextParamIdx : _uri.length());
int eqIdx = uri.indexOf('=', (paramIdx+1));
String name = uri.substring(paramIdx+1, eqIdx);
int nextParamIdx = uri.indexOf('&', (eqIdx+1));
String value = uri.substring(eqIdx+1, (0 < nextParamIdx) ? nextParamIdx : uri.length());
Parameter param = new Parameter(name, value);
paramList.add(param);
paramIdx = nextParamIdx;
@ -437,15 +437,15 @@ public class HTTPRequest extends HTTPPacket
if (isKeepAlive == false) {
try {
in.close();
} catch (Exception e) {}
} catch (Exception e) {};
if (in != null)
try {
out.close();
} catch (Exception e) {}
} catch (Exception e) {};
if (out != null)
try {
postSocket.close();
} catch (Exception e) {}
} catch (Exception e) {};
postSocket = null;
}
}
@ -494,7 +494,6 @@ public class HTTPRequest extends HTTPPacket
// toString
////////////////////////////////////////////////
@Override
public String toString()
{
StringBuilder str = new StringBuilder();

View File

@ -97,7 +97,6 @@ public class HTTPResponse extends HTTPPacket
// toString
////////////////////////////////////////////////
@Override
public String toString()
{
StringBuilder str = new StringBuilder();

View File

@ -37,7 +37,6 @@ public class HTTPServerThread extends Thread
// run
////////////////////////////////////////////////
@Override
public void run()
{
HTTPSocket httpSock = new HTTPSocket(sock);

View File

@ -45,7 +45,6 @@ public class HTTPSocket
setOutputStream(socket.getOutputStream());
}
@Override
public void finalize()
{
close();

View File

@ -101,7 +101,7 @@ public class HostInterface
}
}
}
catch(Exception e){}
catch(Exception e){};
return nHostAddrs;
}
@ -131,7 +131,7 @@ public class HostInterface
}
}
}
catch(Exception e){}
catch(Exception e){};
return "";
}

View File

@ -89,8 +89,8 @@ public class SOAPRequest extends HTTPRequest
try {
ByteArrayInputStream byteIn = new ByteArrayInputStream(content);
Parser xmlParser = SOAP.getXMLParser();
Node _rootNode = xmlParser.parse(byteIn);
soapRes.setEnvelopeNode(_rootNode);
Node rootNode = xmlParser.parse(byteIn);
soapRes.setEnvelopeNode(rootNode);
}
catch (Exception e) {
Debug.warning(e);
@ -170,7 +170,6 @@ public class SOAPRequest extends HTTPRequest
// print
////////////////////////////////////////////////
@Override
public void print()
{
Debug.message(toString());

View File

@ -179,7 +179,6 @@ public class SOAPResponse extends HTTPResponse
// print
////////////////////////////////////////////////
@Override
public void print()
{
Debug.message(toString());

View File

@ -272,8 +272,8 @@ public class Action
actionRes.setResponse(this);
}
else {
UPnPStatus _upnpStatus = getStatus();
actionRes.setFaultResponse(_upnpStatus.getCode(), _upnpStatus.getDescription());
UPnPStatus upnpStatus = getStatus();
actionRes.setFaultResponse(upnpStatus.getCode(), upnpStatus.getDescription());
}
if (Debug.isOn() == true)
actionRes.print();

View File

@ -131,7 +131,6 @@ public class ControlPoint implements HTTPRequestListener
this(DEFAULT_SSDP_PORT, DEFAULT_EVENTSUB_PORT);
}
@Override
public void finalize()
{
stop();
@ -507,8 +506,8 @@ public class ControlPoint implements HTTPRequestListener
public void search(String target, int mx)
{
SSDPSearchRequest msReq = new SSDPSearchRequest(target, mx);
SSDPSearchResponseSocketList _ssdpSearchResponseSocketList = getSSDPSearchResponseSocketList();
_ssdpSearchResponseSocketList.post(msReq);
SSDPSearchResponseSocketList ssdpSearchResponseSocketList = getSSDPSearchResponseSocketList();
ssdpSearchResponseSocketList.post(msReq);
}
public void search(String target)
@ -791,8 +790,8 @@ public class ControlPoint implements HTTPRequestListener
int retryCnt = 0;
int bindPort = getHTTPPort();
HTTPServerList _httpServerList = getHTTPServerList();
while (_httpServerList.open(bindPort) == false) {
HTTPServerList httpServerList = getHTTPServerList();
while (httpServerList.open(bindPort) == false) {
retryCnt++;
if (UPnP.SERVER_RETRY_COUNT < retryCnt) {
Debug.warning("Failed to open HTTP event listener port " + bindPort);
@ -803,40 +802,40 @@ public class ControlPoint implements HTTPRequestListener
setHTTPPort(bindPort - 1);
bindPort = getHTTPPort();
}
_httpServerList.addRequestListener(this);
_httpServerList.start();
httpServerList.addRequestListener(this);
httpServerList.start();
////////////////////////////////////////
// Notify Socket
////////////////////////////////////////
SSDPNotifySocketList _ssdpNotifySocketList = getSSDPNotifySocketList();
if (_ssdpNotifySocketList.open() == false) {
SSDPNotifySocketList ssdpNotifySocketList = getSSDPNotifySocketList();
if (ssdpNotifySocketList.open() == false) {
Debug.warning("Failed to open SSDP notify port 1900");
return false;
}
_ssdpNotifySocketList.setControlPoint(this);
_ssdpNotifySocketList.start();
ssdpNotifySocketList.setControlPoint(this);
ssdpNotifySocketList.start();
////////////////////////////////////////
// SeachResponse Socket
////////////////////////////////////////
int _ssdpPort = getSSDPPort();
int ssdpPort = getSSDPPort();
retryCnt = 0;
SSDPSearchResponseSocketList _ssdpSearchResponseSocketList = getSSDPSearchResponseSocketList();
while (_ssdpSearchResponseSocketList.open(_ssdpPort) == false) {
SSDPSearchResponseSocketList ssdpSearchResponseSocketList = getSSDPSearchResponseSocketList();
while (ssdpSearchResponseSocketList.open(ssdpPort) == false) {
retryCnt++;
if (UPnP.SERVER_RETRY_COUNT < retryCnt) {
Debug.warning("Failed to open SSDP search response port " + _ssdpPort);
Debug.warning("Failed to open SSDP search response port " + ssdpPort);
return false;
}
// I2P go down not up so we don't run into other I2P things
setSSDPPort(_ssdpPort - 1);
_ssdpPort = getSSDPPort();
setSSDPPort(ssdpPort - 1);
ssdpPort = getSSDPPort();
}
_ssdpSearchResponseSocketList.setControlPoint(this);
_ssdpSearchResponseSocketList.start();
ssdpSearchResponseSocketList.setControlPoint(this);
ssdpSearchResponseSocketList.start();
////////////////////////////////////////
// search root devices
@ -879,20 +878,20 @@ public class ControlPoint implements HTTPRequestListener
{
unsubscribe();
SSDPNotifySocketList _ssdpNotifySocketList = getSSDPNotifySocketList();
_ssdpNotifySocketList.stop();
_ssdpNotifySocketList.close();
_ssdpNotifySocketList.clear();
SSDPNotifySocketList ssdpNotifySocketList = getSSDPNotifySocketList();
ssdpNotifySocketList.stop();
ssdpNotifySocketList.close();
ssdpNotifySocketList.clear();
SSDPSearchResponseSocketList _ssdpSearchResponseSocketList = getSSDPSearchResponseSocketList();
_ssdpSearchResponseSocketList.stop();
_ssdpSearchResponseSocketList.close();
_ssdpSearchResponseSocketList.clear();
SSDPSearchResponseSocketList ssdpSearchResponseSocketList = getSSDPSearchResponseSocketList();
ssdpSearchResponseSocketList.stop();
ssdpSearchResponseSocketList.close();
ssdpSearchResponseSocketList.clear();
HTTPServerList _httpServerList = getHTTPServerList();
_httpServerList.stop();
_httpServerList.close();
_httpServerList.clear();
HTTPServerList httpServerList = getHTTPServerList();
httpServerList.stop();
httpServerList.close();
httpServerList.clear();
////////////////////////////////////////
// Disposer

View File

@ -285,13 +285,13 @@ public class Device implements org.cybergarage.http.HTTPRequestListener, SearchL
public Device getRootDevice()
{
Node _rootNode = getRootNode();
if (_rootNode == null)
Node rootNode = getRootNode();
if (rootNode == null)
return null;
Node devNode = _rootNode.getNode(Device.ELEM_NAME);
Node devNode = rootNode.getNode(Device.ELEM_NAME);
if (devNode == null)
return null;
return new Device(_rootNode, devNode);
return new Device(rootNode, devNode);
}
////////////////////////////////////////////////

View File

@ -396,13 +396,13 @@ public class Service
Node actionListNode = scdpNode.getNode(ActionList.ELEM_NAME);
if (actionListNode == null)
return actionList;
Node _serviceNode = getServiceNode();
Node serviceNode = getServiceNode();
int nNode = actionListNode.getNNodes();
for (int n=0; n<nNode; n++) {
Node node = actionListNode.getNode(n);
if (Action.isActionNode(node) == false)
continue;
Action action = new Action(_serviceNode, node);
Action action = new Action(serviceNode, node);
actionList.add(action);
}
return actionList;
@ -433,13 +433,13 @@ public class Service
Node stateTableNode = getSCPDNode().getNode(ServiceStateTable.ELEM_NAME);
if (stateTableNode == null)
return stateTable;
Node _serviceNode = getServiceNode();
Node serviceNode = getServiceNode();
int nNode = stateTableNode.getNNodes();
for (int n=0; n<nNode; n++) {
Node node = stateTableNode.getNode(n);
if (StateVariable.isStateVariableNode(node) == false)
continue;
StateVariable serviceVar = new StateVariable(_serviceNode, node);
StateVariable serviceVar = new StateVariable(serviceNode, node);
stateTable.add(serviceVar);
}
return stateTable;

View File

@ -46,7 +46,7 @@ public class ServiceList extends Vector
try {
obj = get(n);
}
catch (Exception e) {}
catch (Exception e) {};
return (Service)obj;
}
}

View File

@ -72,10 +72,10 @@ public class StateVariable extends NodeData
public Service getService()
{
Node _serviceNode = getServiceNode();
if (_serviceNode == null)
Node serviceNode = getServiceNode();
if (serviceNode == null)
return null;
return new Service(_serviceNode);
return new Service(serviceNode);
}
public Node getStateVariableNode()
@ -301,8 +301,8 @@ public class StateVariable extends NodeData
queryRes.setResponse(retVar);
}
else {
UPnPStatus _upnpStatus = retVar.getStatus();
queryRes.setFaultResponse(_upnpStatus.getCode(), _upnpStatus.getDescription());
UPnPStatus upnpStatus = retVar.getStatus();
queryRes.setFaultResponse(upnpStatus.getCode(), upnpStatus.getDescription());
}
queryReq.post(queryRes);
return true;

View File

@ -51,7 +51,6 @@ public class RenewSubscriber extends ThreadCore
// Thread
////////////////////////////////////////////////
@Override
public void run()
{
ControlPoint ctrlp = getControlPoint();

View File

@ -51,7 +51,6 @@ public class Advertiser extends ThreadCore
// Thread
////////////////////////////////////////////////
@Override
public void run()
{
Device dev = getDevice();

View File

@ -49,7 +49,6 @@ public class Disposer extends ThreadCore
// Thread
////////////////////////////////////////////////
@Override
public void run()
{
Thread.currentThread().setName("UPnP-Disposer");

View File

@ -53,7 +53,6 @@ public class HTTPMUSocket
open(addr, port, bindAddr);
}
@Override
protected void finalize()
{
close();

View File

@ -60,7 +60,6 @@ public class HTTPUSocket
open(bindPort);
}
@Override
protected void finalize()
{
close();

View File

@ -27,6 +27,7 @@ package org.cybergarage.upnp.ssdp;
import java.net.*;
import org.cybergarage.net.*;
import org.cybergarage.util.*;
import org.cybergarage.http.*;
import org.cybergarage.upnp.*;

View File

@ -235,7 +235,6 @@ public class SSDPPacket
// toString
////////////////////////////////////////////////
@Override
public String toString()
{
return new String(getData());

View File

@ -112,7 +112,6 @@ public class SSDPResponse extends HTTPResponse
// getHeader (Override)
////////////////////////////////////////////////
@Override
public String getHeader()
{
StringBuilder str = new StringBuilder();

View File

@ -21,7 +21,6 @@ public class ListenerList extends Vector
{
private static final long serialVersionUID = 8039231561720446173L;
@Override
public boolean add(Object obj)
{
if (0 <= indexOf(obj))

View File

@ -40,7 +40,7 @@ public class Mutex
}
catch (Exception e) {
Debug.warning(e);
}
};
}
syncLock = true;
}

View File

@ -74,10 +74,10 @@ public class Node
public Node getRootNode()
{
Node rootNode = null;
Node _parentNode = getParentNode();
while (_parentNode != null) {
rootNode = _parentNode;
_parentNode = rootNode.getParentNode();
Node parentNode = getParentNode();
while (parentNode != null) {
rootNode = parentNode;
parentNode = rootNode.getParentNode();
}
return rootNode;
}
@ -338,24 +338,24 @@ public class Node
{
String indentString = getIndentLevelString(indentLevel);
String _name = getName();
String _value = getValue();
String name = getName();
String value = getValue();
if (hasNodes() == false || hasChildNode == false) {
ps.print(indentString + "<" + _name);
ps.print(indentString + "<" + name);
outputAttributes(ps);
// Thnaks for Tho Beisch (11/09/04)
if (_value == null || _value.length() == 0) {
if (value == null || value.length() == 0) {
// No value, so use short notation <node />
ps.println(" />");
} else {
ps.println(">" + XML.escapeXMLChars(_value) + "</" + _name + ">");
ps.println(">" + XML.escapeXMLChars(value) + "</" + name + ">");
}
return;
}
ps.print(indentString + "<" + _name);
ps.print(indentString + "<" + name);
outputAttributes(ps);
ps.println(">");
@ -365,7 +365,7 @@ public class Node
cnode.output(ps, indentLevel+1, true);
}
ps.println(indentString +"</" + _name + ">");
ps.println(indentString +"</" + name + ">");
}
public String toString(boolean hasChildNode)