[MAGNOLIA-2377] Issue with getDate() Created: 18/Sep/08 Updated: 23/Jan/13 Resolved: 07/Jan/09 |
|
| Status: | Closed |
| Project: | Magnolia |
| Component/s: | templating |
| Affects Version/s: | 3.5.4 |
| Fix Version/s: | 4.0 |
| Type: | Bug | Priority: | Major |
| Reporter: | Olivier Marti | Assignee: | Magnolia International |
| Resolution: | Workaround exists | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Template: |
|
||||||||
| Acceptance criteria: |
Empty
|
||||||||
| Task DoD: |
[ ]*
Doc/release notes changes? Comment present?
[ ]*
Downstream builds green?
[ ]*
Solution information and context easily available?
[ ]*
Tests
[ ]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
||||||||
| Bug DoR: |
[ ]*
Steps to reproduce, expected, and actual results filled
[ ]*
Affected version filled
|
||||||||
| Date of First Response: | |||||||||
| Description |
|
It seems that for a Value in the repository of the value "Date" only one copy is existing in the memory, where all queries to it are referencing. That's what my code looks like: Result: |
| Comments |
| Comment by Olivier Marti [ 18/Sep/08 ] |
|
Ok found two ways how it's working: Calendar orig = (Calendar) activeNode.getNodeData("date").getDate().clone(); or Calendar orig = new GregorianCalendar(); |
| Comment by Magnolia International [ 18/Sep/08 ] |
|
reopening to set status and resolution appropriately |
| Comment by Magnolia International [ 18/Sep/08 ] |
|
If you look at the Property.getDate() javadoc it says:
This is misleading, because I would thus expect the above snippet to show that we get a fresh copy every time we do getProperty on the node. Instead, if you look at the Jackrabbit code, you'll see that the Value implementation holds a cache of a Calendar instance, and (I'm only guessing here: ), the Node implementation probably also holds a cache of its associated {{Value}}s. I'll actually keep this open to gather some feedback - should this be considered a Jackrabbit issue ? |
| Comment by Magnolia International [ 18/Sep/08 ] |
|
It could indeed be: see https://issues.apache.org/jira/browse/JCR-1396 which is fixed for 1.5 |
| Comment by Magnolia International [ 07/Jan/09 ] |
|
This is fixed by updating to Jackrabbit 1.5+ |