From 8a464813c126ce107c5c2dbc7b33633682636e50 Mon Sep 17 00:00:00 2001 From: Sumit Dethe <91131672+sumitdethe27@users.noreply.github.com> Date: Thu, 8 Jun 2023 19:56:06 +0530 Subject: [PATCH] TypeSafety added - Issue fixed #40 Signed-off-by: Sumit Dethe <91131672+sumitdethe27@users.noreply.github.com> --- src/main/java/com/ibm/as400/access/MessageQueue.java | 2 +- .../com/ibm/as400/access/QueuedMessageEnumeration.java | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/ibm/as400/access/MessageQueue.java b/src/main/java/com/ibm/as400/access/MessageQueue.java index 0f18e8b7f..03c5a5103 100644 --- a/src/main/java/com/ibm/as400/access/MessageQueue.java +++ b/src/main/java/com/ibm/as400/access/MessageQueue.java @@ -449,7 +449,7 @@ public boolean getListDirection() @exception IOException If an error occurs while communicating with the system. @exception ObjectDoesNotExistException If the object does not exist on the system. **/ - public Enumeration getMessages() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException + public Enumeration getMessages() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException { if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Retrieving message queue message list."); // Need to get the length. diff --git a/src/main/java/com/ibm/as400/access/QueuedMessageEnumeration.java b/src/main/java/com/ibm/as400/access/QueuedMessageEnumeration.java index 1f27084dd..06b569b4c 100644 --- a/src/main/java/com/ibm/as400/access/QueuedMessageEnumeration.java +++ b/src/main/java/com/ibm/as400/access/QueuedMessageEnumeration.java @@ -17,7 +17,7 @@ import java.util.NoSuchElementException; // Helper class. Used to wrap the QueuedMessage[] with an Enumeration. This class is used by MessageQueue and JobLog. -class QueuedMessageEnumeration implements Enumeration +class QueuedMessageEnumeration implements Enumeration { private QueuedMessage[] messageCache_; @@ -51,12 +51,13 @@ class QueuedMessageEnumeration implements Enumeration numMessages_ = length; } + @Override public final boolean hasMoreElements() { return counter_ < numMessages_; } - - public final Object nextElement() + @Override + public final QueuedMessage nextElement() { if (counter_ >= numMessages_) {