Fixes warnings.

This commit is contained in:
lubomir.marinov 2010-02-19 08:35:15 +00:00
parent aacc2b3c5d
commit 890ddfd96d
20 changed files with 31 additions and 85 deletions

View File

@ -10,12 +10,11 @@ package org.ice4j;
* A StunException is thrown when a general STUN exception is encountered. * A StunException is thrown when a general STUN exception is encountered.
* *
* <p>Copyright: Copyright (c) 2003</p> * <p>Copyright: Copyright (c) 2003</p>
* <p>Organisation: Louis Pasteur University, Strasbourg, France</p> * <p>Organization: Louis Pasteur University, Strasbourg, France</p>
* <p>Network Research Team (http://www-r2.u-strasbg.fr)</p></p> * <p>Network Research Team (http://www-r2.u-strasbg.fr)</p>
* @author Emil Ivov * @author Emil Ivov
* @version 0.1 * @version 0.1
*/ */
public class StunException extends Exception public class StunException extends Exception
{ {
/** /**
@ -23,11 +22,6 @@ public class StunException extends Exception
*/ */
private static final long serialVersionUID = 35367793L; private static final long serialVersionUID = 35367793L;
/**
* Error ID.
*/
private int errorID = 0;
/** /**
* Means that the the reason that caused the exception was unclear. * Means that the the reason that caused the exception was unclear.
*/ */
@ -50,7 +44,7 @@ public class StunException extends Exception
public static final int INTERNAL_ERROR = 3; public static final int INTERNAL_ERROR = 3;
/** /**
* Thrown when trying to send responses through a non-existant transaction * Thrown when trying to send responses through a non-existent transaction
* That may happen when a corresponding request has already been responded * That may happen when a corresponding request has already been responded
* to or when no such request has been received. * to or when no such request has been received.
*/ */

View File

@ -7,15 +7,14 @@
package org.ice4j.attribute; package org.ice4j.attribute;
import org.ice4j.*; import org.ice4j.*;
import org.ice4j.message.*;
/** /**
* The class provides utilities for decoding a binary stream into an Attribute * The class provides utilities for decoding a binary stream into an Attribute
* class. * class.
* *
* <p>Copyright: Copyright (c) 2003-2008</p> * <p>Copyright: Copyright (c) 2003-2008</p>
* <p>Organisation: Louis Pasteur University, Strasbourg, France</p> * <p>Organization: Louis Pasteur University, Strasbourg, France</p>
* <p>Network Research Team (http://www-r2.u-strasbg.fr)</p></p> * <p>Network Research Team (http://www-r2.u-strasbg.fr)</p>
* @author Emil Ivov * @author Emil Ivov
* @author Sebastien Vincent * @author Sebastien Vincent
* @version 0.1 * @version 0.1
@ -128,5 +127,4 @@ public class AttributeDecoder
return decodedAttribute; return decodedAttribute;
} }
} }

View File

@ -6,8 +6,6 @@
*/ */
package org.ice4j.attribute; package org.ice4j.attribute;
import java.lang.*;
import org.ice4j.*; import org.ice4j.*;
/** /**

View File

@ -6,8 +6,6 @@
*/ */
package org.ice4j.attribute; package org.ice4j.attribute;
import java.lang.*;
import org.ice4j.*; import org.ice4j.*;
/** /**
@ -112,4 +110,3 @@ public class DontFragmentAttribute extends Attribute
} }
} }
} }

View File

@ -6,8 +6,6 @@
*/ */
package org.ice4j.attribute; package org.ice4j.attribute;
import java.util.Hashtable;
import org.ice4j.*; import org.ice4j.*;
/** /**
@ -74,8 +72,8 @@ import org.ice4j.*;
* The client should not retry. * The client should not retry.
* *
* <p>Copyright: Copyright (c) 2003</p> * <p>Copyright: Copyright (c) 2003</p>
* <p>Organisation: Louis Pasteur University, Strasbourg, France</p> * <p>Organization: Louis Pasteur University, Strasbourg, France</p>
* <p>Network Research Team (http://www-r2.u-strasbg.fr)</p></p> * <p>Network Research Team (http://www-r2.u-strasbg.fr)</p>
* @author Emil Ivov * @author Emil Ivov
* @version 0.1 * @version 0.1
*/ */

View File

@ -6,13 +6,11 @@
*/ */
package org.ice4j.attribute; package org.ice4j.attribute;
import java.lang.*;
import org.ice4j.*; import org.ice4j.*;
/** /**
* The EVEN-PORT attribute is used to ask the TURN * The EVEN-PORT attribute is used to ask the TURN
* server to allocate an even port and optionnaly allocate * server to allocate an even port and optionally allocate
* the next higher port number. * the next higher port number.
* *
* There are one flag supported : <br/> * There are one flag supported : <br/>

View File

@ -6,8 +6,6 @@
*/ */
package org.ice4j.attribute; package org.ice4j.attribute;
import java.util.*;
import org.ice4j.*; import org.ice4j.*;
/** /**

View File

@ -6,8 +6,6 @@
*/ */
package org.ice4j.attribute; package org.ice4j.attribute;
import java.lang.*;
import org.ice4j.*; import org.ice4j.*;
/** /**

View File

@ -6,8 +6,6 @@
*/ */
package org.ice4j.attribute; package org.ice4j.attribute;
import java.lang.*;
import org.ice4j.*; import org.ice4j.*;
/** /**
@ -15,7 +13,7 @@ import org.ice4j.*;
* TURN address of certain transport protocol. * TURN address of certain transport protocol.
* *
* In the original TURN specification, only UDP is supported. * In the original TURN specification, only UDP is supported.
* Support of TCP is detailled in draft-ietf-behave-turn-tcp-05. * Support of TCP is detailed in draft-ietf-behave-turn-tcp-05.
* *
* @author Sebastien Vincent * @author Sebastien Vincent
* @version 0.1 * @version 0.1

View File

@ -6,8 +6,6 @@
*/ */
package org.ice4j.attribute; package org.ice4j.attribute;
import org.ice4j.*;
/** /**
* The XOR-PEER-ADDRESS attribute is given by a TURN client to * The XOR-PEER-ADDRESS attribute is given by a TURN client to
* indicates the peer destination address of its relayed packet. * indicates the peer destination address of its relayed packet.

View File

@ -6,8 +6,6 @@
*/ */
package org.ice4j.attribute; package org.ice4j.attribute;
import org.ice4j.*;
/** /**
* The XOR-RELAYED-ADDRESS attribute is given by a TURN server to * The XOR-RELAYED-ADDRESS attribute is given by a TURN server to
* indicates the client its relayed address. * indicates the client its relayed address.

View File

@ -32,7 +32,7 @@ public class Agent
/** /**
* Our class logger. * Our class logger.
*/ */
private final Logger logger private static final Logger logger
= Logger.getLogger(Agent.class.getName()); = Logger.getLogger(Agent.class.getName());
/** /**

View File

@ -17,11 +17,9 @@ import org.ice4j.ice.*;
import org.ice4j.message.*; import org.ice4j.message.*;
import org.ice4j.stack.*; import org.ice4j.stack.*;
import com.sun.org.apache.bcel.internal.generic.*;
/** /**
* A <tt>StunCandidateHarvester</tt> gathers STUN <tt>Candidate</tt>s for a * A <tt>StunCandidateHarvester</tt> gathers STUN <tt>Candidate</tt>s for a
* specified {@link org.ice4j.ice.Component}. * specified {@link Component}.
* *
* @author Emil Ivov * @author Emil Ivov
*/ */
@ -133,21 +131,28 @@ public class StunCandidateHarvester
} }
/** /**
* Blocks the current thread until all resolutions in this harverster * Blocks the current thread until all resolutions in this harvester
* have terminated one way or another. * have terminated one way or another.
*/ */
private void waitForResolutionEnd() private void waitForResolutionEnd()
{ {
synchronized(resolveMap) synchronized(resolveMap)
{ {
if(resolveMap.isEmpty()) boolean interrupted = false;
return;
try // Handle spurious wakeups.
{ while (!resolveMap.isEmpty())
resolveMap.wait(); try
} {
catch (InterruptedException e){} resolveMap.wait();
}
catch (InterruptedException iex)
{
interrupted = true;
}
// Restore the interrupted status.
if (interrupted)
Thread.currentThread().interrupt();
} }
} }
@ -179,7 +184,6 @@ public class StunCandidateHarvester
logger.finest("received a message tranid=" + tranID); logger.finest("received a message tranid=" + tranID);
logger.finest("localCand=" + localCand); logger.finest("localCand=" + localCand);
} }
} }
/** /**
@ -201,7 +205,7 @@ public class StunCandidateHarvester
* because of the oddities of the BSD and Java socket implementations, which * because of the oddities of the BSD and Java socket implementations, which
* is why we currently ignore this method. * is why we currently ignore this method.
* *
* @param event the <tt>StunFailureEvent</tt> * @param event the <tt>StunFailureEvent</tt> containg the
* <tt>PortUnreachableException</tt> which signaled that the destination of * <tt>PortUnreachableException</tt> which signaled that the destination of
* the request was found to be unreachable. * the request was found to be unreachable.
*/ */
@ -250,8 +254,7 @@ public class StunCandidateHarvester
Attribute attribute Attribute attribute
= response.getAttribute(Attribute.XOR_MAPPED_ADDRESS); = response.getAttribute(Attribute.XOR_MAPPED_ADDRESS);
if(attribute == null if(!(attribute instanceof XorMappedAddressAttribute))
|| !(attribute instanceof XorMappedAddressAttribute))
return; return;
TransportAddress addr = ((XorMappedAddressAttribute)attribute) TransportAddress addr = ((XorMappedAddressAttribute)attribute)

