Skip to content

Commit

Permalink
[JENKINS-74964] Updating the Linkage error handling comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Priya-CB committed Dec 20, 2024
1 parent fe5d266 commit 1f17086
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import hudson.model.User;
import hudson.security.AccessControlled;
import hudson.security.Permission;

import java.io.IOException;
import java.security.GeneralSecurityException;
import java.util.ArrayList;
Expand Down Expand Up @@ -623,8 +622,12 @@ public JSONObject doAddCredentials(StaplerRequest2 req, StaplerResponse2 rsp) th
credentialsWereAdded = store.addCredentials(wrapper.getDomain(), credentials);
} catch (LinkageError e) {
/*
* Descriptor#newInstanceImpl throws a LinkageError if the constructor throws any exception other
* than HTTP response exceptions such as Descriptor.FormException.
* Descriptor#newInstanceImpl throws a LinkageError if the DataBoundConstructor or any DataBoundSetter
* throw any exception other than RuntimeException implementing HttpResponse.
*
* Checked exceptions implementing HttpResponse like FormException are wrapped and
* rethrown as HttpResponseException (a RuntimeException implementing HttpResponse) in
* RequestImpl#invokeConstructor.
*
* This approach is taken to maintain backward compatibility, as throwing a FormException directly
* from the constructor would result in a source-incompatible change, potentially breaking dependent plugins.
Expand Down

0 comments on commit 1f17086

Please sign in to comment.