Skip to content

Commit

Permalink
[JENKINS-26781] set $class in submitted form to use descriptor.id, so…
Browse files Browse the repository at this point in the history
… descriptor can be retrieved by ID, which _may_ not be clazz.name
  • Loading branch information
ndeloof committed Feb 4, 2015
1 parent a944634 commit 57c9b48
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions core/src/main/java/hudson/model/Descriptor.java
Expand Up @@ -917,6 +917,8 @@ List<T> newInstancesFromHeteroList(StaplerRequest req, Object formData,
Descriptor<T> d = find(descriptors, kind);
if (d != null) {
items.add(d.newInstance(req, jo));
} else {
LOGGER.warning("Received unexpected formData for descriptor " + kind);
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions core/src/main/resources/lib/form/class-entry.jelly
Expand Up @@ -27,14 +27,15 @@ THE SOFTWARE.
<st:documentation>
Invisible &lt;f:entry> type for embedding a descriptor's $class field.
<st:attribute name="clazz">
The describable class that we are instantiating via structured form submission.
The descriptor ID that we are instantiating via structured form submission.
In most cases, descriptor ID is the Describable class name.
</st:attribute>
<st:attribute name="descriptor">
The descriptor of the describable that we are instantiating via
structured form submission. Mutually exclusive with clazz.
</st:attribute>
</st:documentation>
<j:set var="clazz" value="${attrs.clazz ?: attrs.descriptor.clazz.name}" />
<j:set var="clazz" value="${attrs.clazz ?: attrs.descriptor.id}" />
<f:invisibleEntry>
<!-- Legacy: Remove once plugins have been staged onto $class -->
<input type="hidden" name="stapler-class" value="${clazz}" />
Expand Down

0 comments on commit 57c9b48

Please sign in to comment.