View File

@ -522,10 +522,9 @@ public abstract class Message
while (iter.hasNext()) while (iter.hasNext())
{ {
Attribute attribute Attribute attribute = iter.next().getValue();
= ((Map.Entry<Character, Attribute>)iter.next()).getValue();
byte[] attBinValue = attribute.encode(); byte[] attBinValue = attribute.encode();
System.arraycopy(attBinValue, 0, binMsg, offset, attBinValue.length); System.arraycopy(attBinValue, 0, binMsg, offset, attBinValue.length);
offset += attBinValue.length; offset += attBinValue.length;
} }

View File

@ -7,7 +7,6 @@
package org.ice4j.stack; package org.ice4j.stack;
import java.io.*; import java.io.*;
import java.net.*;
import java.util.logging.*; import java.util.logging.*;
import org.ice4j.*; import org.ice4j.*;
@ -33,7 +32,6 @@ import org.ice4j.message.*;
* @author Emil Ivov. * @author Emil Ivov.
* @author Pascal Mogeri (contributed configuration of client transactions). * @author Pascal Mogeri (contributed configuration of client transactions).
*/ */
class StunClientTransaction class StunClientTransaction
implements Runnable implements Runnable
{ {

View File

@ -7,7 +7,6 @@
package org.ice4j.stunclient; package org.ice4j.stunclient;
import java.io.*; import java.io.*;
import java.net.*;
import java.util.logging.*; import java.util.logging.*;
import org.ice4j.*; import org.ice4j.*;

View File

@ -6,9 +6,6 @@
*/ */
package org.ice4j; package org.ice4j;
import org.ice4j.attribute.*;
import org.ice4j.message.*;
public class MsgFixture public class MsgFixture
{ {
//---------------------- Attributes --------------------------------------- //---------------------- Attributes ---------------------------------------

View File

@ -48,7 +48,6 @@ public class MessageFactoryTest extends TestCase {
Message actualReturn Message actualReturn
= messageFactory.createBindingErrorResponse(errorCode); = messageFactory.createBindingErrorResponse(errorCode);
assertEquals("return value", expectedReturn, actualReturn); assertEquals("return value", expectedReturn, actualReturn);
} }
public void testCreateBindingErrorResponse1() throws StunException { public void testCreateBindingErrorResponse1() throws StunException {
@ -66,7 +65,6 @@ public class MessageFactoryTest extends TestCase {
.createBindingErrorResponse(errorCode, reasonPhrase); .createBindingErrorResponse(errorCode, reasonPhrase);
assertEquals("Failed to create an error code attribute.", assertEquals("Failed to create an error code attribute.",
expectedReturn, actualReturn); expectedReturn, actualReturn);
} }
public void testCreateBindingErrorResponseUnknownAttributes() public void testCreateBindingErrorResponseUnknownAttributes()
@ -98,7 +96,6 @@ public class MessageFactoryTest extends TestCase {
.createBindingErrorResponseUnknownAttributes(unknownAttributes); .createBindingErrorResponseUnknownAttributes(unknownAttributes);
//compare //compare
assertEquals("return value", expectedReturn, actualReturn); assertEquals("return value", expectedReturn, actualReturn);
} }
public void testCreateBindingErrorResponseUnknownAttributes1() public void testCreateBindingErrorResponseUnknownAttributes1()

View File

@ -29,8 +29,6 @@ public class MessageTest extends TestCase {
private MsgFixture msgFixture; private MsgFixture msgFixture;
protected void setUp() throws Exception { protected void setUp() throws Exception {
super.setUp(); super.setUp();
msgFixture = new MsgFixture(); msgFixture = new MsgFixture();
@ -72,8 +70,6 @@ public class MessageTest extends TestCase {
bindingResponse.addAttribute(changedAddress); bindingResponse.addAttribute(changedAddress);
bindingResponse.setTransactionID(msgFixture.TRANSACTION_ID); bindingResponse.setTransactionID(msgFixture.TRANSACTION_ID);
} }
protected void tearDown() throws Exception protected void tearDown() throws Exception
@ -127,9 +123,6 @@ public class MessageTest extends TestCase {
assertEquals("The second attribute could not be extracted.", assertEquals("The second attribute could not be extracted.",
sourceAddress, sourceAddress,
getResult); getResult);
} }
/** /**
@ -155,8 +148,6 @@ public class MessageTest extends TestCase {
assertTrue("A binding response was not properly encoded", assertTrue("A binding response was not properly encoded",
Arrays.equals( expectedReturn, actualReturn ) ); Arrays.equals( expectedReturn, actualReturn ) );
} }
/** /**
@ -187,12 +178,8 @@ public class MessageTest extends TestCase {
assertEquals("A binding response was not properly decoded", assertEquals("A binding response was not properly decoded",
expectedReturn, actualReturn ); expectedReturn, actualReturn );
} }
/** /**
* Tests the equals method against a null, a different and an identical * Tests the equals method against a null, a different and an identical
* object. * object.
@ -235,9 +222,6 @@ public class MessageTest extends TestCase {
binResTarget.addAttribute(changedAddress); binResTarget.addAttribute(changedAddress);
actualReturn = bindingResponse.equals(binResTarget); actualReturn = bindingResponse.equals(binResTarget);
assertEquals("Equals failed against a different target", expectedReturn, actualReturn); assertEquals("Equals failed against a different target", expectedReturn, actualReturn);
} }
/** /**
@ -252,7 +236,6 @@ public class MessageTest extends TestCase {
actualReturn = bindingResponse.getAttributeCount(); actualReturn = bindingResponse.getAttributeCount();
assertEquals("getAttributeCount failed for a bindingRequest", assertEquals("getAttributeCount failed for a bindingRequest",
expectedReturn, actualReturn); expectedReturn, actualReturn);
} }
/** /**
@ -270,8 +253,5 @@ public class MessageTest extends TestCase {
int actualReturn = bindingRequest.getAttributeCount(); int actualReturn = bindingRequest.getAttributeCount();
assertEquals("Attribute count did not change after removing an attribute", assertEquals("Attribute count did not change after removing an attribute",
expectedReturn, actualReturn); expectedReturn, actualReturn);
} }
} }

View File

@ -98,7 +98,7 @@ public class StunAddressDiscovererTest_v4v6 extends TestCase {
stunAddressDiscoverer_v4 = null; stunAddressDiscoverer_v4 = null;
//give the sockets the time to clear out //give the sockets the time to clear out
Thread.currentThread().sleep(1000); Thread.sleep(1000);
super.tearDown(); super.tearDown();
} }