clebertsuconic commented on code in PR #4840:
URL: https://github.com/apache/activemq-artemis/pull/4840#discussion_r1511936965


##########
artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/AMQPLargeMessageReader.java:
##########
@@ -77,39 +74,68 @@ public AMQPLargeMessageReader open() {
    }
 
    @Override
-   public Message readBytes(Delivery delivery) throws Exception {
+   public boolean readBytes(Delivery delivery) throws Exception {
       if (closed) {
          throw new IllegalStateException("AMQP Large Message Reader is closed 
and read cannot proceed");
       }
 
+      serverReceiver.connection.requireInHandler();
+
+      logger.trace("Reading {}", delivery);
+
       final Receiver receiver = ((Receiver) delivery.getLink());
       final ReadableBuffer dataBuffer = receiver.recv();
 
+      final AMQPSessionCallback sessionSPI = 
serverReceiver.getSessionContext().getSessionSPI();
+
       if (currentMessage == null) {
-         final AMQPSessionCallback sessionSPI = 
serverReceiver.getSessionContext().getSessionSPI();
          final long id = sessionSPI.getStorageManager().generateID();
-         currentMessage = new AMQPLargeMessage(id, 
delivery.getMessageFormat(), null,
-                                               
sessionSPI.getCoreMessageObjectPools(),
-                                               sessionSPI.getStorageManager());
+         currentMessage = new AMQPLargeMessage(id, 
delivery.getMessageFormat(), null, sessionSPI.getCoreMessageObjectPools(), 
sessionSPI.getStorageManager());
          currentMessage.parseHeader(dataBuffer);
-
+         logger.trace("Initializing current message {} on {}", currentMessage, 
this);
          sessionSPI.getStorageManager().largeMessageCreated(id, 
currentMessage);
+         sessionSPI.execute(currentMessage::validateFile);

Review Comment:
   I was swallowing on purpose, as any subsequent reads would endue on an 
exception through addBytes calls (which is calling 
AMQPConnectionContext::exception
   
   
   I'm adding the validation now just in case (amended the commit)
   
   
https://github.com/clebertsuconic/activemq-artemis/blob/1bae8665458e53a8c1793330147ee6b389e3b586/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/AMQPConnectionContext.java#L392-L400



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to