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

Rob Stryker (JIRA) issues at jboss.org
Mon Feb 6 14:46:00 EST 2017


    [ https://issues.jboss.org/browse/JBIDE-23867?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13359271#comment-13359271 ] 

Rob Stryker commented on JBIDE-23867:
-------------------------------------

[~adietish] Does this actually cause a problem? Seriously asking. The default platform is only used if the current platform (ie windows) cannot be found. 

CommandLocationBinary.findLocation(etc) will also make sure to pass in the current platform.

Is there an **actual** bug here? Or are you complaining the style is hard to understand?

Does any method call actually return the wrong thing?? 

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


More information about the jbosstools-issues mailing list