You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@activemq.apache.org by GitBox <gi...@apache.org> on 2020/11/17 14:18:05 UTC
[GitHub] [activemq-artemis] jbertram opened a new pull request #3345: ARTEMIS-2997 NPE with JMS queue/topic toString()
jbertram opened a new pull request #3345:
URL: https://github.com/apache/activemq-artemis/pull/3345
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [activemq-artemis] michaelandrepearce commented on a change in pull request #3345: ARTEMIS-2997 NPE with JMS queue/topic toString()
Posted by GitBox <gi...@apache.org>.
michaelandrepearce commented on a change in pull request #3345:
URL: https://github.com/apache/activemq-artemis/pull/3345#discussion_r525507149
##########
File path: artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQDestination.java
##########
@@ -464,7 +464,7 @@ public boolean isQueue() {
// Public --------------------------------------------------------
public String getAddress() {
- return simpleAddress.toString();
+ return simpleAddress != null ? simpleAddress.toString() : null;
Review comment:
E.g. you could do Objects.toString(simpleAddress, null)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [activemq-artemis] jbertram commented on a change in pull request #3345: ARTEMIS-2997 NPE with JMS queue/topic toString()
Posted by GitBox <gi...@apache.org>.
jbertram commented on a change in pull request #3345:
URL: https://github.com/apache/activemq-artemis/pull/3345#discussion_r525526233
##########
File path: artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQDestination.java
##########
@@ -464,7 +464,7 @@ public boolean isQueue() {
// Public --------------------------------------------------------
public String getAddress() {
- return simpleAddress.toString();
+ return simpleAddress != null ? simpleAddress.toString() : null;
Review comment:
I think we're getting close to a bike shed here.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [activemq-artemis] asfgit closed pull request #3345: ARTEMIS-2997 NPE with JMS queue/topic toString()
Posted by GitBox <gi...@apache.org>.
asfgit closed pull request #3345:
URL: https://github.com/apache/activemq-artemis/pull/3345
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [activemq-artemis] michaelandrepearce commented on a change in pull request #3345: ARTEMIS-2997 NPE with JMS queue/topic toString()
Posted by GitBox <gi...@apache.org>.
michaelandrepearce commented on a change in pull request #3345:
URL: https://github.com/apache/activemq-artemis/pull/3345#discussion_r525501374
##########
File path: artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQDestination.java
##########
@@ -464,7 +464,7 @@ public boolean isQueue() {
// Public --------------------------------------------------------
public String getAddress() {
- return simpleAddress.toString();
+ return simpleAddress != null ? simpleAddress.toString() : null;
Review comment:
Theres a static toString method on Objects that handles null from memory surely just use that for cleaness like in other code areas
Objects.toString(obj, default)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [activemq-artemis] clebertsuconic commented on a change in pull request #3345: ARTEMIS-2997 NPE with JMS queue/topic toString()
Posted by GitBox <gi...@apache.org>.
clebertsuconic commented on a change in pull request #3345:
URL: https://github.com/apache/activemq-artemis/pull/3345#discussion_r525531511
##########
File path: artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQDestination.java
##########
@@ -464,7 +464,7 @@ public boolean isQueue() {
// Public --------------------------------------------------------
public String getAddress() {
- return simpleAddress.toString();
+ return simpleAddress != null ? simpleAddress.toString() : null;
Review comment:
@jbertram when I read your changes here:
```java
public String getAddress() {
return simpleAddress != null ? simpleAddress.toString() : null;
```
I thought this was the toString()
my bad!
sorry for the confusion!
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [activemq-artemis] jbertram commented on a change in pull request #3345: ARTEMIS-2997 NPE with JMS queue/topic toString()
Posted by GitBox <gi...@apache.org>.
jbertram commented on a change in pull request #3345:
URL: https://github.com/apache/activemq-artemis/pull/3345#discussion_r525467524
##########
File path: artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQDestination.java
##########
@@ -464,7 +464,7 @@ public boolean isQueue() {
// Public --------------------------------------------------------
public String getAddress() {
- return simpleAddress.toString();
+ return simpleAddress != null ? simpleAddress.toString() : null;
Review comment:
`getAddress()` is returning `null` not `toString()`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [activemq-artemis] jbertram commented on a change in pull request #3345: ARTEMIS-2997 NPE with JMS queue/topic toString()
Posted by GitBox <gi...@apache.org>.
jbertram commented on a change in pull request #3345:
URL: https://github.com/apache/activemq-artemis/pull/3345#discussion_r525466835
##########
File path: artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQDestination.java
##########
@@ -464,7 +464,7 @@ public boolean isQueue() {
// Public --------------------------------------------------------
public String getAddress() {
- return simpleAddress.toString();
+ return simpleAddress != null ? simpleAddress.toString() : null;
Review comment:
`toString()` itself *won't* return `null` since it's returning `"ActiveMQQueue[" + getAddress() + "]"`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [activemq-artemis] jbertram commented on a change in pull request #3345: ARTEMIS-2997 NPE with JMS queue/topic toString()
Posted by GitBox <gi...@apache.org>.
jbertram commented on a change in pull request #3345:
URL: https://github.com/apache/activemq-artemis/pull/3345#discussion_r525525595
##########
File path: artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQDestination.java
##########
@@ -464,7 +464,7 @@ public boolean isQueue() {
// Public --------------------------------------------------------
public String getAddress() {
- return simpleAddress.toString();
+ return simpleAddress != null ? simpleAddress.toString() : null;
Review comment:
FWIW, the pattern `.* != null ? .*\.toString\(\) : null` is used in a handful of places throughout the code-base (including elsewhere in `ActiveMQDestination`) whereas `Objects.toString\(.*\)` is used just once.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [activemq-artemis] michaelandrepearce commented on a change in pull request #3345: ARTEMIS-2997 NPE with JMS queue/topic toString()
Posted by GitBox <gi...@apache.org>.
michaelandrepearce commented on a change in pull request #3345:
URL: https://github.com/apache/activemq-artemis/pull/3345#discussion_r525501374
##########
File path: artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQDestination.java
##########
@@ -464,7 +464,7 @@ public boolean isQueue() {
// Public --------------------------------------------------------
public String getAddress() {
- return simpleAddress.toString();
+ return simpleAddress != null ? simpleAddress.toString() : null;
Review comment:
Theres a static toString method on Objects that handles null from memory surely just use that for cleaness like in other code areas
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [activemq-artemis] michaelandrepearce commented on a change in pull request #3345: ARTEMIS-2997 NPE with JMS queue/topic toString()
Posted by GitBox <gi...@apache.org>.
michaelandrepearce commented on a change in pull request #3345:
URL: https://github.com/apache/activemq-artemis/pull/3345#discussion_r525501374
##########
File path: artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQDestination.java
##########
@@ -464,7 +464,7 @@ public boolean isQueue() {
// Public --------------------------------------------------------
public String getAddress() {
- return simpleAddress.toString();
+ return simpleAddress != null ? simpleAddress.toString() : null;
Review comment:
Theres a static toString method on simple string that handles null from memory surely just use that for cleaness like in other code areas
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [activemq-artemis] clebertsuconic commented on a change in pull request #3345: ARTEMIS-2997 NPE with JMS queue/topic toString()
Posted by GitBox <gi...@apache.org>.
clebertsuconic commented on a change in pull request #3345:
URL: https://github.com/apache/activemq-artemis/pull/3345#discussion_r525422935
##########
File path: artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQDestination.java
##########
@@ -464,7 +464,7 @@ public boolean isQueue() {
// Public --------------------------------------------------------
public String getAddress() {
- return simpleAddress.toString();
+ return simpleAddress != null ? simpleAddress.toString() : null;
Review comment:
toString should always return something not null IMO. Can you instead do:
```java
return simpleAddress != null ? simpleAddress.toString() : "<null address>";
```
or simply
```java
return "" + simpleAddress;
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [activemq-artemis] jbertram commented on a change in pull request #3345: ARTEMIS-2997 NPE with JMS queue/topic toString()
Posted by GitBox <gi...@apache.org>.
jbertram commented on a change in pull request #3345:
URL: https://github.com/apache/activemq-artemis/pull/3345#discussion_r525506260
##########
File path: artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQDestination.java
##########
@@ -464,7 +464,7 @@ public boolean isQueue() {
// Public --------------------------------------------------------
public String getAddress() {
- return simpleAddress.toString();
+ return simpleAddress != null ? simpleAddress.toString() : null;
Review comment:
@michaelandrepearce, I don't see any such method on `SimpleString`.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org