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

neil_a_wilson
08.34.2007 3dca514255b97388b4deeffa0900fdd1107c35de
Update the UTC Time attribute syntax so that it correctly uses two-digit years
instead of four-digit years. Also, update other parts of the server that made
reference to UTC times when they really meant "YYYYMMDDhhmmssZ" to the term
"GMT" instead of "UTC" so there is no confusion about whether the year would be
expressed in four digits or two.

OpenDS Issue Number: 637
17 files modified
413 ■■■■■ changed files
opends/src/server/org/opends/server/api/ClientConnection.java 2 ●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/backends/MonitorBackend.java 2 ●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/backends/task/Task.java 10 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/core/DirectoryServer.java 2 ●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/extensions/ConfigFileHandler.java 2 ●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/loggers/DirectoryFileHandler.java 2 ●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/loggers/TimeStampNaming.java 2 ●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/plugins/LastModPlugin.java 6 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/plugins/profiler/ProfilerPlugin.java 4 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/schema/UTCTimeSyntax.java 264 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/tasks/BackupTask.java 4 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/tools/BackUpDB.java 2 ●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/tools/StopDS.java 2 ●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/types/BackupInfo.java 4 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/util/ServerConstants.java 16 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/util/TimeThread.java 24 ●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/UTCTimeSyntaxTest.java 65 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/api/ClientConnection.java
@@ -129,7 +129,7 @@
  protected ClientConnection()
  {
    connectTime        = TimeThread.getTime();
    connectTimeString  = TimeThread.getUTCTime();
    connectTimeString  = TimeThread.getGMTTime();
    authenticationInfo = new AuthenticationInfo();
    saslAuthState      = null;
    bindInProgress     = false;
opends/src/server/org/opends/server/backends/MonitorBackend.java
@@ -549,7 +549,7 @@
    // Add the current time.
    Attribute currentTimeAttr =
         createAttribute(ATTR_CURRENT_TIME, ATTR_CURRENT_TIME_LC,
                         TimeThread.getUTCTime());
                         TimeThread.getGMTTime());
    ArrayList<Attribute> currentTimeList = new ArrayList<Attribute>(1);
    currentTimeList.add(currentTimeAttr);
    monitorUserAttrs.put(currentTimeAttr.getAttributeType(), currentTimeList);
opends/src/server/org/opends/server/backends/task/Task.java
@@ -202,7 +202,7 @@
      SimpleDateFormat dateFormat;
      if (timeString.endsWith("Z"))
      {
        dateFormat = new SimpleDateFormat(DATE_FORMAT_UTC_TIME);
        dateFormat = new SimpleDateFormat(DATE_FORMAT_GMT_TIME);
        dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
      }
      else
@@ -236,7 +236,7 @@
      SimpleDateFormat dateFormat;
      if (timeString.endsWith("Z"))
      {
        dateFormat = new SimpleDateFormat(DATE_FORMAT_UTC_TIME);
        dateFormat = new SimpleDateFormat(DATE_FORMAT_GMT_TIME);
        dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
      }
      else
@@ -270,7 +270,7 @@
      SimpleDateFormat dateFormat;
      if (timeString.endsWith("Z"))
      {
        dateFormat = new SimpleDateFormat(DATE_FORMAT_UTC_TIME);
        dateFormat = new SimpleDateFormat(DATE_FORMAT_GMT_TIME);
        dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
      }
      else
@@ -629,7 +629,7 @@
                    ATTR_TASK_ACTUAL_START_TIME);
      }
      SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT_UTC_TIME);
      SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT_GMT_TIME);
      dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
      Date d = new Date(actualStartTime);
      ASN1OctetString s = new ASN1OctetString(dateFormat.format(d));
@@ -689,7 +689,7 @@
             DirectoryServer.getDefaultAttributeType(ATTR_TASK_COMPLETION_TIME);
      }
      SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT_UTC_TIME);
      SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT_GMT_TIME);
      dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
      Date d = new Date(completionTime);
      ASN1OctetString s = new ASN1OctetString(dateFormat.format(d));
