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

Expose exceptions #539

Merged
merged 3 commits into from
Feb 24, 2021
Merged

Expose exceptions #539

merged 3 commits into from
Feb 24, 2021

Conversation

robertvazan
Copy link
Collaborator

Per #530, but only for three important classes: JsonSerializer, WbGetEntitiesAction, and WbSearchEntitiesAction. There are some spurious exception handlers in dumpfiles/rdf that I have not touched in this pull request.

Calling code within WDTK itself already assumes exceptions. There were no null checks anywhere, so this actually fixes a bug.

This is a breaking change but a very visible one, so there would be no silent failures in apps.

@codecov
Copy link

codecov bot commented Feb 23, 2021

Codecov Report

Merging #539 (dc0e35a) into master (3bc5d8f) will decrease coverage by 0.02%.
The diff coverage is 69.11%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #539      +/-   ##
============================================
- Coverage     81.04%   81.02%   -0.03%     
+ Complexity     2088     2085       -3     
============================================
  Files           149      149              
  Lines          7306     7293      -13     
  Branches        895      895              
============================================
- Hits           5921     5909      -12     
+ Misses         1116     1115       -1     
  Partials        269      269              
Impacted Files Coverage Δ Complexity Δ
...idata/wdtk/datamodel/helpers/JsonDeserializer.java 95.23% <ø> (ø) 6.00 <0.00> (ø)
...idata/wdtk/wikibaseapi/WbSearchEntitiesAction.java 63.63% <63.63%> (-0.26%) 5.00 <5.00> (-1.00)
...wikidata/wdtk/wikibaseapi/WbGetEntitiesAction.java 86.66% <74.19%> (-1.22%) 18.00 <0.00> (-1.00)
...ikidata/wdtk/datamodel/helpers/JsonSerializer.java 68.88% <75.00%> (-2.54%) 11.00 <3.00> (-1.00)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3bc5d8f...dc0e35a. Read the comment docs.

Copy link
Member

@wetneb wetneb left a comment

Choose a reason for hiding this comment

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

Looks like a sensible move, thanks! But the diff seems bigger than it needs to be, at a first glance.

}

return results;
}
Copy link
Member

Choose a reason for hiding this comment

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

This seems to be a large piece of code that got reformatted in the process, it's not clear to me what changed there?

@robertvazan
Copy link
Collaborator Author

I am sorry for the large diff. As I have said in #535, there are no coding standards. Most code seems to use tabs. Eclipse doesn't work so well with mixed indentation. I have therefore converted spaces in affected code to tabs. Some code has indentation changes, because try/catch was removed. GitHub fortunately allows you to hide whitespace changes.

I am touching only three classes that are relevant in lexeme I/O. This is all a preparation for #403. Of these classes, JsonSerializer is really essential. The other two are changed for consistency.

I should clarify that this is not really a breaking change as long as WDTK correctly parses entities returned from Wikibase API. New exceptions are thrown only if parsing fails, which would imply a bug in WDTK. All code using Wb*Action classes is already handling IOException, so the new exceptions will be caught when Wikibase data model changes. Only direct JsonSerializer calls require application code changes, but that is only relevant when Wikibase data model changes. If that is a serious enough problem, I can create separate set of methods in JsonSerializer and deprecate the old ones.

@Tpt Tpt merged commit 0b26279 into Wikidata:master Feb 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants