On a fresh lenya 2.0.4 install, trying to empty the trash leads to (after clicking on the delete button in the confirmation dialog): java.lang.RuntimeException: The document [test:trash:b005a910-315f-11e0-806c-93e5409e06ee:de] is not referenced in the site structure. at org.apache.lenya.cms.publication.DocumentImpl.getLocator(DocumentImpl.java:508) at org.apache.lenya.cms.publication.DocumentManagerImpl.deleteAllLanguageVersions(DocumentManagerImpl.java:763) at org.apache.lenya.cms.publication.DocumentManagerImpl$DeleteVisitor.visitDocument(DocumentManagerImpl.java:791) at org.apache.lenya.cms.publication.DocumentImpl.accept(DocumentImpl.java:404) at org.apache.lenya.cms.publication.util.DocumentSet.visit(DocumentSet.java:131) at org.apache.lenya.cms.publication.DocumentManagerImpl.delete(DocumentManagerImpl.java:817) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:592) at org.apache.avalon.excalibur.component.ComponentProxyGenerator$ComponentInvocationHandler.invoke(ComponentProxyGenerator.java:143) at $Proxy56.delete(Unknown Source) at org.apache.lenya.cms.site.usecases.EmptyTrash.doExecute(EmptyTrash.java:116) at org.apache.lenya.cms.usecase.AbstractUsecase.execute(AbstractUsecase.java:319)
Analysis of the bug: The exception happens if you try to delete more than one language version of a document. EmptyTrash.doExecute passes a list of documents to DocumentManager.delete. Different language versions are passed as separate documents. However, the method DeleteVisitor.visitDocument (in DocumentManagerImpl) calls deleteAllLanguageVersions on each of the documents, hence on each of the language versions, ie. tries to delete the same thing several times. Replacing the call of deleteAllLanguageVersions by delete seems to do the trick.
Fixed in r1068192 (2.0.4), added test case in r1070690. Needs to be merged to 2.1.X
(In reply to comment #2) > Fixed in r1068192 (2.0.4), added test case in r1070690. > > Needs to be merged to 2.1.X Done in r1072602.
Fixed for Release 2.0.4.