Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some @Nullable annotations and fix related compilation warnings. #7251

Closed
wants to merge 1 commit into from

Conversation

Projects
None yet
3 participants
@jpountz
Copy link
Contributor

jpountz commented Aug 13, 2014

Added @Nullable to:

  • IndicesService.indexService
  • IndexService.shard
  • IndexService.shardInjector

This change doesn't try to do anything smart but just makes sure that a
*MissingException is thrown instead of a NullPointerException when the requested
object doesn't exist.

Internal: Add some @nullable annotations and fix related compilation …
…warnings.

Added @nullable to:
 - IndicesService.indexService
 - IndexService.shard
 - IndexService.shardInjector

This change doesn't try to do anything smart but just makes sure that a
*MissingException is thrown instead of a NullPointerException when the requested
object doesn't exist.
if (indexShard != null) {
return new StoreFilesMetaData(true, shardId, indexShard.store().getMetadata().asMap());
}
return new StoreFilesMetaData(true, shardId, indexShard.store().getMetadata().asMap());

This comment has been minimized.

Copy link
@jpountz

jpountz Aug 13, 2014

Author Contributor

indexShard != null is already checked above

throw new IndexMissingException(new Index(index));
newMappers.put(index, newMapper);
if (existingMapper != null) {
existingMappers.put(index, existingMapper);

This comment has been minimized.

Copy link
@jpountz

jpountz Aug 13, 2014

Author Contributor

This change is mostly indentation: it replaces

IndexService indexService = indicesService.indexService(index);
if (indexService != null) {
  // do something
} else {
  throw new IndexMissingException(new Index(index));
}

with

IndexService indexService = indicesService.indexServiceSafe(index);
// do something

@jpountz jpountz added the review label Aug 13, 2014

@martijnvg

This comment has been minimized.

Copy link
Member

martijnvg commented Aug 14, 2014

LGTM

@martijnvg martijnvg removed the review label Aug 14, 2014

jpountz added a commit that referenced this pull request Aug 14, 2014

Internal: Add some @nullable annotations and fix related compilation …
…warnings.

Added @nullable to:
 - IndicesService.indexService
 - IndexService.shard
 - IndexService.shardInjector

This change doesn't try to do anything smart but just makes sure that a
*MissingException is thrown instead of a NullPointerException when the requested
object doesn't exist.

Close #7251
@jpountz

This comment has been minimized.

Copy link
Contributor Author

jpountz commented Aug 14, 2014

Thanks @martijnvg

@jpountz jpountz closed this Aug 14, 2014

jpountz added a commit that referenced this pull request Aug 14, 2014

Internal: Add some @nullable annotations and fix related compilation …
…warnings.

Added @nullable to:
 - IndicesService.indexService
 - IndexService.shard
 - IndexService.shardInjector

This change doesn't try to do anything smart but just makes sure that a
*MissingException is thrown instead of a NullPointerException when the requested
object doesn't exist.

Close #7251

@jpountz jpountz deleted the jpountz:fix/indexservice_nullable branch Aug 14, 2014

@jpountz jpountz added v2.0.0 labels Aug 14, 2014

jpountz added a commit that referenced this pull request Sep 8, 2014

Internal: Add some @nullable annotations and fix related compilation …
…warnings.

Added @nullable to:
 - IndicesService.indexService
 - IndexService.shard
 - IndexService.shardInjector

This change doesn't try to do anything smart but just makes sure that a
*MissingException is thrown instead of a NullPointerException when the requested
object doesn't exist.

Close #7251

@clintongormley clintongormley changed the title Internal: Add some @Nullable annotations and fix related compilation warnings. Add some @Nullable annotations and fix related compilation warnings. Jun 7, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.