You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "Galkin Alexey (Jira)" <ji...@apache.org> on 2024/04/20 14:09:00 UTC
[jira] [Updated] (ARTEMIS-4735) BOXED PRIMITIVE FOR PARSING in ActiveMQConnectionMetaData.java
[ https://issues.apache.org/jira/browse/ARTEMIS-4735?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Galkin Alexey updated ARTEMIS-4735:
-----------------------------------
Description:
[On line 48|https://github.com/apache/activemq-artemis/blob/main/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnectionMetaData.java](JMS_MAJOR_VERSION = Integer.valueOf(versionProps.getProperty("activemq.version.implementation.majorVersion", "2")), a truly boxed primitive is created from a string simply to extract the value of the unboxed primitive. This approach is inefficient and can lead to code redundancy and loss of performance.
A more efficient approach would be to immediately convert strings to primitive values without creating boxed primitives. For example, use the Integer.parseInt() method to directly convert a string to an int without creating an Integer object.
Found by Linux Verification Center (portal.linuxtesting.ru) with SVACE.
Author Alexey Galkin.
was:
[On line 48|https://github.com/apache/activemq-artemis/blob/main/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnectionMetaData.java(JMS_MAJOR_VERSION = Integer.valueOf(versionProps.getProperty("activemq.version.implementation.majorVersion", "2"));), a truly boxed primitive is created from a string simply to extract the value of the unboxed primitive. This approach is inefficient and can lead to code redundancy and loss of performance.
A more efficient approach would be to immediately convert strings to primitive values without creating boxed primitives. For example, use the Integer.parseInt() method to directly convert a string to an int without creating an Integer object.
Found by Linux Verification Center (portal.linuxtesting.ru) with SVACE.
Author Alexey Galkin.
> BOXED PRIMITIVE FOR PARSING in ActiveMQConnectionMetaData.java
> --------------------------------------------------------------
>
> Key: ARTEMIS-4735
> URL: https://issues.apache.org/jira/browse/ARTEMIS-4735
> Project: ActiveMQ Artemis
> Issue Type: Bug
> Reporter: Galkin Alexey
> Priority: Minor
>
> [On line 48|https://github.com/apache/activemq-artemis/blob/main/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnectionMetaData.java](JMS_MAJOR_VERSION = Integer.valueOf(versionProps.getProperty("activemq.version.implementation.majorVersion", "2")), a truly boxed primitive is created from a string simply to extract the value of the unboxed primitive. This approach is inefficient and can lead to code redundancy and loss of performance.
> A more efficient approach would be to immediately convert strings to primitive values without creating boxed primitives. For example, use the Integer.parseInt() method to directly convert a string to an int without creating an Integer object.
>
> Found by Linux Verification Center (portal.linuxtesting.ru) with SVACE.
> Author Alexey Galkin.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)