mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-18 06:22:29 +00:00
Fixed a regression in 1.286 about handling form field validations in some plugins.
(<a href="http://www.nabble.com/1.286-version-and-description-The-requested-resource-%28%29-is-not--available.-td22233801.html">report</a>) git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@15826 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
1 parent
87c74aaa70
commit
ff005a685e
6 files changed
+58
-2
No files matched your search
@@ -29,12 +29,15 @@ import hudson.model.Hudson;
|
||||
import hudson.model.ViewDescriptor;
|
||||
import hudson.model.Descriptor.FormException;
|
||||
import hudson.util.Memoizer;
|
||||
import hudson.util.Iterators;
|
||||
import hudson.util.Iterators.FlattenIterator;
|
||||
import hudson.slaves.NodeDescriptor;
|
||||
import hudson.tasks.Publisher;
|
||||
import hudson.tasks.Publisher.DescriptorExtensionListImpl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.lang.reflect.Type;
|
||||
@@ -138,7 +141,7 @@ public class DescriptorExtensionList<T extends Describable<T>, D extends Descrip
|
||||
}
|
||||
|
||||
/**
|
||||
* Stores manually registered Descriptor instances.
|
||||
* Stores manually registered Descriptor instances. Keyed by the {@link Describable} type.
|
||||
*/
|
||||
private static final Memoizer<Class,CopyOnWriteArrayList> legacyDescriptors = new Memoizer<Class,CopyOnWriteArrayList>() {
|
||||
public CopyOnWriteArrayList compute(Class key) {
|
||||
@@ -146,5 +149,20 @@ public class DescriptorExtensionList<T extends Describable<T>, D extends Descrip
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* List up all the legacy instances currently in use.
|
||||
*/
|
||||
public static Iterable<Descriptor> listLegacyInstances() {
|
||||
return new Iterable<Descriptor>() {
|
||||
public Iterator<Descriptor> iterator() {
|
||||
return new FlattenIterator<Descriptor,CopyOnWriteArrayList>(legacyDescriptors.values()) {
|
||||
protected Iterator expand(CopyOnWriteArrayList v) {
|
||||
return v.iterator();
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private static final Logger LOGGER = Logger.getLogger(DescriptorExtensionList.class.getName());
|
||||
}
|
||||
@@ -103,6 +103,7 @@ import hudson.util.HudsonIsRestarting;
|
||||
import hudson.util.DescribableList;
|
||||
import hudson.util.Futures;
|
||||
import hudson.util.Memoizer;
|
||||
import hudson.util.Iterators;
|
||||
import hudson.widgets.Widget;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.acegisecurity.*;
|
||||
@@ -691,7 +692,8 @@ public final class Hudson extends Node implements ItemGroup<TopLevelItem>, Stapl
|
||||
* this just doesn't scale.
|
||||
*/
|
||||
public Descriptor getDescriptor(String fullyQualifiedClassName) {
|
||||
for( Descriptor d : getExtensionList(Descriptor.class) )
|
||||
// legacy descriptors that are reigstered manually doesn't show up in getExtensionList, so check them explicitly.
|
||||
for( Descriptor d : Iterators.sequence(getExtensionList(Descriptor.class),DescriptorExtensionList.listLegacyInstances()) )
|
||||
if(d.clazz.getName().equals(fullyQualifiedClassName))
|
||||
return d;
|
||||
return null;
|
||||
|
||||
@@ -219,5 +219,10 @@ public interface BuildStep {
|
||||
public Iterator<Descriptor<Publisher>> iterator() {
|
||||
return core.iterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean remove(Object o) {
|
||||
return core.remove(o);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -130,6 +130,11 @@ public final class DescriptorList<T extends Describable<T>> extends AbstractList
|
||||
add(element); // order is ignored
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean remove(Object o) {
|
||||
return store().remove(o);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the actual data store. This is the key to control the dual-mode nature of {@link DescriptorList}
|
||||
*/
|
||||
|
||||
@@ -65,4 +65,11 @@ public abstract class Memoizer<K,V> {
|
||||
public void clear() {
|
||||
store.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides a snapshot view of all {@code V}s.
|
||||
*/
|
||||
public Iterable<V> values() {
|
||||
return store.values();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user