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

[JENKINS-64150] Fix blank manifest view #76

Closed
Closed
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
4 changes: 3 additions & 1 deletion src/main/java/hudson/plugins/repo/ManifestAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import java.util.logging.Level;
import java.util.logging.Logger;

import org.kohsuke.stapler.DataBoundSetter;
import org.kohsuke.stapler.export.ExportedBean;

import hudson.model.BuildBadgeAction;
Expand All @@ -47,7 +48,7 @@ public class ManifestAction implements RunAction2, Serializable, BuildBadgeActio
private static final long serialVersionUID = 1;

private transient Run<?, ?> run;
private transient RevisionState revisionState;
private RevisionState revisionState;
Copy link

@francoisferrand francoisferrand May 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revisionState is a large object, which should not be persisted I think; and it will anyway be re-loaded on call to setIndex, hence the transient annotation.
Isn't the @DataBoundSetter annotation enough to fix the problem here?

Copy link
Author

@abioteau abioteau May 31, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know, I cannot test my fix.

I add @DataBoundSetter annotation to follow your comment in #75 but ManifestAction is not created from StaplerRequest.bindJSON() or StaplerRequest.bindParameters(), so I don't think setIndex will be call.

So I remove transient annotation to keep revisionState object has setIndex is only call at creation of ManifestAction.


/**
* Allow disambiguation of the action url when multiple {@link RevisionState} actions present.
Expand All @@ -69,6 +70,7 @@ public class ManifestAction implements RunAction2, Serializable, BuildBadgeActio
*
* @param index the index, indexes less than or equal to {@code 1} will be discarded.
*/
@DataBoundSetter
public void setIndex(final Integer index) {
this.index = index == null || index <= 1 ? null : index;
try {
Expand Down