Nothing really, just applies tiny formatting changes.

This commit is contained in:
lubomir.marinov 2010-02-25 08:38:27 +00:00
parent 890ddfd96d
commit 16f592bc27
5 changed files with 16 additions and 35 deletions

View File

@ -48,6 +48,7 @@ public class TransportAddress
public TransportAddress(String hostname, int port, Transport transport)
{
super(hostname, port);
this.transport = transport;
}
@ -71,9 +72,7 @@ public class TransportAddress
public TransportAddress(byte[] ipAddress, int port, Transport transport)
throws UnknownHostException
{
super(InetAddress.getByAddress(ipAddress), port);
this.transport = transport;
this(InetAddress.getByAddress(ipAddress), port, transport);
}
/**
@ -88,8 +87,7 @@ public class TransportAddress
*/
public TransportAddress(InetSocketAddress address, Transport transport)
{
super(address.getAddress(), address.getPort());
this.transport = transport;
this(address.getAddress(), address.getPort(), transport);
}
/**
@ -112,6 +110,7 @@ public class TransportAddress
public TransportAddress(InetAddress address, int port, Transport transport)
{
super(address, port);
this.transport = transport;
}
@ -137,7 +136,7 @@ public class TransportAddress
*/
public String toString()
{
return super.toString() + "/"+getTransport();
return super.toString() + "/" + getTransport();
}
/**
@ -148,7 +147,6 @@ public class TransportAddress
public String getHostAddress()
{
InetAddress addr = getAddress();
String addressStr = addr.getHostAddress();
if(addr instanceof Inet6Address)
@ -234,12 +232,8 @@ public class TransportAddress
*/
public boolean canReach(TransportAddress dst)
{
if (dst.getTransport() != getTransport())
return false;
if( isIPv6() != dst.isIPv6())
return false;
return true;
return
(getTransport() == dst.getTransport())
&& (isIPv6() != dst.isIPv6());
}
}

View File

@ -18,7 +18,6 @@ import org.ice4j.attribute.*;
* @author Emil Ivov
* @author Sebastien Vincent
*/
public class MessageFactory
{
private static final Logger logger =
@ -171,7 +170,6 @@ public class MessageFactory
return bindingResponse;
}
/**
* Creates a binding error response according to the specified error code
* and unknown attributes.
@ -257,7 +255,6 @@ public class MessageFactory
unknownAttributes);
}
/**
* Creates a binding error response with an ERROR-CODE attribute.
*
@ -301,6 +298,7 @@ public class MessageFactory
public static Request createAllocateRequest()
{
Request allocateRequest = new Request();
try
{
allocateRequest.setMessageType(Message.ALLOCATE_REQUEST);
@ -310,7 +308,6 @@ public class MessageFactory
//there should be no exc here since we're the creators.
logger.log(Level.FINE, "Failed to set message type.", ex);
}
return allocateRequest;
}
@ -330,7 +327,6 @@ public class MessageFactory
{
allocateRequest.setMessageType(Message.ALLOCATE_REQUEST);
/* XXX add enum somewhere for transport number */
if(protocol != 6 && protocol != 17)
{
@ -500,5 +496,4 @@ public class MessageFactory
throw new UnsupportedOperationException(
"Shared Secret Support is not currently implemented");
}
}

View File

@ -15,7 +15,6 @@ import org.ice4j.*;
*
* @author Emil Ivov
*/
public class Response extends Message
{
@ -24,7 +23,6 @@ public class Response extends Message
*/
Response()
{
}
/**
@ -45,5 +43,4 @@ public class Response extends Message
super.setMessageType(responseType);
}
}

View File

@ -13,6 +13,7 @@ import java.util.logging.*;
import org.ice4j.*;
import org.ice4j.message.*;
/**
* The entry point to the Stun4J stack. The class is used to start, stop and
* configure the stack.
@ -59,7 +60,7 @@ public class StunStack
/**
* A dispatcher for incoming requests event;
*/
private EventDispatcher eventDispatcher = new EventDispatcher();
private final EventDispatcher eventDispatcher = new EventDispatcher();
/**
* Returns a reference to the singleton StunStack instance. If the stack
@ -372,7 +373,6 @@ public class StunStack
StunServerTransaction sTran = serverTransactions.get(serverTid);
if( sTran != null)
{
//requests from this transaction have already been seen
//retransmit the response if there was any
logger.finest("found an existing transaction");
@ -414,9 +414,7 @@ public class StunStack
{
TransactionID tid
= TransactionID.createTransactionID(msg.getTransactionID());
StunClientTransaction tran =
clientTransactions.remove(tid);
StunClientTransaction tran = clientTransactions.remove(tid);
if(tran != null)
{

View File

@ -15,18 +15,18 @@ import java.util.*;
*
* @author Emil Ivov
*/
public class TransactionID
{
/**
* The id itself
*/
private byte transactionID[] = new byte[12];
private final byte transactionID[] = new byte[12];
/**
* The object to use to generate the rightmost 8 bytes of the id.
*/
private static Random random = new Random(System.currentTimeMillis());
private static final Random random
= new Random(System.currentTimeMillis());
/**
* A hashcode for hashtable storage.
@ -93,7 +93,6 @@ public class TransactionID
return tid;
}
/**
* Returns the transaction id byte array (length 12).
* @return the transaction ID byte array.
@ -110,9 +109,7 @@ public class TransactionID
*/
public boolean equals(Object obj)
{
if( obj == null
|| !(obj instanceof TransactionID))
if(!(obj instanceof TransactionID))
return false;
if(this == obj)