[
https://issues.jboss.org/browse/JBIDE-23867?page=com.atlassian.jira.plugi...
]
Andre Dietisheim commented on JBIDE-23867:
------------------------------------------
[~rob.stryker] this is not a bug per se (changing the issue type accordingly). It's
just something that one stumbles upon when reading code, something that one could do more
cleanly for sure.
OCBinary: is mixing platform independent with dependent code
------------------------------------------------------------
Key: JBIDE-23867
URL:
https://issues.jboss.org/browse/JBIDE-23867
Project: Tools (JBoss Tools)
Issue Type: Bug
Components: openshift
Affects Versions: 4.4.3.AM2
Reporter: Andre Dietisheim
Assignee: Rob Stryker
OCBinary is suing enums for the different platform. The platform instance is chosen right
when you get the instance that you want to work with:
{code}
OCBinary#getInstance
{code}
{code}
public static OCBinary getInstance() {
if (SystemUtils.IS_OS_WINDOWS) {
return WINDOWS;
} else {
return OTHER;
}
}
{code}
But then, latter code (that was introduced later in #getSystemPathLocation ignoring it
and start being platform independent again, even setting the default to be linux:
{code}
public String getSystemPathLocation() {
if (locationBinary == null) {
this.locationBinary = new CommandLocationBinary("oc");
locationBinary.addPlatformLocation(Platform.OS_LINUX, OC_DEFAULTLOCATION_LINUX);
locationBinary.setDefaultPlatform(Platform.OS_LINUX);
}
return locationBinary.findLocation();
}
{code}
Even worse is that the above code hard-codes the oc binary to be "oc" while the
enum for windows is defining it as "oc.exe"
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)