[ 
https://issues.apache.org/jira/browse/ARTEMIS-4932?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18033261#comment-18033261
 ] 

ASF subversion and git services commented on ARTEMIS-4932:
----------------------------------------------------------

Commit 27437e91ba5401087f107e632d57ab53e915612b in activemq-artemis's branch 
refs/heads/main from Justin Bertram
[ https://gitbox.apache.org/repos/asf?p=activemq-artemis.git;h=27437e91ba ]

ARTEMIS-4932 mitigate NPE in URISchema


> Reference, returned from function 'defaultFactory.getScheme()String' at 
> URISchema.java:53, may be null and is dereferenced at URISchema.java:53.
> ------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: ARTEMIS-4932
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-4932
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>    Affects Versions: 2.25.0
>            Reporter: Suhov Roman
>            Priority: Major
>         Attachments: 1.png
>
>
> A problem has been detected in the {{URISchema.java}} file on line 53 and 70.
> In a call to the {{getScheme()}} method on a {{defaultFactory}} object, 
> {{getScheme()}} may return {{null}} which will throw a 
> {{NullPointerException}} when {{equals()}} is called.
> To avoid a {{NullPointerException}}, you should check the result of 
> {{getScheme()}} for {{null}} before calling {{equals()}}, e.g.:
> {code:java}
> if (defaultFactory != null && uri.getHost() == null) {
>     String defaultScheme = defaultFactory.getScheme();
>     if (defaultScheme != null && defaultScheme.equals(uri.getScheme())) {
>         uri = defaultFactory;
>     }
> }{code}
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact


Reply via email to