You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by brettKK <gi...@git.apache.org> on 2018/04/19 13:55:37 UTC
[GitHub] cassandra pull request #219: CASSANDRA-14385
GitHub user brettKK opened a pull request:
https://github.com/apache/cassandra/pull/219
CASSANDRA-14385
@LJ1043041006 found a potential NPE in cassandra
---
We have developed a static analysis tool [NPEDetector](https://github.com/lujiefsi/NPEDetector) to find some potential NPE. Our analysis shows that some callees may return null in corner case(e.g. node crash , IO exception), some of their callers have !=null check but some do not have. In this issue we post a patch which can add !=null based on existed !=null check. For example:
Calle Schema#getView may return null:
```
public ViewMetadata getView(String keyspaceName, String viewName)
{
assert keyspaceName != null;
KeyspaceMetadata ksm = keyspaces.getNullable(keyspaceName);
return (ksm == null) ? null : ksm.views.getNullable(viewName);//may return null
}
```
it have 4 callers, 3 of them have !=null check, like its caller MigrationManager#announceViewDrop have !=null check()
```
public static void announceViewDrop(String ksName, String viewName, boolean announceLocally) throws ConfigurationException
{
ViewMetadata view = Schema.instance.getView(ksName, viewName);
if (view == null)//null pointer checker
throw new ConfigurationException(String.format("Cannot drop non existing materialized view '%s' in keyspace '%s'.", viewName, ksName));
KeyspaceMetadata ksm = Schema.instance.getKeyspaceMetadata(ksName);
logger.info("Drop table '{}/{}'", view.keyspace, view.name);
announce(SchemaKeyspace.makeDropViewMutation(ksm, view, FBUtilities.timestampMicros()), announceLocally);
}
```
but caller MigrationManager#announceMigration does not have
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/brettKK/cassandra CASSANDRA-14385
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/cassandra/pull/219.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #219
----
commit 61b4ed4afbd80fbde24bef3cedb9e8d3b06f788c
Author: brettkk <10...@...>
Date: 2018-04-19T13:49:49Z
fix CASSANDRA-14385
----
---
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
[GitHub] cassandra issue #219: CASSANDRA-14385
Posted by brettKK <gi...@git.apache.org>.
Github user brettKK commented on the issue:
https://github.com/apache/cassandra/pull/219
https://issues.apache.org/jira/browse/CASSANDRA-14385
---
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org