You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opennlp.apache.org by jo...@apache.org on 2014/01/24 13:31:23 UTC
svn commit: r1560972 -
/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/TrainerFactory.java
Author: joern
Date: Fri Jan 24 12:31:23 2014
New Revision: 1560972
URL: http://svn.apache.org/r1560972
Log:
No jira, fixed a null check to avoid a NPE.
Modified:
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/TrainerFactory.java
Modified: opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/TrainerFactory.java
URL: http://svn.apache.org/viewvc/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/TrainerFactory.java?rev=1560972&r1=1560971&r2=1560972&view=diff
==============================================================================
--- opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/TrainerFactory.java (original)
+++ opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/TrainerFactory.java Fri Jan 24 12:31:23 2014
@@ -66,7 +66,10 @@ public class TrainerFactory {
String trainerType = trainParams.get(AbstractTrainer.TRAINER_TYPE_PARAM);
if (trainerType == null) {
- trainerType = getPluggableTrainerType(trainParams.get(AbstractTrainer.ALGORITHM_PARAM));
+ String alogrithmValue = trainParams.get(AbstractTrainer.ALGORITHM_PARAM);
+ if (alogrithmValue != null) {
+ trainerType = getPluggableTrainerType(trainParams.get(AbstractTrainer.ALGORITHM_PARAM));
+ }
}
if (trainParams.get(AbstractTrainer.TRAINER_TYPE_PARAM) != null) {
@@ -74,7 +77,6 @@ public class TrainerFactory {
.get(AbstractTrainer.TRAINER_TYPE_PARAM));
}
- // default
return true;
}
@@ -83,7 +85,10 @@ public class TrainerFactory {
String trainerType = trainParams.get(AbstractTrainer.TRAINER_TYPE_PARAM);
if (trainerType == null) {
- trainerType = getPluggableTrainerType(trainParams.get(AbstractTrainer.ALGORITHM_PARAM));
+ String alogrithmValue = trainParams.get(AbstractTrainer.ALGORITHM_PARAM);
+ if (alogrithmValue != null) {
+ trainerType = getPluggableTrainerType(trainParams.get(AbstractTrainer.ALGORITHM_PARAM));
+ }
}
if (SequenceTrainer.SEQUENCE_VALUE.equals(trainerType)) {