- Adds Eclipse .project and .classpath files to ease the import of the project into the IDE.

- Removes Override annotations on interface implementations to avoid compilation errors.
- Overrides hashCode in a class which overrides equals in order to maintain the general contract of the hashCode method and to avoid possible (future) issues related to hashtables.
This commit is contained in:
lubomir.marinov 2012-07-30 21:12:49 +00:00
parent 12e275f640
commit 290572f32f
6 changed files with 53 additions and 26 deletions

10
.classpath Normal file
View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="lib/jain-sdp.jar"/>
<classpathentry kind="lib" path="lib/junit.jar"/>
<classpathentry kind="lib" path="lib/weupnp-0.1.2-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="lib/xalan-2.6.0.jar"/>
<classpathentry kind="output" path="classes"/>
</classpath>

17
.project Normal file
View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>ice4j</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -239,7 +239,6 @@ public class PseudoTcpSocket implements IPseudoTcpNotify
pseudoTcp.NotifyClock(System.currentTimeMillis()); pseudoTcp.NotifyClock(System.currentTimeMillis());
receiveThread = new Thread(new Runnable() receiveThread = new Thread(new Runnable()
{ {
@Override
public void run() public void run()
{ {
ReceivePackets(); ReceivePackets();
@ -247,7 +246,6 @@ public class PseudoTcpSocket implements IPseudoTcpNotify
}, "PseudoTcpReceiveThread"); }, "PseudoTcpReceiveThread");
clockThread = new Thread(new Runnable() clockThread = new Thread(new Runnable()
{ {
@Override
public void run() public void run()
{ {
RunClock(); RunClock();
@ -298,7 +296,6 @@ public class PseudoTcpSocket implements IPseudoTcpNotify
* *
* @param tcp * @param tcp
*/ */
@Override
public void OnTcpOpen(PseudoTCPBase tcp) public void OnTcpOpen(PseudoTCPBase tcp)
{ {
logger.log(Level.FINE, "tcp opened"); logger.log(Level.FINE, "tcp opened");
@ -316,7 +313,6 @@ public class PseudoTcpSocket implements IPseudoTcpNotify
* *
* @param tcp * @param tcp
*/ */
@Override
public void OnTcpReadable(PseudoTCPBase tcp) public void OnTcpReadable(PseudoTCPBase tcp)
{ {
//release all thread blocked at read_notify monitor //release all thread blocked at read_notify monitor
@ -334,7 +330,6 @@ public class PseudoTcpSocket implements IPseudoTcpNotify
* *
* @param tcp * @param tcp
*/ */
@Override
public void OnTcpWriteable(PseudoTCPBase tcp) public void OnTcpWriteable(PseudoTCPBase tcp)
{ {
@ -355,7 +350,6 @@ public class PseudoTcpSocket implements IPseudoTcpNotify
* @param tcp * @param tcp
* @param e * @param e
*/ */
@Override
public void OnTcpClosed(PseudoTCPBase tcp, IOException e) public void OnTcpClosed(PseudoTCPBase tcp, IOException e)
{ {
if (e != null) if (e != null)
@ -415,7 +409,6 @@ public class PseudoTcpSocket implements IPseudoTcpNotify
* @param len * @param len
* @return * @return
*/ */
@Override
public WriteResult TcpWritePacket(PseudoTCPBase tcp, byte[] buffer, int len) public WriteResult TcpWritePacket(PseudoTCPBase tcp, byte[] buffer, int len)
{ {
if (logger.isLoggable(Level.FINEST)) if (logger.isLoggable(Level.FINEST))

View File

@ -14,13 +14,11 @@ import java.net.*;
import java.nio.channels.*; import java.nio.channels.*;
import java.util.logging.*; import java.util.logging.*;
import org.ice4j.stack.*;
/** /**
* Implements a <tt>DatagramSocket</tt> which delegates its calls to a specific * Implements a <tt>DatagramSocket</tt> which delegates its calls to a specific
* <tt>DatagramSocket</tt>. * <tt>DatagramSocket</tt>.
* *
* @author Lubomir Marinov * @author Lyubomir Marinov
*/ */
public class DelegatingDatagramSocket public class DelegatingDatagramSocket
extends DatagramSocket extends DatagramSocket

View File

@ -10,8 +10,6 @@ import java.io.*;
import java.nio.channels.*; import java.nio.channels.*;
import java.net.*; import java.net.*;
import org.ice4j.stack.*;
/** /**
* Implements a <tt>Socket</tt> which delegates its calls to a specific * Implements a <tt>Socket</tt> which delegates its calls to a specific
* <tt>Socket</tt>. * <tt>Socket</tt>.

View File

@ -18,7 +18,7 @@ import org.ice4j.message.*;
* "Session Traversal Utilities for NAT (STUN)" i.e. with method Binding or the * "Session Traversal Utilities for NAT (STUN)" i.e. with method Binding or the
* reserved method 0x000 and 0x002/SharedSecret. * reserved method 0x000 and 0x002/SharedSecret.
* *
* @author Lubomir Marinov * @author Lyubomir Marinov
*/ */
public class StunDatagramPacketFilter public class StunDatagramPacketFilter
implements DatagramPacketFilter implements DatagramPacketFilter
@ -132,27 +132,38 @@ public class StunDatagramPacketFilter
} }
/** /**
* Indicates whether some other DatagramPacketFilter is "equal to" this one. * Indicates whether some other object is "equal to" this one.
* *
* @param obj the reference object with which to compare. * @param obj the reference object with which to compare.
* @return <code>true</code> if this <tt>StunDatagramPacketFilter</tt> is * @return <tt>true</tt> if this <tt>StunDatagramPacketFilter</tt> is equal
* equal to the obj argument; <code>false</code> otherwise. * to the <tt>obj</tt> argument; <tt>false</tt>, otherwise.
*
* @throws java.lang.NullPointerException if <tt>obj</tt> is null;
*/ */
@Override @Override
public boolean equals(Object obj) public boolean equals(Object obj)
throws NullPointerException
{ {
if(obj == this) if (null == obj)
return false;
else if (this == obj)
return true; return true;
else
return getClass().equals(obj.getClass());
}
if(obj.getClass().equals(getClass())) /**
{ * Returns a hash code value for this object for the benefit of hashtables
return true; * such as those provided by <tt>Hashtable</tt>.
} *
* @return a hash code value for this object
return false; */
@Override
public int hashCode()
{
/*
* Overrides the super implementation in order to maintain the general
* contract of the hashCode method which states that equal objects must
* have equal hash codes.
*/
return getClass().hashCode();
} }
/** /**