예제 #1
0
 /** 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();
 }
예제 #2
0
  /** 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();
  }