You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stanbol.apache.org by rw...@apache.org on 2015/06/16 14:35:25 UTC

svn commit: r1685798 - /stanbol/branches/release-0.12/entityhub/indexing/destination/solryard/src/main/java/org/apache/stanbol/entityhub/indexing/destination/solryard/fst/CorpusCreationTask.java

Author: rwesten
Date: Tue Jun 16 12:35:25 2015
New Revision: 1685798

URL: http://svn.apache.org/r1685798
Log:
minor: merged the fix of 1685794 from trunk to 0.12

Modified:
    stanbol/branches/release-0.12/entityhub/indexing/destination/solryard/src/main/java/org/apache/stanbol/entityhub/indexing/destination/solryard/fst/CorpusCreationTask.java

Modified: stanbol/branches/release-0.12/entityhub/indexing/destination/solryard/src/main/java/org/apache/stanbol/entityhub/indexing/destination/solryard/fst/CorpusCreationTask.java
URL: http://svn.apache.org/viewvc/stanbol/branches/release-0.12/entityhub/indexing/destination/solryard/src/main/java/org/apache/stanbol/entityhub/indexing/destination/solryard/fst/CorpusCreationTask.java?rev=1685798&r1=1685797&r2=1685798&view=diff
==============================================================================
--- stanbol/branches/release-0.12/entityhub/indexing/destination/solryard/src/main/java/org/apache/stanbol/entityhub/indexing/destination/solryard/fst/CorpusCreationTask.java (original)
+++ stanbol/branches/release-0.12/entityhub/indexing/destination/solryard/src/main/java/org/apache/stanbol/entityhub/indexing/destination/solryard/fst/CorpusCreationTask.java Tue Jun 16 12:35:25 2015
@@ -72,11 +72,15 @@ public class CorpusCreationTask implemen
                 log.warn("Unable to delete existing FST fiel for {}",corpusInfo);
             }
         }
-        try {
-            corpus.save(corpusInfo.fst);
-        } catch (IOException e) {
-            log.warn("Unable to store FST corpus " + corpusInfo + " to "
-                    + corpusInfo.fst.getAbsolutePath() + "!", e);
+        if(corpus.getPhrases() != null){ //the FST is not empty
+            try { //NOTE saving an empty corpus results in a NPE
+                corpus.save(corpusInfo.fst);
+            } catch (IOException e) {
+                log.warn("Unable to store FST corpus " + corpusInfo + " to "
+                        + corpusInfo.fst.getAbsolutePath() + "!", e);
+            }
+        } else {
+           log.info("FST for {} is empty ... no FST will be stored",corpusInfo); 
         }
     }