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

Valery Kharseko
10 hours ago e24c2780b6d44c7e5d386e70a1fb3346149ccdc9
opendj-server-legacy/src/main/java/org/opends/server/replication/common/CSN.java
@@ -20,6 +20,8 @@
import java.io.Serializable;
import java.util.Date;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizedIllegalArgumentException;
import org.forgerock.opendj.ldap.ByteSequence;
import org.forgerock.opendj.ldap.ByteSequenceReader;
import org.forgerock.opendj.ldap.ByteString;
@@ -72,6 +74,8 @@
   * @param s
   *          The string to be parsed.
   * @return The parsed CSN.
   * @throws LocalizedIllegalArgumentException
   *           If the provided string is not a valid {@link #toString()} representation of a CSN
   * @see #toString()
   */
  public static CSN valueOf(String s)
@@ -102,17 +106,26 @@
   *
   * @param str
   *          the string from which to create a {@link CSN}
   * @throws LocalizedIllegalArgumentException
   *           If the provided string is not a valid {@link #toString()} representation of a CSN
   */
  public CSN(String str)
  {
    String temp = str.substring(0, 16);
    timeStamp = Long.parseLong(temp, 16);
    if (str == null || str.length() < STRING_ENCODING_LENGTH)
    {
      throw new LocalizedIllegalArgumentException(LocalizableMessage.raw("Invalid CSN: \"%s\"", str));
    }
    temp = str.substring(16, 20);
    serverId = Integer.parseInt(temp, 16);
    temp = str.substring(20, 28);
    seqnum = Integer.parseInt(temp, 16);
    try
    {
      timeStamp = Long.parseLong(str.substring(0, 16), 16);
      serverId = Integer.parseInt(str.substring(16, 20), 16);
      seqnum = Integer.parseInt(str.substring(20, STRING_ENCODING_LENGTH), 16);
    }
    catch (NumberFormatException e)
    {
      throw new LocalizedIllegalArgumentException(LocalizableMessage.raw("Invalid CSN: \"%s\"", str));
    }
  }
  /**