SOLR-5509: fix possible npe

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1546189 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Robert Miller 2013-11-27 20:43:35 +00:00
parent 2939fce489
commit e54b08e2ab
1 changed files with 10 additions and 8 deletions

View File

@ -109,14 +109,16 @@ public class AddUpdateCommand extends UpdateCommand implements Iterable<IndexDoc
}
public String getPrintableId() {
IndexSchema schema = req.getSchema();
SchemaField sf = schema.getUniqueKeyField();
if (solrDoc != null && sf != null) {
SolrInputField field = solrDoc.getField(sf.getName());
if (field != null) {
return field.getFirstValue().toString();
}
}
if (req != null) {
IndexSchema schema = req.getSchema();
SchemaField sf = schema.getUniqueKeyField();
if (solrDoc != null && sf != null) {
SolrInputField field = solrDoc.getField(sf.getName());
if (field != null) {
return field.getFirstValue().toString();
}
}
}
return "(null)";
}