throw new FBXAException("Prepare called with current xid",
throw new FBXAException("Prepare called with non-ended xid",
    int internalPrepare(Xid xid) throws FBXAException, GDSException {        if (log != null) log.trace("prepare called: " + xid);        IscTrHandle committingTr = (IscTrHandle)xidMap.get(xid);        if (committingTr == null)            throw new FBXAException("Prepare called with unknown transaction",                    XAException.XAER_NOTA);        if (committingTr == gdsHelper.getCurrentTrHandle())            throw new FBXAException("Prepare called with current xid",                    XAException.XAER_PROTO);                try {            FBXid fbxid;            if (xid instanceof FBXid) {                fbxid = (FBXid) xid;            } else {                fbxid = new FBXid(xid);            }            byte[] message = fbxid.toBytes();                        gdsHelper.getInternalAPIHandler().iscPrepareTransaction2(committingTr, message);        } catch (GDSException ge) {            try {                gdsHelper.getInternalAPIHandler().iscRollbackTransaction(committingTr);            } catch (GDSException ge2) {                if (log != null)                    log.debug("Exception rolling back failed tx: ", ge2);            } finally {                xidMap.remove(xid);            }                         if (log != null) log.warn("error in prepare", ge);            throw ge;        }        return XA_OK;    }