On May 10, 2008, at 12:52 AM, sdumitriu (SVN) wrote:
Author: sdumitriu Date: 2008-05-10 00:52:10 +0200 (Sat, 10 May 2008) New Revision: 9742
Modified: xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/ doc/XWikiAttachment.java Log: XWIKI-1938: Viewing attachment history fails for some imported attachments Fix part of the problem
Modified: xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/ xwiki/doc/XWikiAttachment.java =================================================================== --- xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/ doc/XWikiAttachment.java 2008-05-09 22:38:54 UTC (rev 9741) +++ xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/ doc/XWikiAttachment.java 2008-05-09 22:52:10 UTC (rev 9742) @@ -459,7 +459,15 @@
public synchronized Version[] getVersions() { - return getAttachment_archive().getVersions(); + try { + return getAttachment_archive().getVersions(); + } catch (Exception ex) { + if (LOG.isWarnEnabled()) {
we could drop the if since it's inside a catch... -Vincent
+ LOG.warn(String.format("Cannot retrieve versions of attachment [%s@%s]: %s", + getFilename(), getDoc().getFullName(), ex.getMessage())); + } + return new Version[] {new Version(this.getVersion())}; + } }
// We assume versions go from 1.1 to the current one