HHH-8922 ClassLoaderServiceImpl#getResources should use LinkedHashSet to

preserve ordering
This commit is contained in:
Brett Meyer 2014-02-07 10:01:24 -05:00
parent bbe4714196
commit 629b653cc7
2 changed files with 4 additions and 6 deletions

View File

@ -31,7 +31,6 @@ import java.util.Collection;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
@ -43,7 +42,6 @@ import org.hibernate.boot.registry.classloading.spi.ClassLoadingException;
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.internal.CoreLogging;
import org.hibernate.internal.util.ClassLoaderHelper;
import org.jboss.logging.Logger;
/**
@ -182,7 +180,7 @@ public class ClassLoaderServiceImpl implements ClassLoaderService {
@Override
public Enumeration<URL> getResources(String name) throws IOException {
final HashSet<URL> resourceUrls = new HashSet<URL>();
final LinkedHashSet<URL> resourceUrls = new LinkedHashSet<URL>();
for ( ClassLoader classLoader : individualClassLoaders ) {
final Enumeration<URL> urls = classLoader.getResources( name );

View File

@ -27,7 +27,7 @@ import java.net.URL;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
@ -46,8 +46,8 @@ import org.osgi.framework.Bundle;
public class OsgiClassLoader extends ClassLoader implements Stoppable {
// Leave these as Sets -- addClassLoader or addBundle may be called more
// than once if a SF or EMF is closed and re-created.
private Set<ClassLoader> classLoaders = new HashSet<ClassLoader>();
private Set<Bundle> bundles = new HashSet<Bundle>();
private Set<ClassLoader> classLoaders = new LinkedHashSet<ClassLoader>();
private Set<Bundle> bundles = new LinkedHashSet<Bundle>();
private Map<String, Class<?>> classCache = new HashMap<String, Class<?>>();
private Map<String, URL> resourceCache = new HashMap<String, URL>();