Re: java.lang.RuntimeException RDDI_DAP_OPERATION_FAILED
I think I figured this one out.
In my case it seemed that the 'java.lang.RuntimeException RDDI_DAP_OPERATION_FAILED' was related to my code reprogramming the PMUX of the SWD pins. When using the Atmel-ICE with MPLAB-X it does not drive the Reset line of the chip (not required as long as the PMUX settings are not changed).
As far as I can tell it is not possible to enable this in MPLAB, so I solved the problem by installing Atmel Studio and using the Tools -> Device Programming option to do a full Chip erase. As this programmer DOES drive the Reset pin it is able to perform 'cold-plugging' (See your chip's datasheet) making it possible to escape from the disabled SWD.
Hope this one will help you guys too :)