wujimin commented on a change in pull request #1013: 
[SCB-1047]microservice.yaml  service_description.version support form…
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/1013#discussion_r238551748
 
 

 ##########
 File path: 
service-registry/src/main/java/org/apache/servicecomb/serviceregistry/version/Version.java
 ##########
 @@ -21,37 +21,41 @@
 
 import org.apache.commons.lang.ArrayUtils;
 
+import com.google.common.annotations.VisibleForTesting;
+
 // short version is enough
 public class Version implements Comparable<Version> {
-  private static final String[] ZERO = new String[] {"0", "0", "0"};
+  private static final String[] ZERO = new String[] {"0", "0", "0", "0"};
 
   private final short major;
 
   private final short minor;
 
   private final short patch;
 
+  private final short build;
+
   private final String version;
 
   private final long numberVersion;
 
   // 1
   // 1.0
   // 1.0.0
+  // 1.0.0.0
   public Version(String version) {
     Objects.requireNonNull(version);
 
     String[] versions = version.split("\\.", -1);
-    if (versions.length > 3) {
+    if (versions.length > 4) {
       throw new IllegalStateException(String.format("Invalid version \"%s\".", 
version));
     }
 
-    if (versions.length < 3) {
-      versions = (String[]) ArrayUtils.addAll(versions, ZERO);
-    }
+    versions = (String[]) ArrayUtils.addAll(versions, ZERO);
 
 Review comment:
   less then 4, need to concat array

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to