Skip to content

Commit

Permalink
[DS-1569] Don't try to emit a password if there is none.
Browse files Browse the repository at this point in the history
Issue #DS-1569 - RoleDisseminator fails to check for possible null password
  • Loading branch information
mwoodiupui committed Jun 4, 2013
1 parent 556352f commit 263613e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -479,19 +479,25 @@ private void writeEPerson(EPerson eperson, XMLStreamWriter writer,
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())
Expand Down
2 changes: 1 addition & 1 deletion dspace-api/src/main/java/org/dspace/eperson/EPerson.java
Original file line number Diff line number Diff line change
Expand Up @@ -905,7 +905,7 @@ public void setPasswordHash(PasswordHash password)
/**
* 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()
{
Expand Down

0 comments on commit 263613e

Please sign in to comment.