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

Jean-Noel Rouvignac
06.08.2013 5f57c0e25899bbe8f02d43afe1d9ffc043d0d44c
opendj-sdk/opends/src/server/org/opends/server/replication/server/changelog/je/DraftCNData.java
@@ -31,7 +31,7 @@
import org.opends.messages.Message;
import org.opends.server.replication.common.CSN;
import org.opends.server.replication.server.changelog.api.CNIndexData;
import org.opends.server.replication.server.changelog.api.CNIndexRecord;
import org.opends.server.replication.server.changelog.api.ChangelogException;
import com.sleepycat.je.DatabaseEntry;
@@ -48,7 +48,7 @@
  private static final long serialVersionUID = 1L;
  private long changeNumber;
  private CNIndexData cnIndexData;
  private CNIndexRecord record;
  /**
   * Creates a record to be stored in the DraftCNDB.
@@ -84,27 +84,27 @@
  public DraftCNData(long changeNumber, byte[] data) throws ChangelogException
  {
    this.changeNumber = changeNumber;
    this.cnIndexData = decodeData(changeNumber, data);
    this.record = decodeData(changeNumber, data);
  }
  /**
   * Decode and returns a {@link CNIndexData} record.
   * Decode and returns a {@link CNIndexRecord}.
   *
   * @param changeNumber
   * @param data
   *          the provided byte array.
   * @return the decoded {@link CNIndexData} record
   * @return the decoded {@link CNIndexRecord}
   * @throws ChangelogException
   *           when a problem occurs.
   */
  private CNIndexData decodeData(long changeNumber, byte[] data)
  private CNIndexRecord decodeData(long changeNumber, byte[] data)
      throws ChangelogException
  {
    try
    {
      String stringData = new String(data, "UTF-8");
      String[] str = stringData.split(FIELD_SEPARATOR, 3);
      return new CNIndexData(changeNumber, str[0], str[1], new CSN(str[2]));
      return new CNIndexRecord(changeNumber, str[0], str[1], new CSN(str[2]));
    }
    catch (UnsupportedEncodingException e)
    {
@@ -115,17 +115,17 @@
  }
  /**
   * Getter for the decoded {@link CNIndexData} record.
   * Getter for the decoded record.
   *
   * @return the CNIndexData record.
   * @return the {@link CNIndexRecord} record.
   * @throws ChangelogException
   *           when a problem occurs.
   */
  public CNIndexData getCNIndexData() throws ChangelogException
  public CNIndexRecord getRecord() throws ChangelogException
  {
    if (cnIndexData == null)
      cnIndexData = decodeData(changeNumber, getData());
    return cnIndexData;
    if (record == null)
      record = decodeData(changeNumber, getData());
    return record;
  }
  /**
@@ -135,7 +135,7 @@
  @Override
  public String toString()
  {
    return "DraftCNData : [" + cnIndexData + "]";
    return "DraftCNData : [" + record + "]";
  }
}