hudson.model.JDK.isDefaultJDKValid()方法的使用及代码示例

x33g5p2x  于2022-01-22 转载在 其他  
字(4.0k)|赞(0)|评价(0)|浏览(199)

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

JDK.isDefaultJDKValid介绍

[英]Checks if "java" is in PATH on the given node.

If it's not, then the user must specify a configured JDK, so this is often useful for form field validation.
[中]检查给定节点上的路径中是否有“java”。
如果不是,那么用户必须指定一个已配置的JDK,因此这对于表单字段验证通常很有用。

代码示例

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

/**
 * If the user chose the default JDK, make sure we got 'java' in PATH.
 */
public FormValidation doDefaultJDKCheck(StaplerRequest request, @QueryParameter String value) {
  if(!JDK.isDefaultName(value))
    // assume the user configured named ones properly in system config ---
    // or else system config should have reported form field validation errors.
    return FormValidation.ok();
  // default JDK selected. Does such java really exist?
  if(JDK.isDefaultJDKValid(Jenkins.this))
    return FormValidation.ok();
  else
    return FormValidation.errorWithMarkup(Messages.Hudson_NoJavaInPath(request.getContextPath()));
}

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

/**
 * If the user chose the default JDK, make sure we got 'java' in PATH.
 */
public FormValidation doDefaultJDKCheck(StaplerRequest request, @QueryParameter String value) {
  if (!value.equals("(Default)")) // assume the user configured named ones properly in system config ---
  // or else system config should have reported form field validation errors.
  {
    return FormValidation.ok();
  }
  // default JDK selected. Does such java really exist?
  if (JDK.isDefaultJDKValid(Hudson.this)) {
    return FormValidation.ok();
  } else {
    return FormValidation.errorWithMarkup(Messages.Hudson_NoJavaInPath(request.getContextPath()));
  }
}

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

/**
 * If the user chose the default JDK, make sure we got 'java' in PATH.
 */
public FormValidation doDefaultJDKCheck(StaplerRequest request, @QueryParameter String value) {
  if (!value.equals("(Default)")) // assume the user configured named ones properly in system config ---
  // or else system config should have reported form field validation errors.
  {
    return FormValidation.ok();
  }
  // default JDK selected. Does such java really exist?
  if (JDK.isDefaultJDKValid(Hudson.this)) {
    return FormValidation.ok();
  } else {
    return FormValidation.errorWithMarkup(Messages.Hudson_NoJavaInPath(request.getContextPath()));
  }
}

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

/**
 * If the user chose the default JDK, make sure we got 'java' in PATH.
 */
public FormValidation doDefaultJDKCheck(StaplerRequest request, @QueryParameter String value) {
  if (!value.equals("(Default)")) // assume the user configured named ones properly in system config ---
  // or else system config should have reported form field validation errors.
  {
    return FormValidation.ok();
  }
  // default JDK selected. Does such java really exist?
  if (JDK.isDefaultJDKValid(Hudson.this)) {
    return FormValidation.ok();
  } else {
    return FormValidation.errorWithMarkup(Messages.Hudson_NoJavaInPath(request.getContextPath()));
  }
}

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

/**
 * If the user chose the default JDK, make sure we got 'java' in PATH.
 */
public FormValidation doDefaultJDKCheck(StaplerRequest request, @QueryParameter String value) {
  if (!value.equals("(Default)")) // assume the user configured named ones properly in system config ---
  // or else system config should have reported form field validation errors.
  {
    return FormValidation.ok();
  }
  // default JDK selected. Does such java really exist?
  if (JDK.isDefaultJDKValid(Hudson.this)) {
    return FormValidation.ok();
  } else {
    return FormValidation.errorWithMarkup(Messages.Hudson_NoJavaInPath(request.getContextPath()));
  }
}

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

/**
 * If the user chose the default JDK, make sure we got 'java' in PATH.
 */
public FormValidation doDefaultJDKCheck(StaplerRequest request, @QueryParameter String value) {
  if(!JDK.isDefaultName(value))
    // assume the user configured named ones properly in system config ---
    // or else system config should have reported form field validation errors.
    return FormValidation.ok();
  // default JDK selected. Does such java really exist?
  if(JDK.isDefaultJDKValid(Jenkins.this))
    return FormValidation.ok();
  else
    return FormValidation.errorWithMarkup(Messages.Hudson_NoJavaInPath(request.getContextPath()));
}

相关文章