[ 
https://issues.apache.org/jira/browse/OPENNLP-1410?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17646148#comment-17646148
 ] 

ASF GitHub Bot commented on OPENNLP-1410:
-----------------------------------------

rzo1 commented on code in PR #456:
URL: https://github.com/apache/opennlp/pull/456#discussion_r1045950983


##########
opennlp-tools/src/main/java/opennlp/tools/namefind/TokenNameFinderFactory.java:
##########
@@ -133,18 +173,36 @@ public void validateArtifactMap() throws 
InvalidFormatException {
     // no additional artifacts
   }
 
+  /**
+   * @return Retrieves a {@link SequenceCodec} instance.
+   */
   public SequenceCodec<String> createSequenceCodec() {
 
     if (artifactProvider != null) {
-      String sequeceCodecImplName = artifactProvider.getManifestProperty(
+      String sequenceCodecImplName = artifactProvider.getManifestProperty(
           TokenNameFinderModel.SEQUENCE_CODEC_CLASS_NAME_PARAMETER);
-      return instantiateSequenceCodec(sequeceCodecImplName);
+      try {
+        return instantiateSequenceCodec(sequenceCodecImplName);
+      } catch (InvalidFormatException e) {
+        // TODO Is this compensation valid here? Or: should we escalate 
towards the caller?
+        System.out.println("Encountered a problem with the sequence codec '"

Review Comment:
   I don't know, if it is natural, that we return a `BioCodec` instance or 
something else from `init(...)` in case we fail to load the requested codec 
from the given `ArtifactProvider`.  My expectation - as a user - would be, that 
I get an exception, which tells me, that my `codec`, which I specified via the 
manifest property couldn't be loaded via the given artifact loader and I can 
deal with that in my app.
   
   Regarding the second half of @jzonthemtn comment:
   
   We should replace  `System.out.println` and  `System.err.println` with calls 
to some logging library any time soon. These calls might be thrown into the 
nether, if OpenNLP is used within an application server for example.





> Enhance JavaDoc in opennlp.tools.namefind package
> -------------------------------------------------
>
>                 Key: OPENNLP-1410
>                 URL: https://issues.apache.org/jira/browse/OPENNLP-1410
>             Project: OpenNLP
>          Issue Type: Improvement
>          Components: Name Finder
>    Affects Versions: 2.1.0
>            Reporter: Martin Wiesner
>            Assignee: Martin Wiesner
>            Priority: Minor
>             Fix For: 2.1.1
>
>
> The JavaDoc the _opennlp.tools.namefind_ package suffers from several 
> inconsistencies and missing descriptions. Moreover, several typos are present 
> that need sanitizing.
> It needs enhancements and/or additions to provide more clarity for readers.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to