---------- Forwarded message ----------
From: <[email protected]>
Date: Thu, Mar 23, 2017 at 1:34 PM
Subject: New Defects reported by Coverity Scan for Apache ActiveMQ Artemis
To: [email protected]
Hi,
Please find the latest report on new defect(s) introduced to Apache
ActiveMQ Artemis found with Coverity Scan.
8 new defect(s) introduced to Apache ActiveMQ Artemis found with Coverity
Scan.
8 defect(s), reported by Coverity Scan earlier, were marked fixed in the
recent build analyzed by Coverity Scan.
New defect(s) Reported-by: Coverity Scan
Showing 8 of 8 defect(s)
** CID 1420682: FindBugs: Correctness (FB.GC_UNRELATED_TYPES)
/artemis-protocols/artemis-amqp-protocol/src/main/java/
org/apache/activemq/artemis/protocol/amqp/broker/AMQPConnectionCallback.java:
252 in org.apache.activemq.artemis.protocol.amqp.broker.
AMQPConnectionCallback.removeTransaction(org.apache.
qpid.proton.amqp.Binary)()
____________________________________________________________
____________________________________________
*** CID 1420682: FindBugs: Correctness (FB.GC_UNRELATED_TYPES)
/artemis-protocols/artemis-amqp-protocol/src/main/java/
org/apache/activemq/artemis/protocol/amqp/broker/AMQPConnectionCallback.java:
252 in org.apache.activemq.artemis.protocol.amqp.broker.
AMQPConnectionCallback.removeTransaction(org.apache.
qpid.proton.amqp.Binary)()
246
247 return tx;
248 }
249
250 public Transaction removeTransaction(Binary txid) {
251 XidImpl xid = newXID(txid.getArray());
>>> CID 1420682: FindBugs: Correctness (FB.GC_UNRELATED_TYPES)
>>> org.apache.activemq.artemis.core.transaction.impl.XidImpl is
incompatible with expected argument type org.apache.qpid.proton.amqp.Binary.
252 return transactions.remove(xid);
253 }
254
255 protected XidImpl newXID() {
256 return newXID(UUIDGenerator.getInstance().
generateStringUUID().getBytes());
257 }
** CID 1420681: FindBugs: Correctness (FB.EC_UNRELATED_TYPES)
/tests/integration-tests/src/test/java/org/apache/activemq/
artemis/tests/integration/amqp/AmqpTransactionTest.java: 970 in
org.apache.activemq.artemis.tests.integration.amqp.AmqpTransactionTest$3.
inspectDeliveryUpdate(org.apache.qpid.proton.engine.Delivery)()
____________________________________________________________
____________________________________________
*** CID 1420681: FindBugs: Correctness (FB.EC_UNRELATED_TYPES)
/tests/integration-tests/src/test/java/org/apache/activemq/
artemis/tests/integration/amqp/AmqpTransactionTest.java: 970 in
org.apache.activemq.artemis.tests.integration.amqp.AmqpTransactionTest$3.
inspectDeliveryUpdate(org.apache.qpid.proton.engine.Delivery)()
964 }
965 }
966
967 TransactionalState localTxState =
(TransactionalState) delivery.getLocalState();
968 TransactionalState remoteTxState =
(TransactionalState) delivery.getRemoteState();
969
>>> CID 1420681: FindBugs: Correctness (FB.EC_UNRELATED_TYPES)
>>> Call to org.apache.qpid.proton.amqp.Binary.equals(org.apache.qpid.
proton.amqp.transaction.TransactionalState).
970 if (!localTxState.getTxnId().equals(remoteTxState)) {
971 markAsInvalid("Message not enrolled in expected
transaction");
972 }
973 }
974 }
975 });
** CID 1420680: (FB.DM_DEFAULT_ENCODING)
/tests/integration-tests/src/test/java/org/apache/activemq/
artemis/tests/integration/mqtt/imported/MQTTTest.java: 202 in
org.apache.activemq.artemis.tests.integration.mqtt.imported.MQTTTest.
testManagementQueueMessagesAreAckd()()
/tests/integration-tests/src/test/java/org/apache/activemq/
artemis/tests/integration/mqtt/imported/MQTTTest.java: 205 in
org.apache.activemq.artemis.tests.integration.mqtt.imported.MQTTTest.
testManagementQueueMessagesAreAckd()()
____________________________________________________________
____________________________________________
*** CID 1420680: (FB.DM_DEFAULT_ENCODING)
/tests/integration-tests/src/test/java/org/apache/activemq/
artemis/tests/integration/mqtt/imported/MQTTTest.java: 202 in
org.apache.activemq.artemis.tests.integration.mqtt.imported.MQTTTest.
testManagementQueueMessagesAreAckd()()
196 final MQTTClientProvider provider = getMQTTClientProvider();
197 provider.setClientId(clientId);
198 initializeConnection(provider);
199 provider.subscribe("foo", EXACTLY_ONCE);
200 for (int i = 0; i < NUM_MESSAGES; i++) {
201 String payload = "Test Message: " + i;
>>> CID 1420680: (FB.DM_DEFAULT_ENCODING)
>>> Found reliance on default encoding: String.getBytes().
202 provider.publish("foo", payload.getBytes(), EXACTLY_ONCE);
203 byte[] message = provider.receive(5000);
204 assertNotNull("Should get a message", message);
205 assertEquals(payload, new String(message));
206 }
207
/tests/integration-tests/src/test/java/org/apache/activemq/
artemis/tests/integration/mqtt/imported/MQTTTest.java: 205 in
org.apache.activemq.artemis.tests.integration.mqtt.imported.MQTTTest.
testManagementQueueMessagesAreAckd()()
199 provider.subscribe("foo", EXACTLY_ONCE);
200 for (int i = 0; i < NUM_MESSAGES; i++) {
201 String payload = "Test Message: " + i;
202 provider.publish("foo", payload.getBytes(), EXACTLY_ONCE);
203 byte[] message = provider.receive(5000);
204 assertNotNull("Should get a message", message);
>>> CID 1420680: (FB.DM_DEFAULT_ENCODING)
>>> Found reliance on default encoding: new String(byte[]).
205 assertEquals(payload, new String(message));
206 }
207
208 final Queue queue = server.locateQueue(new
SimpleString(MQTTUtil.MANAGEMENT_QUEUE_PREFIX + clientId));
209
210 Wait.waitFor(() -> queue.getMessageCount() == 0, 1000, 100);
** CID 1420679: FindBugs: Performance (FB.BX_UNBOXING_IMMEDIATELY_REBOXED)
/artemis-protocols/artemis-amqp-protocol/src/main/java/
org/apache/activemq/artemis/protocol/amqp/broker/AMQPMessage.java: 499 in
org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessage.isDurable()()
____________________________________________________________
____________________________________________
*** CID 1420679: FindBugs: Performance (FB.BX_UNBOXING_IMMEDIATELY_
REBOXED)
/artemis-protocols/artemis-amqp-protocol/src/main/java/
org/apache/activemq/artemis/protocol/amqp/broker/AMQPMessage.java: 499 in
org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessage.isDurable()()
493 public boolean isDurable() {
494 if (durable != null) {
495 return durable;
496 }
497
498 if (getHeader() != null && getHeader().getDurable() != null) {
>>> CID 1420679: FindBugs: Performance (FB.BX_UNBOXING_IMMEDIATELY_
REBOXED)
>>> Boxed value is unboxed and then immediately reboxed.
499 durable = getHeader().getDurable().booleanValue();
500 return durable;
501 } else {
502 return durable != null ? durable : false;
503 }
504 }
** CID 1420678: Null pointer dereferences (NULL_RETURNS)
/artemis-protocols/artemis-amqp-protocol/src/main/java/
org/apache/activemq/artemis/protocol/amqp/broker/AMQPMessage.java: 159 in
org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessage.
getApplicationProperties()()
____________________________________________________________
____________________________________________
*** CID 1420678: Null pointer dereferences (NULL_RETURNS)
/artemis-protocols/artemis-amqp-protocol/src/main/java/
org/apache/activemq/artemis/protocol/amqp/broker/AMQPMessage.java: 159 in
org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessage.
getApplicationProperties()()
153 }
154
155 private ApplicationProperties getApplicationProperties() {
156 parseHeaders();
157
158 if (applicationProperties == null && appLocation >= 0) {
>>> CID 1420678: Null pointer dereferences (NULL_RETURNS)
>>> Calling a method on null object "getBuffer()".
159 ByteBuffer buffer = getBuffer().nioBuffer();
160 buffer.position(appLocation);
161 TLSEncode.getDecoder().setByteBuffer(buffer);
162 Object section = TLSEncode.getDecoder().readObject();
163 if (section instanceof ApplicationProperties) {
164 this.applicationProperties = (ApplicationProperties)
section;
** CID 1420677: Program hangs (LOCK_INVERSION)
/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java:
1291 in org.apache.activemq.artemis.core.server.impl.
ServerSessionImpl.send(org.apache.activemq.artemis.core.transaction.Transaction,
org.apache.activemq.artemis.api.core.Message, boolean, boolean)()
____________________________________________________________
____________________________________________
*** CID 1420677: Program hangs (LOCK_INVERSION)
/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java:
1291 in org.apache.activemq.artemis.core.server.impl.
ServerSessionImpl.send(org.apache.activemq.artemis.core.transaction.Transaction,
org.apache.activemq.artemis.api.core.Message, boolean, boolean)()
1285 }
1286
1287 @Override
1288 public synchronized RoutingStatus send(Transaction tx,
1289 final Message message,
1290 final boolean direct,
>>> CID 1420677: Program hangs (LOCK_INVERSION)
>>> Acquiring lock "ServerSessionImpl.this".
1291 boolean
noAutoCreateQueue) throws Exception {
1292
1293 // If the protocol doesn't support flow control, we have no
choice other than fail the communication
1294 if (!this.getRemotingConnection().isSupportsFlowControl() &&
pagingManager.isDiskFull()) {
1295 ActiveMQIOErrorException exception =
ActiveMQMessageBundle.BUNDLE.diskBeyondLimit();
1296 this.getRemotingConnection().fail(exception);
** CID 1420676: (DEADCODE)
/tests/integration-tests/src/test/java/org/apache/activemq/
artemis/tests/integration/amqp/AmqpTestSupport.java: 71 in
org.apache.activemq.artemis.tests.integration.amqp.AmqpTestSupport.
getBrokerAmqpConnectionURI()()
/tests/integration-tests/src/test/java/org/apache/activemq/
artemis/tests/integration/amqp/AmqpTestSupport.java: 77 in
org.apache.activemq.artemis.tests.integration.amqp.AmqpTestSupport.
getBrokerAmqpConnectionURI()()
____________________________________________________________
____________________________________________
*** CID 1420676: (DEADCODE)
/tests/integration-tests/src/test/java/org/apache/activemq/
artemis/tests/integration/amqp/AmqpTestSupport.java: 71 in
org.apache.activemq.artemis.tests.integration.amqp.AmqpTestSupport.
getBrokerAmqpConnectionURI()()
65 int port = 61616;
66
67 String uri = null;
68
69 if (isUseSSL()) {
70 if (webSocket) {
>>> CID 1420676: (DEADCODE)
>>> Execution cannot reach this statement: "uri = "wss://127.0.0.1:" +
...".
71 uri = "wss://127.0.0.1:" + port;
72 } else {
73 uri = "ssl://127.0.0.1:" + port;
74 }
75 } else {
76 if (webSocket) {
/tests/integration-tests/src/test/java/org/apache/activemq/
artemis/tests/integration/amqp/AmqpTestSupport.java: 77 in
org.apache.activemq.artemis.tests.integration.amqp.AmqpTestSupport.
getBrokerAmqpConnectionURI()()
71 uri = "wss://127.0.0.1:" + port;
72 } else {
73 uri = "ssl://127.0.0.1:" + port;
74 }
75 } else {
76 if (webSocket) {
>>> CID 1420676: (DEADCODE)
>>> Execution cannot reach this statement: "uri = "ws://127.0.0.1:" +
p...".
77 uri = "ws://127.0.0.1:" + port;
78 } else {
79 uri = "tcp://127.0.0.1:" + port;
80 }
81 }
82
** CID 1420675: Class hierarchy inconsistencies (CALL_SUPER)
/tests/artemis-test-support/src/main/java/org/apache/
activemq/transport/amqp/client/AmqpSender.java: 423 in
org.apache.activemq.transport.amqp.client.AmqpSender.
processDeliveryUpdates(org.apache.activemq.transport.amqp.client.AmqpConnection,
org.apache.qpid.proton.engine.Delivery)()
____________________________________________________________
____________________________________________
*** CID 1420675: Class hierarchy inconsistencies (CALL_SUPER)
/tests/artemis-test-support/src/main/java/org/apache/
activemq/transport/amqp/client/AmqpSender.java: 423 in
org.apache.activemq.transport.amqp.client.AmqpSender.
processDeliveryUpdates(org.apache.activemq.transport.amqp.client.AmqpConnection,
org.apache.qpid.proton.engine.Delivery)()
417 LOG.warn("{} failed to send any data from current
Message.", this);
418 }
419 }
420 }
421
422 @Override
>>> CID 1420675: Class hierarchy inconsistencies (CALL_SUPER)
>>> Missing call to "org.apache.activemq.transport.amqp.client.
AmqpAbstractResource.processDeliveryUpdates(org.apache.activemq.transport.amqp.client.AmqpConnection,
org.apache.qpid.proton.engine.Delivery)" (as is done elsewhere 2 out of 3
times).
423 public void processDeliveryUpdates(AmqpConnection connection,
Delivery updated) throws IOException {
424 List<Delivery> toRemove = new ArrayList<>();
425
426 for (Delivery delivery : pending) {
427 DeliveryState state = delivery.getRemoteState();
428 if (state == null) {
____________________________________________________________
____________________________________________
To view the defects in Coverity Scan visit, https://u2389337.ct.sendgrid.
net/wf/click?upn=08onrYu34A-2BWcWUl-2F-2BfV0V05UPxvVjWch-
2Bd2MGckcRZSbhom32dlDl11LWEm9nX1rtAWaC-2BDSVBpUSy28m9Zb8yC8TsR8PEkb70
GF-2BiZPHs-3D_FskC5xBa3KJMdLzpQ7DMPdi-2Bg7iORJg0iEJDpvzM9wAcdjhhKQgo
A-2FzBgFriAc5uDVMa19pTXD-2FmYwa3DH3eK0-2By39FhpWAQKVPf8F02btjoXlBZq-
2BSkY69aFM3gWBNLd-2BFgo-2FcIigtMFD2-2BkCpIO86JMXS578-
2FyXoRCoiQ8XmHOwSsbM-2B-2BltqqYXBLrgH78Y8ncexHOrPOAduB0vca-2BzQ-3D-3D
--
Jiří Daněk