Exceptions that occur during the commit of LAO resource's LocalTransaction are not controllable, because the thrown Exception is simply replaces by a specific XAException in ConnectorXAResource.
This makes it impossible for the calling app code to catch the exception that was the cause for the failed commit and to react accordingly.
Moreover, the LAO resource might want to vote for a rollback of the whole global transaction, which is not possible today (the exception is replaced by an INTERNAL later on that doesn't lead to a rollback as far as I understood the code).
This in turn leaves the whole global transaction in a broken state.
My suggestion would be to allow the LAO resource's LocalTransaction to rethrow an XAException with the right errorCode that would not be replaced inside ConnectorXAResource, but just thrown.
If the LAO resource's LocalTransaction throws any other exception than a XAException, the process would remain as it is today.
I could provide this quite simple modification, if you want me to.