hudson.FilePath.validateRelativePath()方法的使用及代码示例

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

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

FilePath.validateRelativePath介绍

[英]Validates a relative file path from this FilePath. Requires configure permission on ancestor AbstractProject object in request.
[中]验证此文件路径中的相对文件路径。要求对请求中的项目对象具有配置权限。

代码示例

代码示例来源:origin: jenkinsci/jenkins

/**
 * A convenience method over {@link #validateRelativePath(String, boolean, boolean)}.
 */
public FormValidation validateRelativeDirectory(String value, boolean errorIfNotExist) throws IOException {
  return validateRelativePath(value,errorIfNotExist,false);
}

代码示例来源:origin: org.eclipse.hudson/hudson-core

/**
 * A convenience method over
 * {@link #validateRelativePath(String, boolean, boolean)}.
 */
public FormValidation validateRelativeDirectory(String value, boolean errorIfNotExist) throws IOException {
  return validateRelativePath(value, errorIfNotExist, false);
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

/**
 * A convenience method over {@link #validateRelativePath(String, boolean, boolean)}.
 */
public FormValidation validateRelativeDirectory(String value, boolean errorIfNotExist) throws IOException {
  return validateRelativePath(value,errorIfNotExist,false);
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

/**
 * A convenience method over {@link #validateRelativePath(String, boolean, boolean)}.
 */
public FormValidation validateRelativeDirectory(String value, boolean errorIfNotExist) throws IOException {
  return validateRelativePath(value,errorIfNotExist,false);
}

代码示例来源:origin: hudson/hudson-2.x

/**
 * A convenience method over {@link #validateRelativePath(String, boolean, boolean)}.
 */
public FormValidation validateRelativeDirectory(String value, boolean errorIfNotExist) throws IOException {
  return validateRelativePath(value,errorIfNotExist,false);
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

/**
 * A convenience method over {@link #validateRelativePath(String, boolean, boolean)}.
 */
public FormValidation validateRelativeDirectory(String value, boolean errorIfNotExist) throws IOException {
  return validateRelativePath(value,errorIfNotExist,false);
}

代码示例来源:origin: org.jvnet.hudson.plugins/ivy

/**
 * Check the location of the ivy descriptor file, alternate settings file, etc - any file.
 */
public FormValidation doCheckFileInWorkspace(@QueryParameter String value) throws IOException, ServletException {
  IvyModuleSetBuild lb = getLastBuild();
  if (lb!=null) {
    FilePath ws = lb.getModuleRoot();
    if(ws!=null)
      return ws.validateRelativePath(value,true,true);
  }
  return FormValidation.ok();
}

代码示例来源:origin: org.jvnet.hudson.main/maven-plugin

/**
 * Check the location of the POM, alternate settings file, etc - any file.
 */
public FormValidation doCheckFileInWorkspace(@QueryParameter String value) throws IOException, ServletException {
  MavenModuleSetBuild lb = getLastBuild();
  if (lb!=null) {
    FilePath ws = lb.getModuleRoot();
    if(ws!=null)
      return ws.validateRelativePath(value,true,true);
  }
  return FormValidation.ok();
}

代码示例来源:origin: org.jenkins-ci.plugins/ivy

/**
 * Check the location of the ivy descriptor file, alternate settings file, etc - any file.
 */
public FormValidation doCheckFileInWorkspace(@QueryParameter String value) throws IOException, ServletException {
  IvyModuleSetBuild lb = getLastBuild();
  if (lb!=null) {
    FilePath ws = lb.getModuleRoot();
    if(ws!=null)
      return ws.validateRelativePath(value,true,true);
  }
  return FormValidation.ok();
}

代码示例来源:origin: org.hudsonci.plugins/ivy

/**
 * Check the location of the ivy descriptor file, alternate settings file, etc - any file.
 */
public FormValidation doCheckFileInWorkspace(@QueryParameter String value) throws IOException, ServletException {
  IvyModuleSetBuild lb = getLastBuild();
  if (lb!=null) {
    FilePath ws = lb.getModuleRoot();
    if(ws!=null)
      return ws.validateRelativePath(value,true,true);
  }
  return FormValidation.ok();
}

代码示例来源:origin: jenkinsci/maven-plugin

/**
 * Check the location of the POM, alternate settings file, etc - any file.
 */
public FormValidation doCheckFileInWorkspace(@QueryParameter String value) throws IOException, ServletException {
  MavenModuleSetBuild lb = getLastBuild();
  if (lb!=null) {
    FilePath ws = lb.getModuleRoot();
    if(ws!=null)
      return ws.validateRelativePath(value,true,true);
  }
  return FormValidation.ok();
}

代码示例来源:origin: org.jenkins-ci.plugins/publish-over

public static FormValidation validateFileOnMaster(final String value) {
  // this check prevents a NPE when called from global configuration - if not global, use validatePath directly
  if (JenkinsCapabilities.missing(JenkinsCapabilities.VALIDATE_FILE_ON_MASTER_FROM_GLOBAL_CFG))
    return FormValidation.ok();
  try {
    return Hudson.getInstance().getRootPath().validateRelativePath(value, true, true);
  } catch (IOException ioe) {
    return FormValidation.error(ioe, "");
  }
}

代码示例来源:origin: org.jvnet.hudson.main/maven-plugin

/**
 * Check that the provided file is a relative path. And check that it exists, just in case.
 */
public FormValidation doCheckFileRelative(@QueryParameter String value) throws IOException, ServletException {
  String v = fixEmpty(value);
  if ((v == null) || (v.length() == 0)) {
    // Null values are allowed.
    return FormValidation.ok();
  }
  if ((v.startsWith("/")) || (v.startsWith("\\")) || (v.matches("^\\w\\:\\\\.*"))) {
    return FormValidation.error("Alternate settings file must be a relative path.");
  }
  
  MavenModuleSetBuild lb = getLastBuild();
  if (lb!=null) {
    FilePath ws = lb.getWorkspace();
    if(ws!=null)
      return ws.validateRelativePath(value,true,true);
  }
  return FormValidation.ok();
}

代码示例来源:origin: org.jvnet.hudson.plugins/ivy

/**
 * Check that the provided file is a relative path. And check that it exists, just in case.
 */
public FormValidation doCheckIvySettingsFile(@QueryParameter String value) throws IOException, ServletException {
  String v = fixEmpty(value);
  if ((v == null) || (v.length() == 0)) {
    // Null values are allowed.
    return FormValidation.ok();
  }
  if ((v.startsWith("/")) || (v.startsWith("\\")) || (v.matches("^\\w\\:\\\\.*"))) {
    return FormValidation.error("Ivy settings file must be a relative path.");
  }
  IvyModuleSetBuild lb = getLastBuild();
  if (lb!=null) {
    FilePath ws = lb.getWorkspace();
    if(ws!=null)
      return ws.validateRelativePath(value,true,true);
  }
  return FormValidation.ok();
}

代码示例来源:origin: org.hudsonci.plugins/ivy

/**
 * Check that the provided file is a relative path. And check that it exists, just in case.
 */
public FormValidation doCheckIvySettingsFile(@QueryParameter String value) throws IOException, ServletException {
  String v = fixEmpty(value);
  if ((v == null) || (v.length() == 0)) {
    // Null values are allowed.
    return FormValidation.ok();
  }
  if ((v.startsWith("/")) || (v.startsWith("\\")) || (v.matches("^\\w\\:\\\\.*"))) {
    return FormValidation.error("Ivy settings file must be a relative path.");
  }
  IvyModuleSetBuild lb = getLastBuild();
  if (lb!=null) {
    FilePath ws = lb.getWorkspace();
    if(ws!=null)
      return ws.validateRelativePath(value,true,true);
  }
  return FormValidation.ok();
}

代码示例来源:origin: org.jenkins-ci.plugins/ivy

/**
 * Check that the provided file exists, just in case.
 */
public FormValidation doCheckIvySettingsFile(@QueryParameter String value) throws IOException, ServletException {
  String v = fixEmpty(value);
  if ((v == null) || (v.length() == 0)) {
    // Null values are allowed.
    return FormValidation.ok();
  }
  IvyModuleSetBuild lb = getLastBuild();
  if (lb != null) {
    FilePath ws = lb.getWorkspace();
    if (ws != null) {
      if ((v.startsWith("/")) || (v.startsWith("\\")) || (v.matches("^\\w\\:\\\\.*"))) {
        return validateAbsolutePath(ws, v);
      } else {
        return ws.validateRelativePath(v, true, true);
      }
    }
  }
  return FormValidation.ok();
}

相关文章