Task #1346

Updated by Sebastien Jacquot about 5 years ago

OS detection in TBX is actually done by strings comparison and used in various places, e.g. System.getProperty("os.name").contains("win32") for Windows.
On some systems, System.getProperty("os.name") now returns "Windows 7" on Windows 7 OS leading to a failure of R/CQP launching on Win 7 because the Linux launching native code is executed instead of Win native code. Result in log is:

<pre>
Failed to start RServe : org.txm.stat.engine.r.RWorkspaceException: ** The Statistics Engine program path is set but we couldn't find it : C:\XXXXXX\R\bin\R.exe

</pre>

h3. Solution 1

* use org.ecplise.core.runtime.Platform.getOS()
* bundle is present in TBX project
* NOTE to clarify this issue: NOTE: using Platform.getOS() in TBX layer leads to an Eclipse classloader problem in TXM Web/Portal layer. This solution 1 was used since revision 2967. To fix these classloader problems, the use of System.getProperty("os.name").contains("win32") comparison has been introduced in r2967 leading to the Windows bug detailed above.
In future we should use this Platform class which really seems a better solution.
2967

h3. Solution 2

* use org.apache.tools.ant.taskdefs.condition.Os
* bundle is present in TBX project

h3. Solution 3

* org.apache.commons.exec.OS
* bundle is NOT present in TBX project

h3. Solution 4

* implement own custom class using System.getProperty("os.name")

h3. Solution 5

* use solution 1, 2 or 3
* centralize/encapsulate the OS detection code in a class, e.g. OSDetector in TBX layer to minimize impact of further string definition potential changes

h3. Validation tests

* start TXM on Linux
* look for the following line in the console log:
=> "Statistical Engine launched."
* create an AFC chart

* start TXM on Windows
* look for the following line in the console log:
=> "Statistical Engine launched."
* create an AFC chart

* start TXM on Mac
* look for the following line in the console log:
=> "Statistical Engine launched."
* create an AFC chart

Back