Uploaded image for project: 'Tools (JBoss Tools)'
  1. Tools (JBoss Tools)
  2. JBIDE-23867

OCBinary: is mixing platform independent with dependent code

    XMLWordPrintable

Details

    Description

      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:

      OCBinary#getInstance
      
      	public static OCBinary getInstance() {
      		if (SystemUtils.IS_OS_WINDOWS) {
      			return WINDOWS;
      		} else {
      			return OTHER;
      		}
      	}
      

      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:

      	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();
      	}
      

      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"

      Attachments

        Issue Links

          Activity

            People

              rob.stryker Rob Stryker (Inactive)
              adietish@redhat.com André Dietisheim
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: