1.1 --- a/context/pom.xml Tue Jan 13 16:41:10 2015 +0100
1.2 +++ b/context/pom.xml Mon Jan 26 19:28:18 2015 +0100
1.3 @@ -33,9 +33,14 @@
1.4 <dependency>
1.5 <groupId>org.testng</groupId>
1.6 <artifactId>testng</artifactId>
1.7 - <version>6.8.1</version>
1.8 <scope>test</scope>
1.9 </dependency>
1.10 + <dependency>
1.11 + <groupId>org.netbeans.api</groupId>
1.12 + <artifactId>org-openide-util-lookup</artifactId>
1.13 + <scope>test</scope>
1.14 + <type>jar</type>
1.15 + </dependency>
1.16 </dependencies>
1.17 <description>Representation of an HTML page context a Java program operates in.</description>
1.18 </project>
2.1 --- a/context/src/main/java/org/netbeans/html/context/spi/Contexts.java Tue Jan 13 16:41:10 2015 +0100
2.2 +++ b/context/src/main/java/org/netbeans/html/context/spi/Contexts.java Mon Jan 26 19:28:18 2015 +0100
2.3 @@ -46,7 +46,9 @@
2.4 import java.lang.annotation.Retention;
2.5 import java.lang.annotation.RetentionPolicy;
2.6 import java.lang.annotation.Target;
2.7 +import java.util.HashSet;
2.8 import java.util.ServiceLoader;
2.9 +import java.util.Set;
2.10 import net.java.html.BrwsrCtx;
2.11 import org.netbeans.html.context.impl.CtxImpl;
2.12
2.13 @@ -112,12 +114,19 @@
2.14 } catch (SecurityException ex) {
2.15 l = null;
2.16 }
2.17 + Set<Class<?>> classes = new HashSet<Class<?>>();
2.18 for (Provider cp : ServiceLoader.load(Provider.class, l)) {
2.19 + if (!classes.add(cp.getClass())) {
2.20 + continue;
2.21 + }
2.22 cp.fillContext(cb, requestor);
2.23 found = true;
2.24 }
2.25 try {
2.26 for (Provider cp : ServiceLoader.load(Provider.class, Provider.class.getClassLoader())) {
2.27 + if (!classes.add(cp.getClass())) {
2.28 + continue;
2.29 + }
2.30 cp.fillContext(cb, requestor);
2.31 found = true;
2.32 }
2.33 @@ -128,6 +137,9 @@
2.34 }
2.35 if (!found) {
2.36 for (Provider cp : ServiceLoader.load(Provider.class)) {
2.37 + if (!classes.add(cp.getClass())) {
2.38 + continue;
2.39 + }
2.40 cp.fillContext(cb, requestor);
2.41 found = true;
2.42 }