Skip to content
Snippets Groups Projects
Commit 735e50ea authored by Jeff Burke's avatar Jeff Burke
Browse files

S1738: update User equal method

parent 0a1c9d2b
No related branches found
No related tags found
No related merge requests found
...@@ -74,6 +74,8 @@ import java.util.Set; ...@@ -74,6 +74,8 @@ import java.util.Set;
import ca.nrc.cadc.auth.AuthenticationUtil; import ca.nrc.cadc.auth.AuthenticationUtil;
import javax.security.auth.x500.X500Principal;
public class User<T extends Principal> public class User<T extends Principal>
{ {
...@@ -133,7 +135,18 @@ public class User<T extends Principal> ...@@ -133,7 +135,18 @@ public class User<T extends Principal>
return false; return false;
} }
User other = (User) obj; User other = (User) obj;
return AuthenticationUtil.equals(userID, other.userID); if (userID instanceof X500Principal)
{
return AuthenticationUtil.equals(userID, other.userID);
}
else
{
if (!userID.equals(other.userID))
{
return false;
}
return true;
}
} }
@Override @Override
......
...@@ -174,8 +174,6 @@ public class GroupReaderWriterTest ...@@ -174,8 +174,6 @@ public class GroupReaderWriterTest
StringBuilder xml = new StringBuilder(); StringBuilder xml = new StringBuilder();
GroupWriter.write(expected, xml); GroupWriter.write(expected, xml);
assertFalse(xml.toString().isEmpty()); assertFalse(xml.toString().isEmpty());
System.out.println(xml.toString());
Group actual = GroupReader.read(xml.toString()); Group actual = GroupReader.read(xml.toString());
assertNotNull(actual); assertNotNull(actual);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment