You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tika.apache.org by ta...@apache.org on 2018/06/12 12:57:11 UTC

[tika] branch branch_1x updated: avoid npe when lang code not found on classpath

This is an automated email from the ASF dual-hosted git repository.

tallison pushed a commit to branch branch_1x
in repository https://gitbox.apache.org/repos/asf/tika.git


The following commit(s) were added to refs/heads/branch_1x by this push:
     new 92aaf22  avoid npe when lang code not found on classpath
92aaf22 is described below

commit 92aaf22866d2bb7bc6b91351fb4e0bfca4c8203c
Author: tballison <ta...@mitre.org>
AuthorDate: Tue Jun 12 08:55:19 2018 -0400

    avoid npe when lang code not found on classpath
---
 .../java/org/apache/tika/eval/tokens/CommonTokenCountManager.java | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/tika-eval/src/main/java/org/apache/tika/eval/tokens/CommonTokenCountManager.java b/tika-eval/src/main/java/org/apache/tika/eval/tokens/CommonTokenCountManager.java
index a03e241..a5bd96b 100644
--- a/tika-eval/src/main/java/org/apache/tika/eval/tokens/CommonTokenCountManager.java
+++ b/tika-eval/src/main/java/org/apache/tika/eval/tokens/CommonTokenCountManager.java
@@ -58,7 +58,7 @@ public class CommonTokenCountManager {
         Set<String> set = commonTokenMap.get(defaultLangCode);
         if (set == null) {
             LOG.warn("No common tokens for default language: '"+defaultLangCode+"'");
-            commonTokenMap.put(defaultLangCode, new HashSet<String>());
+            commonTokenMap.put(defaultLangCode, new HashSet<>());
         }
     }
 
@@ -129,8 +129,10 @@ public class CommonTokenCountManager {
 
 
             if (is == null) {
-                LOG.warn("Couldn't find common tokens file for: '" + langCode + "': " +
-                        p.toAbsolutePath());
+                String path = (p == null) ? "resource on class path: /common_tokens/"+langCode
+                        : p.toAbsolutePath().toString();
+                LOG.warn("Couldn't find common tokens file for: '" + langCode + "' tried here: " +
+                        path);
                 alreadyTriedToLoad.add(langCode);
                 return;
             }

-- 
To stop receiving notification emails like this one, please contact
tallison@apache.org.