Fórum
Liferay 6.11 failure on Import of Articles with multiple Versions
Bogoy Hafner, modificado 11 Anos atrás.
Liferay 6.11 failure on Import of Articles with multiple Versions
New Member Postagens: 6 Data de Entrada: 15/11/12 Postagens Recentes
We seem to have an issue with importing articles with multiple versions in liferay 6.11
Caused by: com.liferay.portlet.journal.DuplicateArticleIdException
at com.liferay.portlet.journal.service.impl.JournalArticleLocalServiceImpl.validate(JournalArticleLocalServiceImpl.java:3565)
at com.liferay.portlet.journal.service.impl.JournalArticleLocalServiceImpl.validate(JournalArticleLocalServiceImpl.java:3546)
at com.liferay.portlet.journal.service.impl.JournalArticleLocalServiceImpl.addArticle(JournalArticleLocalServiceImpl.java:192)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
This error occurs during the import (data strategy copy as new).
I've stepped through the code with a debugger (netbeans), and it seems when liferay tries to import the second version of an article, it does not generate a new Id (which is fine - as its the same article Id), but validates if there is already an article with the same article Id and group Id present... which of course it is, as its just a different version of the article.
I can reproduce this by:
1) Unzip liferay 6.11 tomcat bundle.
2) create a community
3) backup installation
4) create an article
5) change and publish that article
6) Export the community pages
7) restore previous backup
8) import the exported lar
=> error
This seems like a bug to me, but I can't imagine, the import has not been tested with multiple versions of articles... so maybe I'm doing something completely wrong or misunderstanding something?
Caused by: com.liferay.portlet.journal.DuplicateArticleIdException
at com.liferay.portlet.journal.service.impl.JournalArticleLocalServiceImpl.validate(JournalArticleLocalServiceImpl.java:3565)
at com.liferay.portlet.journal.service.impl.JournalArticleLocalServiceImpl.validate(JournalArticleLocalServiceImpl.java:3546)
at com.liferay.portlet.journal.service.impl.JournalArticleLocalServiceImpl.addArticle(JournalArticleLocalServiceImpl.java:192)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
This error occurs during the import (data strategy copy as new).
I've stepped through the code with a debugger (netbeans), and it seems when liferay tries to import the second version of an article, it does not generate a new Id (which is fine - as its the same article Id), but validates if there is already an article with the same article Id and group Id present... which of course it is, as its just a different version of the article.
protected void validate(
long companyId, long groupId, long classNameId, String articleId,
boolean autoArticleId, double version, Map<locale, string> titleMap,
String content, String type, String structureId, String templateId,
boolean smallImage, String smallImageURL, File smallImageFile,
byte[] smallImageBytes)
throws PortalException, SystemException {
if (!autoArticleId) {
validate(groupId, articleId);
}
validate(
companyId, groupId, classNameId, titleMap, content, type,
structureId, templateId, smallImage, smallImageURL, smallImageFile,
smallImageBytes);
}</locale,>
I can reproduce this by:
1) Unzip liferay 6.11 tomcat bundle.
2) create a community
3) backup installation
4) create an article
5) change and publish that article
6) Export the community pages
7) restore previous backup
8) import the exported lar
=> error
This seems like a bug to me, but I can't imagine, the import has not been tested with multiple versions of articles... so maybe I'm doing something completely wrong or misunderstanding something?