提交 c43925d0 编写于 作者: K kohsuke

bug fix when the submission contains no items.


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@5556 71c3de6d-444a-0410-be80-ed276b4c234a
上级 7e143f8c
......@@ -259,13 +259,18 @@ public abstract class Descriptor<T extends Describable<T>> {
* The JSON property name for 'formData' that represents the data for the list of describables.
* @param descriptors
* List of descriptors to create instances from.
* @return
* Can be empty but never null.
*/
public static <T extends Describable<T>>
List<T> newInstancesFromHeteroList(StaplerRequest req, JSONObject formData, String key,
Collection<? extends Descriptor<T>> descriptors) throws FormException {
JSONArray a = JSONArray.fromObject(formData.get(key));
List<T> items = new ArrayList<T>();
if(!formData.has(key)) return items;
JSONArray a = JSONArray.fromObject(formData.get(key));
for (Object o : a) {
JSONObject jo = (JSONObject)o;
String kind = jo.getString("kind");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册