Description
To repeat:
- Upload an attachment, upload it again so it's version 1.2
- Paste this code into the document:
{{velocity}} $doc.getAttachmentList().get(0).getVersionList() {{/velocity}}
Observe an OOM error:
Caused by: java.lang.OutOfMemoryError: Java heap space at java.util.Arrays.copyOf(Arrays.java:2734) at java.util.ArrayList.ensureCapacity(ArrayList.java:167) at java.util.ArrayList.add(ArrayList.java:351) at com.xpn.xwiki.doc.XWikiAttachment.getVersionList(XWikiAttachment.java:607) at com.xpn.xwiki.api.Attachment.getVersionList(Attachment.java:169) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
This is caused by questionable usage of Version.next() which appears to have been broken by an api change or bug fix.