mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

neil_a_wilson
01.26.2007 96d851d150d24fafbcc8b2f695d4bdee6cbd7173
opends/src/server/org/opends/server/controls/PasswordExpiredControl.java
@@ -28,6 +28,7 @@
import org.opends.server.protocols.asn1.ASN1OctetString;
import org.opends.server.protocols.ldap.LDAPResultCode;
import org.opends.server.types.Control;
import org.opends.server.types.LDAPException;
@@ -39,23 +40,20 @@
/**
 * This class implements the Netscape password expired control. This is a very
 * simple control because it does not have a value.
 * This class implements the Netscape password expired control.  The value for
 * this control should be a string that indicates the length of time until the
 * password expires, but because it is already expired it will always be "0".
 */
public class PasswordExpiredControl
       extends Control
{
  /**
   * Creates a new instance of the password expired control with the default
   * settings.
   */
  public PasswordExpiredControl()
  {
    super(OID_NS_PASSWORD_EXPIRED, false);
    super(OID_NS_PASSWORD_EXPIRED, false, new ASN1OctetString("0"));
  }
@@ -70,8 +68,7 @@
   */
  public PasswordExpiredControl(String oid, boolean isCritical)
  {
    super(oid, isCritical);
    super(oid, isCritical, new ASN1OctetString("0"));
  }
@@ -93,12 +90,19 @@
  {
    if (control.hasValue())
    {
      int    msgID   = MSGID_PWEXPIRED_CONTROL_HAS_VALUE;
      String message = getMessage(msgID);
      throw new LDAPException(LDAPResultCode.PROTOCOL_ERROR, msgID, message);
      String valueStr = control.getValue().stringValue();
      try
      {
        Integer.parseInt(valueStr);
      }
      catch (Exception e)
      {
        int    msgID   = MSGID_PWEXPIRED_CONTROL_INVALID_VALUE;
        String message = getMessage(msgID);
        throw new LDAPException(LDAPResultCode.PROTOCOL_ERROR, msgID, message);
      }
    }
    return new PasswordExpiredControl(control.getOID(), control.isCritical());
  }