Tabnine Logo
Descriptor$FormException
Code IndexAdd Tabnine to your IDE (free)

How to use
Descriptor$FormException
in
hudson.model

Best Java code snippets using hudson.model.Descriptor$FormException (Showing top 20 results out of 369)

Refine searchRefine arrow

  • JSONObject
  • Jenkins
  • StaplerRequest
origin: jenkinsci/jenkins

public boolean configure(StaplerRequest req, JSONObject json) throws hudson.model.Descriptor.FormException {
  Jenkins j = Jenkins.getInstance();
  j.checkPermission(Jenkins.ADMINISTER);
  if (json.has("useSecurity")) {
    JSONObject security = json.getJSONObject("useSecurity");
    j.setDisableRememberMe(security.optBoolean("disableRememberMe", false));
    j.setSecurityRealm(SecurityRealm.all().newInstanceFromRadioList(security, "realm"));
    j.setAuthorizationStrategy(AuthorizationStrategy.all().newInstanceFromRadioList(security, "authorization"));    
  if (json.has("markupFormatter")) {
    j.setMarkupFormatter(req.bindJSON(MarkupFormatter.class, json.getJSONObject("markupFormatter")));
  } else {
    j.setMarkupFormatter(null);
      j.setSlaveAgentPort(new ServerTcpPort(json.getJSONObject("slaveAgentPort")).getPort());
    } catch (IOException e) {
      throw new hudson.model.Descriptor.FormException(e, "slaveAgentPortType");
origin: org.eclipse.hudson.main/hudson-core

checkPermission(ADMINISTER);
JSONObject json = req.getSubmittedForm();
if (json.has("use_security")) {
  useSecurity = true;
  JSONObject security = json.getJSONObject("use_security");
  setSecurityRealm(SecurityRealm.all().newInstanceFromRadioList(security, "realm"));
  setAuthorizationStrategy(AuthorizationStrategy.all().newInstanceFromRadioList(security, "authorization"));
  if (security.has("markupFormatter")) {
    markupFormatter = req.bindJSON(MarkupFormatter.class, security.getJSONObject("markupFormatter"));
  } else {
    markupFormatter = null;
if (json.has("viewsTabBar")) {
  viewsTabBar = req.bindJSON(ViewsTabBar.class, json.getJSONObject("viewsTabBar"));
} else {
  viewsTabBar = new DefaultViewsTabBar();
      slaveAgentPort = Integer.parseInt(req.getParameter("slaveAgentPort"));
    } catch (NumberFormatException e) {
      throw new FormException(Messages.Hudson_BadPortNumber(req.getParameter("slaveAgentPort")), "slaveAgentPort");
origin: org.hudsonci.plugins/ivy

@Override
protected void submit(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException, FormException {
  super.submit(req,rsp);
  JSONObject json = req.getSubmittedForm();
  ignoreUpstreamChanges = !json.has("triggerByDependency");
  allowedToTriggerDownstream = json.has("allowedToTriggerDownstream");
  useUpstreamParameters = json.has("useUpstreamParameters");
  ivyFilePattern = Util.fixEmptyAndTrim(json.getString("ivyFilePattern"));
  ivyFileExcludesPattern = Util.fixEmptyAndTrim(json.getString("ivyFileExcludesPattern"));
  JSONObject ivyBuilderTypeJson = json.getJSONObject("ivyBuilderType");
  try {
    ivyBuilderType = (IvyBuilderType) req.bindJSON(Class.forName(ivyBuilderTypeJson.getString("stapler-class")), ivyBuilderTypeJson);
  } catch (ClassNotFoundException e) {
    throw new FormException("Error creating specified builder type.", e, "ivyBuilderType");
  aggregatorStyleBuild = !req.hasParameter("perModuleBuild");
  incrementalBuild = req.hasParameter("incrementalBuild");
  if (incrementalBuild)
origin: org.jenkins-ci.plugins/sectioned-view

@Override
public SectionedViewSection newInstance(StaplerRequest req, JSONObject formData) throws FormException {
  SectionedViewSection section = (SectionedViewSection)req.bindJSON(getClass().getDeclaringClass(), formData);
  if (formData.get("useincluderegex") != null) {
    JSONObject merp = formData.getJSONObject("useincluderegex");
    section.includeRegex = Util.nullify(merp.getString("includeRegex"));
    try {
      section.includePattern = Pattern.compile(section.includeRegex);
    } catch (PatternSyntaxException e) {
      throw new FormException("Regular expression is invalid: " + e.getMessage(), e, "includeRegex");
  ItemGroup<?> group = req.findAncestorObject(ItemGroup.class);
  if (group == null) {
    group = Jenkins.getInstance();
    section.jobFilters.rebuildHetero(req, formData, ViewJobFilter.all(), "jobFilters");
  } catch (IOException e) {
    throw new FormException("Error rebuilding list of view job filters.", e, "jobFilters");
origin: jenkinsci/jenkins

/**
 * Accepts the update to the node configuration.
 */
@RequirePOST
public void doConfigSubmit( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException, FormException {
  checkPermission(CONFIGURE);
  String proposedName = Util.fixEmptyAndTrim(req.getSubmittedForm().getString("name"));
  Jenkins.checkGoodName(proposedName);
  Node node = getNode();
  if (node == null) {
    throw new ServletException("No such node " + nodeName);
  }
  if ((!proposedName.equals(nodeName))
      && Jenkins.getActiveInstance().getNode(proposedName) != null) {
    throw new FormException(Messages.ComputerSet_SlaveAlreadyExists(proposedName), "name");
  }
  String nExecutors = req.getSubmittedForm().getString("numExecutors");
  if (StringUtils.isBlank(nExecutors) || Integer.parseInt(nExecutors)<=0) {
    throw new FormException(Messages.Slave_InvalidConfig_Executors(nodeName), "numExecutors");
  }
  Node result = node.reconfigure(req, req.getSubmittedForm());
  Jenkins.getInstance().getNodesObject().replaceNode(this.getNode(), result);
  // take the user back to the agent top page.
  rsp.sendRedirect2("../" + result.getNodeName() + '/');
}
origin: jenkinsci/jenkins

  @Override
  public boolean configure(StaplerRequest req, JSONObject json) throws hudson.model.Descriptor.FormException {
    // for compatibility reasons, the actual value is stored in Jenkins
    Jenkins j = Jenkins.get();
    final JSONObject optJSONObject = json.optJSONObject("useProjectNamingStrategy");
    if (optJSONObject != null) {
      final JSONObject strategyObject = optJSONObject.getJSONObject("namingStrategy");
      final String className = strategyObject.getString("$class");
      try {
        Class clazz = Class.forName(className, true, j.getPluginManager().uberClassLoader);
        final ProjectNamingStrategy strategy = (ProjectNamingStrategy) req.bindJSON(clazz, strategyObject);
        j.setProjectNamingStrategy(strategy);
      } catch (ClassNotFoundException e) {
        throw new FormException(e, "namingStrategy");
      }
    }
    if (j.getProjectNamingStrategy() == null) {
      j.setProjectNamingStrategy(DefaultProjectNamingStrategy.DEFAULT_NAMING_STRATEGY);
    }
    return true;
  }
}
origin: jenkinsci/ircbot-plugin

String[] channelsNames = req.getParameterValues("irc_publisher.channel.name");
String[] channelsPasswords = req.getParameterValues("irc_publisher.channel.password");
      throw new FormException("Channel name must not be empty", "channel.name");
    boolean notifyOnly = jchans != null ? jchans.get(i).getBoolean("notificationOnly") : false;
    targets.add(new GroupChatIMMessageTarget(channelsNames[i], password, notifyOnly));
String n = req.getParameter(getParamNames().getStrategy());
if (n == null) {
  n = PARAMETERVALUE_STRATEGY_DEFAULT;
if (formData.has("matrixNotifier")) {
  String o = formData.getString("matrixNotifier");
  matrixJobMultiplier = MatrixJobMultiplier.valueOf(o);
origin: org.jenkins-ci.main/jenkins-core

  @Override
  public boolean configure(StaplerRequest req, JSONObject json) throws hudson.model.Descriptor.FormException {
    // for compatibility reasons, the actual value is stored in Jenkins
    Jenkins j = Jenkins.getInstance();
    final JSONObject optJSONObject = json.optJSONObject("useProjectNamingStrategy");
    if (optJSONObject != null) {
      final JSONObject strategyObject = optJSONObject.getJSONObject("namingStrategy");
      final String className = strategyObject.getString("$class");
      try {
        Class clazz = Class.forName(className, true, Jenkins.getInstance().getPluginManager().uberClassLoader);
        final ProjectNamingStrategy strategy = (ProjectNamingStrategy) req.bindJSON(clazz, strategyObject);
        j.setProjectNamingStrategy(strategy);
      } catch (ClassNotFoundException e) {
        throw new FormException(e, "namingStrategy");
      }
    }
    if (j.getProjectNamingStrategy() == null) {
      j.setProjectNamingStrategy(DefaultProjectNamingStrategy.DEFAULT_NAMING_STRATEGY);
    }
    return true;
  }
}
origin: jenkinsci/jenkins

@Override
protected void submit(StaplerRequest req) throws IOException, ServletException, FormException {
  String proxiedViewName = req.getSubmittedForm().getString("proxiedViewName");
  if (Jenkins.getInstance().getView(proxiedViewName) == null) {
    throw new FormException("Not an existing global view", "proxiedViewName");
  }
  this.proxiedViewName = proxiedViewName;
}
origin: jenkinsci/jenkins

  @Override
  public boolean configure(StaplerRequest req, JSONObject json) throws FormException {
    Jenkins j = Jenkins.get();
    try {
      // for compatibility reasons, this value is stored in Jenkins
      String num = json.getString("numExecutors");
      if (!num.matches("\\d+")) {
        throw new FormException(Messages.Hudson_Computer_IncorrectNumberOfExecutors(),"numExecutors");
      }
      
      j.setNumExecutors(json.getInt("numExecutors"));
      if (req.hasParameter("master.mode"))
        j.setMode(Mode.valueOf(req.getParameter("master.mode")));
      else
        j.setMode(Mode.NORMAL);

      j.setLabelString(json.optString("labelString", ""));

      return true;
    } catch (IOException e) {
      throw new FormException(e,"numExecutors");
    }
  }
}
origin: jenkinsci/promoted-builds-plugin

private JobPropertyImpl(StaplerRequest req, JSONObject json) throws Descriptor.FormException, IOException {
  List<Ancestor> ancs = req.getAncestors();
  final Object ancestor = ancs.get(ancs.size()-1).getObject();
  if (ancestor instanceof AbstractProject) {
    owner = (AbstractProject)ancestor;
  } else if (ancestor == null) {
    throw new Descriptor.FormException("Cannot retrieve the ancestor item in the request",
    "owner");
  } else {
    throw new Descriptor.FormException("Cannot create Promoted Builds Job Property for " + ancestor.getClass()
    + ". Currently the plugin supports instances of AbstractProject only."
    + ". Other job types are not supported, submit a bug to the plugin, which provides the job type"
  if(json.has("promotions"))
    json = json.getJSONObject("promotions");
  for( Object o : JSONArray.fromObject(json.get("activeItems")) ) {
    JSONObject c = (JSONObject)o;
    String name = c.getString("name");
      Hudson.checkGoodName(name);
    } catch (Failure f) {
      throw new Descriptor.FormException(f.getMessage(), name);
origin: org.eclipse.hudson/hudson-core

@Override
public Publisher newInstance(StaplerRequest req, JSONObject formData)
    throws hudson.model.Descriptor.FormException {
  String testResults = formData.getString("testResults");
  boolean keepLongStdio = formData.getBoolean("keepLongStdio");
  DescribableList<TestDataPublisher, Descriptor<TestDataPublisher>> testDataPublishers = new DescribableList<TestDataPublisher, Descriptor<TestDataPublisher>>(Saveable.NOOP);
  try {
    testDataPublishers.rebuild(req, formData, TestDataPublisher.all());
  } catch (IOException e) {
    throw new FormException(e, null);
  }
  return new JUnitResultArchiver(testResults, keepLongStdio, testDataPublishers);
}
origin: org.eclipse.hudson.main/hudson-core

@Override
protected void submit(StaplerRequest req) throws IOException, ServletException, FormException {
  String proxiedViewName = req.getSubmittedForm().getString("proxiedViewName");
  if (Hudson.getInstance().getView(proxiedViewName) == null) {
    throw new FormException("Not an existing global view", "proxiedViewName");
  }
  this.proxiedViewName = proxiedViewName;
}
origin: org.eclipse.hudson/hudson-core

checkPermission(Permission.HUDSON_ADMINISTER);
JSONObject json = req.getSubmittedForm();
if (json.has("use_security")) {
  useSecurity = true;
  JSONObject security = json.getJSONObject("use_security");
  if (security.has("markupFormatter")) {
    markupFormatter = req.bindJSON(MarkupFormatter.class, security.getJSONObject("markupFormatter"));
    String v = req.getParameter("slaveAgentPortType");
    if (!isUseSecurity() || v == null || v.equals("random")) {
      slaveAgentPort = 0;
        slaveAgentPort = Integer.parseInt(req.getParameter("slaveAgentPort"));
      } catch (NumberFormatException e) {
        throw new FormException(hudson.model.Messages.Hudson_BadPortNumber(req.getParameter("slaveAgentPort")), "slaveAgentPort");
origin: openstack-infra/gearman-plugin

enablePlugin = json.getBoolean("enablePlugin");
host = json.getString("host");
port = json.getInt("port");
    throw new FormException("Unable to connect to Gearman server. "
          + "Please check the server connection settings and retry.",
          "host");
      throw new FormException("Unable to connect to Gearman server. "
            + "Please check the server connection settings and retry.",
            "host");
req.bindJSON(this, json);
save();
return true;
origin: org.jenkins-ci.main/jenkins-core

  @Override
  public boolean configure(StaplerRequest req, JSONObject json) throws FormException {
    // for compatibility reasons, the actual value is stored in Jenkins
    Jenkins j = Jenkins.getInstance();
    if (json.has("primaryView")) {
      final String viewName = json.getString("primaryView");
      final View newPrimaryView = j.getView(viewName);
      if (newPrimaryView == null) {
        throw new FormException(Messages.GlobalDefaultViewConfiguration_ViewDoesNotExist(viewName), "primaryView");
      }
      j.setPrimaryView(newPrimaryView);
    } else {
      // Fallback if the view is not specified
      j.setPrimaryView(j.getViews().iterator().next());
    }
    
    return true;
  }
}
origin: jenkinsci/tfs-plugin

@Override
public boolean configure(StaplerRequest req, JSONObject json) throws FormException {
  try {
    req.bindJSON(this, json);
    
    // stapler oddity, empty lists are not set on bean by  "req.bindJSON(this, json)"
    this.releaseWebHookConfigurations = req.bindJSONToList(ReleaseWebHook.class, json.get("releaseWebHookConfigurations"));
  }
  catch (final Exception e) {
    final String message = "Configuration error: " + e.getMessage();
    LOGGER.log(Level.WARNING, message, e);
    LOGGER.log(Level.FINE, "Form data: {}", json.toString());
    throw new FormException(message, e, "team-configuration");
  }
  save();
  return true;
}
origin: jenkinsci/ansicolor-plugin

@Override
public boolean configure(final StaplerRequest req, final JSONObject formData) throws FormException {
  try {
    setColorMaps(req.bindJSONToList(AnsiColorMap.class,
        req.getSubmittedForm().get("colorMap")).toArray(new AnsiColorMap[1]));
    return true;
  } catch (ServletException e) {
    throw new FormException(e, "");
  }
}
origin: org.jenkins-ci.main/jenkins-core

  @Override
  public boolean configure(StaplerRequest req, JSONObject json) throws FormException {
    Jenkins j = Jenkins.getInstance();
    try {
      // for compatibility reasons, this value is stored in Jenkins
      j.setNumExecutors(json.getInt("numExecutors"));
      if (req.hasParameter("master.mode"))
        j.setMode(Mode.valueOf(req.getParameter("master.mode")));
      else
        j.setMode(Mode.NORMAL);

      j.setLabelString(json.optString("labelString", ""));

      return true;
    } catch (IOException e) {
      throw new FormException(e,"numExecutors");
    }
  }
}
origin: jenkinsci/jenkins

  @Override
  public boolean configure(StaplerRequest req, JSONObject json) throws FormException {
    // for compatibility reasons, the actual value is stored in Jenkins
    Jenkins j = Jenkins.get();
    if (json.has("primaryView")) {
      final String viewName = json.getString("primaryView");
      final View newPrimaryView = j.getView(viewName);
      if (newPrimaryView == null) {
        throw new FormException(Messages.GlobalDefaultViewConfiguration_ViewDoesNotExist(viewName), "primaryView");
      }
      j.setPrimaryView(newPrimaryView);
    } else {
      // Fallback if the view is not specified
      j.setPrimaryView(j.getViews().iterator().next());
    }
    
    return true;
  }
}
hudson.modelDescriptor$FormException

Most used methods

  • <init>
  • getMessage
  • printStackTrace
  • getCause

Popular in Java

  • Making http post requests using okhttp
  • setContentView (Activity)
  • runOnUiThread (Activity)
  • getResourceAsStream (ClassLoader)
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • Permission (java.security)
    Legacy security code; do not use.
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • JPanel (javax.swing)
  • Runner (org.openjdk.jmh.runner)
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now