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

FIX - Reporting missing "property.type" XML/JSON property #4109

Merged

Conversation

Agnul97
Copy link
Contributor

@Agnul97 Agnul97 commented Sep 27, 2024

the call to the rest-api endpoint PUT /{scopeId}/serviceConfigurations/{componentId} was returning a 204 code when some "properties" you want to update had a missing "type" parameter. This was wrong because, in this case, the back-end cannot unmarshall properly the xml/json, resulting in a no-up update, so an error should be shown to the client.

To change this, I modified the code of the custom unmarshaller we created (XmlPropertiesAdapter.java) in order to throw an internal exception in such case.

I tried to throw a more proper KapuaException instead of the internalError but I had some problems for the way JAXB handles exceptions. In a future PR I will work on this in order to more correctly propagate a 404 error code to the client

Finally, I added some tests

Copy link

codecov bot commented Sep 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 16.81%. Comparing base (ce975f4) to head (46bdeff).
Report is 7 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             develop    #4109   +/-   ##
==========================================
  Coverage      16.80%   16.81%           
  Complexity        22       22           
==========================================
  Files           2019     2019           
  Lines          52410    52411    +1     
  Branches        4417     4417           
==========================================
+ Hits            8810     8812    +2     
  Misses         43202    43202           
+ Partials         398      397    -1     
Files with missing lines Coverage Δ
...kapua/model/xml/adapters/XmlPropertiesAdapter.java 97.43% <100.00%> (+0.06%) ⬆️

... and 1 file with indirect coverage changes

@Coduz Coduz added the Bug This is a bug or an unexpected behaviour. Fix it! label Oct 1, 2024
@Coduz Coduz merged commit 2fed32d into eclipse:develop Oct 1, 2024
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This is a bug or an unexpected behaviour. Fix it!
Projects
Development

Successfully merging this pull request may close these issues.

2 participants