cshannon commented on code in PR #1386:
URL: https://github.com/apache/activemq/pull/1386#discussion_r1941567695


##########
activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/MultiKahaDBTransactionStore.java:
##########
@@ -427,15 +427,16 @@ private void recoverPendingLocalTransactions() throws 
IOException {
     }
 
     public JournalCommand<?> load(Location location) throws IOException {
-        DataByteArrayInputStream is = new 
DataByteArrayInputStream(journal.read(location));
-        byte readByte = is.readByte();
-        KahaEntryType type = KahaEntryType.valueOf(readByte);
-        if (type == null) {
-            throw new IOException("Could not load journal record. Invalid 
location: " + location);
-        }
-        JournalCommand<?> message = (JournalCommand<?>) type.createMessage();
-        message.mergeFramed(is);
-        return message;
+        try(DataByteArrayInputStream is = new 
DataByteArrayInputStream(journal.read(location))) {

Review Comment:
   Do we actually want to close this? We don't close it in regular KahadDB and 
the javadocs for DataByteArrayInputStream can be used more than once so I am 
wondering if there will be any unintentional side effects or if this should 
have always been closed after loading.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: gitbox-unsubscr...@activemq.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@activemq.apache.org
For additional commands, e-mail: gitbox-h...@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact


Reply via email to