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

Andre Dietisheim (JIRA) issues at jboss.org
Mon Feb 6 14:54:01 EST 2017


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

Andre Dietisheim edited comment on JBIDE-23867 at 2/6/17 2:53 PM:
------------------------------------------------------------------

[~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. But there clearly is no urgency.


was (Author: adietish):
[~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: Enhancement
>          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