Author: ragerri
Date: Fri Oct 10 12:41:27 2014
New Revision: 1630789
URL: http://svn.apache.org/r1630789
Log:
OPENNLP-718 TokenNameFinder factory not initialized by void init() method; bug
solved
Modified:
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/namefind/TokenNameFinderFactory.java
Modified:
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/namefind/TokenNameFinderFactory.java
URL:
http://svn.apache.org/viewvc/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/namefind/TokenNameFinderFactory.java?rev=1630789&r1=1630788&r2=1630789&view=diff
==============================================================================
---
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/namefind/TokenNameFinderFactory.java
(original)
+++
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/namefind/TokenNameFinderFactory.java
Fri Oct 10 12:41:27 2014
@@ -76,22 +76,25 @@ public class TokenNameFinderFactory exte
public static TokenNameFinderFactory create(String subclassName, byte[]
featureGeneratorBytes, final Map<String, Object> resources,
SequenceCodec<String> seqCodec)
throws InvalidFormatException {
+ TokenNameFinderFactory theFactory;
if (subclassName == null) {
// will create the default factory
- return new TokenNameFinderFactory();
- }
- try {
- TokenNameFinderFactory theFactory = ExtensionLoader.instantiateExtension(
- TokenNameFinderFactory.class, subclassName);
- theFactory.init(featureGeneratorBytes, resources, seqCodec);
- return theFactory;
- } catch (Exception e) {
- String msg = "Could not instantiate the " + subclassName
- + ". The initialization throw an exception.";
- System.err.println(msg);
- e.printStackTrace();
- throw new InvalidFormatException(msg, e);
+ theFactory = new TokenNameFinderFactory();
+ } else {
+ try {
+ theFactory = ExtensionLoader.instantiateExtension(
+ TokenNameFinderFactory.class, subclassName);
+ return theFactory;
+ } catch (Exception e) {
+ String msg = "Could not instantiate the " + subclassName
+ + ". The initialization throw an exception.";
+ System.err.println(msg);
+ e.printStackTrace();
+ throw new InvalidFormatException(msg, e);
+ }
}
+ theFactory.init(featureGeneratorBytes, resources, seqCodec);
+ return theFactory;
}
@Override