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

Jean-Noel Rouvignac
13.33.2015 c69031ec843ebd291b5125e66520610138baccc2
Fixed bugs in TracedStorage.

TracedStorage.java:
In read() and write(), do not execute twice read / write operation.
In hex(), fixed a NPE
1 files modified
16 ■■■■■ changed files
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/TracedStorage.java 16 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/TracedStorage.java
@@ -279,18 +279,19 @@
  @Override
  public <T> T read(final ReadOperation<T> readOperation) throws Exception
  {
    ReadOperation<T> op = readOperation;
    if (logger.isTraceEnabled())
    {
      return storage.read(new ReadOperation<T>()
      op = new ReadOperation<T>()
      {
        @Override
        public T run(final ReadableStorage txn) throws Exception
        {
          return readOperation.run(new TracedReadableStorage(txn));
        }
      });
      };
    }
    return storage.read(readOperation);
    return storage.read(op);
  }
  @Override
@@ -324,22 +325,23 @@
  @Override
  public void write(final WriteOperation writeOperation) throws Exception
  {
    WriteOperation op = writeOperation;
    if (logger.isTraceEnabled())
    {
      storage.write(new WriteOperation()
      op = new WriteOperation()
      {
        @Override
        public void run(final WriteableStorage txn) throws Exception
        {
          writeOperation.run(new TracedWriteableStorage(txn));
        }
      });
      };
    }
    storage.write(writeOperation);
    storage.write(op);
  }
  private String hex(final ByteSequence bytes)
  {
    return bytes.toByteString().toHexString();
    return bytes != null ? bytes.toByteString().toHexString() : "null";
  }
}