opends/src/server/org/opends/server/core/DirectoryServer.java
@@ -1111,7 +1111,7 @@
      // Mark the current time as the start time and indicate that the server is
      // now running.
      startUpTime  = System.currentTimeMillis();
      startTimeUTC = TimeThread.getUTCTime();
      startTimeUTC = TimeThread.getGMTTime();
      isRunning    = true;
      int    msgID   = MSGID_DIRECTORY_SERVER_STARTED;
opends/src/server/org/opends/server/extensions/ConfigFileHandler.java
@@ -1769,7 +1769,7 @@
      File archiveFile;
      try
      {
        String timestamp = TimeThread.getUTCTime();
        String timestamp = TimeThread.getGMTTime();
        archiveFile = new File(archiveDirectory, "config-" + timestamp + ".gz");
        if (archiveFile.exists())
        {
opends/src/server/org/opends/server/loggers/DirectoryFileHandler.java
@@ -356,7 +356,7 @@
   */
  private String getFileExtension()
  {
    return TimeThread.getUTCTime();
    return TimeThread.getGMTTime();
  }
opends/src/server/org/opends/server/loggers/TimeStampNaming.java
@@ -64,6 +64,6 @@
   */
  public File getNextName()
  {
    return new File(file + "." + TimeThread.getUTCTime());
    return new File(file + "." + TimeThread.getGMTTime());
  }
}
opends/src/server/org/opends/server/plugins/LastModPlugin.java
@@ -177,7 +177,7 @@
    LinkedHashSet<AttributeValue> timeValues =
         new LinkedHashSet<AttributeValue>(1);
    timeValues.add(new AttributeValue(createTimestampType,
                                      ByteStringFactory.create(getUTCTime())));
                                      ByteStringFactory.create(getGMTTime())));
    Attribute timeAttr = new Attribute(createTimestampType,
                                       OP_ATTR_CREATE_TIMESTAMP, timeValues);
@@ -240,7 +240,7 @@
    LinkedHashSet<AttributeValue> timeValues =
         new LinkedHashSet<AttributeValue>(1);
    timeValues.add(new AttributeValue(modifyTimestampType,
                                      ByteStringFactory.create(getUTCTime())));
                                      ByteStringFactory.create(getGMTTime())));
    Attribute timeAttr = new Attribute(modifyTimestampType,
                                       OP_ATTR_MODIFY_TIMESTAMP, timeValues);
@@ -302,7 +302,7 @@
    LinkedHashSet<AttributeValue> timeValues =
         new LinkedHashSet<AttributeValue>(1);
    timeValues.add(new AttributeValue(modifyTimestampType,
                                      ByteStringFactory.create(getUTCTime())));
                                      ByteStringFactory.create(getGMTTime())));
    Attribute timeAttr = new Attribute(modifyTimestampType,
                                       OP_ATTR_MODIFY_TIMESTAMP, timeValues);
