Permalink
Browse files

Merge pull request #338 from jgrivolla/uima-notext

uima: don't query endpoint without text
  • Loading branch information...
2 parents a4fdff3 + 163de1b commit 01a66e24f9954ee41fa5b4b98e32b1a706964972 @sandroacoelho sandroacoelho committed on GitHub Jun 20, 2017
Showing with 4 additions and 4 deletions.
  1. +4 −4 uima/src/main/java/org/dbpedia/spotlight/uima/SpotlightAnnotator.java
@@ -7,6 +7,7 @@
import javax.ws.rs.core.MediaType;
+import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
import org.apache.uima.fit.component.JCasAnnotator_ImplBase;
@@ -72,7 +73,7 @@ public void process(JCas aJCas) throws AnalysisEngineProcessException {
String documentText = aJCas.getDocumentText();
// don't query endpoint without text
- if (documentText == null || documentText.isEmpty()) {
+ if (StringUtils.isBlank(documentText)) {
return;
}
@@ -102,10 +103,9 @@ public void process(JCas aJCas) throws AnalysisEngineProcessException {
request += line;
numLines++;
}
- if (request == null || request.isEmpty()) {
- break;
+ if (StringUtils.isBlank(request)) {
+ continue;
}
-
Annotation response = null;
boolean retry = false;

0 comments on commit 01a66e2

Please sign in to comment.