rmondegar opened a new issue #1203:
URL: https://github.com/apache/cordova-android/issues/1203


   # Bug Report
   
   ## Problem
   check_reqs.js fails to retrieve the correct version java. When checking the 
version using `javac -version`, `semver.coerce` always returns version "8.0.0".
   `javac -version` returns the following output:
   
   
![image](https://user-images.githubusercontent.com/60993939/114612178-2d99e100-9c78-11eb-8e12-24abb2ecca6f.png)
   
   `semver.coerce` uses the first number found and returns this as a version:
   
   
![image](https://user-images.githubusercontent.com/60993939/114612207-368ab280-9c78-11eb-8eb6-50cac5e0b4cc.png)
   
   With this, the needed check fails:
   
   
![image](https://user-images.githubusercontent.com/60993939/114611339-4fdf2f00-9c77-11eb-916a-e94c13a9d9f7.png)
   
   ### What is expected to happen?
   
   Return the correct version, in this case, 1.8.0_282
   
   ### What does actually happen?
   
   Always returns 8 (related to UTF8)
   
   ## Information
   It seems the problem was introduced with the commit 
774de786910abd0c83e5b5e285961fcb07c38474 where this check was refactored
   
   ### Command or Code
   `javac -version`
   `cordova build -d`
   
   ```
   import semver = require('semver');
   const version ="Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8\njavac 
1.8.0_282"
   console.log(semver.coerce(version));
   ```
   
   ### Environment, Platform, Device
   OS: Ubuntu 18.04.1
   
   ### Version information
   Cordova: 10.0.0
   Plugin list:
   ```
   cordova-hot-code-push-plugin 1.5.3 "Hot Code Push Plugin"
   cordova-plugin-appcenter-analytics 0.5.1 "App Center Analytics for Cordova"
   cordova-plugin-appcenter-crashes 0.5.1 "App Center Crashes for Cordova"
   cordova-plugin-appcenter-shared 0.5.1 "App Center shared code for Cordova"
   cordova-plugin-barcodescanner 0.7.4 "BarcodeScanner"
   cordova-plugin-camera 5.0.1 "Camera"
   cordova-plugin-compat 1.2.0 "Compat"
   cordova-plugin-device 1.1.2 "Device"
   cordova-plugin-file 6.0.2 "File"
   cordova-plugin-geolocation 4.0.2 "Geolocation"
   cordova-plugin-inappbrowser 4.0.0 "InAppBrowser"
   cordova-plugin-media-capture 3.0.3 "Capture"
   cordova-plugin-media 5.0.3 "Media"
   cordova-plugin-openfilenative 1.0.3 "Open File Native"
   cordova-plugin-statusbar 2.4.3 "StatusBar"
   cordova-plugin-whitelist 1.3.5-dev "Whitelist"
   cordova-plugin-wkwebviewxhrfix 1.0.0 "Cordova WKWebView File XHR Fix"
   ```
   `cordova platform ls` output:
   ```
   Installed platforms:
     android 9.1.0
   Available platforms:
     browser ^6.0.0
     electron ^1.0.0
   Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8
   javac 1.8.0_282
   SemVer {
     options: {},
     loose: false,
     includePrerelease: false,
     raw: '8.0.0',
     major: 8,
     minor: 0,
     patch: 0,
     prerelease: [],
     build: [],
     version: '8.0.0'
   }
   ```
   
   OS: Ubuntu 18.04.1
   
   ## Checklist
   <!-- Please check the boxes by putting an x in the [ ] like so: [x] -->
   
   - [X] I searched for existing GitHub issues
   - [ ] I updated all Cordova tooling to most recent version
   - [X] I included all the necessary information above


-- 
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.

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



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to