com.sap.psr.vulas.shared.util.FileUtil.isAccessibleDirectory()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(182)

本文整理了Java中com.sap.psr.vulas.shared.util.FileUtil.isAccessibleDirectory()方法的一些代码示例,展示了FileUtil.isAccessibleDirectory()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtil.isAccessibleDirectory()方法的具体详情如下:
包路径:com.sap.psr.vulas.shared.util.FileUtil
类名称:FileUtil
方法名:isAccessibleDirectory

FileUtil.isAccessibleDirectory介绍

暂无

代码示例

代码示例来源:origin: SAP/vulnerability-assessment-tool

@Override
public boolean canAnalyze(File _file) {
  return FileUtil.isAccessibleDirectory(_file);
}

代码示例来源:origin: SAP/vulnerability-assessment-tool

public final static boolean isAccessibleDirectory(Path _dir) {
  if(_dir==null)
    return false;
  else {
    return FileUtil.isAccessibleDirectory(_dir.toFile());
  }
}

代码示例来源:origin: SAP/vulnerability-assessment-tool

public void setReportDir(Path _path) throws IllegalArgumentException {
  if(!FileUtil.isAccessibleDirectory(_path))
    throw new IllegalArgumentException("Cannot write report to [" + _path + "]");
}

代码示例来源:origin: SAP/vulnerability-assessment-tool

public final static boolean isAccessibleDirectory(String _dir) {
  if(_dir==null || _dir.equals(""))
    return false;
  else
    return FileUtil.isAccessibleDirectory(Paths.get(_dir));
}

代码示例来源:origin: SAP/vulnerability-assessment-tool

public void setInclPath(Path _p) throws IllegalArgumentException {
  if(FileUtil.isAccessibleDirectory(_p) || FileUtil.isAccessibleFile(_p))
    this.inclPath = _p;
}

代码示例来源:origin: SAP/vulnerability-assessment-tool

public void setLibPath(Path _p) throws IllegalArgumentException {
  if(FileUtil.isAccessibleDirectory(_p) || FileUtil.isAccessibleFile(_p))
    this.libPath = _p;
}

代码示例来源:origin: SAP/vulnerability-assessment-tool

public void addAppPath(Path _p) throws IllegalArgumentException {
  if(!FileUtil.isAccessibleDirectory(_p) && !FileUtil.isAccessibleFile(_p))
    log.warn("[" + _p + "] is not an accessible file or directory");
  else if(this.getAppPaths().contains(_p))
    log.debug("[" + _p + "] is already part of application paths, and will not be added another time");
  else
    this.searchPaths.add(_p);
}

代码示例来源:origin: SAP/vulnerability-assessment-tool

public void addInstrPath(Path _p) throws IllegalArgumentException {
  if(!FileUtil.isAccessibleDirectory(_p) && !FileUtil.isAccessibleFile(_p))
    log.warn("[" + _p + "] is not an accessible file or directory");
  else if(this.getAppPaths().contains(_p))
    log.debug("[" + _p + "] is already part of intrumentation paths, and will not be added another time");
  else
    this.instrPaths.add(_p);
}

代码示例来源:origin: SAP/vulnerability-assessment-tool

public ProcessWrapper setCommand(Path _executable, String... _args) throws ProcessWrapperException {
  //if(_executable==null || FileUtil.isAccessibleFile(_executable))
  //	throw new ProcessWrapperException("Illegal executable [" + _executable + "]");
  
  for(int i=0; i<_args.length; i++) {
    final Matcher m = ALLOWED.matcher(_args[i]);
    if(!m.matches() && !FileUtil.isAccessibleFile(_args[i]) && !FileUtil.isAccessibleDirectory(_args[i]))
      throw new ProcessWrapperException("Illegal characters in argument [" + i + "], allowed are: a-zA-Z_0-9-.=");
  }
  
  this.exe = _executable;
  this.args = _args;
  return this;
}

代码示例来源:origin: SAP/vulnerability-assessment-tool

public static Path getPath(String _path, boolean _create) {
  if(_path==null || _path.equals(""))
    return null;
  else {
    final Path p = Paths.get(_path).toAbsolutePath();
    if(FileUtil.isAccessibleFile(p) || FileUtil.isAccessibleDirectory(p)) {
      return p;
    } else if(!p.toFile().exists() && _create) {
      FileUtil.createDirectory(p);
      return p;
    } else {
      FileUtil.log.warn("Path [" + _path + "] is neither an accessible file nor an accessible directory, hence, will be ignored");
      return null;
    }            
  }
}

代码示例来源:origin: SAP/vulnerability-assessment-tool

/**
 * Searches for an egg directory in the location of this installed package.
 * @return
 */
private Path searchPyDir() {
  // Search for <name>.py
  Path file = Paths.get(Paths.get(this.properties.get(LOCATION)).toString());
  if(FileUtil.isAccessibleDirectory(file) && !file.toString().endsWith("site-packages"))
    return file;
  // Search for <name>-<version>-py3.6.egg
  final String name = this.getName().replaceAll("-", "_");
  final Path location = Paths.get(this.properties.get(LOCATION));
  DirnamePatternSearch dns = new DirnamePatternSearch("^" + name + "-" + this.version + "-.*egg$");
  Set<Path> files = dns.search(location, 0);
  if(files.size()==0) {
    log.info("No python dir found for " + this + " in path [" + location + "]");
    file = null;
  }
  else if(files.size()==1) {
    log.info("Python dir [" + file + "] found for " + this + " in path [" + location + "]");
    file = files.iterator().next();
  }
  else {
    log.info(files.size() + " python dirs found for " + this + " in path [" + location + "]");
    file = null;
  }
  return file;
}

代码示例来源:origin: SAP/vulnerability-assessment-tool

if(!FileUtil.isAccessibleDirectory(_dir))
  Files.createDirectories(_dir);

代码示例来源:origin: SAP/vulnerability-assessment-tool

@Override
public void analyze(final File _file) throws FileAnalysisException {
  if(!FileUtil.isAccessibleDirectory(_file))
    throw new IllegalArgumentException("Expected a directory but got [" + _file + "]");
  this.dir = _file;

代码示例来源:origin: SAP/vulnerability-assessment-tool

if(FileUtil.isAccessibleDirectory(_file) || FileUtil.isAccessibleFile(_file.toPath())) {
  final ServiceLoader<FileAnalyzer> loader = ServiceLoader.load(FileAnalyzer.class);
  for(FileAnalyzer l: loader) {

代码示例来源:origin: SAP/vulnerability-assessment-tool

if(!FileUtil.isAccessibleDirectory(_path_to_python_project))
  throw new IllegalArgumentException("Project path [" + _path_to_python_project + "] does not point to an accessible directory");
if(!DirUtil.containsFile(_path_to_python_project.toFile(), SETUP_PY))

代码示例来源:origin: SAP/vulnerability-assessment-tool

if(FileUtil.isAccessibleDirectory(file)) {
  final FileSearch fs = new FileSearch(new String[] {"json"});
  final Set<Path> files = fs.search(Paths.get(file));

代码示例来源:origin: SAP/vulnerability-assessment-tool

try {
  if(FileUtil.isAccessibleDirectory(p) || FileUtil.hasFileExtension(p, EXT_FILTER)) {
    log.info("Searching for Python constructs in search path [" + p + "] with filter [" + StringUtil.join(EXT_FILTER, ", ") + "]");
    final FileAnalyzer da = FileAnalyzerFactory.buildFileAnalyzer(p.toFile(), EXT_FILTER);

相关文章