mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
ACE-2981: Fixed NPE when applying the "patch. SurfConfigFolder" patch to an alfresco repository which has no Site.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@86213 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -41,6 +41,7 @@ import org.alfresco.repo.site.SiteModel;
|
||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.rule.RuleService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.service.namespace.RegexQNamePattern;
|
||||
import org.alfresco.util.Pair;
|
||||
import org.apache.commons.logging.Log;
|
||||
@@ -352,11 +353,11 @@ public class SurfConfigFolderPatch extends AsynchronousPatch
|
||||
private long maxId = Long.MAX_VALUE;
|
||||
private long workCount = Long.MAX_VALUE;
|
||||
private long currentId = 0L;
|
||||
private final long siteTypeQNameId;
|
||||
private final Pair<Long, QName> siteTypeQNameId;
|
||||
|
||||
private SiteWorkProvider()
|
||||
{
|
||||
this.siteTypeQNameId = qnameDAO.getQName(SiteModel.TYPE_SITE).getFirst();
|
||||
this.siteTypeQNameId = qnameDAO.getQName(SiteModel.TYPE_SITE);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -390,12 +391,16 @@ public class SurfConfigFolderPatch extends AsynchronousPatch
|
||||
{
|
||||
// Record the site node IDs
|
||||
final List<Long> siteNodeIDs = new ArrayList<Long>(SITE_BATCH_MAX_QUERY_RANGE);
|
||||
|
||||
// ACE-2981
|
||||
if (siteTypeQNameId == null)
|
||||
{
|
||||
return siteNodeIDs;
|
||||
}
|
||||
// Keep querying until we have enough results to give back
|
||||
int minResults = SITE_BATCH_MAX_QUERY_RANGE / 2;
|
||||
while (currentId <= maxId && siteNodeIDs.size() < minResults)
|
||||
{
|
||||
List<Long> nodeIds = patchDAO.getNodesByTypeQNameId(siteTypeQNameId, currentId, currentId + SITE_BATCH_MAX_QUERY_RANGE);
|
||||
List<Long> nodeIds = patchDAO.getNodesByTypeQNameId(siteTypeQNameId.getFirst(), currentId, currentId + SITE_BATCH_MAX_QUERY_RANGE);
|
||||
siteNodeIDs.addAll(nodeIds);
|
||||
// Increment the minimum ID
|
||||
currentId += SITE_BATCH_MAX_QUERY_RANGE;
|
||||
|
Reference in New Issue
Block a user