[NETCONF-511] Incorrect Error mappings in 8040 code Created: 23/Feb/18  Updated: 16/Jan/19  Resolved: 16/Jan/19

Status: Resolved
Project: netconf
Component/s: restconf-nb
Affects Version/s: Oxygen, Fluorine, Neon, Fluorine SR1
Fix Version/s: Neon, Fluorine SR2

Type: Bug Priority: High
Reporter: Anton Ivanov Assignee: Anton Ivanov
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Tested with json rpc but shows with other data too too.



 Description   

The new 8040 code returns bogus errors when trying to create data resources which already exist via post.

Instead of returning 409 (same as the old code) or another appropriate 4xx code for a conflict it returns 503 - server failed. This is broken, there is no server failure, the server did its job and determined that a conflict is in place. It should neither pollute the logs nor return bogus error codes to the client.

 



 Comments   
Comment by Tom Pantelis [ 25/Feb/18 ]

Can you provide the full error response? Also any error logged in the karaf.log? I don't see anywhere in the 8040 code where it would throw a RestconfDocumentedException with RestconfError.RESOURCE_DENIED_TRANSPORT which maps to 503 so I suspect the 503 (Service Unavailable) was returned from higher up - perhaps restconf throw an ISE or some other unchecked ex from somewhere.

Looking at TransactionUtil.checkItemDoesNotExists which is called by PostDataTransactionUtil, it does throw a RestconfDocumentedException with RestconfError.DATA_EXISTS which maps to 409 so it should work as expected..

Comment by Robert Varga [ 04/Sep/18 ]

aivanov can you provide the input Tom asked for, please?

Comment by Anton Ivanov [ 04/Sep/18 ]

I unicasted it back at the time. In fact, it needs a retest - Tom and Ryan were working on a fix and it may have been merged along with other patches.

 

Comment by Jakub Morvay [ 01/Oct/18 ]

aivanov do you have some spare cycles to retest this and confirm if it is still present?

Comment by Tomas Cere [ 16/Jan/19 ]

Quick check revealed this was still present, cause was that the status code from RestconfDocumentedException was not forwarded to the WebApplicationException

Generated at Wed Feb 07 20:15:13 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.