mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Fix to Forum Icons Patch - now checks for missing nodes (in search results) and closes search ResultSet
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2738 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -57,13 +57,19 @@ public class ForumsIconsPatch extends AbstractPatch
|
|||||||
{
|
{
|
||||||
int changed = 0;
|
int changed = 0;
|
||||||
String query = "TYPE:\"" + typeName.toString() + "\"";
|
String query = "TYPE:\"" + typeName.toString() + "\"";
|
||||||
ResultSet results = this.searchService.query(this.importerBootstrap.getStoreRef(),
|
|
||||||
|
ResultSet results = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
results = this.searchService.query(this.importerBootstrap.getStoreRef(),
|
||||||
SearchService.LANGUAGE_LUCENE, query);
|
SearchService.LANGUAGE_LUCENE, query);
|
||||||
|
|
||||||
// if there are any results iterate through nodes and update icon property
|
// if there are any results iterate through nodes and update icon property
|
||||||
if (results.length() > 0)
|
if (results.length() > 0)
|
||||||
{
|
{
|
||||||
for (NodeRef node : results.getNodeRefs())
|
for (NodeRef node : results.getNodeRefs())
|
||||||
|
{
|
||||||
|
if (this.nodeService.exists(node))
|
||||||
{
|
{
|
||||||
String icon = (String)this.nodeService.getProperty(node, ContentModel.PROP_ICON);
|
String icon = (String)this.nodeService.getProperty(node, ContentModel.PROP_ICON);
|
||||||
if (icon != null && icon.length() > 0)
|
if (icon != null && icon.length() > 0)
|
||||||
@@ -78,6 +84,15 @@ public class ForumsIconsPatch extends AbstractPatch
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (results != null)
|
||||||
|
{
|
||||||
|
results.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user