> Am 08.07.2020 um 10:16 schrieb Goyot, Martin <[email protected]>:
> 
> Hi there,
> 
> On the OAuth plugin I'm working on, I'd like to modify the 
> @DataboundConstructor for the Realm. Issue is, if I modify it, whether be the 
> signature or the inners of the function, the deserialization for previous 
> instances won't work anymore hence breaking any previous installation of the 
> plugin.
> 
> How am I supposed to proceed in such particular cases, when I need to update 
> this constructor without breaking any config already set on Jenkins instances?
> 

The serialization does not use the constructor. You need to provide a 
readResolve method that will map the old fields to the new fields.

> Here is some code for reference:
> 
> public class MySecurityRealm extends SecurityRealm {
>     private String clientId;
>     private Secret clientSecret;
> 
>     @DataBoundConstructor
>     public MySecurityRealm(String clientId, String clientSecret) {
>         this.clientId = Util.fixEmptyAndTrim(clientId);
>         this.setClientSecret(Util.fixEmptyAndTrim(clientSecret));
>     }
> }
> 
> Thanks in advance !
> Martin
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Jenkins Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/jenkinsci-dev/CA%2Bb6JB-wx%3D%2BPRcXb057-9idgZkL7kYw%3DSvmSsaR-mxRJ9_g96A%40mail.gmail.com
>  
> <https://groups.google.com/d/msgid/jenkinsci-dev/CA%2Bb6JB-wx%3D%2BPRcXb057-9idgZkL7kYw%3DSvmSsaR-mxRJ9_g96A%40mail.gmail.com?utm_medium=email&utm_source=footer>.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/E316B1D7-CCBE-4BCE-A50C-E64A53A88E68%40gmail.com.

Reply via email to