Validates if the file path is in absolute form and if so relativize it.

@param entry
191779
private void validatePath(PropertyEntry entry) {
        if (entry instanceof VideoEntry) {
            VideoEntry e = (VideoEntry) entry;
            if (e.getPath().contains(configuration.getRootDir().getAbsolutePath())) {
                e.setLink(e.getPath().substring(configuration.getRootDir().getAbsolutePath().length() + 1));
            }
        } else if (entry instanceof ScreenshotEntry) {
            ScreenshotEntry e = (ScreenshotEntry) entry;
            if (e.getPath().contains(configuration.getRootDir().getAbsolutePath())) {
                e.setLink(e.getPath().substring(configuration.getRootDir().getAbsolutePath().length() + 1));
            }
        }
    }
1147810
protected void validate(File file, ValidationOptions option){
		if(!file.exists()){
			this.errors.addError("file <{}> does not exist in file system", file.getAbsolutePath());
		}
		else if(!file.isFile()){
			this.errors.addError("file <{}> is not a file", file.getAbsolutePath());
		}
		if(file.isHidden()){
			this.errors.addError("file <{}> is a hidden file", file.getAbsolutePath());
		}
		else{
			switch(option){
				case AS_SOURCE:
					if(!file.canRead()){
						this.errors.addError("file <{}> is not readable", file.getAbsolutePath());
					}
					break;
				case AS_SOURCE_AND_TARGET:
					if(!file.canRead()){
						this.errors.addError("file <{}> is not readable", file.getAbsolutePath());
					}
					if(!file.canWrite()){
						this.errors.addError("file <{}> is not writable", file.getAbsolutePath());
					}
					break;
				case AS_TARGET:
					if(!file.canWrite()){
						this.errors.addError("file <{}> is not writable", file.getAbsolutePath());
					}
					break;
			}
		}
	}
751138
protected function validateFactoryEntry($entry)
    {
        if (!is_string($entry) && !is_callable($entry) && !$entry instanceof FactoryInterface) {
            $type = is_object($entry) ? get_class($entry) : gettype($entry);
            $message = sprintf('Argument "entry" in "%s" must be a string, a callable or an instance '
                    . 'of "%s"; "%s" was given.', __METHOD__, FactoryInterface::class, $type);
            throw new Exception\InvalidArgumentException($message);
        }

        if (is_string($entry)) {
            if (!class_exists($entry)) {
                throw new Exception\ClassNotFoundException($entry);
            }

            if (!is_subclass_of($entry, FactoryInterface::class)) {
                $message = sprintf('Entry "%s" in "%s" is expected to be an instance of "%s".', $entry, __METHOD__, FactoryInterface::class);
                throw new Exception\InvalidArgumentException($message);
            }
        }
    }
227285
private static void addEntry(ZipEntrySource entry, ZipOutputStream out) throws IOException {
    out.putNextEntry(entry.getEntry());
    InputStream in = entry.getInputStream();
    if (in != null) {
      try {
        IOUtils.copy(in, out);
      }
      finally {
        IOUtils.closeQuietly(in);
      }
    }
    out.closeEntry();
  }
1078500
public static boolean isValid(String entry) {
		boolean result = true;

		try {
			shouldRun(entry);
		} catch (Exception ex) {
			result = false;
		}
		return result;
	}
480423
protected boolean discardPath(String pathToEntry, Entry<String, Object> entry)
	{
		if (!foundAsPrefix(pathToEntry) || !delim.accept(entry.getKey()))
		{
			//skip traversal of subtree and remove from the traversal iterator
			return true;
		}
		return false;
	}
1253649
private void validateRootFolder() {
        File rootDir = new File(m_config.root);
        if (!rootDir.exists()) {
            logErrorThrow("Root directory does not exist: {}", m_config.root);
        } else if (!rootDir.isDirectory()) {
            logErrorThrow("Root directory must be a folder: {}", m_config.root);
        } else if (!m_config.root.endsWith(File.separator)) {
            m_config.root = m_config.root + File.separator;
        }
    }
218192
private String validateFile(final MultipartFile file) {
        final String filename = StringUtils
                .cleanPath(file.getOriginalFilename());
        if (file.isEmpty()) {
            throw new StorageException(
                    "Failed to store empty file " + filename);
        }
        if (filename.contains("..")) {
            // This is a security check
            throw new StorageException(
                    "Cannot store file with relative path outside current"
                    + " directory "
                    + filename);
        }
        return filename;
    }
