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 2011/12/01 12:21:51 UTC

svn commit: r1209036 - /incubator/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/util/model/BaseModel.java

Author: joern
Date: Thu Dec  1 11:21:50 2011
New Revision: 1209036

URL: http://svn.apache.org/viewvc?rev=1209036&view=rev
Log:
OPENNLP-406 Version check is only performed if current version is not the dev version.

Modified:
    incubator/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/util/model/BaseModel.java

Modified: incubator/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/util/model/BaseModel.java
URL: http://svn.apache.org/viewvc/incubator/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/util/model/BaseModel.java?rev=1209036&r1=1209035&r2=1209036&view=diff
==============================================================================
--- incubator/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/util/model/BaseModel.java (original)
+++ incubator/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/util/model/BaseModel.java Thu Dec  1 11:21:50 2011
@@ -229,17 +229,20 @@ public abstract class BaseModel {
         throw new InvalidFormatException("Unable to parse model version!, e");
       }
       
-      // Major and minor version must match, revision might be 
-      if (Version.currentVersion().getMajor() != version.getMajor() ||
-          Version.currentVersion().getMinor() != version.getMinor()) {
-        throw new InvalidFormatException("Model version " + version + " is not supported by this (" 
-            + Version.currentVersion() +") version of OpenNLP!");
-      }
-      
-      // Reject loading a snapshot model with a non-snapshot version
-      if (!Version.currentVersion().isSnapshot() && version.isSnapshot()) {
-        throw new InvalidFormatException("Model is a snapshot models are not" +
-        		"supported by release versions!");
+      // Version check is only performed if current version is not the dev/debug version
+      if (!Version.currentVersion().equals(Version.DEV_VERSION)) {
+        // Major and minor version must match, revision might be 
+        if (Version.currentVersion().getMajor() != version.getMajor() ||
+            Version.currentVersion().getMinor() != version.getMinor()) {
+          throw new InvalidFormatException("Model version " + version + " is not supported by this (" 
+              + Version.currentVersion() +") version of OpenNLP!");
+        }
+        
+        // Reject loading a snapshot model with a non-snapshot version
+        if (!Version.currentVersion().isSnapshot() && version.isSnapshot()) {
+          throw new InvalidFormatException("Model is a snapshot models are not" +
+          		"supported by release versions!");
+        }
       }
     }
     else {