Revision: 5929
          http://sourceforge.net/p/jump-pilot/code/5929
Author:   edso
Date:     2018-08-27 12:20:07 +0000 (Mon, 27 Aug 2018)
Log Message:
-----------
rework version detection for 'openjdk version "12-ea"'

Modified Paths:
--------------
    core/trunk/ChangeLog
    core/trunk/scripts/oj_windows.bat

Modified: core/trunk/ChangeLog
===================================================================
--- core/trunk/ChangeLog        2018-08-25 16:46:57 UTC (rev 5928)
+++ core/trunk/ChangeLog        2018-08-27 12:20:07 UTC (rev 5929)
@@ -3,6 +3,9 @@
 # 2. make sure that lines break at 80 chars for constricted display situations
 #<-------------------------------- 80 chars 
---------------------------------->#
 
+2018-08-27 ede
+  * oj_windows.bat rework version detection for 'openjdk version "12-ea"'
+
 2018-08-24 mmichaud <m.michael.mich...@orange.fr>
   * Improve LayerView naming and saving, allow views based on view
 
@@ -663,7 +666,7 @@
   * bugfix : old postgis driver could not save layer with pk != dbid
 
 2016-09-01 Giuseppe Aruta  <giuseppe_ar...@yahoo.it>
-  * File projection detection: Added IGNF and IGN G\xE9oportail codes
+  * File projection detection: Added IGNF and IGN G�oportail codes
   * File projection detection: Added measure units
   
 2016-07-18 ede
@@ -1070,7 +1073,7 @@
     - polygon width
     - polygon length
     - circularity (Miller)
-    - compacity (Grav\xE9lius)
+    - compacity (Grav�lius)
 
 2015-06-26 bertazza
   * Raster styles: some bugs fixed.
@@ -2731,7 +2734,7 @@
   * Finish to fix 3513864 : add an icon to RasterImageLayer
   
 2012-04-02 ede
-  * Finish 3510778 with the help of Larry (Michaa\xBF\xBDl's fix was 
inefficient)
+  * Finish 3510778 with the help of Larry (Michaa��l's fix was inefficient)
   * workaround for bug 
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7122141
     and FeatureInstaller cleaning
 

Modified: core/trunk/scripts/oj_windows.bat
===================================================================
--- core/trunk/scripts/oj_windows.bat   2018-08-25 16:46:57 UTC (rev 5928)
+++ core/trunk/scripts/oj_windows.bat   2018-08-27 12:20:07 UTC (rev 5929)
@@ -99,11 +99,12 @@
     call :concat "; " %%i
     for /F "tokens=1-3 delims= " %%a in ("%%i") do (
        rem -- memorize version number string --
-       if "%%a"=="java" ( 
-           if "%%b"=="version" ( 
+       if "%%a"=="java" if "%%b"=="version" ( 
                set JAVAVER=%%c
            )
-       )
+       if /I "%%a"=="openjdk" if "%%b"=="version" ( 
+               set JAVAVER=%%c
+           )
     )
 )
 set "JAVA_VERSIONSTRING=%concat%"
@@ -118,17 +119,24 @@
 rem @echo Output: %JAVAVER%
 
 for /f "delims=. tokens=1-3" %%v in ("%JAVAVER%") do (
+    if [%%v] neq [] call :extractLeadingNumbers "%%v" major
     rem @echo Major: %%v
-    set JAVAVER_MAJOR=%%v
+    if [%%w] neq [] call :extractLeadingNumbers "%%w" minor
     rem @echo Minor: %%w
-    set JAVAVER_MINOR=%%w
-    rem @echo Build: %%x
-    set JAVAVER_PATCH=%%x
+    if [%%x] neq [] call :extractLeadingNumbers "%%x" patch
+    rem @echo Patch: %%x
 )
+if [%major%] neq [] ( set "JAVAVER_MAJOR=%major%" ) else (
+    echo ERROR: Could not detect java version number.
+    set "ERROR=1"
+    goto :end
+)
+if [%minor%] neq [] ( set "JAVAVER_MINOR=%minor%" ) else ( set 
"JAVAVER_MINOR=0" )
+if [%patch%] neq [] ( set "JAVAVER_PATCH=%patch%" ) else ( set 
"JAVAVER_PATCH=0" )
 
-rem -- java9+ needs some packages explicitly added/exported --
-set /a JAVAVER_NUMBER=JAVAVER_MAJOR
-if %JAVAVER_NUMBER% geq 9 (
+
+rem -- java9-java11 need some packages explicitly added/exported --
+if %JAVAVER_MAJOR% geq 9 if %JAVAVER_MAJOR% lss 12 (
   set JAVA_OPTS=%JAVA_OPTS% --add-exports 
java.base/jdk.internal.loader=ALL-UNNAMED ^
 --add-exports java.desktop/com.sun.java.swing.plaf.windows=ALL-UNNAMED ^
 --add-exports java.desktop/com.sun.java.swing.plaf.motif=ALL-UNNAMED ^
@@ -388,5 +396,20 @@
 set "JAVA_MEM_STRING=Xmx to %value%M"
 goto:eof
 
+rem This extracts the first numerical series in the input string
+:extractLeadingNumbers inputString returnVar
+setlocal enableextensions disabledelayedexpansion
+rem Retrieve the string from arguments
+set "string=%~1"
 
+rem Use numbers as delimiters (so they are removed) to retrieve the rest of 
the string
+for /f "tokens=1-2 delims=0123456789 " %%a in ("%string:^"=%") do set 
"delimiters=%%a%%b"
+
+rem Use the retrieved characters as delimiters to retrieve the first numerical 
serie
+for /f "delims=%delimiters% " %%a in ("%string:^"=%") do set "numbers=%%a"
+
+rem Return the found data to caller and leave
+endlocal & set "%~2=%numbers%"
+goto :eof
+
 :eof


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to