This is an automated email from the ASF dual-hosted git repository. tabish pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/qpid-protonj2.git
The following commit(s) were added to refs/heads/main by this push: new f28bc42 PROTON-2420 Fix some minor code issues found with static analysis f28bc42 is described below commit f28bc429f9b3b481e3f36ea7bbc23b1def5cd404 Author: Timothy Bish <tabish...@gmail.com> AuthorDate: Tue Aug 24 16:32:46 2021 -0400 PROTON-2420 Fix some minor code issues found with static analysis --- .../qpid/protonj2/client/TransportOptions.java | 21 +++++++++++++-------- .../protonj2/client/transport/NettyIOContext.java | 2 +- .../qpid/protonj2/client/SaslOptionsTest.java | 4 ++-- .../qpid/protonj2/client/TransportOptionsTest.java | 18 ++++++++++-------- .../qpid/protonj2/client/impl/ConnectionTest.java | 2 +- .../qpid/protonj2/client/impl/ReceiverTest.java | 8 ++++---- .../protonj2/client/transport/TcpTransportTest.java | 8 ++++---- .../qpid/protonj2/test/driver/DriverSessions.java | 4 ++-- .../qpid/protonj2/test/driver/FrameDecoder.java | 4 ++-- .../test/driver/codec/primitives/Binary.java | 2 +- .../test/driver/codec/transport/Attach.java | 1 + .../protonj2/test/driver/codec/transport/Open.java | 4 ++-- .../driver/codec/transport/ReceiverSettleMode.java | 2 +- .../driver/codec/transport/SenderSettleMode.java | 2 +- .../test/driver/expectations/AttachExpectation.java | 2 +- .../test/driver/expectations/DetachExpectation.java | 4 ++-- .../driver/expectations/DispositionExpectation.java | 2 +- .../test/driver/expectations/FlowExpectation.java | 2 +- .../driver/expectations/TransferExpectation.java | 2 +- .../qpid/protonj2/types/messaging/Target.java | 2 +- .../types/messaging/TerminusExpiryPolicy.java | 3 ++- .../types/transport/ReceiverSettleMode.java | 2 +- .../protonj2/types/transport/SenderSettleMode.java | 2 +- .../protonj2/buffer/util/ProtonTestByteBuffer.java | 4 ++-- 24 files changed, 58 insertions(+), 49 deletions(-) diff --git a/protonj2-client/src/main/java/org/apache/qpid/protonj2/client/TransportOptions.java b/protonj2-client/src/main/java/org/apache/qpid/protonj2/client/TransportOptions.java index f2624dc..489147a 100644 --- a/protonj2-client/src/main/java/org/apache/qpid/protonj2/client/TransportOptions.java +++ b/protonj2-client/src/main/java/org/apache/qpid/protonj2/client/TransportOptions.java @@ -16,7 +16,10 @@ */ package org.apache.qpid.protonj2.client; +import java.util.Arrays; +import java.util.Collections; import java.util.HashMap; +import java.util.List; import java.util.Map; /** @@ -38,7 +41,9 @@ public class TransportOptions implements Cloneable { public static final int DEFAULT_LOCAL_PORT = 0; public static final boolean DEFAULT_USE_WEBSOCKETS = false; public static final int DEFAULT_WEBSOCKET_MAX_FRAME_SIZE = 65535; - public static final String[] DEFAULT_NATIVEIO_PREFERENCES = { "EPOLL", "KQUEUE" }; + private static final String[] DEFAULT_NATIVEIO_PREFERENCES_ARRAY = { "EPOLL", "KQUEUE" }; + public static final List<String> DEFAULT_NATIVEIO_PREFERENCES = + Collections.unmodifiableList(Arrays.asList( DEFAULT_NATIVEIO_PREFERENCES_ARRAY )); private int sendBufferSize = DEFAULT_SEND_BUFFER_SIZE; private int receiveBufferSize = DEFAULT_RECEIVE_BUFFER_SIZE; @@ -52,7 +57,7 @@ public class TransportOptions implements Cloneable { private String localAddress; private int localPort = DEFAULT_LOCAL_PORT; private boolean allowNativeIO = DEFAULT_ALLOW_NATIVE_IO; - private String[] nativeIOPeference = DEFAULT_NATIVEIO_PREFERENCES; + private String[] nativeIOPreference = DEFAULT_NATIVEIO_PREFERENCES_ARRAY; private boolean traceBytes = DEFAULT_TRACE_BYTES; private boolean useWebSockets = DEFAULT_USE_WEBSOCKETS; private String webSocketPath; @@ -331,18 +336,18 @@ public class TransportOptions implements Cloneable { /** * @return the nativeIOPeference */ - public String[] nativeIOPeference() { - return nativeIOPeference; + public String[] nativeIOPreference() { + return nativeIOPreference; } /** * @param nativeIOPeference the nativeIOPeference to set */ - public void nativeIOPeference(String... nativeIOPeference) { + public void nativeIOPreference(String... nativeIOPeference) { if (nativeIOPeference == null || nativeIOPeference.length == 0 || nativeIOPeference.length == 1 && nativeIOPeference[0] == null) { - this.nativeIOPeference = DEFAULT_NATIVEIO_PREFERENCES; + this.nativeIOPreference = DEFAULT_NATIVEIO_PREFERENCES_ARRAY; } else { - this.nativeIOPeference = nativeIOPeference; + this.nativeIOPreference = nativeIOPeference; } } @@ -468,7 +473,7 @@ public class TransportOptions implements Cloneable { other.trafficClass(trafficClass()); other.defaultTcpPort(defaultTcpPort()); other.allowNativeIO(allowNativeIO()); - other.nativeIOPeference(nativeIOPeference()); + other.nativeIOPreference(nativeIOPreference()); other.traceBytes(traceBytes()); other.localAddress(localAddress()); other.localPort(localPort()); diff --git a/protonj2-client/src/main/java/org/apache/qpid/protonj2/client/transport/NettyIOContext.java b/protonj2-client/src/main/java/org/apache/qpid/protonj2/client/transport/NettyIOContext.java index af79ed9..20066b0 100644 --- a/protonj2-client/src/main/java/org/apache/qpid/protonj2/client/transport/NettyIOContext.java +++ b/protonj2-client/src/main/java/org/apache/qpid/protonj2/client/transport/NettyIOContext.java @@ -57,7 +57,7 @@ public final class NettyIOContext { this.sslOptions = ssl; this.threadFactory = new TrackableThreadFactory(ioThreadName, true); - final String[] nativeIOPreference = options.nativeIOPeference(); + final String[] nativeIOPreference = options.nativeIOPreference(); EventLoopGroup selectedGroup = null; Class<? extends Channel> selectedChannelClass = null; diff --git a/protonj2-client/src/test/java/org/apache/qpid/protonj2/client/SaslOptionsTest.java b/protonj2-client/src/test/java/org/apache/qpid/protonj2/client/SaslOptionsTest.java index a8f0a7d..ff3a5e2 100644 --- a/protonj2-client/src/test/java/org/apache/qpid/protonj2/client/SaslOptionsTest.java +++ b/protonj2-client/src/test/java/org/apache/qpid/protonj2/client/SaslOptionsTest.java @@ -60,7 +60,7 @@ class SaslOptionsTest { assertFalse(options.allowedMechanisms().isEmpty()); - options.allowedMechanisms().contains("PLAIN"); - options.allowedMechanisms().contains("ANONYMOUS"); + assertTrue(options.allowedMechanisms().contains("PLAIN")); + assertTrue(options.allowedMechanisms().contains("ANONYMOUS")); } } diff --git a/protonj2-client/src/test/java/org/apache/qpid/protonj2/client/TransportOptionsTest.java b/protonj2-client/src/test/java/org/apache/qpid/protonj2/client/TransportOptionsTest.java index 04de894..c2bd89d 100644 --- a/protonj2-client/src/test/java/org/apache/qpid/protonj2/client/TransportOptionsTest.java +++ b/protonj2-client/src/test/java/org/apache/qpid/protonj2/client/TransportOptionsTest.java @@ -24,6 +24,8 @@ import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; +import java.util.Arrays; + import org.apache.qpid.protonj2.client.test.ImperativeClientTestCase; import org.junit.jupiter.api.Test; @@ -157,18 +159,18 @@ public class TransportOptionsTest extends ImperativeClientTestCase { public void testNativeIOPerferencesCannotBeNulled() { TransportOptions options = createNonDefaultOptions(); - assertNotNull(options.nativeIOPeference()); - assertArrayEquals(TransportOptions.DEFAULT_NATIVEIO_PREFERENCES, options.nativeIOPeference()); + assertNotNull(options.nativeIOPreference()); + assertEquals(TransportOptions.DEFAULT_NATIVEIO_PREFERENCES, Arrays.asList(options.nativeIOPreference())); - options.nativeIOPeference((String) null); + options.nativeIOPreference((String) null); - assertNotNull(options.nativeIOPeference()); - assertArrayEquals(TransportOptions.DEFAULT_NATIVEIO_PREFERENCES, options.nativeIOPeference()); + assertNotNull(options.nativeIOPreference()); + assertEquals(TransportOptions.DEFAULT_NATIVEIO_PREFERENCES, Arrays.asList(options.nativeIOPreference())); - options.nativeIOPeference("epolling"); + options.nativeIOPreference("epolling"); - assertNotNull(options.nativeIOPeference()); - assertArrayEquals(new String[] { "epolling" }, options.nativeIOPeference()); + assertNotNull(options.nativeIOPreference()); + assertArrayEquals(new String[] { "epolling" }, options.nativeIOPreference()); } @Test diff --git a/protonj2-client/src/test/java/org/apache/qpid/protonj2/client/impl/ConnectionTest.java b/protonj2-client/src/test/java/org/apache/qpid/protonj2/client/impl/ConnectionTest.java index 69adf5a..ad02b5e 100644 --- a/protonj2-client/src/test/java/org/apache/qpid/protonj2/client/impl/ConnectionTest.java +++ b/protonj2-client/src/test/java/org/apache/qpid/protonj2/client/impl/ConnectionTest.java @@ -1000,7 +1000,7 @@ public class ConnectionTest extends ImperativeClientTestCase { Receiver receiver = connection.openDynamicReceiver(); receiver.openFuture().get(10, TimeUnit.SECONDS); - assertNotNull("Remote should have assigned the address for the dynamic receiver", receiver.address()); + assertNotNull(receiver.address(), "Remote should have assigned the address for the dynamic receiver"); receiver.closeAsync().get(10, TimeUnit.SECONDS); diff --git a/protonj2-client/src/test/java/org/apache/qpid/protonj2/client/impl/ReceiverTest.java b/protonj2-client/src/test/java/org/apache/qpid/protonj2/client/impl/ReceiverTest.java index a753362..1c2636a 100644 --- a/protonj2-client/src/test/java/org/apache/qpid/protonj2/client/impl/ReceiverTest.java +++ b/protonj2-client/src/test/java/org/apache/qpid/protonj2/client/impl/ReceiverTest.java @@ -688,7 +688,7 @@ public class ReceiverTest extends ImperativeClientTestCase { Receiver receiver = session.openDynamicReceiver(); receiver.openFuture().get(10, TimeUnit.SECONDS); - assertNotNull("Remote should have assigned the address for the dynamic receiver", receiver.address()); + assertNotNull(receiver.address(), "Remote should have assigned the address for the dynamic receiver"); assertEquals("test-dynamic-node", receiver.address()); receiver.closeAsync().get(10, TimeUnit.SECONDS); @@ -734,7 +734,7 @@ public class ReceiverTest extends ImperativeClientTestCase { Session session = connection.openSession(); Receiver receiver = session.openDynamicReceiver(nodeProperties); - assertNotNull("Remote should have assigned the address for the dynamic receiver", receiver.address()); + assertNotNull(receiver.address(), "Remote should have assigned the address for the dynamic receiver"); assertEquals("test-dynamic-node", receiver.address()); receiver.closeAsync().get(10, TimeUnit.SECONDS); @@ -774,7 +774,7 @@ public class ReceiverTest extends ImperativeClientTestCase { // sent by the receiver session.openSender("test"); - assertNotNull("Remote should have assigned the address for the dynamic receiver", receiver.address()); + assertNotNull(receiver.address(), "Remote should have assigned the address for the dynamic receiver"); assertEquals("test-dynamic-node", receiver.address()); receiver.close(); @@ -828,7 +828,7 @@ public class ReceiverTest extends ImperativeClientTestCase { } if (attachResponse) { - assertNotNull("Remote should have assigned the address for the dynamic receiver", receiver.address()); + assertNotNull(receiver.address(), "Remote should have assigned the address for the dynamic receiver"); assertEquals("test-dynamic-node", receiver.address()); } else { try { diff --git a/protonj2-client/src/test/java/org/apache/qpid/protonj2/client/transport/TcpTransportTest.java b/protonj2-client/src/test/java/org/apache/qpid/protonj2/client/transport/TcpTransportTest.java index 4fb9f8b..16f4ef3 100644 --- a/protonj2-client/src/test/java/org/apache/qpid/protonj2/client/transport/TcpTransportTest.java +++ b/protonj2-client/src/test/java/org/apache/qpid/protonj2/client/transport/TcpTransportTest.java @@ -772,7 +772,7 @@ public class TcpTransportTest extends ImperativeClientTestCase { public void testCreateFailsIfUnknownPerferredNativeIOLayerSelected() throws Exception { TransportOptions options = createTransportOptions(); options.allowNativeIO(true); - options.nativeIOPeference("NATIVE-IO"); + options.nativeIOPreference("NATIVE-IO"); assertThrows(IllegalArgumentException.class, () -> createTransport(options, createSSLOptions())); } @@ -797,7 +797,7 @@ public class TcpTransportTest extends ImperativeClientTestCase { TransportOptions options = createTransportOptions(); options.allowNativeIO(useEpoll); - options.nativeIOPeference("EPOLL"); + options.nativeIOPreference("EPOLL"); Transport transport = createTransport(options, createSSLOptions()); try { transport.connect(HOSTNAME, port, testListener).awaitConnect(); @@ -842,7 +842,7 @@ public class TcpTransportTest extends ImperativeClientTestCase { TransportOptions options = createTransportOptions(); options.allowNativeIO(useIOUring); - options.nativeIOPeference("IO_URING"); + options.nativeIOPreference("IO_URING"); Transport transport = createTransport(options, createSSLOptions()); try { transport.connect(HOSTNAME, port, testListener).awaitConnect(); @@ -989,7 +989,7 @@ public class TcpTransportTest extends ImperativeClientTestCase { TransportOptions options = createTransportOptions(); options.allowNativeIO(true); - options.nativeIOPeference(nativeIOLayer); + options.nativeIOPreference(nativeIOLayer); Transport transport = createTransport(options, createSSLOptions()); try { diff --git a/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/DriverSessions.java b/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/DriverSessions.java index ba548ea..dd3fa93 100644 --- a/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/DriverSessions.java +++ b/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/DriverSessions.java @@ -94,7 +94,7 @@ public class DriverSessions { sessionTracker = localSessions.get(remoteBegin.getRemoteChannel()); if (sessionTracker == null) { throw new AssertionError(String.format( - "Received Begin on channel [%d] that indicated it was a response to a Begin this driver never sent to channel [%d]: ", + "Received Begin on channel [%s] that indicated it was a response to a Begin this driver never sent to channel [%s]: ", remoteChannel, remoteBegin.getRemoteChannel())); } } else { @@ -118,7 +118,7 @@ public class DriverSessions { if (sessionTracker == null) { throw new AssertionError(String.format( - "Received End on channel [%d] that has no matching Session for that remote channel. ", remoteChannel)); + "Received End on channel [%s] that has no matching Session for that remote channel. ", remoteChannel)); } else { sessionTracker.handleEnd(remoteEnd); remoteSessions.remove(remoteChannel); diff --git a/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/FrameDecoder.java b/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/FrameDecoder.java index f1fdc07..e94a170 100644 --- a/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/FrameDecoder.java +++ b/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/FrameDecoder.java @@ -165,7 +165,7 @@ class FrameDecoder { @Override public void parse(ByteBuf input) throws AssertionError { while (input.isReadable()) { - frameSize |= ((input.readByte() & 0xFF) << --multiplier * Byte.SIZE); + frameSize |= (input.readByte() & 0xFF) << (--multiplier * Byte.SIZE); if (multiplier == 0) { break; } @@ -336,7 +336,7 @@ class FrameDecoder { * If parsing fails the parser enters the failed state and remains there always throwing the given exception * if additional parsing is requested. */ - private class ParsingErrorStage implements FrameParserStage { + private static class ParsingErrorStage implements FrameParserStage { private final AssertionError parsingError; diff --git a/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/codec/primitives/Binary.java b/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/codec/primitives/Binary.java index e1c19eb..f75e783 100644 --- a/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/codec/primitives/Binary.java +++ b/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/codec/primitives/Binary.java @@ -62,7 +62,7 @@ public final class Binary { public final int hashCode() { int hc = hashCode; if (hc == 0 && buffer != null) { - hashCode = buffer.hashCode(); + hashCode = Arrays.hashCode(buffer); } return hc; } diff --git a/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/codec/transport/Attach.java b/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/codec/transport/Attach.java index 4641f5e..cd3ea64 100644 --- a/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/codec/transport/Attach.java +++ b/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/codec/transport/Attach.java @@ -270,6 +270,7 @@ public class Attach extends PerformativeDescribedType { break; case INCOMPLETE_UNSETTLED: result = Boolean.FALSE; + break; default: break; } diff --git a/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/codec/transport/Open.java b/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/codec/transport/Open.java index 31ad53b..f69a032 100644 --- a/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/codec/transport/Open.java +++ b/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/codec/transport/Open.java @@ -194,8 +194,8 @@ public class Open extends PerformativeDescribedType { ", maxFrameSize=" + getMaxFrameSize() + ", channelMax=" + getChannelMax() + ", idleTimeOut=" + getIdleTimeOut() + - ", outgoingLocales=" + getOutgoingLocales() + - ", incomingLocales=" + getIncomingLocales() + + ", outgoingLocales=" + Arrays.toString(getOutgoingLocales()) + + ", incomingLocales=" + Arrays.toString(getIncomingLocales()) + ", offeredCapabilities=" + Arrays.toString(getOfferedCapabilities()) + ", desiredCapabilities=" + Arrays.toString(getDesiredCapabilities()) + ", properties=" + getProperties() + diff --git a/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/codec/transport/ReceiverSettleMode.java b/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/codec/transport/ReceiverSettleMode.java index 7c25a7b..0f38f96 100644 --- a/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/codec/transport/ReceiverSettleMode.java +++ b/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/codec/transport/ReceiverSettleMode.java @@ -22,7 +22,7 @@ public enum ReceiverSettleMode { FIRST(0), SECOND(1); - private UnsignedByte value; + private final UnsignedByte value; private ReceiverSettleMode(int value) { this.value = UnsignedByte.valueOf((byte)value); diff --git a/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/codec/transport/SenderSettleMode.java b/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/codec/transport/SenderSettleMode.java index 648717f..e09dcc3 100644 --- a/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/codec/transport/SenderSettleMode.java +++ b/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/codec/transport/SenderSettleMode.java @@ -22,7 +22,7 @@ public enum SenderSettleMode { UNSETTLED(0), SETTLED(1), MIXED(2); - private UnsignedByte value; + private final UnsignedByte value; private SenderSettleMode(int value) { this.value = UnsignedByte.valueOf((byte)value); diff --git a/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/expectations/AttachExpectation.java b/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/expectations/AttachExpectation.java index e8ad5ac..15b9c8f 100644 --- a/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/expectations/AttachExpectation.java +++ b/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/expectations/AttachExpectation.java @@ -114,7 +114,7 @@ public class AttachExpectation extends AbstractExpectation<Attach> { if (session == null) { throw new AssertionError(String.format( - "Received Attach on channel [%d] that has no matching Session for that remote channel. ", remoteChannel)); + "Received Attach on channel [%s] that has no matching Session for that remote channel. ", remoteChannel)); } final LinkTracker link = session.handleRemoteAttach(attach); diff --git a/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/expectations/DetachExpectation.java b/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/expectations/DetachExpectation.java index a0d8cdc..c35b7d6 100644 --- a/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/expectations/DetachExpectation.java +++ b/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/expectations/DetachExpectation.java @@ -77,14 +77,14 @@ public class DetachExpectation extends AbstractExpectation<Detach> { if (session == null) { throw new AssertionError(String.format( - "Received Detach on channel [%d] that has no matching Session for that remote channel. ", remoteChannel)); + "Received Detach on channel [%s] that has no matching Session for that remote channel. ", remoteChannel)); } final LinkTracker link = session.handleRemoteDetach(detach); if (link == null) { throw new AssertionError(String.format( - "Received Detach on channel [%d] that has no matching Attached link for that remote handle. ", detach.getHandle())); + "Received Detach on channel [%s] that has no matching Attached link for that remote handle. ", detach.getHandle())); } if (response != null) { diff --git a/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/expectations/DispositionExpectation.java b/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/expectations/DispositionExpectation.java index b2d94c9..b7da989 100644 --- a/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/expectations/DispositionExpectation.java +++ b/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/expectations/DispositionExpectation.java @@ -76,7 +76,7 @@ public class DispositionExpectation extends AbstractExpectation<Disposition> { if (session == null) { throw new AssertionError(String.format( - "Received Disposition on channel [%d] that has no matching Session for that remote channel. ", remoteChannel)); + "Received Disposition on channel [%s] that has no matching Session for that remote channel. ", remoteChannel)); } session.handleDisposition(disposition); diff --git a/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/expectations/FlowExpectation.java b/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/expectations/FlowExpectation.java index d9f5053..604cb11 100644 --- a/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/expectations/FlowExpectation.java +++ b/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/expectations/FlowExpectation.java @@ -79,7 +79,7 @@ public class FlowExpectation extends AbstractExpectation<Flow> { if (session == null) { throw new AssertionError(String.format( - "Received Flow on channel [%d] that has no matching Session for that remote channel. ", remoteChannel)); + "Received Flow on channel [%s] that has no matching Session for that remote channel. ", remoteChannel)); } final LinkTracker linkTracker = session.handleFlow(flow); // Can be null if Flow was session level only. diff --git a/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/expectations/TransferExpectation.java b/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/expectations/TransferExpectation.java index 7f8c729..f202e22 100644 --- a/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/expectations/TransferExpectation.java +++ b/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/expectations/TransferExpectation.java @@ -138,7 +138,7 @@ public class TransferExpectation extends AbstractExpectation<Transfer> { if (session == null) { throw new AssertionError(String.format( - "Received Transfer on channel [%d] that has no matching Session for that remote channel. ", remoteChannel)); + "Received Transfer on channel [%s] that has no matching Session for that remote channel. ", remoteChannel)); } final LinkTracker link = session.handleTransfer(transfer, payload); diff --git a/protonj2/src/main/java/org/apache/qpid/protonj2/types/messaging/Target.java b/protonj2/src/main/java/org/apache/qpid/protonj2/types/messaging/Target.java index 979717b..fbfc96a 100644 --- a/protonj2/src/main/java/org/apache/qpid/protonj2/types/messaging/Target.java +++ b/protonj2/src/main/java/org/apache/qpid/protonj2/types/messaging/Target.java @@ -40,7 +40,7 @@ public final class Target implements Terminus { public Target() { } - protected Target(Target other) { + private Target(Target other) { this.address = other.address; this.durable = other.durable; this.expiryPolicy = other.expiryPolicy; diff --git a/protonj2/src/main/java/org/apache/qpid/protonj2/types/messaging/TerminusExpiryPolicy.java b/protonj2/src/main/java/org/apache/qpid/protonj2/types/messaging/TerminusExpiryPolicy.java index bc46604..5ad4e3b 100644 --- a/protonj2/src/main/java/org/apache/qpid/protonj2/types/messaging/TerminusExpiryPolicy.java +++ b/protonj2/src/main/java/org/apache/qpid/protonj2/types/messaging/TerminusExpiryPolicy.java @@ -28,9 +28,10 @@ public enum TerminusExpiryPolicy { CONNECTION_CLOSE("connection-close"), NEVER("never"); - private Symbol policy; private static final Map<Symbol, TerminusExpiryPolicy> map = new HashMap<>(); + private final Symbol policy; + TerminusExpiryPolicy(String policy) { this.policy = Symbol.valueOf(policy); } diff --git a/protonj2/src/main/java/org/apache/qpid/protonj2/types/transport/ReceiverSettleMode.java b/protonj2/src/main/java/org/apache/qpid/protonj2/types/transport/ReceiverSettleMode.java index edd5de4..88eff9b 100644 --- a/protonj2/src/main/java/org/apache/qpid/protonj2/types/transport/ReceiverSettleMode.java +++ b/protonj2/src/main/java/org/apache/qpid/protonj2/types/transport/ReceiverSettleMode.java @@ -22,7 +22,7 @@ public enum ReceiverSettleMode { FIRST(0), SECOND(1); - private UnsignedByte value; + private final UnsignedByte value; private ReceiverSettleMode(int value) { this.value = UnsignedByte.valueOf((byte)value); diff --git a/protonj2/src/main/java/org/apache/qpid/protonj2/types/transport/SenderSettleMode.java b/protonj2/src/main/java/org/apache/qpid/protonj2/types/transport/SenderSettleMode.java index 98739aa..26ea060 100644 --- a/protonj2/src/main/java/org/apache/qpid/protonj2/types/transport/SenderSettleMode.java +++ b/protonj2/src/main/java/org/apache/qpid/protonj2/types/transport/SenderSettleMode.java @@ -22,7 +22,7 @@ public enum SenderSettleMode { UNSETTLED(0), SETTLED(1), MIXED(2); - private UnsignedByte value; + private final UnsignedByte value; private SenderSettleMode(int value) { this.value = UnsignedByte.valueOf((byte)value); diff --git a/protonj2/src/test/java/org/apache/qpid/protonj2/buffer/util/ProtonTestByteBuffer.java b/protonj2/src/test/java/org/apache/qpid/protonj2/buffer/util/ProtonTestByteBuffer.java index 7bf2bbd..60094b6 100644 --- a/protonj2/src/test/java/org/apache/qpid/protonj2/buffer/util/ProtonTestByteBuffer.java +++ b/protonj2/src/test/java/org/apache/qpid/protonj2/buffer/util/ProtonTestByteBuffer.java @@ -75,7 +75,7 @@ public class ProtonTestByteBuffer extends ProtonByteBuffer { throw new UnsupportedOperationException(); } - return getArray(); + return super.getArray(); } @Override @@ -84,6 +84,6 @@ public class ProtonTestByteBuffer extends ProtonByteBuffer { throw new UnsupportedOperationException(); } - return getArrayOffset(); + return super.getArrayOffset(); } } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org