Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Xstream2#addCriticalField directly instead of via reflection #42

Merged
merged 1 commit into from
Sep 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
</licenses>

<properties>
<jenkins.version>2.60.3</jenkins.version>
<jenkins.version>2.89.4</jenkins.version>
<java.level>8</java.level>
<workflow.version>1.0</workflow.version> <!-- only for testing purpose -->
</properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
import hudson.model.Queue;
import hudson.util.FormApply;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
Expand All @@ -49,8 +47,6 @@
import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
import javax.servlet.ServletException;

import hudson.util.XStream2;
import jenkins.model.Jenkins;
import jenkins.model.TransientActionFactory;
import net.sf.json.JSONObject;
Expand Down Expand Up @@ -138,10 +134,8 @@ public Authentication authenticate(Queue.Item item) {
* This method is responsible for ensuring that POSTing config.xml respects the defined strategy.
*/
@Initializer(after = InitMilestone.PLUGINS_STARTED)
public static void setStrategyCritical() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
//TODO the reflection could be removed when the addCriticalField will be un-restricted (PR: https://github.com/jenkinsci/jenkins/pull/3066)
Method method = XStream2.class.getMethod("addCriticalField", Class.class, String.class);
method.invoke(Items.XSTREAM2, AuthorizeProjectProperty.class, "strategy");
public static void setStrategyCritical() {
Items.XSTREAM2.addCriticalField(AuthorizeProjectProperty.class, "strategy");
}

/**
Expand Down