[jira] [Comment Edited] (CASSANDRA-13357) A possible NPE in nodetool getendpoints

2019-04-03 Thread mck (JIRA)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-13357?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16808589#comment-16808589
 ] 

mck edited comment on CASSANDRA-13357 at 4/3/19 10:29 AM:
--

[~haozhong] and [~eduard.tudenhoefner],
taking another look at this, the patch was originally correct in only catching 
an {{IllegalArgumentException}}…

The fix in CASSANDRA-8950 included changing {{StorageService}} so that it threw 
an {{IllegalArgumentException}} instead of the {{NullPointerException}}.
See 
https://github.com/apache/cassandra/commit/37eb2a0e29c22a1b2f033e8191b5808a6f7b0d3f#diff-b76a607445d53f18a98c9df14323c7dd
 

Looking in trunk, {{NodeTool}} already now handles the 
{{IllegalArgumentException}}, printing it nicely to the user.
For example
{code}
nodetool getendpoints syste loca -7564491331177403445
nodetool: Unknown keyspace 'syste'
See 'nodetool help' or 'nodetool help '.
{code}

If I apply the (originally) patch it changes this to…
{code}
nodetool getendpoints syste loca -7564491331177403445

Error: Unknown keyspace 'syste'
{code}

Given the code works fine as it is, I'm closing the issue as {{won't fix}}. 
Feel free to comment or re-open if I got it wrong or missed anything.


was (Author: michaelsembwever):
[~haozhong] and [~eduard.tudenhoefner],
taking another look at this, the patch was originally correct in only catching 
an {{IllegalArgumentException}}…

The fix in CASSANDRA-8950 included changing {{StorageService}} so that it threw 
an {{IllegalArgumentException}} instead of the {{NullPointerException}}.
See 
https://github.com/apache/cassandra/commit/37eb2a0e29c22a1b2f033e8191b5808a6f7b0d3f#diff-b76a607445d53f18a98c9df14323c7dd
 

Looking in trunk, {{NodeTool}} already now handles the 
{{IllegalArgumentException}}, printing it nicely to the user.
For example
{code}
nodetool getendpoints syste loca -7564491331177403445
nodetool: Unknown keyspace 'syste'
See 'nodetool help' or 'nodetool help '.
{code}

If I apply the (originally) patch it changes this to…
{code}
bash build/dist/bin/nodetool getendpoints syste loca -7564491331177403445

Error: Unknown keyspace 'syste'
{code}

Given the code works fine as it is, I'm closing the issue as {{won't fix}}. 
Feel free to comment or re-open if I got it wrong or missed anything.

> A possible NPE in nodetool getendpoints
> ---
>
> Key: CASSANDRA-13357
> URL: https://issues.apache.org/jira/browse/CASSANDRA-13357
> Project: Cassandra
>  Issue Type: Bug
>  Components: Tool/nodetool
>Reporter: Hao Zhong
>Assignee: Hao Zhong
>Priority: Normal
> Fix For: 4.x
>
> Attachments: cassandra.patch
>
>
> The GetEndpoints.execute method has the following code:
> {code:title=GetEndpoints.java|borderStyle=solid}
>List endpoints = probe.getEndpoints(ks, table, key);
> for (InetAddress endpoint : endpoints)
> {
> System.out.println(endpoint.getHostAddress());
> }
> {code}
> This code can throw NPE. A similar bug is fixed in CASSANDRA-8950. The buggy 
> code  is 
> {code:title=NodeCmd.java|borderStyle=solid}
>   List endpoints = this.probe.getEndpoints(keySpace, cf, key);
> for (InetAddress anEndpoint : endpoints)
> {
>output.println(anEndpoint.getHostAddress());
> }
> {code}
> The fixed code is:
> {code:title=NodeCmd.java|borderStyle=solid}
> try
> {
> List endpoints = probe.getEndpoints(keySpace, cf, 
> key);
> for (InetAddress anEndpoint : endpoints)
>output.println(anEndpoint.getHostAddress());
> }
> catch (IllegalArgumentException ex)
> {
> output.println(ex.getMessage());
> probe.failed();
> }
> {code}
> The GetEndpoints.execute method shall be modified as CASSANDRA-8950 does.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Comment Edited] (CASSANDRA-13357) A possible NPE in nodetool getendpoints

