code: private void stage3CommitProcessing(int state) throws SystemException, RollbackException, HeuristicMixedException, HeuristicHazardException {
          if (tc.isEntryEnabled())
              Tr.entry(tc, "stage3CommitProcessing", TransactionState.stateToString(state));
  
          switch (state) {
              case TransactionState.STATE_ROLLING_BACK: // could be retries
              case TransactionState.STATE_ROLLED_BACK:
                  //
                  // As we rolled back we need to throw a RollbackException
                  // unless the rollback was triggered by a SystemException or heuristic
                  // in which case we should throw a SystemException or heuristic
                  //
                  if (_systemExceptionOccured) {
                      final SystemException se = new SystemException();
                      if (tc.isEntryEnabled())
                          Tr.exit(tc, "stage3CommitProcessing", se);
                      throw se;
                  } else if (_heuristicOnPrepare != null) {
                      if (tc.isEntryEnabled())
                          Tr.exit(tc, "stage3CommitProcessing", _heuristicOnPrepare);
                      if (_heuristicOnPrepare instanceof HeuristicMixedException)
                          throw (HeuristicMixedException) _heuristicOnPrepare;
  
                      throw (HeuristicHazardException) _heuristicOnPrepare;
                  }
  
                  // PK19059 starts here
                  final RollbackException rbe;
                  if (getOriginalException() == null) {
                      rbe = new RollbackException();
                  } else {
                      rbe = new RollbackException();
                      rbe.initCause(getOriginalException());
                  }
                  // PK19059 ends here
                  if (tc.isEntryEnabled())
                      Tr.exit(tc, "stage3CommitProcessing", rbe);
                  throw rbe;
          }
  
          if (tc.isEntryEnabled())
              Tr.exit(tc, "stage3CommitProcessing");
      }
docs: /*
  @throws SystemException
  
  @throws RollbackException, HeuristicMixedException, HeuristicHazardException