opends/src/server/org/opends/server/plugins/profiler/ProfilerPlugin.java
@@ -339,7 +339,7 @@
        profilerThread.stopProfiling();
        String filename = profileDirectory + File.separator + "profile." +
                          TimeThread.getUTCTime();
                          TimeThread.getGMTTime();
        try
        {
          profilerThread.writeCaptureData(filename);
@@ -751,7 +751,7 @@
                }
                String filename = profileDirectory + File.separator +
                                  "profile." + TimeThread.getUTCTime();
                                  "profile." + TimeThread.getGMTTime();
                try
                {
opends/src/server/org/opends/server/schema/UTCTimeSyntax.java
@@ -71,9 +71,6 @@
public class UTCTimeSyntax
       extends AttributeSyntax
{
  /**
   * The lock that will be used to provide threadsafe access to the date
   * formatter.
@@ -125,7 +122,6 @@
  public UTCTimeSyntax()
  {
    super();
  }
@@ -289,7 +285,7 @@
    // "YYYYMMDDhhmmZ", which is the shortest allowed value.
    String valueString = value.stringValue().toUpperCase();
    int    length      = valueString.length();
    if (length < 13)
    if (length < 11)
    {
      int    msgID   = MSGID_ATTR_SYNTAX_UTC_TIME_TOO_SHORT;
      String message = getMessage(msgID, valueString);
@@ -298,9 +294,9 @@
    }
    // The first four characters are the century and year, and they must be
    // numeric digits between 0 and 9.
    for (int i=0; i < 4; i++)
    // The first two characters are the year, and they must be numeric digits
    // between 0 and 9.
    for (int i=0; i < 2; i++)
    {
      switch (valueString.charAt(i))
      {
@@ -328,8 +324,8 @@
    // The next two characters are the month, and they must form the string
    // representation of an integer between 01 and 12.
    char m1 = valueString.charAt(4);
    char m2 = valueString.charAt(5);
    char m1 = valueString.charAt(2);
    char m2 = valueString.charAt(3);
    switch (m1)
    {
      case '0':
@@ -350,7 +346,7 @@
          default:
            int    msgID   = MSGID_ATTR_SYNTAX_UTC_TIME_INVALID_MONTH;
            String message = getMessage(msgID, valueString,
                                        valueString.substring(4, 6));
                                        valueString.substring(2, 4));
            invalidReason.append(message);
            return false;
        }
@@ -367,7 +363,7 @@
          default:
            int    msgID   = MSGID_ATTR_SYNTAX_UTC_TIME_INVALID_MONTH;
            String message = getMessage(msgID, valueString,
                                        valueString.substring(4, 6));
                                        valueString.substring(2, 4));
            invalidReason.append(message);
            return false;
        }
@@ -375,7 +371,7 @@
      default:
        int    msgID   = MSGID_ATTR_SYNTAX_UTC_TIME_INVALID_MONTH;
        String message = getMessage(msgID, valueString,
                                    valueString.substring(4, 6));
                                    valueString.substring(2, 4));
        invalidReason.append(message);
        return false;
    }
@@ -386,8 +382,8 @@
    // This doesn't do any validation against the year or month, so it will
    // allow dates like April 31, or February 29 in a non-leap year, but we'll
    // let those slide.
    char d1 = valueString.charAt(6);
    char d2 = valueString.charAt(7);
    char d1 = valueString.charAt(4);
    char d2 = valueString.charAt(5);
    switch (d1)
    {
      case '0':
@@ -408,7 +404,7 @@
          default:
            int    msgID   = MSGID_ATTR_SYNTAX_UTC_TIME_INVALID_DAY;
            String message = getMessage(msgID, valueString,
                                        valueString.substring(6, 8));
                                        valueString.substring(4, 6));
            invalidReason.append(message);
            return false;
        }
@@ -434,7 +430,7 @@
          default:
            int    msgID   = MSGID_ATTR_SYNTAX_UTC_TIME_INVALID_DAY;
            String message = getMessage(msgID, valueString,
                                        valueString.substring(6, 8));
                                        valueString.substring(4, 6));
            invalidReason.append(message);
            return false;
        }
@@ -450,7 +446,7 @@
          default:
            int    msgID   = MSGID_ATTR_SYNTAX_UTC_TIME_INVALID_DAY;
            String message = getMessage(msgID, valueString,
                                        valueString.substring(6, 8));
                                        valueString.substring(4, 6));
            invalidReason.append(message);
            return false;
        }
@@ -458,7 +454,7 @@
      default:
        int    msgID   = MSGID_ATTR_SYNTAX_UTC_TIME_INVALID_DAY;
        String message = getMessage(msgID, valueString,
                                    valueString.substring(6, 8));
                                    valueString.substring(4, 6));
        invalidReason.append(message);
        return false;
    }
@@ -466,8 +462,8 @@
    // The next two characters must be the hour, and they must form the string
    // representation of an integer between 00 and 23.
    char h1 = valueString.charAt(8);
    char h2 = valueString.charAt(9);
    char h1 = valueString.charAt(6);
    char h2 = valueString.charAt(7);
    switch (h1)
    {
      case '0':
@@ -490,7 +486,7 @@
          default:
            int    msgID   = MSGID_ATTR_SYNTAX_UTC_TIME_INVALID_HOUR;
            String message = getMessage(msgID, valueString,
                                        valueString.substring(8, 10));
                                        valueString.substring(6, 8));
            invalidReason.append(message);
            return false;
        }
@@ -508,7 +504,7 @@
          default:
            int    msgID   = MSGID_ATTR_SYNTAX_UTC_TIME_INVALID_HOUR;
            String message = getMessage(msgID, valueString,
                                        valueString.substring(8, 10));
                                        valueString.substring(6, 8));
            invalidReason.append(message);
            return false;
        }
@@ -516,7 +512,7 @@
      default:
        int    msgID   = MSGID_ATTR_SYNTAX_UTC_TIME_INVALID_HOUR;
        String message = getMessage(msgID, valueString,
                                    valueString.substring(8, 10));
                                    valueString.substring(6, 8));
        invalidReason.append(message);
        return false;
    }
@@ -524,7 +520,7 @@
    // Next, there should be two digits comprising an integer between 00 and 59
    // for the minute.
    m1 = valueString.charAt(10);
    m1 = valueString.charAt(8);
    switch (m1)
    {
      case '0':
@@ -535,10 +531,65 @@
      case '5':
        // There must be at least two more characters, and the next one must
        // be a digit between 0 and 9.
        if (length < 11)
        {
          int    msgID   = MSGID_ATTR_SYNTAX_UTC_TIME_INVALID_CHAR;
          String message = getMessage(msgID, valueString, m1, 8);
          invalidReason.append(message);
          return false;
        }
        switch (valueString.charAt(9))
        {
          case '0':
          case '1':
          case '2':
          case '3':
          case '4':
          case '5':
          case '6':
          case '7':
          case '8':
          case '9':
            // These are all fine.
            break;
          default:
            int    msgID   = MSGID_ATTR_SYNTAX_UTC_TIME_INVALID_MINUTE;
            String message = getMessage(msgID, valueString,
                                        valueString.substring(8, 10));
            invalidReason.append(message);
            return false;
        }
        break;
      default:
        int    msgID   = MSGID_ATTR_SYNTAX_UTC_TIME_INVALID_CHAR;
        String message = getMessage(msgID, valueString, m1, 8);
        invalidReason.append(message);
        return false;
    }
    // Next, there should be either two digits comprising an integer between 00
    // and 60 (for the second, including a possible leap second), a letter 'Z'
    // (for the UTC specifier), or a plus or minus sign followed by four digits
    // (for the UTC offset).
    char s1 = valueString.charAt(10);
    switch (s1)
    {
      case '0':
      case '1':
      case '2':
      case '3':
      case '4':
      case '5':
        // There must be at least two more characters, and the next one must
        // be a digit between 0 and 9.
        if (length < 13)
        {
          int    msgID   = MSGID_ATTR_SYNTAX_UTC_TIME_INVALID_CHAR;
          String message = getMessage(msgID, valueString, m1, 10);
          String message = getMessage(msgID, valueString, s1, 10);
          invalidReason.append(message);
          return false;
        }
@@ -558,64 +609,9 @@
            // These are all fine.
            break;
          default:
            int    msgID   = MSGID_ATTR_SYNTAX_UTC_TIME_INVALID_MINUTE;
            String message = getMessage(msgID, valueString,
                                        valueString.substring(10, 12));
            invalidReason.append(message);
            return false;
        }
        break;
      default:
        int    msgID   = MSGID_ATTR_SYNTAX_UTC_TIME_INVALID_CHAR;
        String message = getMessage(msgID, valueString, m1, 10);
        invalidReason.append(message);
        return false;
    }
    // Next, there should be either two digits comprising an integer between 00
    // and 60 (for the second, including a possible leap second), a letter 'Z'
    // (for the UTC specifier), or a plus or minus sign followed by four digits
    // (for the UTC offset).
    char s1 = valueString.charAt(12);
    switch (s1)
    {
      case '0':
      case '1':
      case '2':
      case '3':
      case '4':
      case '5':
        // There must be at least two more characters, and the next one must
        // be a digit between 0 and 9.
        if (length < 15)
        {
          int    msgID   = MSGID_ATTR_SYNTAX_UTC_TIME_INVALID_CHAR;
          String message = getMessage(msgID, valueString, s1, 12);
          invalidReason.append(message);
          return false;
        }
        switch (valueString.charAt(13))
        {
          case '0':
          case '1':
          case '2':
          case '3':
          case '4':
          case '5':
          case '6':
          case '7':
          case '8':
          case '9':
            // These are all fine.
            break;
          default:
            int    msgID   = MSGID_ATTR_SYNTAX_UTC_TIME_INVALID_SECOND;
            String message = getMessage(msgID, valueString,
                                        valueString.substring(12, 14));
                                        valueString.substring(10, 12));
            invalidReason.append(message);
            return false;
        }
@@ -624,19 +620,19 @@
      case '6':
        // There must be at least two more characters and the next one must be
        // a 0.
        if (length < 15)
        if (length < 13)
        {
          int    msgID   = MSGID_ATTR_SYNTAX_UTC_TIME_INVALID_CHAR;
          String message = getMessage(msgID, valueString, s1, 12);
          String message = getMessage(msgID, valueString, s1, 10);
          invalidReason.append(message);
          return false;
        }
        if (valueString.charAt(13) != '0')
        if (valueString.charAt(11) != '0')
        {
          int    msgID   = MSGID_ATTR_SYNTAX_UTC_TIME_INVALID_SECOND;
          String message = getMessage(msgID, valueString,
                                      valueString.substring(12, 14));
                                      valueString.substring(10, 12));
          invalidReason.append(message);
          return false;
        }
@@ -644,6 +640,48 @@
        break;
      case 'Z':
        // This is fine only if we are at the end of the value.
        if (length == 11)
        {
          return true;
        }
        else
        {
          int    msgID   = MSGID_ATTR_SYNTAX_UTC_TIME_INVALID_CHAR;
          String message = getMessage(msgID, valueString, s1, 10);
          invalidReason.append(message);
          return false;
        }
      case '+':
      case '-':
        // These are fine only if there are exactly four more digits that
        // specify a valid offset.
        if (length == 15)
        {
          return hasValidOffset(valueString, 11, invalidReason);
        }
        else
        {
          int    msgID   = MSGID_ATTR_SYNTAX_UTC_TIME_INVALID_CHAR;
          String message = getMessage(msgID, valueString, s1, 10);
          invalidReason.append(message);
          return false;
        }
      default:
        int    msgID   = MSGID_ATTR_SYNTAX_UTC_TIME_INVALID_CHAR;
        String message = getMessage(msgID, valueString, s1, 10);
        invalidReason.append(message);
        return false;
    }
    // The last element should be either a letter 'Z' (for the UTC specifier),
    // or a plus or minus sign followed by four digits (for the UTC offset).
    switch (valueString.charAt(12))
    {
      case 'Z':
        // This is fine only if we are at the end of the value.
        if (length == 13)
        {
          return true;
@@ -651,50 +689,8 @@
        else
        {
          int    msgID   = MSGID_ATTR_SYNTAX_UTC_TIME_INVALID_CHAR;
          String message = getMessage(msgID, valueString, s1, 12);
          invalidReason.append(message);
          return false;
        }
      case '+':
      case '-':
        // These are fine only if there are exactly four more digits that
        // specify a valid offset.
        if (length == 17)
        {
          return hasValidOffset(valueString, 13, invalidReason);
        }
        else
        {
          int    msgID   = MSGID_ATTR_SYNTAX_UTC_TIME_INVALID_CHAR;
          String message = getMessage(msgID, valueString, s1, 12);
          invalidReason.append(message);
          return false;
        }
      default:
        int    msgID   = MSGID_ATTR_SYNTAX_UTC_TIME_INVALID_CHAR;
        String message = getMessage(msgID, valueString, s1, 12);
        invalidReason.append(message);
        return false;
    }
    // The last element should be either a letter 'Z' (for the UTC specifier),
    // or a plus or minus sign followed by four digits (for the UTC offset).
    switch (valueString.charAt(14))
    {
      case 'Z':
        // This is fine only if we are at the end of the value.
        if (length == 15)
        {
          return true;
        }
        else
        {
          int    msgID   = MSGID_ATTR_SYNTAX_UTC_TIME_INVALID_CHAR;
          String message = getMessage(msgID, valueString,
                                      valueString.charAt(14), 14);
                                      valueString.charAt(12), 12);
          invalidReason.append(message);
          return false;
        }
@@ -703,23 +699,23 @@
      case '-':
        // These are fine only if there are four or two more digits that
        // specify a valid offset.
        if ((length == 19) || (length == 17))
        if ((length == 17) || (length == 15))
        {
          return hasValidOffset(valueString, 15, invalidReason);
          return hasValidOffset(valueString, 13, invalidReason);
        }
        else
        {
          int    msgID   = MSGID_ATTR_SYNTAX_UTC_TIME_INVALID_CHAR;
          String message = getMessage(msgID, valueString,
                                      valueString.charAt(14), 14);
                                      valueString.charAt(12), 12);
          invalidReason.append(message);
          return false;
        }
      default:
        int    msgID   = MSGID_ATTR_SYNTAX_UTC_TIME_INVALID_CHAR;
        String message = getMessage(msgID, valueString, valueString.charAt(14),
                                    14);
        String message = getMessage(msgID, valueString, valueString.charAt(12),
                                    12);
        invalidReason.append(message);
        return false;
    }
opends/src/server/org/opends/server/tasks/BackupTask.java
@@ -31,7 +31,7 @@
import static org.opends.server.messages.TaskMessages.*;
import static org.opends.server.messages.ToolMessages.*;
import static org.opends.server.messages.MessageHandler.getMessage;
import static org.opends.server.util.ServerConstants.DATE_FORMAT_UTC_TIME;
import static org.opends.server.util.ServerConstants.DATE_FORMAT_GMT_TIME;
import static org.opends.server.loggers.Error.logError;
import static org.opends.server.util.StaticUtils.stackTraceToSingleLineString;
import static org.opends.server.util.ServerConstants.
@@ -229,7 +229,7 @@
    // If no backup ID was provided, then create one with the current timestamp.
    if (backupID == null)
    {
      SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT_UTC_TIME);
      SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT_GMT_TIME);
      dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
      backupID = dateFormat.format(new Date());
    }
opends/src/server/org/opends/server/tools/BackUpDB.java
@@ -290,7 +290,7 @@
    }
    else
    {
      SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT_UTC_TIME);
      SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT_GMT_TIME);
      dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
      backupID = dateFormat.format(new Date());
    }
opends/src/server/org/opends/server/tools/StopDS.java
@@ -647,7 +647,7 @@
      ArrayList<ASN1OctetString> stopTimeValues =
           new ArrayList<ASN1OctetString>(1);
      SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT_UTC_TIME);
      SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT_GMT_TIME);
      dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
      stopTimeValues.add(new ASN1OctetString(dateFormat.format(stopTime)));
      attributes.add(new LDAPAttribute(ATTR_TASK_SCHEDULED_START_TIME,
opends/src/server/org/opends/server/types/BackupInfo.java
@@ -422,7 +422,7 @@
  {
    LinkedList<String> list       = new LinkedList<String>();
    SimpleDateFormat   dateFormat =
         new SimpleDateFormat(DATE_FORMAT_UTC_TIME);
         new SimpleDateFormat(DATE_FORMAT_GMT_TIME);
    dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
@@ -545,7 +545,7 @@
        else if (name.equals(PROPERTY_BACKUP_DATE))
        {
          SimpleDateFormat dateFormat =
               new SimpleDateFormat(DATE_FORMAT_UTC_TIME);
               new SimpleDateFormat(DATE_FORMAT_GMT_TIME);
          dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
          backupDate = dateFormat.parse(value);
        }
opends/src/server/org/opends/server/util/ServerConstants.java
@@ -88,11 +88,21 @@
  /**
   * The date format string that will be used to construct and parse dates
   * represented using generalized time.  It is assumed that the provided date
   * formatter will be set to UTC.
   * represented using generalized time with a four-digit year.  It is assumed
   * that the provided date formatter will be set to UTC.
   */
  public static final String DATE_FORMAT_GMT_TIME =
       "yyyyMMddHHmmss'Z'";
  /**
   * The date format string that will be used to construct and parse dates
   * represented using generalized time with a two-digit year.  It is assumed
   * that the provided date formatter will be set to UTC.
   */
  public static final String DATE_FORMAT_UTC_TIME =
       "yyyyMMddHHmmss'Z'";
       "yyMMddHHmmss'Z'";
opends/src/server/org/opends/server/util/TimeThread.java
@@ -90,8 +90,8 @@
  // The date formatter that will be used to obtain the local timestamp.
  private static SimpleDateFormat localTimestampFormatter;
  // The date formatter that will be used to obtain the UTC timestamp.
  private static SimpleDateFormat utcTimestampFormatter;
  // The date formatter that will be used to obtain the GMT timestamp.
  private static SimpleDateFormat gmtTimestampFormatter;
  // The timestamp for this time thread in the generalized time format.
  private static String generalizedTime;
@@ -99,8 +99,8 @@
  // The timestamp for this time thread in the local time zone.
  private static String localTimestamp;
  // The timestamp for this time thread in UTC.
  private static String utcTimestamp;
  // The timestamp for this time thread in GMT.
  private static String gmtTimestamp;
@@ -122,8 +122,8 @@
         new SimpleDateFormat(DATE_FORMAT_GENERALIZED_TIME);
    generalizedTimeFormatter.setTimeZone(utcTimeZone);
    utcTimestampFormatter = new SimpleDateFormat(DATE_FORMAT_UTC_TIME);
    utcTimestampFormatter.setTimeZone(utcTimeZone);
    gmtTimestampFormatter = new SimpleDateFormat(DATE_FORMAT_GMT_TIME);
    gmtTimestampFormatter.setTimeZone(utcTimeZone);
    localTimestampFormatter = new SimpleDateFormat(DATE_FORMAT_LOCAL_TIME);
@@ -132,7 +132,7 @@
    time            = date.getTime();
    generalizedTime = generalizedTimeFormatter.format(date);
    localTimestamp  = localTimestampFormatter.format(date);
    utcTimestamp    = utcTimestampFormatter.format(date);
    gmtTimestamp    = gmtTimestampFormatter.format(date);
    hourAndMinute   = (calendar.get(Calendar.HOUR_OF_DAY) * 100) +
                      calendar.get(Calendar.MINUTE);
@@ -156,7 +156,7 @@
        time            = date.getTime();
        generalizedTime = generalizedTimeFormatter.format(date);
        localTimestamp  = localTimestampFormatter.format(date);
        utcTimestamp    = utcTimestampFormatter.format(date);
        gmtTimestamp    = gmtTimestampFormatter.format(date);
        hourAndMinute   = (calendar.get(Calendar.HOUR_OF_DAY) * 100) +
                          calendar.get(Calendar.MINUTE);
@@ -245,14 +245,14 @@
  /**
   * Retrieves a string containing the current time in UTC.  The timestamp will
   * Retrieves a string containing the current time in GMT.  The timestamp will
   * look like "20050101000000Z".
   *
   * @return  A string containing the current time in UTC.
   * @return  A string containing the current time in GMT.
   */
  public static String getUTCTime()
  public static String getGMTTime()
  {
    return utcTimestamp;
    return gmtTimestamp;
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/UTCTimeSyntaxTest.java
@@ -26,8 +26,13 @@
 */
package org.opends.server.schema;
import java.util.Date;
import org.opends.server.api.AttributeSyntax;
import org.opends.server.types.AttributeValue;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import static org.testng.Assert.*;
/**
 * Test the UTCTimeSyntax.
@@ -49,11 +54,7 @@
  public Object[][] createAcceptableValues()
  {
    return new Object [][] {
        // tests for the UTC time syntax. This time syntax only uses 2 digits
        // for the year but it is currently implemented using 4 digits
        // disable the tests for now.
        // see issue 637
        /*
        // tests for the UTC time syntax.
        {"060906135030+01",   true},
        {"0609061350Z",       true},
        {"060906135030Z",     true},
@@ -62,7 +63,8 @@
        {"061231235959Z",     true},
        {"060906135030+0101", true},
        {"060906135030+2359", true},
        */
        {"060906135060+0101", true},
        {"060906135061+0101", false},
        {"060906135030+3359", false},
        {"060906135030+2389", false},
        {"062231235959Z",     false},
@@ -73,7 +75,58 @@
        {"0612-1235959Z",     false},
        {"061231#35959Z",     false},
        {"2006",              false},
        {"062106135030+0101", false},
        {"060A06135030+0101", false},
        {"061A06135030+0101", false},
        {"060936135030+0101", false},
        {"06090A135030+0101", false},
        {"06091A135030+0101", false},
        {"060900135030+0101", false},
        {"060906335030+0101", false},
        {"0609061A5030+0101", false},
        {"0609062A5030+0101", false},
        {"060906137030+0101", false},
        {"060906135A30+0101", false},
        {"060906135", false},
        {"0609061350", false},
        {"060906135070+0101", false},
        {"06090613503A+0101", false},
        {"06090613503", false},
        {"0609061350Z0", false},
        {"0609061350+0", false},
        {"0609061350+000A", false},
        {"0609061350+A00A", false},
        {"060906135030Z0", false},
        {"060906135030+010", false},
        {"060906135030+010A", false},
        {"060906135030+0A01", false},
        {"060906135030+2501", false},
        {"060906135030+0170", false},
        {"060906135030+010A", false},
        {"060906135030+A00A", false},
        {"060906135030Q", false},
        {"060906135030+", false},
    };
  }
  /**
   * Tests the {@code createUTCTimeValue} and {@code decodeUTCTimeValue}
   * methods.
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Test()
  public void testCreateAndDecodeUTCTimeValue()
         throws Exception
  {
    Date d = new Date();
    AttributeValue timeValue = UTCTimeSyntax.createUTCTimeValue(d);
    Date decodedDate = UTCTimeSyntax.decodeUTCTimeValue(timeValue.getValue());
    // UTCTime does not have support for sub-second values, so we need to make
    // sure that the decoded value is within 1000 milliseconds.
    assertTrue(Math.abs(d.getTime() - decodedDate.getTime()) < 1000);
  }
}