/** * Attempts tp determine whether both files are on different volumes. Returns true if we could determine that * the files are on different volumes. Returns false otherwise or if an error occurred while doing the check. * * @param srcFile * @param targetFile * @return true if on different volumes, false otherwise or if an error occurred */ boolean areOnDifferentVolumes(File srcFile, File targetFile) throws RolloverFailure { if (!EnvUtil.isJDK7OrHigher()) return false; File parentOfTarget = targetFile.getParentFile(); try { boolean onSameFileStore = FileStoreUtil.areOnSameFileStore(srcFile, parentOfTarget); return !onSameFileStore; } catch (RolloverFailure rf) { addWarn("Error while checking file store equality", rf); return false; } }
if(!EnvUtil.isJaninoAvailable()) { addError(MISSING_JANINO_MSG); addError(MISSING_JANINO_SEE);
@Override public void start() { OutputStream targetStream = target.getStream(); // enable jansi only on Windows and only if withJansi set to true if (EnvUtil.isWindows() && withJansi) { targetStream = getTargetStreamForWindows(targetStream); } setOutputStream(targetStream); super.start(); }
@Test public void testJava9() { System.setProperty("java.version", "9"); assertTrue(EnvUtil.isJDK5()); assertTrue(EnvUtil.isJDK7OrHigher()); }
static public boolean isJDK6OrHigher() { return isJDK_N_OrHigher(6); }
/** * Gets the absolute path to the filename, starting from the app's * "files" directory, if it is not already an absolute path * * @param filename filename to evaluate * @return absolute path to the filename */ private String getAbsoluteFilePath(String filename) { // In Android, relative paths created with File() are relative // to root, so fix it by prefixing the path to the app's "files" // directory. // This transformation is rather expensive, since it involves loading the // Android manifest from the APK (which is a ZIP file), and parsing it to // retrieve the application package name. This should be avoided if // possible as it may perceptibly delay the app launch time. if (EnvUtil.isAndroidOS() && !new File(filename).isAbsolute()) { String dataDir = context.getProperty(CoreConstants.DATA_DIR_KEY); filename = FileUtil.prefixRelativePath(dataDir, filename); } return filename; } }
@Test public void testJava1_7() { System.setProperty("java.version", "1.7.xx"); assertTrue(EnvUtil.isJDK5()); assertTrue(EnvUtil.isJDK7OrHigher()); }
static public boolean isJDK7OrHigher() { return isJDK_N_OrHigher(7); }
@Test public void testJava1_8() { System.setProperty("java.version", "1.8.xx"); assertTrue(EnvUtil.isJDK5()); assertTrue(EnvUtil.isJDK7OrHigher()); }
static public boolean isJDK5() { return isJDK_N_OrHigher(5); }
/** * Attempts tp determine whether both files are on different volumes. Returns true if we could determine that * the files are on different volumes. Returns false otherwise or if an error occurred while doing the check. * * @param srcFile * @param targetFile * @return true if on different volumes, false otherwise or if an error occurred */ boolean areOnDifferentVolumes(File srcFile, File targetFile) throws RolloverFailure { if (!EnvUtil.isJDK7OrHigher()) return false; File parentOfTarget = targetFile.getParentFile(); try { boolean onSameFileStore = FileStoreUtil.areOnSameFileStore(srcFile, parentOfTarget); return !onSameFileStore; } catch (RolloverFailure rf) { addWarn("Error while checking file store equality", rf); return false; } }
@Override public void start() { OutputStream targetStream = target.getStream(); // enable jansi only on Windows and only if withJansi set to true if (EnvUtil.isWindows() && withJansi) { targetStream = getTargetStreamForWindows(targetStream); } setOutputStream(targetStream); super.start(); }
if (!EnvUtil.isJaninoAvailable()) { addError(MISSING_JANINO_MSG); addError(MISSING_JANINO_SEE);
@Test public void testJava10() { System.setProperty("java.version", "10.xx"); assertTrue(EnvUtil.isJDK5()); assertTrue(EnvUtil.isJDK7OrHigher()); } }
static public boolean isJDK7OrHigher() { return isJDK_N_OrHigher(7); } }
if (!EnvUtil.isJDK7OrHigher()) return false;
@Override public void start() { OutputStream targetStream = target.getStream(); // enable jansi only on Windows and only if withJansi set to true if (EnvUtil.isWindows() && withJansi) { targetStream = getTargetStreamForWindows(targetStream); } setOutputStream(targetStream); super.start(); }
if(!EnvUtil.isJaninoAvailable()) { addError(MISSING_JANINO_MSG); addError(MISSING_JANINO_SEE);
@Test public void testJava1_4() { System.setProperty("java.version", "1.4.xx"); assertFalse(EnvUtil.isJDK5()); assertFalse(EnvUtil.isJDK7OrHigher()); }
static public boolean isJDK6OrHigher() { return isJDK_N_OrHigher(6); }