[jbosstools-issues] [JBoss JIRA] (JBIDE-23867) OCBinary: is mixing platform independent with dependent code

Andre Dietisheim (JIRA) issues at jboss.org
Mon Feb 6 04:38:00 EST 2017


Andre Dietisheim created JBIDE-23867:
----------------------------------------

             Summary: 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


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)


More information about the jbosstools-issues mailing list