hudson.Util.nullify()方法的使用及代码示例

x33g5p2x  于2022-01-31 转载在 其他  
字(12.9k)|赞(0)|评价(0)|浏览(157)

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

Util.nullify介绍

暂无

代码示例

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

/** @since 1.526 */
public void setIncludeRegex(String includeRegex) {
  this.includeRegex = Util.nullify(includeRegex);
  if (this.includeRegex == null)
    this.includePattern = null;
  else
    this.includePattern = Pattern.compile(includeRegex);
}

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

/**
 * Sets the e-mail address of Jenkins administrator.
 * @param adminAddress Admin address. Use null to reset the value to default.
 */
public void setAdminAddress(@CheckForNull String adminAddress) {
  String address = Util.nullify(adminAddress);
  if(address != null && address.startsWith("\"") && address.endsWith("\"")) {
    // some users apparently quote the whole thing. Don't know why
    // anyone does this, but it's a machine's job to forgive human mistake
    address = address.substring(1,address.length()-1);
  }
  this.adminAddress = address;
  save();
}

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

public void setUrl(@CheckForNull String jenkinsUrl) {
  String url = Util.nullify(jenkinsUrl);
  if(url!=null && !url.endsWith("/"))
    url += '/';
  this.jenkinsUrl = url;
  save();
  updateSecureSessionFlag();
}

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

/**
 * Accepts submission from the configuration page.
 *
 * Subtypes should override the {@link #submit(StaplerRequest)} method.
 */
