mirror of https://github.com/apache/lucene.git
[SOLR-3221] - fixed possible NPE for text variable being null in UIMAUpdateRequestProcessor
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1347817 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
211f9c77b7
commit
7de9508aa5
|
@ -40,7 +40,6 @@ import java.util.Map;
|
||||||
/**
|
/**
|
||||||
* Update document(s) to be indexed with UIMA extracted information
|
* Update document(s) to be indexed with UIMA extracted information
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class UIMAUpdateRequestProcessor extends UpdateRequestProcessor {
|
public class UIMAUpdateRequestProcessor extends UpdateRequestProcessor {
|
||||||
|
|
||||||
|
@ -102,16 +101,24 @@ public class UIMAUpdateRequestProcessor extends UpdateRequestProcessor {
|
||||||
new StringBuilder(". ").append(logField).append("=")
|
new StringBuilder(". ").append(logField).append("=")
|
||||||
.append((String)cmd.getSolrInputDocument().getField(logField).getValue())
|
.append((String)cmd.getSolrInputDocument().getField(logField).getValue())
|
||||||
.append(", ").toString();
|
.append(", ").toString();
|
||||||
int len = Math.min(text.length(), 100);
|
int len;
|
||||||
|
String debugString;
|
||||||
|
if (text != null && text.length() > 0) {
|
||||||
|
len = Math.min(text.length(), 100);
|
||||||
|
debugString = new StringBuilder(" text=\"").append(text.substring(0, len)).append("...\"").toString();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
debugString = " null text";
|
||||||
|
}
|
||||||
if (solrUIMAConfiguration.isIgnoreErrors()) {
|
if (solrUIMAConfiguration.isIgnoreErrors()) {
|
||||||
log.warn(new StringBuilder("skip the text processing due to ")
|
log.warn(new StringBuilder("skip the text processing due to ")
|
||||||
.append(e.getLocalizedMessage()).append(optionalFieldInfo)
|
.append(e.getLocalizedMessage()).append(optionalFieldInfo)
|
||||||
.append(" text=\"").append(text.substring(0, len)).append("...\"").toString());
|
.append(debugString).toString());
|
||||||
} else {
|
} else {
|
||||||
throw new SolrException(ErrorCode.SERVER_ERROR,
|
throw new SolrException(ErrorCode.SERVER_ERROR,
|
||||||
new StringBuilder("processing error: ")
|
new StringBuilder("processing error ")
|
||||||
.append(e.getLocalizedMessage()).append(optionalFieldInfo)
|
.append(e.getLocalizedMessage()).append(optionalFieldInfo)
|
||||||
.append(" text=\"").append(text.substring(0, len)).append("...\"").toString(), e);
|
.append(debugString).toString(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
super.processAdd(cmd);
|
super.processAdd(cmd);
|
||||||
|
|
Loading…
Reference in New Issue