From 5e890e6656cc7f8c0b95771b3793264978b6275c Mon Sep 17 00:00:00 2001 From: Gavin Cornwell Date: Fri, 7 Mar 2008 12:28:36 +0000 Subject: [PATCH] Merged V2.2 to HEAD 8019: Merged V2.1 to V2.2 7715: Fix for AWC-1753 7725: Additional files for AWC-1753 - also fixes unreported issue of OK button not being highlighted when editing post until you press a key 7726: Additional files for AWC-1753 - also fixes unreported issue of OK button not being highlighted when editing post until you press a key 7731: Added support for Range and Content-Range headers to support Download managers and Resume features for HTTP downloads 7967: Workaround for ACT-771: Missing AVM Store system descriptor properties prevents system startup 7980: AWC-1662: Fixed NPE when searching for users 7981: Fix for AWC-1661: Can't edit details of user who has had their home space removed 7988: NodeRef + child path relative URLs support for DownloadContentServlet 8003: Fix for AWC-1795 8004: Fix http://issues.alfresco.com/browse/AR-1807 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8461 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- config/alfresco/avm-services-context.xml | 2 +- .../java/org/alfresco/repo/avm/AVMDAOs.java | 5 ++--- .../org/alfresco/repo/avm/AVMStoreImpl.java | 22 +++++++++++++++---- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/config/alfresco/avm-services-context.xml b/config/alfresco/avm-services-context.xml index 6f5cf4a8a0..28479264d9 100644 --- a/config/alfresco/avm-services-context.xml +++ b/config/alfresco/avm-services-context.xml @@ -124,7 +124,7 @@ - + diff --git a/source/java/org/alfresco/repo/avm/AVMDAOs.java b/source/java/org/alfresco/repo/avm/AVMDAOs.java index f277a8eb54..2eca72438b 100644 --- a/source/java/org/alfresco/repo/avm/AVMDAOs.java +++ b/source/java/org/alfresco/repo/avm/AVMDAOs.java @@ -19,11 +19,10 @@ public class AVMDAOs /** * The single instance of an AVMContext. */ - private static AVMDAOs fgInstance; + private static final AVMDAOs fgInstance = new AVMDAOs(); - AVMDAOs() + private AVMDAOs() { - fgInstance = this; } /** diff --git a/source/java/org/alfresco/repo/avm/AVMStoreImpl.java b/source/java/org/alfresco/repo/avm/AVMStoreImpl.java index bd5c2ce296..cdf3cccf44 100644 --- a/source/java/org/alfresco/repo/avm/AVMStoreImpl.java +++ b/source/java/org/alfresco/repo/avm/AVMStoreImpl.java @@ -1049,7 +1049,15 @@ public class AVMStoreImpl implements AVMStore, Serializable */ public int getLastVersionID() { - return AVMDAOs.Instance().fVersionRootDAO.getMaxVersionID(this); + Integer lastVersionId = AVMDAOs.Instance().fVersionRootDAO.getMaxVersionID(this); + if (lastVersionId == null) + { + return 0; + } + else + { + return lastVersionId.intValue(); + } } /** @@ -1159,9 +1167,15 @@ public class AVMStoreImpl implements AVMStore, Serializable */ public AVMStoreDescriptor getDescriptor() { - return new AVMStoreDescriptor(fName, - getProperty(ContentModel.PROP_CREATOR).getStringValue(), - ((Date)getProperty(ContentModel.PROP_CREATED).getValue(DataTypeDefinition.DATE)).getTime()); + // Get the creator ensuring that nulls are not hit + PropertyValue creatorValue = getProperty(ContentModel.PROP_CREATOR); + String creator = creatorValue == null ? "system" : (String) creatorValue.getValue(DataTypeDefinition.TEXT); + creator = (creator == null) ? "system" : creator; + // Get the created date ensuring that nulls are not hit + PropertyValue createdValue = getProperty(ContentModel.PROP_CREATED); + Date created = createdValue == null ? (new Date()) : (Date) createdValue.getValue(DataTypeDefinition.DATE); + created = (created == null) ? (new Date()) : created; + return new AVMStoreDescriptor(fName, creator, created.getTime()); } /**