[ https://issues.apache.org/jira/browse/JCR-1396?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Stefan Guggisberg resolved JCR-1396. ------------------------------------ Resolution: Fixed Fix Version/s: 1.5 fixed in svn r629770 thanks for reporting this issue! > DateValue.getDate not a copy > ---------------------------- > > Key: JCR-1396 > URL: https://issues.apache.org/jira/browse/JCR-1396 > Project: Jackrabbit > Issue Type: Bug > Components: jackrabbit-jcr-commons > Affects Versions: 1.4 > Environment: any > Reporter: Sebastian Prehn > Fix For: 1.5 > > Original Estimate: 0.25h > Remaining Estimate: 0.25h > > I noticed that getDate() in org.apache.jackrabbit.value.DateValue is returned > by reference. According to the specification it should be a copy. (see. JSR > 170 section 6.2.7) > > private Calendar date; > > public Calendar getDate() > throws ValueFormatException, IllegalStateException, > RepositoryException { > setValueConsumed(); > > if (date != null) { > return date; // <-- HERE > } else { > throw new ValueFormatException("empty value"); > } > } > short test: > ValueFactory factory = session.getValueFactory(); > Value v = factory.createValue(GregorianCalendar.getInstance()); > Calendar c0 = v.getDate(); > Calendar c1 = v.getDate(); > > if(c0 == c1){ > out.println("error - references are equal"); > out.println(c0); > } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.