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

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

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

Util.nullify介绍

暂无

代码示例

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

  1. /** @since 1.526 */
  2. public void setIncludeRegex(String includeRegex) {
  3. this.includeRegex = Util.nullify(includeRegex);
  4. if (this.includeRegex == null)
  5. this.includePattern = null;
  6. else
  7. this.includePattern = Pattern.compile(includeRegex);
  8. }

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

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

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

  1. public void setUrl(@CheckForNull String jenkinsUrl) {
  2. String url = Util.nullify(jenkinsUrl);
  3. if(url!=null && !url.endsWith("/"))
  4. url += '/';
  5. this.jenkinsUrl = url;
  6. save();
  7. updateSecureSessionFlag();
  8. }

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

  1. /**
  2. * Accepts submission from the configuration page.
  3. *
  4. * Subtypes should override the {@link #submit(StaplerRequest)} method.
  5. */
  6. @RequirePOST
  7. public final synchronized void doConfigSubmit( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException, FormException {
  8. checkPermission(CONFIGURE);
  9. submit(req);
  10. description = Util.nullify(req.getParameter("description"));
  11. filterExecutors = req.getParameter("filterExecutors") != null;
  12. filterQueue = req.getParameter("filterQueue") != null;
  13. rename(req.getParameter("name"));
  14. getProperties().rebuild(req, req.getSubmittedForm(), getApplicablePropertyDescriptors());
  15. save();
  16. FormApply.success("../" + Util.rawEncode(name)).generateResponse(req,rsp,this);
  17. }

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

  1. /**
  2. * Accepts submission from the configuration page.
  3. */
  4. @RequirePOST
  5. public synchronized void doConfigSubmit( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException, FormException {
  6. BulkChange bc = new BulkChange(this);
  7. try {
  8. checkPermission(ADMINISTER);
  9. JSONObject json = req.getSubmittedForm();
  10. systemMessage = Util.nullify(req.getParameter("system_message"));
  11. boolean result = true;
  12. for (Descriptor<?> d : Functions.getSortedDescriptorsForGlobalConfigUnclassified())
  13. result &= configureDescriptor(req,json,d);
  14. save();
  15. updateComputerList();
  16. if(result)
  17. FormApply.success(req.getContextPath()+'/').generateResponse(req, rsp, null);
  18. else
  19. FormApply.success("configure").generateResponse(req, rsp, null); // back to config
  20. } finally {
  21. bc.commit();
  22. }
  23. }

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

  1. /** @since 1.526 */
  2. public void setIncludeRegex(String includeRegex) {
  3. this.includeRegex = Util.nullify(includeRegex);
  4. if (this.includeRegex == null)
  5. this.includePattern = null;
  6. else
  7. this.includePattern = Pattern.compile(includeRegex);
  8. }

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

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

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

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

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

  1. public static List<ModuleLocation> parse(String[] remoteLocations, String[] localLocations,
  2. String[] depthOptions, boolean[] isIgnoreExternals) {
  3. List<ModuleLocation> modules = new ArrayList<ModuleLocation>();
  4. if (remoteLocations != null && localLocations != null) {
  5. int entries = Math.min(remoteLocations.length, localLocations.length);
  6. for (int i = 0; i < entries; i++) {
  7. // the remote (repository) location
  8. String remoteLoc = Util.nullify(remoteLocations[i]);
  9. if (remoteLoc != null) {// null if skipped
  10. remoteLoc = Util.removeTrailingSlash(remoteLoc.trim());
  11. modules.add(new ModuleLocation(remoteLoc, Util.nullify(localLocations[i]),
  12. depthOptions != null ? depthOptions[i] : null,
  13. isIgnoreExternals != null && isIgnoreExternals[i]));
  14. }
  15. }
  16. }
  17. return modules;
  18. }

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

  1. public void setUrl(@CheckForNull String jenkinsUrl) {
  2. String url = Util.nullify(jenkinsUrl);
  3. if(url!=null && !url.endsWith("/"))
  4. url += '/';
  5. this.jenkinsUrl = url;
  6. save();
  7. updateSecureSessionFlag();
  8. }

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

  1. public static List<ModuleLocation> parse(String[] remoteLocations, String[] localLocations,
  2. String[] depthOptions, boolean[] isIgnoreExternals) {
  3. List<ModuleLocation> modules = new ArrayList<ModuleLocation>();
  4. if (remoteLocations != null && localLocations != null) {
  5. int entries = Math.min(remoteLocations.length, localLocations.length);
  6. for (int i = 0; i < entries; i++) {
  7. // the remote (repository) location
  8. String remoteLoc = Util.nullify(remoteLocations[i]);
  9. if (remoteLoc != null) {// null if skipped
  10. remoteLoc = Util.removeTrailingSlash(remoteLoc.trim());
  11. modules.add(new ModuleLocation(remoteLoc, Util.nullify(localLocations[i]),
  12. depthOptions != null ? depthOptions[i] : null,
  13. isIgnoreExternals != null && isIgnoreExternals[i]));
  14. }
  15. }
  16. }
  17. return modules;
  18. }
  19. }

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

  1. public static List<ModuleLocation> parse(String[] remoteLocations, String[] credentialIds,
  2. String[] localLocations, String[] depthOptions,
  3. boolean[] isIgnoreExternals, boolean[] cancelProcessOnExternalsFails) {
  4. List<ModuleLocation> modules = new ArrayList<ModuleLocation>();
  5. if (remoteLocations != null && localLocations != null) {
  6. int entries = Math.min(remoteLocations.length, localLocations.length);
  7. for (int i = 0; i < entries; i++) {
  8. // the remote (repository) location
  9. String remoteLoc = Util.nullify(remoteLocations[i]);
  10. if (remoteLoc != null) {// null if skipped
  11. remoteLoc = Util.removeTrailingSlash(remoteLoc.trim());
  12. modules.add(new ModuleLocation(remoteLoc,
  13. credentialIds != null && credentialIds.length > i ? credentialIds[i] : null,
  14. Util.nullify(localLocations[i]),
  15. depthOptions != null ? depthOptions[i] : null,
  16. isIgnoreExternals != null && isIgnoreExternals[i],
  17. cancelProcessOnExternalsFails != null && cancelProcessOnExternalsFails[i]));
  18. }
  19. }
  20. }
  21. return modules;
  22. }

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

  1. @DataBoundConstructor
  2. public MailAccount(JSONObject jo){
  3. address = nullify(jo.optString("address", null));
  4. smtpHost = nullify(jo.optString("smtpHost", null));
  5. smtpPort = nullify(jo.optString("smtpPort", null));
  6. if(jo.optBoolean("auth", false)){
  7. smtpUsername = nullify(jo.optString("smtpUsername", null));
  8. smtpPassword = Secret.fromString(jo.optString("smtpPassword", null));
  9. }
  10. useSsl = jo.optBoolean("useSsl", false);
  11. advProperties = nullify(jo.optString("advProperties", null));
  12. }

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

  1. /**
  2. * Accepts submission from the configuration page.
  3. *
  4. * Subtypes should override the {@link #submit(StaplerRequest)} method.
  5. */
  6. public final synchronized void doConfigSubmit( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException, FormException {
  7. checkPermission(CONFIGURE);
  8. submit(req);
  9. description = Util.nullify(req.getParameter("description"));
  10. filterExecutors = req.getParameter("filterExecutors") != null;
  11. filterQueue = req.getParameter("filterQueue") != null;
  12. rename(req.getParameter("name"));
  13. owner.save();
  14. rsp.sendRedirect2("../"+name);
  15. }

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

  1. /**
  2. * Accepts submission from the configuration page.
  3. *
  4. * Subtypes should override the {@link #submit(StaplerRequest)} method.
  5. */
  6. public final synchronized void doConfigSubmit( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException, FormException {
  7. checkPermission(CONFIGURE);
  8. submit(req);
  9. description = Util.nullify(req.getParameter("description"));
  10. filterExecutors = req.getParameter("filterExecutors") != null;
  11. filterQueue = req.getParameter("filterQueue") != null;
  12. rename(req.getParameter("name"));
  13. owner.save();
  14. rsp.sendRedirect2("../"+name);
  15. }

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

  1. /**
  2. * Accepts submission from the configuration page.
  3. *
  4. * Subtypes should override the {@link #submit(StaplerRequest)} method.
  5. */
  6. public final synchronized void doConfigSubmit(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException, FormException {
  7. checkPermission(CONFIGURE);
  8. submit(req);
  9. description = Util.nullify(req.getParameter("description"));
  10. filterExecutors = req.getParameter("filterExecutors") != null;
  11. filterQueue = req.getParameter("filterQueue") != null;
  12. rename(req.getParameter("name"));
  13. owner.save();
  14. rsp.sendRedirect2("../" + name);
  15. }

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

  1. /**
  2. * Accepts submission from the configuration page.
  3. *
  4. * Subtypes should override the {@link #submit(StaplerRequest)} method.
  5. */
  6. public final synchronized void doConfigSubmit( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException, FormException {
  7. checkPermission(CONFIGURE);
  8. submit(req);
  9. description = Util.nullify(req.getParameter("description"));
  10. filterExecutors = req.getParameter("filterExecutors") != null;
  11. filterQueue = req.getParameter("filterQueue") != null;
  12. rename(req.getParameter("name"));
  13. owner.save();
  14. rsp.sendRedirect2("../"+name);
  15. }

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

  1. @Override
  2. protected void submit(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException, FormException {
  3. super.submit(req, rsp);
  4. JSONObject json = req.getSubmittedForm();
  5. setCombinationFilter(
  6. req.getParameter(HAS_COMBINATION_FILTER_PARAM) != null ? Util.nullify(req.getParameter(
  7. COMBINATION_FILTER_PROPERTY_NAME)) : null);
  8. if (req.getParameter(HAS_TOUCH_STONE_COMBINATION_FILTER_PARAM)!=null) {
  9. setTouchStoneCombinationFilter(Util.nullify(req.getParameter(TOUCH_STONE_COMBINATION_FILTER_PARAM)));
  10. setTouchStoneResultCondition(Result.fromString(req.getParameter(TOUCH_STONE_RESULT_CONDITION_PARAM)));
  11. } else {
  12. setTouchStoneCombinationFilter(null);
  13. }
  14. setCustomWorkspace(
  15. req.hasParameter(CUSTOM_WORKSPACE_PARAM) ? req.getParameter(CUSTOM_WORKSPACE_DIRECTORY_PARAM) : null);
  16. // parse system axes
  17. DescribableList<Axis, AxisDescriptor> newAxes = DescribableListUtil.buildFromHetero(this, req, json, "axis",
  18. Axis.all());
  19. checkAxisNames(newAxes);
  20. setAxes(new AxisList(newAxes.toList()));
  21. setRunSequentially(json.has(RUN_SEQUENTIALLY_PROPERTY_NAME));
  22. rebuildConfigurations();
  23. }

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

  1. @Override
  2. protected void submit(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException, FormException {
  3. super.submit(req, rsp);
  4. JSONObject json = req.getSubmittedForm();
  5. setCombinationFilter(
  6. req.getParameter(HAS_COMBINATION_FILTER_PARAM) != null ? Util.nullify(req.getParameter(
  7. COMBINATION_FILTER_PROPERTY_NAME)) : null);
  8. if (req.getParameter(HAS_TOUCH_STONE_COMBINATION_FILTER_PARAM)!=null) {
  9. setTouchStoneCombinationFilter(Util.nullify(req.getParameter(TOUCH_STONE_COMBINATION_FILTER_PARAM)));
  10. setTouchStoneResultCondition(Result.fromString(req.getParameter(TOUCH_STONE_RESULT_CONDITION_PARAM)));
  11. } else {
  12. setTouchStoneCombinationFilter(null);
  13. }
  14. setCustomWorkspace(
  15. req.hasParameter(CUSTOM_WORKSPACE_PARAM) ? req.getParameter(CUSTOM_WORKSPACE_DIRECTORY_PARAM) : null);
  16. // parse system axes
  17. DescribableList<Axis, AxisDescriptor> newAxes = DescribableListUtil.buildFromHetero(this, req, json, "axis",
  18. Axis.all());
  19. checkAxisNames(newAxes);
  20. setAxes(new AxisList(newAxes.toList()));
  21. setRunSequentially(json.has(RUN_SEQUENTIALLY_PROPERTY_NAME));
  22. rebuildConfigurations();
  23. }

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

  1. /**
  2. * Accepts submission from the configuration page.
  3. *
  4. * Subtypes should override the {@link #submit(StaplerRequest)} method.
  5. */
  6. @RequirePOST
  7. public final synchronized void doConfigSubmit( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException, FormException {
  8. checkPermission(CONFIGURE);
  9. submit(req);
  10. description = Util.nullify(req.getParameter("description"));
  11. filterExecutors = req.getParameter("filterExecutors") != null;
  12. filterQueue = req.getParameter("filterQueue") != null;
  13. rename(req.getParameter("name"));
  14. getProperties().rebuild(req, req.getSubmittedForm(), getApplicablePropertyDescriptors());
  15. updateTransientActions();
  16. save();
  17. FormApply.success("../" + Util.rawEncode(name)).generateResponse(req,rsp,this);
  18. }

相关文章