Mostly, applies formatting. Fixes an instance of using String#getBytes without an encoding which is discouraged (and hasn't come up as a problem during testing yet).
This commit is contained in:
parent
c631805349
commit
b4579547da
@ -6,6 +6,9 @@
|
|||||||
*/
|
*/
|
||||||
package org.ice4j.attribute;
|
package org.ice4j.attribute;
|
||||||
|
|
||||||
|
import java.io.*;
|
||||||
|
import java.lang.reflect.*;
|
||||||
|
|
||||||
import org.ice4j.*;
|
import org.ice4j.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -315,17 +318,23 @@ public class AttributeFactory
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a UsernameAttribute.
|
* Creates a new <tt>UsernameAttribute</tt> instance.
|
||||||
*
|
*
|
||||||
* @param username the String value of the username
|
* @param username the String value of the username
|
||||||
*
|
* @return a new <tt>UsernameAttribute</tt> instance
|
||||||
* @return newly created UsernameAttribute
|
|
||||||
*/
|
*/
|
||||||
public static UsernameAttribute createUsernameAttribute(String username)
|
public static UsernameAttribute createUsernameAttribute(String username)
|
||||||
{
|
{
|
||||||
UsernameAttribute attribute = new UsernameAttribute();
|
UsernameAttribute attribute = new UsernameAttribute();
|
||||||
|
|
||||||
attribute.setUsername(username.getBytes());
|
try
|
||||||
|
{
|
||||||
|
attribute.setUsername(username.getBytes("UTF-8"));
|
||||||
|
}
|
||||||
|
catch (UnsupportedEncodingException ueex)
|
||||||
|
{
|
||||||
|
throw new UndeclaredThrowableException(ueex);
|
||||||
|
}
|
||||||
return attribute;
|
return attribute;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -345,8 +354,8 @@ public class AttributeFactory
|
|||||||
String username)
|
String username)
|
||||||
{
|
{
|
||||||
MessageIntegrityAttribute attribute = new MessageIntegrityAttribute();
|
MessageIntegrityAttribute attribute = new MessageIntegrityAttribute();
|
||||||
attribute.setUsername(username);
|
|
||||||
|
|
||||||
|
attribute.setUsername(username);
|
||||||
return attribute;
|
return attribute;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -162,14 +162,15 @@ public class MessageIntegrityAttribute
|
|||||||
throws IllegalArgumentException
|
throws IllegalArgumentException
|
||||||
{
|
{
|
||||||
byte[] hmac;
|
byte[] hmac;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// get an HMAC-SHA1 key from the raw key bytes
|
// get an HMAC-SHA1 key from the raw key bytes
|
||||||
SecretKeySpec signingKey
|
SecretKeySpec signingKey
|
||||||
= new SecretKeySpec(key, HMAC_SHA1_ALGORITHM);
|
= new SecretKeySpec(key, HMAC_SHA1_ALGORITHM);
|
||||||
|
|
||||||
// get an HMAC-SHA1 Mac instance and initialize it with the key
|
// get an HMAC-SHA1 Mac instance and initialize it with the key
|
||||||
Mac mac = Mac.getInstance(HMAC_SHA1_ALGORITHM);
|
Mac mac = Mac.getInstance(HMAC_SHA1_ALGORITHM);
|
||||||
|
|
||||||
mac.init(signingKey);
|
mac.init(signingKey);
|
||||||
|
|
||||||
// compute the hmac on input data bytes
|
// compute the hmac on input data bytes
|
||||||
@ -179,7 +180,6 @@ public class MessageIntegrityAttribute
|
|||||||
//so we'd need to create an array that only contains what we
|
//so we'd need to create an array that only contains what we
|
||||||
//actually need to work with.
|
//actually need to work with.
|
||||||
System.arraycopy(message, offset, macInput, 0, length);
|
System.arraycopy(message, offset, macInput, 0, length);
|
||||||
|
|
||||||
hmac = mac.doFinal(macInput);
|
hmac = mac.doFinal(macInput);
|
||||||
}
|
}
|
||||||
catch (Exception exc)
|
catch (Exception exc)
|
||||||
@ -187,7 +187,6 @@ public class MessageIntegrityAttribute
|
|||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"Could not create HMAC-SHA1 request encoding: ", exc);
|
"Could not create HMAC-SHA1 request encoding: ", exc);
|
||||||
}
|
}
|
||||||
|
|
||||||
return hmac;
|
return hmac;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -74,7 +74,7 @@ public abstract class Candidate
|
|||||||
* however (that is when running a more recent JVM) we will reflect it in
|
* however (that is when running a more recent JVM) we will reflect it in
|
||||||
* this property.
|
* this property.
|
||||||
*/
|
*/
|
||||||
private boolean isVirtual = false;
|
private boolean virtual = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The component that this candidate was created for. Every candidate is
|
* The component that this candidate was created for. Every candidate is
|
||||||
@ -461,7 +461,7 @@ public abstract class Candidate
|
|||||||
*/
|
*/
|
||||||
public boolean isVirtual()
|
public boolean isVirtual()
|
||||||
{
|
{
|
||||||
return isVirtual;
|
return virtual;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -478,9 +478,9 @@ public abstract class Candidate
|
|||||||
* address associated with this <tt>Candidate</tt> comes from a virtual
|
* address associated with this <tt>Candidate</tt> comes from a virtual
|
||||||
* interface and <tt>false</tt> if otherwise.
|
* interface and <tt>false</tt> if otherwise.
|
||||||
*/
|
*/
|
||||||
public void setVirtual(boolean isVirtual)
|
public void setVirtual(boolean virtual)
|
||||||
{
|
{
|
||||||
this.isVirtual = isVirtual;
|
this.virtual = virtual;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -135,7 +135,7 @@ public class CandidatePair
|
|||||||
*/
|
*/
|
||||||
protected void setLocalCandidate( LocalCandidate localCnd)
|
protected void setLocalCandidate( LocalCandidate localCnd)
|
||||||
{
|
{
|
||||||
this.localCandidate = localCnd;;
|
this.localCandidate = localCnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -156,7 +156,7 @@ public class CandidatePair
|
|||||||
*/
|
*/
|
||||||
protected void setRemoteCandidate( Candidate remoteCnd)
|
protected void setRemoteCandidate( Candidate remoteCnd)
|
||||||
{
|
{
|
||||||
this.remoteCandidate = remoteCnd;;
|
this.remoteCandidate = remoteCnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user