Merged branch 'jetty-9.3.x' into 'jetty-9.4.x'.

This commit is contained in:
Simone Bordet 2017-05-18 21:12:29 +02:00
commit c09a78adae
1 changed files with 14 additions and 4 deletions

View File

@ -96,10 +96,15 @@ public abstract class Credential implements Serializable
{
if (s1 == s2)
return true;
if (s1 == null || s2 == null || s1.length() != s2.length())
if (s1 == null || s2 == null)
return false;
boolean result = true;
for (int i = 0; i < s1.length(); i++)
int l1 = s1.length();
int l2 = s2.length();
if (l1 != l2)
result = false;
int l = Math.min(l1, l2);
for (int i = 0; i < l; ++i)
result &= s1.charAt(i) == s2.charAt(i);
return result;
}
@ -115,10 +120,15 @@ public abstract class Credential implements Serializable
{
if (b1 == b2)
return true;
if (b1 == null || b2 == null || b1.length != b2.length)
if (b1 == null || b2 == null)
return false;
boolean result = true;
for (int i = 0; i < b1.length; i++)
int l1 = b1.length;
int l2 = b2.length;
if (l1 != l2)
result = false;
int l = Math.min(l1, l2);
for (int i = 0; i < l; ++i)
result &= b1[i] == b2[i];
return result;
}