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

Changes in invalid input handling #373

Merged
merged 1 commit into from
Jul 31, 2023
Merged

Conversation

heemin32
Copy link
Collaborator

Description

  1. Switch exception type from OpenSearchException to IllegalArgumentException for invalid endpoint
  2. Add cluster state validation for update API

Issues Resolved

N/A

Check List

  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

1. Switch exception type from OpenSearchException to IllegalArgumentException for invalid endpoint
2. Add cluster state validation for update API

Signed-off-by: Heemin Kim <heemin@amazon.com>
@codecov
Copy link

codecov bot commented Jul 28, 2023

Codecov Report

Merging #373 (48f9aba) into main (26b1938) will decrease coverage by 0.06%.
The diff coverage is 100.00%.

@@             Coverage Diff              @@
##               main     #373      +/-   ##
============================================
- Coverage     88.65%   88.60%   -0.06%     
  Complexity      752      752              
============================================
  Files            92       92              
  Lines          2707     2711       +4     
  Branches        219      220       +1     
============================================
+ Hits           2400     2402       +2     
- Misses          228      230       +2     
  Partials         79       79              
Files Changed Coverage Δ
...ip2geo/action/UpdateDatasourceTransportAction.java 91.02% <100.00%> (-3.65%) ⬇️
...opensearch/geospatial/ip2geo/dao/GeoIpDataDao.java 87.40% <100.00%> (+0.09%) ⬆️

... and 1 file with indirect coverage changes

@@ -94,6 +95,11 @@ protected void doExecute(final Task task, final UpdateDatasourceRequest request,
if (datasource == null) {
throw new ResourceNotFoundException("no such datasource exist");
}
if (DatasourceState.AVAILABLE.equals(datasource.getState()) == false) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use if(!DatasourceState.....)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

== false is more readable and preferred format borrowed from OpenSearch core.

@heemin32 heemin32 requested a review from vamshin July 30, 2023 02:27
@heemin32 heemin32 merged commit e1f41bb into opensearch-project:main Jul 31, 2023
13 checks passed
@heemin32 heemin32 deleted the bugfix branch July 31, 2023 16:48
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jul 31, 2023
1. Switch exception type from OpenSearchException to IllegalArgumentException for invalid endpoint
2. Add cluster state validation for update API

Signed-off-by: Heemin Kim <heemin@amazon.com>
(cherry picked from commit e1f41bb)
heemin32 added a commit that referenced this pull request Jul 31, 2023
1. Switch exception type from OpenSearchException to IllegalArgumentException for invalid endpoint
2. Add cluster state validation for update API

Signed-off-by: Heemin Kim <heemin@amazon.com>
(cherry picked from commit e1f41bb)

Co-authored-by: Heemin Kim <heemin@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x Backport PR to 2.x branch skip-changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants