lgxbslgx commented on code in PR #16008:
URL: https://github.com/apache/pulsar/pull/16008#discussion_r895659214


##########
conf/pulsar_env.sh:
##########
@@ -60,6 +60,10 @@ for token in $("$JAVA_BIN" -version 2>&1 | grep 'version 
"'); do
           JAVA_MAJOR_VERSION=${BASH_REMATCH[1]}
         fi
         break
+    elif [[ $token =~ \"([[:digit:]]+)(.*)\" ]]; then

Review Comment:
   > https://openjdk.java.net/jeps/223 .
   
   Thanks for pointing out the standard. I list the following important 
information.
   
   ```
   Version numbers $VNUM
   [1-9][0-9]*((\.0)*\.[1-9][0-9]*)*
   
   Version strings $VSTR
   $VNUM(-$PRE)?\+$BUILD(-$OPT)?
   $VNUM-$PRE(-$OPT)?
   $VNUM(+-$OPT)?
   
   
   Name                            Syntax
   ------------------------------  --------------
   java.version                    $VNUM(\-$PRE)? 
   java.runtime.version            $VSTR
   java.vm.version                 $VSTR
   java.specification.version      $VNUM
   java.vm.specification.version   $VNUM
   
   $ java -version
   openjdk version \"${java.version}\"
   ${java.runtime.name} (build ${java.runtime.version})
   ${java.vm.name} (build ${java.vm.version}, ${java.vm.info})
   ```
   
   From the standard, we can know the `java.version` is started by a 
**necessary major version number**, then followed by zero or several 
"sub-version"(minor/security), and finally ended with a optional `-$PRE`.
   
   So I can confirm that the newly added pattern `\"([[:digit:]]+)(.*)\"` can 
address all the common cases of the standard. And the pattern 
`\"([[:digit:]]+)\.([[:digit:]]+)\.(.*)\"` you added previously solves the vein 
that the `java.version` has at aleast one  "sub-version".
   
   > I guess it would make sense if the pattern handles the $PRE format 
described by the JEP
   
   If we want to handle the `$PRE` format by changing the pattern 
`\"([[:digit:]]+)(.*)\"` . I may ask: should we need to change the 
`\"([[:digit:]]+)\.([[:digit:]]+)\.(.*)\"` to handle the `$PRE` too? If the 
answer is no, why we need to handle `$PRE` in this new common pattern.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to