248309
public boolean adjustEntry(E entry) {
    final SpatialDirectoryEntry se = (SpatialDirectoryEntry) entry;
    final ModifiableHyperBoundingBox mbr = computeMBR();
    boolean changed = false;
    if(se.hasMBR()) {
      final int dim = se.getDimensionality();
      // Test for changes
      for(int i = 0; i < dim; i++) {
        if(Math.abs(se.getMin(i) - mbr.getMin(i)) > Float.MIN_NORMAL) {
          changed = true;
          break;
        }
        if(Math.abs(se.getMax(i) - mbr.getMax(i)) > Float.MIN_NORMAL) {
          changed = true;
          break;
        }
      }
    }
    else { // No preexisting MBR.
      changed = true;
    }
    if(changed) {
      se.setMBR(mbr);
    }
    return changed;
  }
526121
def _CheckIsDirectory(self, file_entry):
    
    if definitions.FILE_ENTRY_TYPE_DIRECTORY not in self._file_entry_types:
      return False
    return file_entry.IsDirectory()
671110
public static @NotNull String validFilename(@NotNull String value) {
    String fileExtension = StringUtils.substringAfterLast(value, ".");
    String fileName = StringUtils.substringBeforeLast(value, ".");
    if (StringUtils.isEmpty(fileExtension)) {
      return validName(fileName);
    }
    return validName(fileName) + "." + validName(fileExtension);
  }
916366
public static void addEntry(final File zip, final ZipEntrySource entry) {
    operateInPlace(zip, new InPlaceAction() {
      public boolean act(File tmpFile) {
        addEntry(zip, entry, tmpFile);
        return true;
      }
    });
  }
1199395
public static void validateDirectory(File topIndexDir) {
    if (!topIndexDir.exists() || !topIndexDir.isDirectory()) {
      throw new RuntimeException("Not found or is not a directory:\n" +
              topIndexDir + "\n" +
              "As ngram directory, please select the directory that has a subdirectory like 'en'\n" +
              "(or whatever language code you're using).");
    }
    List<String> dirs = new ArrayList<>();
    for (String name : topIndexDir.list()) {
      if (name.matches("[123]grams")) {
        dirs.add(name);
      }
    }
    if (dirs.isEmpty()) {
      throw new RuntimeException("Directory must contain at least '1grams', '2grams', and '3grams': " + topIndexDir.getAbsolutePath());
    }
    if (dirs.size() < 3) {
      throw new RuntimeException("Expected at least '1grams', '2grams', and '3grams' sub directories but only got " + dirs + " in " + topIndexDir.getAbsolutePath());
    }
  }
818202
def __check_to_permit(self, entry_type, entry_filename):
        """"""

        rules = self.__filter_rules[entry_type]

        # Should explicitly include?
        for pattern in rules[fss.constants.FILTER_INCLUDE]:
            if fnmatch.fnmatch(entry_filename, pattern):
                _LOGGER_FILTER.debug("Entry explicitly INCLUDED: [%s] [%s] "
                                     "[%s]", 
                                     entry_type, pattern, entry_filename)

                return True

        # Should explicitly exclude?
        for pattern in rules[fss.constants.FILTER_EXCLUDE]:
            if fnmatch.fnmatch(entry_filename, pattern):
                _LOGGER_FILTER.debug("Entry explicitly EXCLUDED: [%s] [%s] "
                                     "[%s]", 
                                     entry_type, pattern, entry_filename)

                return False

        # Implicitly include.

        _LOGGER_FILTER.debug("Entry IMPLICITLY included: [%s] [%s]", 
                             entry_type, entry_filename)

        return True
640057
public void viewDocument(DocumentEntry entry)
   {
      InputStream is = null;

      try
      {
         is = new DocumentInputStream(entry);
         byte[] data = new byte[is.available()];
         is.read(data);
         m_model.setData(data);
         updateTables();
      }

      catch (IOException ex)
      {
         throw new RuntimeException(ex);
      }

      finally
      {
         StreamHelper.closeQuietly(is);
      }

   }
1227499
@Trivial
    public static boolean pathIsAbsolute(String normalizedPath) {
        // Absolute path with leading /
        if (normalizedPath.length() > 0 && normalizedPath.charAt(0) == '/')
            return true;

        // Absolute path with symbolic
        if (isSymbol(normalizedPath))
            return true;

        if (normalizedPath.contains(":")) {
            // Absolute windows path with leading c:/
            if (normalizedPath.length() > 3 && normalizedPath.charAt(1) == ':' && normalizedPath.charAt(2) == '/')
                return true;

            // Absolute path with scheme, e.g. file://whatever
            Matcher m = ABSOLUTE_URI.matcher(normalizedPath);
            if (m.matches())
                return true;
        }

        return false;
    }
194963
public static boolean entryEquals(File f1, File f2, String path) {
    return entryEquals(f1, f2, path, path);
  }