| Summary: | NPE in TransactionCommitContext with re-attached object on branch. | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [Modeling] EMF | Reporter: | Pascal Lehmann <pascal.lehmann> | ||||||||||
| Component: | cdo.core | Assignee: | Caspar D. <caspar_d> | ||||||||||
| Status: | CLOSED FIXED | QA Contact: | Eike Stepper <stepper> | ||||||||||
| Severity: | normal | ||||||||||||
| Priority: | P3 | CC: | caspar_d, cyril.jaquier, saulius.tvarijonas | ||||||||||
| Version: | 4.0 | Flags: | stepper:
review+
|
||||||||||
| Target Milestone: | --- | ||||||||||||
| Hardware: | All | ||||||||||||
| OS: | All | ||||||||||||
| Whiteboard: | offline-02 | ||||||||||||
| Attachments: |
|
||||||||||||
|
Description
Pascal Lehmann
Created attachment 178417 [details]
Testcase
Created attachment 178418 [details]
Proposed patch
Resetting version in case of branch change on re-attach.
1) The number of lines that you changed is smaller than 250. confirmed. 2) You are the only author of these changed lines. confirmed. 3) You apply the EPL to these changed lines. confirmed. The patch avoids the exceptions, but I'm not sure it addresses the problem in the best possible way, because the fix performs work that should IMO be done by AbstractCDORevision#adjustForCommit. I'm still debugging to understand why this doesn't work.. perhaps Pascal has already investigated this? Flagging for Eike's review anyway, but I don't recommend committing this yet. (BTW, this problem is also partially due to the fact that our client-side logic doesn't net out redundant deltas -- but that's a more general issue that we can address separately.) Created attachment 178485 [details]
Patch v2
Here's my own stab at a patch.
I believe the problem was not that the ReattachTransition DIDN'T
change the branch, but rather that it DID. In other words, it was
prematurely setting the branch of the reattached revision to the
transaction's *current* branch. But this adjustment shouldn't be
made until postCommit time, by AbstractCDORevision#adjustForCommit.
I completely agree that the version adjustments should be handled in adjustForCommit, so I took another look: The reason it wasn't caught by the code already present in adjustForCommit is that the branch in the revision for reattached objects will always be the current branch (Line 693: revision.setBranchPoint(transaction.getBranch().getHead());) no matter what branch the revKey acutally came from. ahh cheers, you beat me :) Created attachment 178675 [details]
Patch v3 - ready to be committed
I included the tests in AllConfigs
Committed to HEAD |