You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@bookkeeper.apache.org by GitBox <gi...@apache.org> on 2018/04/05 17:57:17 UTC

[GitHub] sijie commented on a change in pull request #1318: MockLedgerHandle duplicates LedgerEntries on read

sijie commented on a change in pull request #1318: MockLedgerHandle duplicates LedgerEntries on read
URL: https://github.com/apache/bookkeeper/pull/1318#discussion_r179548960
 
 

 ##########
 File path: bookkeeper-server/src/test/java/org/apache/bookkeeper/client/MockLedgerHandle.java
 ##########
 @@ -108,7 +108,7 @@ public void run() {
                 final Queue<LedgerEntry> seq = new ArrayDeque<LedgerEntry>();
                 long entryId = firstEntry;
                 while (entryId <= lastEntry && entryId < entries.size()) {
-                    seq.add(new LedgerEntry(entries.get((int) entryId++)));
+                    seq.add(new LedgerEntry(entries.get((int) entryId++).duplicate()));
 
 Review comment:
   `LedgerEntryImpl` is a new api implementation, we are converting it to the legacy "LedgerEntry" implementation. so better to written as following:
   
   ```
   try (LedgerEntryImpl duplicatedEntry = entries.get((int) entryId++).duplicate()) {
      seq.add(new LedgerEntry(duplicatedEntry));
   }
   
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services