Source:
<code>private static EventFiringWebDriver getFFInstance() { FirefoxProfile profile = new FirefoxProfile(); if (System.getProperty("os.name").toUpperCase().equals("WINDOWS 8")){ System.setProperty( "webdriver.firefox.bin", "c:" + File.separator + "Program Files (x86)" + File.separator + "Mozilla Firefox" + File.separator + "Firefox.exe" ); } if (System.getProperty("os.name").toUpperCase().equals("LINUX")) { File mozillaPath = new File(System.getProperty("user.home") + File.separator + ".mozilla" + File.separator); File tempFile; if (!mozillaPath.exists()) { if (!mozillaPath.mkdir()) { throw new RuntimeException("Can't create %s dir".replace("%s", mozillaPath.getAbsolutePath())); } } try { <START> tempFile = File.createTempFile("webdriver", UUID.randomUUID().toString(), mozillaPath); <END> } catch (IOException ex) { throw new RuntimeException(ex.getMessage()); } tempFile.delete(); } if (browserName.contains("CONSOLE")) { try { File jsErr = new File( "." + File.separator + "src" + File.separator + "test" + File.separator + "resources" + File.separator + "Firebug" + File.separator + "JSErrorCollector.xpi" ); profile.addExtension(jsErr); Global.JS_ERROR_ENABLED = true; } catch(FileNotFoundException e) { System.out.println("JS extension file doesn't exist in provided location"); } catch (IOException e) { System.out.println("Error with adding firefox extension"); } } caps.setCapability(FirefoxDriver.PROFILE, profile); return new EventFiringWebDriver(new FirefoxDriver(caps)); }</code><technical_language>check if is other check right access</technical_language>

Target:
private static EventFiringWebDriver getFFInstance() { FirefoxProfile profile = new FirefoxProfile(); if (System.getProperty("os.name").toUpperCase().equals("WINDOWS 8")){ System.setProperty( "webdriver.firefox.bin", "c:" + File.separator + "Program Files (x86)" + File.separator + "Mozilla Firefox" + File.separator + "Firefox.exe" ); } if (System.getProperty("os.name").toUpperCase().equals("LINUX")) { File homePath = new File(System.getenv("HOME") + File.separator); File mozillaPath = new File(homePath + File.separator + ".mozilla"); if (mozillaPath.exists()) { try { File.createTempFile("webdriver", UUID.randomUUID().toString(), mozillaPath); } catch (IOException ex) { throw new RuntimeException("Can't create file in path: %s".replace("%s", mozillaPath.getAbsolutePath())); } } else { try { File.createTempFile("webdriver", UUID.randomUUID().toString(), homePath); } catch (IOException ex) { throw new RuntimeException("Can't create file in path: %s".replace("%s", homePath.getAbsolutePath())); } } } if (browserName.contains("CONSOLE")) { try { File jsErr = new File( "." + File.separator + "src" + File.separator + "test" + File.separator + "resources" + File.separator + "Firebug" + File.separator + "JSErrorCollector.xpi" ); profile.addExtension(jsErr); Global.JS_ERROR_ENABLED = true; } catch(FileNotFoundException e) { System.out.println("JS extension file doesn't exist in provided location"); } catch (IOException e) { System.out.println("Error with adding firefox extension"); } } caps.setCapability(FirefoxDriver.PROFILE, profile); return new EventFiringWebDriver(new FirefoxDriver(caps)); }