Skip to content
Permalink
Browse files

[FIXED JENKINS-44324] fix readResolve() of build cards for ancient ve…

…rsions of plugin

Wrap hasPermission() in try catch so in the very worst case we don't
brick Jenkins entirely
  • Loading branch information...
dalvizu committed Jun 16, 2017
1 parent 08939fa commit bfa47e5da3669ea58e4d8bbec1eed6095190c5b3
@@ -293,28 +293,23 @@ protected Object readResolve() {
if (selectedJob != null) {
gridBuilder = new DownstreamProjectGridBuilder(selectedJob);
}
} else {
// safe to assume an existing install, check if we need to migrate
// header config
if (columnHeaders == null) {
if (!showPipelineDefinitionHeader) {
columnHeaders = new NullColumnHeader();
} else if (showPipelineParametersInHeaders) {
columnHeaders = new BuildVariablesHeader();
} else {
columnHeaders = new SimpleColumnHeader();
}
}
if (columnHeaders == null) {
if (!showPipelineDefinitionHeader) {
columnHeaders = new NullColumnHeader();
} else if (showPipelineParametersInHeaders) {
columnHeaders = new BuildVariablesHeader();
} else {
columnHeaders = new SimpleColumnHeader();
}
if (rowHeaders == null) {
if (showPipelineParameters) {
rowHeaders = new BuildVariablesHeader();
} else {
rowHeaders = new SimpleRowHeader();
}
}
if (rowHeaders == null) {
if (showPipelineParameters) {
rowHeaders = new BuildVariablesHeader();
} else {
rowHeaders = new SimpleRowHeader();
}
}


return this;
}

@@ -996,18 +991,25 @@ public Item doCreateItem(final StaplerRequest req, final StaplerResponse rsp) th

@Override
public boolean hasPermission(final Permission p) {
boolean display = true;
//tester la liste vide seulement en lecture
if (READ.name.equals(p.name)) {
if (isEmpty()) {
display = false;
try {
boolean display = true;
//tester la liste vide seulement en lecture
if (READ.name.equals(p.name)) {
if (isEmpty()) {
display = false;
}
} else {
//Pas en lecture => permission standard
display = super.hasPermission(p);
}
} else {
//Pas en lecture => permission standard
display = super.hasPermission(p);
}

return display;
return display;
} catch (Throwable t) {
// JENKINS-44324This can be called from jenkins just determinig if it needs to show the
// pipeline tab, so if there are any errors don't blow up
LOGGER.log(Level.SEVERE, "Error in hasPermission: ", t);
return false;
}
}

/**

0 comments on commit bfa47e5

Please sign in to comment.
You can’t perform that action at this time.