mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Fixed ALF-10811: SOLR: NPE in SOLRTrackingComponentImpl.getCategoryPaths after upgrade
- Simple NPE; code was assuming that if categories could be present that they were git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@31232 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -18,10 +18,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.repo.solr;
|
package org.alfresco.repo.solr;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -36,24 +32,19 @@ import java.util.Set;
|
|||||||
import java.util.zip.CRC32;
|
import java.util.zip.CRC32;
|
||||||
|
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.repo.dictionary.CompiledModel;
|
|
||||||
import org.alfresco.repo.dictionary.DictionaryDAO;
|
import org.alfresco.repo.dictionary.DictionaryDAO;
|
||||||
import org.alfresco.repo.dictionary.DictionaryDAOImpl;
|
|
||||||
import org.alfresco.repo.domain.CrcHelper;
|
|
||||||
import org.alfresco.repo.domain.node.Node;
|
import org.alfresco.repo.domain.node.Node;
|
||||||
import org.alfresco.repo.domain.node.NodeDAO;
|
import org.alfresco.repo.domain.node.NodeDAO;
|
||||||
import org.alfresco.repo.domain.node.NodeDAO.ChildAssocRefQueryCallback;
|
import org.alfresco.repo.domain.node.NodeDAO.ChildAssocRefQueryCallback;
|
||||||
import org.alfresco.repo.domain.permissions.AclDAO;
|
import org.alfresco.repo.domain.permissions.AclDAO;
|
||||||
import org.alfresco.repo.domain.qname.QNameDAO;
|
import org.alfresco.repo.domain.qname.QNameDAO;
|
||||||
import org.alfresco.repo.domain.solr.SOLRDAO;
|
import org.alfresco.repo.domain.solr.SOLRDAO;
|
||||||
import org.alfresco.repo.solr.AlfrescoModelDiff.TYPE;
|
|
||||||
import org.alfresco.repo.tenant.TenantService;
|
import org.alfresco.repo.tenant.TenantService;
|
||||||
import org.alfresco.service.cmr.dictionary.AspectDefinition;
|
import org.alfresco.service.cmr.dictionary.AspectDefinition;
|
||||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||||
import org.alfresco.service.cmr.dictionary.ModelDefinition;
|
import org.alfresco.service.cmr.dictionary.ModelDefinition;
|
||||||
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
|
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
|
||||||
import org.alfresco.service.cmr.dictionary.ModelDefinition.XMLBindingType;
|
|
||||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||||
import org.alfresco.service.cmr.repository.InvalidNodeRefException;
|
import org.alfresco.service.cmr.repository.InvalidNodeRefException;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
@@ -64,7 +55,6 @@ import org.alfresco.service.cmr.security.PermissionService;
|
|||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
import org.alfresco.util.Pair;
|
import org.alfresco.util.Pair;
|
||||||
import org.alfresco.util.PropertyCheck;
|
import org.alfresco.util.PropertyCheck;
|
||||||
import org.alfresco.util.TempFileProvider;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Component providing data for SOLR tracking
|
* Component providing data for SOLR tracking
|
||||||
@@ -334,9 +324,18 @@ public class SOLRTrackingComponentImpl implements SOLRTrackingComponent
|
|||||||
LinkedList<Pair<Path, QName>> aspectPaths = new LinkedList<Pair<Path, QName>>();
|
LinkedList<Pair<Path, QName>> aspectPaths = new LinkedList<Pair<Path, QName>>();
|
||||||
for (PropertyDefinition propDef : aspDef.getProperties().values())
|
for (PropertyDefinition propDef : aspDef.getProperties().values())
|
||||||
{
|
{
|
||||||
if (propDef.getDataType().getName().equals(DataTypeDefinition.CATEGORY))
|
if (!propDef.getDataType().getName().equals(DataTypeDefinition.CATEGORY))
|
||||||
{
|
{
|
||||||
for (NodeRef catRef : DefaultTypeConverter.INSTANCE.getCollection(NodeRef.class, properties.get(propDef.getName())))
|
// The property is not a category
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// Don't try to iterate if the property is null
|
||||||
|
Serializable propVal = properties.get(propDef.getName());
|
||||||
|
if (propVal == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
for (NodeRef catRef : DefaultTypeConverter.INSTANCE.getCollection(NodeRef.class, propVal))
|
||||||
{
|
{
|
||||||
if (catRef == null)
|
if (catRef == null)
|
||||||
{
|
{
|
||||||
@@ -404,7 +403,6 @@ public class SOLRTrackingComponentImpl implements SOLRTrackingComponent
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
categoryPaths.addAll(aspectPaths);
|
categoryPaths.addAll(aspectPaths);
|
||||||
}
|
}
|
||||||
// Add member final element
|
// Add member final element
|
||||||
|
Reference in New Issue
Block a user