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

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

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

FileUtil.isAccessibleFile介绍

暂无

代码示例

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

@Override
public void analyze(final File _file) throws FileAnalysisException {
  if(!FileUtil.isAccessibleFile(_file.toPath()))
    throw new IllegalArgumentException("[" + _file + "] does not exist or is not readable");
  this.file = _file;
}

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

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

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

@Override
public void analyze(final File _file) throws FileAnalysisException {
  if(!FileUtil.isAccessibleFile(_file.toPath()))
    throw new IllegalArgumentException("[" + _file + "] does not exist or is not readable");
  this.file = _file;
}

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

@Override
public void analyze(final File _file) throws FileAnalysisException {
  if(!FileUtil.isAccessibleFile(_file.toPath()))
    throw new IllegalArgumentException("[" + _file + "] does not exist or is not readable");
  this.file = _file;
}

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

public void setFile(File _file) throws IllegalArgumentException {
  final String ext = FileUtil.getFileExtension(_file);
  if(!ext.equals("class"))
    throw new IllegalArgumentException("Expected a class file but got [" + _file + "]");
  if(!FileUtil.isAccessibleFile(_file.toPath()))
    throw new IllegalArgumentException("Cannot open file [" + _file + "]");
  this.file = _file;
}

代码示例来源: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 setFile(File _file) throws IllegalArgumentException {
  final String ext = FileUtil.getFileExtension(_file);
  if(!ext.equals("java"))
    throw new IllegalArgumentException("Expected a java file but got [" + _file + "]");
  if(!FileUtil.isAccessibleFile(_file.toPath()))
    throw new IllegalArgumentException("Cannot open file [" + _file + "]");
  this.file = _file;
}

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

public PythonConstructDigest(Path _path, DigestAlgorithm _alg) throws IllegalArgumentException {
  if(!FileUtil.isAccessibleFile(_path))
    throw new IllegalArgumentException("Path argument [" + _path + "] is not a valid file");
  this.digest = FileUtil.getDigest(_path.toFile(), _alg);
  this.digestAlgorithm = _alg;
  this.computedFrom = _path.getFileName().toString();
  this.computedFromType = ComputedFromType.FILE;
}

代码示例来源: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 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 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 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

@SuppressWarnings("unchecked")
  public T read(Path _path) {
    T object = null;
    if(FileUtil.isAccessibleFile(_path)) {
      try {
        final String json = FileUtil.readFile(_path);
        object = (T)JacksonUtil.asObject(json, this.clazz);
      } catch (IOException e) {
        log.error("Error reading from file [" + _path + "]: " + e.getMessage(), e);
      } catch (ClassCastException e) {
        log.error("Error reading from file [" + _path + "]: " + e.getMessage(), e);
      } catch (Exception e) {
        log.error("Error reading from file [" + _path + "]: " + e.getMessage(), e);
      }
    }
    return object;
  }    
}

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

@Override
public void run() {		
  String name = null;
  if(FileUtil.isAccessibleFile(this.exe))
    name = this.exe.getFileName().toString();
  else if(this.exe.toString().indexOf(System.getProperty("file.separator"))!=-1)

代码示例来源: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

else if(FileUtil.isAccessibleFile(file)) {
  PatchAnalyzer.uploadFile(Paths.get(file));

相关文章