Skip to content
Permalink
Browse files

[JENKINS-26781] lookup descriptor by ID, then by class if explicitly set

to match some specific use cases.
  • Loading branch information...
ndeloof committed Feb 4, 2015
1 parent a944634 commit 8881703f7c7351695c5d5b2662faefae60de68e8
@@ -909,14 +909,19 @@ private URL getStaticHelpUrl(Klass<?> c, String suffix) {
if (formData!=null) {
for (Object o : JSONArray.fromObject(formData)) {
JSONObject jo = (JSONObject)o;
String kind = jo.optString("$class", null);
if (kind == null) {
// Legacy: Remove once plugins have been staged onto $class
kind = jo.getString("kind");
Descriptor<T> d = null;
String kind = jo.optString("kind", null);
if (kind != null) {
d = find(descriptors, kind);
}
if (d == null) {
kind = jo.getString("$class");
d = find(descriptors, kind);
}
Descriptor<T> d = find(descriptors, kind);
if (d != null) {
items.add(d.newInstance(req, jo));
} else {
LOGGER.warning("Received unexpected formData for descriptor " + kind);
}
}
}
@@ -36,12 +36,11 @@ THE SOFTWARE.
</st:documentation>
<j:set var="clazz" value="${attrs.clazz ?: attrs.descriptor.clazz.name}" />
<f:invisibleEntry>
<!-- Legacy: Remove once plugins have been staged onto $class -->
<input type="hidden" name="stapler-class" value="${clazz}" />
<!-- Legacy: Remove once plugins have been staged onto $class -->
<j:if test="${attrs.descriptor != null}">
<input type="hidden" name="kind" value="${attrs.descriptor.id}" />
</j:if>
<!-- Legacy: Remove once plugins have been staged onto $class -->
<input type="hidden" name="stapler-class" value="${clazz}" />
<input type="hidden" name="$class" value="${clazz}" />
</f:invisibleEntry>
</j:jelly>
</j:jelly>

0 comments on commit 8881703

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