Guarding Community and Collection names from causing NPEs in DSIndexer when null.

git-svn-id: http://scm.dspace.org/svn/repo/trunk@2042 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
Mark Diggory
2007-07-06 02:03:07 +00:00
parent c2590feb4a
commit 0c7bdff878

View File

@@ -823,8 +823,12 @@ public class DSIndexer
// and populate it
String name = community.getMetadata("name");
doc.add(new Field("name", name, Field.Store.YES, Field.Index.TOKENIZED));
doc.add(new Field("default", name, Field.Store.YES, Field.Index.TOKENIZED));
if(name != null)
{
doc.add(new Field("name", name, Field.Store.YES, Field.Index.TOKENIZED));
doc.add(new Field("default", name, Field.Store.YES, Field.Index.TOKENIZED));
}
return doc;
}
@@ -848,9 +852,13 @@ public class DSIndexer
// and populate it
String name = collection.getMetadata("name");
doc.add(new Field("name", name, Field.Store.YES, Field.Index.TOKENIZED));
doc.add(new Field("default", name, Field.Store.YES, Field.Index.TOKENIZED));
if(name != null)
{
doc.add(new Field("name", name, Field.Store.YES, Field.Index.TOKENIZED));
doc.add(new Field("default", name, Field.Store.YES, Field.Index.TOKENIZED));
}
return doc;
}