2019-04-01 Thread mck (JIRA)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-13357?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16807407#comment-16807407
 ] 

mck edited comment on CASSANDRA-13357 at 4/2/19 5:07 AM:
-

[~eduard.tudenhoefner] (and [~haozhong]),
 the code in `GetEndpoints` in trunk has changed a little since this. I've 
redone the patch, can you let me know if it's ok by you?


|| branch || circleci || asf jenkins ||
| 
[CASSANDRA-13357|https://github.com/thelastpickle/cassandra/commit/6a44f1202dfa37f2b190bc3c02de83e65922706d]
  | 
[circleci|https://circleci.com/workflow-run/9532cd94-8123-4cab-9c29-deaa52b3c372]
 | 
[!https://builds.apache.org/view/A-D/view/Cassandra/job/Cassandra-devbranch-testall/37//badge/icon!|https://builds.apache.org/view/A-D/view/Cassandra/job/Cassandra-devbranch-testall/37/]
 |


was (Author: michaelsembwever):
[~eduard.tudenhoefner] (and [~haozhong]),
 the code in `GetEndpoints` in trunk has changed a little since this. I've 
redone the patch, can you let me know if it's ok by you?


|| branch || circleci || asf jenkins ||
| 
[CASSANDRA-13357|https://github.com/thelastpickle/cassandra/commit/6a44f1202dfa37f2b190bc3c02de83e65922706d]
  | 
[!https://circleci.com/workflow-run/9532cd94-8123-4cab-9c29-deaa52b3c372.svg?style=svg!|https://circleci.com/workflow-run/9532cd94-8123-4cab-9c29-deaa52b3c372]
   | 
[!https://builds.apache.org/view/A-D/view/Cassandra/job/Cassandra-devbranch-testall/37//badge/icon!|https://builds.apache.org/view/A-D/view/Cassandra/job/Cassandra-devbranch-testall/37/]
 |

> A possible NPE in nodetool getendpoints
> ---
>
> Key: CASSANDRA-13357
> URL: https://issues.apache.org/jira/browse/CASSANDRA-13357
> Project: Cassandra
>  Issue Type: Bug
>  Components: Tool/nodetool
>Reporter: Hao Zhong
>Assignee: Hao Zhong
>Priority: Normal
> Fix For: 4.x
>
> Attachments: cassandra.patch
>
>
> The GetEndpoints.execute method has the following code:
> {code:title=GetEndpoints.java|borderStyle=solid}
>List endpoints = probe.getEndpoints(ks, table, key);
> for (InetAddress endpoint : endpoints)
> {
> System.out.println(endpoint.getHostAddress());
> }
> {code}
> This code can throw NPE. A similar bug is fixed in CASSANDRA-8950. The buggy 
> code  is 
> {code:title=NodeCmd.java|borderStyle=solid}
>   List endpoints = this.probe.getEndpoints(keySpace, cf, key);
> for (InetAddress anEndpoint : endpoints)
> {
>output.println(anEndpoint.getHostAddress());
> }
> {code}
> The fixed code is:
> {code:title=NodeCmd.java|borderStyle=solid}
> try
> {
> List endpoints = probe.getEndpoints(keySpace, cf, 
> key);
> for (InetAddress anEndpoint : endpoints)
>output.println(anEndpoint.getHostAddress());
> }
> catch (IllegalArgumentException ex)
> {
> output.println(ex.getMessage());
> probe.failed();
> }
> {code}
> The GetEndpoints.execute method shall be modified as CASSANDRA-8950 does.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org