[DS-1569] Don't try to emit a password if there is none.

Issue #DS-1569 - RoleDisseminator fails to check for possible null password
This commit is contained in:
Mark H. Wood
2013-06-04 14:38:41 -04:00
parent 556352f105
commit 263613e81b
2 changed files with 17 additions and 11 deletions

View File

@@ -479,19 +479,25 @@ public class RoleDisseminator implements PackageDisseminator
if (emitPassword)
{
PasswordHash password = eperson.getPasswordHash();
if (null != password)
{
writer.writeStartElement(PASSWORD_HASH);
writer.writeStartElement(PASSWORD_HASH);
String algorithm = password.getAlgorithm();
if (null != algorithm)
{
writer.writeAttribute(PASSWORD_DIGEST, algorithm);
}
String algorithm = password.getAlgorithm();
if (null != algorithm)
writer.writeAttribute(PASSWORD_DIGEST, algorithm);
String salt = password.getSaltString();
if (null != salt)
{
writer.writeAttribute(PASSWORD_SALT, salt);
}
String salt = password.getSaltString();
if (null != salt)
writer.writeAttribute(PASSWORD_SALT, salt);
writer.writeCharacters(password.getHashString());
writer.writeEndElement();
writer.writeCharacters(password.getHashString());
writer.writeEndElement();
}
}
if (eperson.canLogIn())

View File

@@ -905,7 +905,7 @@ public class EPerson extends DSpaceObject
/**
* Return the EPerson's password hash.
*
* @return hash of the password
* @return hash of the password, or null on failure (such as no password).
*/
public PasswordHash getPasswordHash()
{