@RequirePOST
public final synchronized void doConfigSubmit( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException, FormException {
  checkPermission(CONFIGURE);
  submit(req);
  description = Util.nullify(req.getParameter("description"));
  filterExecutors = req.getParameter("filterExecutors") != null;
  filterQueue = req.getParameter("filterQueue") != null;
  rename(req.getParameter("name"));
  getProperties().rebuild(req, req.getSubmittedForm(), getApplicablePropertyDescriptors());
  save();
  FormApply.success("../" + Util.rawEncode(name)).generateResponse(req,rsp,this);
}

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

/**
 * Accepts submission from the configuration page.
 */
@RequirePOST
public synchronized void doConfigSubmit( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException, FormException {
  BulkChange bc = new BulkChange(this);
  try {
    checkPermission(ADMINISTER);
    JSONObject json = req.getSubmittedForm();
    systemMessage = Util.nullify(req.getParameter("system_message"));
    boolean result = true;
    for (Descriptor<?> d : Functions.getSortedDescriptorsForGlobalConfigUnclassified())
      result &= configureDescriptor(req,json,d);
    
    save();
    updateComputerList();
    if(result)
      FormApply.success(req.getContextPath()+'/').generateResponse(req, rsp, null);
    else
      FormApply.success("configure").generateResponse(req, rsp, null);    // back to config
  } finally {
    bc.commit();
  }
}

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

/** @since 1.526 */
public void setIncludeRegex(String includeRegex) {
  this.includeRegex = Util.nullify(includeRegex);
  if (this.includeRegex == null)
    this.includePattern = null;
  else
    this.includePattern = Pattern.compile(includeRegex);
}

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

/**
 * validate the value for a local location (local checkout directory).
 */
public FormValidation doCheckLocal(@QueryParameter String value) throws IOException, ServletException {
  String v = Util.nullify(value);
  if (v == null)
    // local directory is optional so this is ok
    return FormValidation.ok();
  v = v.trim();
  // check if a absolute path has been supplied
  // (the last check with the regex will match windows drives)
  if (v.startsWith("/") || v.startsWith("\\") || v.startsWith("..") || v.matches("^[A-Za-z]:.*"))
    return FormValidation.error("absolute path is not allowed");
  // all tests passed so far
  return FormValidation.ok();
}

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

/**
 * Sets the e-mail address of Jenkins administrator.
 * @param adminAddress Admin address. Use null to reset the value to default.
 */
public void setAdminAddress(@CheckForNull String adminAddress) {
  String address = Util.nullify(adminAddress);
  if(address != null && address.startsWith("\"") && address.endsWith("\"")) {
    // some users apparently quote the whole thing. Don't know why
    // anyone does this, but it's a machine's job to forgive human mistake
    address = address.substring(1,address.length()-1);
  }
  this.adminAddress = address;
  save();
}

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

public static List<ModuleLocation> parse(String[] remoteLocations, String[] localLocations,
                     String[] depthOptions, boolean[] isIgnoreExternals) {
  List<ModuleLocation> modules = new ArrayList<ModuleLocation>();
  if (remoteLocations != null && localLocations != null) {
    int entries = Math.min(remoteLocations.length, localLocations.length);
    for (int i = 0; i < entries; i++) {
      // the remote (repository) location
      String remoteLoc = Util.nullify(remoteLocations[i]);
      if (remoteLoc != null) {// null if skipped
        remoteLoc = Util.removeTrailingSlash(remoteLoc.trim());
        modules.add(new ModuleLocation(remoteLoc, Util.nullify(localLocations[i]),
          depthOptions != null ? depthOptions[i] : null,
          isIgnoreExternals != null && isIgnoreExternals[i]));
      }
    }
  }
  return modules;
}

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

public void setUrl(@CheckForNull String jenkinsUrl) {
  String url = Util.nullify(jenkinsUrl);
  if(url!=null && !url.endsWith("/"))
    url += '/';
  this.jenkinsUrl = url;
  save();
  updateSecureSessionFlag();
}

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

public static List<ModuleLocation> parse(String[] remoteLocations, String[] localLocations,
                       String[] depthOptions, boolean[] isIgnoreExternals) {
    List<ModuleLocation> modules = new ArrayList<ModuleLocation>();
    if (remoteLocations != null && localLocations != null) {
      int entries = Math.min(remoteLocations.length, localLocations.length);
      for (int i = 0; i < entries; i++) {
        // the remote (repository) location
        String remoteLoc = Util.nullify(remoteLocations[i]);
        if (remoteLoc != null) {// null if skipped
          remoteLoc = Util.removeTrailingSlash(remoteLoc.trim());
          modules.add(new ModuleLocation(remoteLoc, Util.nullify(localLocations[i]),
            depthOptions != null ? depthOptions[i] : null,
            isIgnoreExternals != null && isIgnoreExternals[i]));
        }
      }
    }
    return modules;
  }
}

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

public static List<ModuleLocation> parse(String[] remoteLocations, String[] credentialIds,
                     String[] localLocations, String[] depthOptions,
                     boolean[] isIgnoreExternals, boolean[] cancelProcessOnExternalsFails) {
  List<ModuleLocation> modules = new ArrayList<ModuleLocation>();
  if (remoteLocations != null && localLocations != null) {
    int entries = Math.min(remoteLocations.length, localLocations.length);
    for (int i = 0; i < entries; i++) {
      // the remote (repository) location
      String remoteLoc = Util.nullify(remoteLocations[i]);
      if (remoteLoc != null) {// null if skipped
        remoteLoc = Util.removeTrailingSlash(remoteLoc.trim());
        modules.add(new ModuleLocation(remoteLoc,
            credentialIds != null && credentialIds.length > i ? credentialIds[i] : null,
            Util.nullify(localLocations[i]),
          depthOptions != null ? depthOptions[i] : null,
          isIgnoreExternals != null && isIgnoreExternals[i],
          cancelProcessOnExternalsFails != null && cancelProcessOnExternalsFails[i]));
      }
    }
  }
  return modules;
}

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

@DataBoundConstructor
public MailAccount(JSONObject jo){
  address = nullify(jo.optString("address", null));
  smtpHost = nullify(jo.optString("smtpHost", null));
  smtpPort = nullify(jo.optString("smtpPort", null));
  if(jo.optBoolean("auth", false)){
    smtpUsername = nullify(jo.optString("smtpUsername", null));
    smtpPassword = Secret.fromString(jo.optString("smtpPassword", null));
  }
  useSsl = jo.optBoolean("useSsl", false);
  advProperties = nullify(jo.optString("advProperties", null));
}

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

/**
 * Accepts submission from the configuration page.
 *
 * Subtypes should override the {@link #submit(StaplerRequest)} method.
 */
public final synchronized void doConfigSubmit( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException, FormException {
  checkPermission(CONFIGURE);
  submit(req);
  description = Util.nullify(req.getParameter("description"));
  filterExecutors = req.getParameter("filterExecutors") != null;
  filterQueue = req.getParameter("filterQueue") != null;
  rename(req.getParameter("name"));
  owner.save();
  rsp.sendRedirect2("../"+name);
}

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

/**
 * Accepts submission from the configuration page.
 *
 * Subtypes should override the {@link #submit(StaplerRequest)} method.
 */
public final synchronized void doConfigSubmit( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException, FormException {
  checkPermission(CONFIGURE);
  submit(req);
  description = Util.nullify(req.getParameter("description"));
  filterExecutors = req.getParameter("filterExecutors") != null;
  filterQueue = req.getParameter("filterQueue") != null;
  rename(req.getParameter("name"));
  owner.save();
  rsp.sendRedirect2("../"+name);
}

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

/**
 * Accepts submission from the configuration page.
 *
 * Subtypes should override the {@link #submit(StaplerRequest)} method.
 */
public final synchronized void doConfigSubmit(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException, FormException {
  checkPermission(CONFIGURE);
  submit(req);
  description = Util.nullify(req.getParameter("description"));
  filterExecutors = req.getParameter("filterExecutors") != null;
  filterQueue = req.getParameter("filterQueue") != null;
  rename(req.getParameter("name"));
  owner.save();
  rsp.sendRedirect2("../" + name);
}

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

/**
 * Accepts submission from the configuration page.
 *
 * Subtypes should override the {@link #submit(StaplerRequest)} method.
 */
public final synchronized void doConfigSubmit( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException, FormException {
  checkPermission(CONFIGURE);
  submit(req);
  description = Util.nullify(req.getParameter("description"));
  filterExecutors = req.getParameter("filterExecutors") != null;
  filterQueue = req.getParameter("filterQueue") != null;
  rename(req.getParameter("name"));
  owner.save();
  rsp.sendRedirect2("../"+name);
}

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

@Override
protected void submit(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException, FormException {
  super.submit(req, rsp);
  JSONObject json = req.getSubmittedForm();
  setCombinationFilter(
    req.getParameter(HAS_COMBINATION_FILTER_PARAM) != null ? Util.nullify(req.getParameter(
      COMBINATION_FILTER_PROPERTY_NAME)) : null);
  if (req.getParameter(HAS_TOUCH_STONE_COMBINATION_FILTER_PARAM)!=null) {
    setTouchStoneCombinationFilter(Util.nullify(req.getParameter(TOUCH_STONE_COMBINATION_FILTER_PARAM)));
    setTouchStoneResultCondition(Result.fromString(req.getParameter(TOUCH_STONE_RESULT_CONDITION_PARAM)));
  } else {
    setTouchStoneCombinationFilter(null);
  }
  setCustomWorkspace(
    req.hasParameter(CUSTOM_WORKSPACE_PARAM) ? req.getParameter(CUSTOM_WORKSPACE_DIRECTORY_PARAM) : null);
  // parse system axes
  DescribableList<Axis, AxisDescriptor> newAxes = DescribableListUtil.buildFromHetero(this, req, json, "axis",
    Axis.all());
  checkAxisNames(newAxes);
  setAxes(new AxisList(newAxes.toList()));
  setRunSequentially(json.has(RUN_SEQUENTIALLY_PROPERTY_NAME));
  rebuildConfigurations();
}

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

@Override
protected void submit(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException, FormException {
  super.submit(req, rsp);
  JSONObject json = req.getSubmittedForm();
  setCombinationFilter(
    req.getParameter(HAS_COMBINATION_FILTER_PARAM) != null ? Util.nullify(req.getParameter(
      COMBINATION_FILTER_PROPERTY_NAME)) : null);
  if (req.getParameter(HAS_TOUCH_STONE_COMBINATION_FILTER_PARAM)!=null) {
    setTouchStoneCombinationFilter(Util.nullify(req.getParameter(TOUCH_STONE_COMBINATION_FILTER_PARAM)));
    setTouchStoneResultCondition(Result.fromString(req.getParameter(TOUCH_STONE_RESULT_CONDITION_PARAM)));
  } else {
    setTouchStoneCombinationFilter(null);
  }
  setCustomWorkspace(
    req.hasParameter(CUSTOM_WORKSPACE_PARAM) ? req.getParameter(CUSTOM_WORKSPACE_DIRECTORY_PARAM) : null);
  // parse system axes
  DescribableList<Axis, AxisDescriptor> newAxes = DescribableListUtil.buildFromHetero(this, req, json, "axis",
    Axis.all());
  checkAxisNames(newAxes);
  setAxes(new AxisList(newAxes.toList()));
  setRunSequentially(json.has(RUN_SEQUENTIALLY_PROPERTY_NAME));
  rebuildConfigurations();
}

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

/**
 * Accepts submission from the configuration page.
 *
 * Subtypes should override the {@link #submit(StaplerRequest)} method.
 */
@RequirePOST
public final synchronized void doConfigSubmit( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException, FormException {
  checkPermission(CONFIGURE);
  submit(req);
  description = Util.nullify(req.getParameter("description"));
  filterExecutors = req.getParameter("filterExecutors") != null;
  filterQueue = req.getParameter("filterQueue") != null;
  rename(req.getParameter("name"));
  getProperties().rebuild(req, req.getSubmittedForm(), getApplicablePropertyDescriptors());
  updateTransientActions();  
  save();
  FormApply.success("../" + Util.rawEncode(name)).generateResponse(req,rsp,this);
}

相关文章

微信公众号

最新文章

更多