Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2010-02-26 11:00:43 -0500
committerThomas Watson2010-02-26 11:00:43 -0500
commit63954c61b0dd0ce54f48a2871e7ef68eb4420a03 (patch)
tree67f562998d6dcbc489b3f90f45e45b981154ba90
parente7c0aee7eafac42921a43d885a599516b32d11e3 (diff)
downloadrt.equinox.framework-63954c61b0dd0ce54f48a2871e7ef68eb4420a03.tar.gz
rt.equinox.framework-63954c61b0dd0ce54f48a2871e7ef68eb4420a03.tar.xz
rt.equinox.framework-63954c61b0dd0ce54f48a2871e7ef68eb4420a03.zip
Bug 303842 - Launching Equinox Raises Circularity Exception
-rw-r--r--bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/protocol/StreamHandlerFactory.java56
1 files changed, 40 insertions, 16 deletions
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/protocol/StreamHandlerFactory.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/protocol/StreamHandlerFactory.java
index c51c6c7c3..10c5d0372 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/protocol/StreamHandlerFactory.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/protocol/StreamHandlerFactory.java
@@ -50,6 +50,7 @@ public class StreamHandlerFactory extends MultiplexingFactory implements URLStre
}
private Hashtable proxies;
private URLStreamHandlerFactory parentFactory;
+ private ThreadLocal creatingProtocols = new ThreadLocal();
/**
* Create the factory.
@@ -97,26 +98,49 @@ public class StreamHandlerFactory extends MultiplexingFactory implements URLStre
* @return a URLStreamHandler for the specific protocol.
*/
public URLStreamHandler createURLStreamHandler(String protocol) {
- //first check for built in handlers
- String builtInHandlers = secureAction.getProperty(PROTOCOL_HANDLER_PKGS);
- Class clazz = getBuiltIn(protocol, builtInHandlers, false);
- if (clazz != null)
- return null; // let the VM handle it
- URLStreamHandler result = null;
- if (isMultiplexing()) {
- if (findAuthorizedURLStreamHandler(protocol) != null)
- result = new MultiplexingURLStreamHandler(protocol, this);
- } else {
- result = createInternalURLStreamHandler(protocol);
+ // Check if we are recursing
+ if (isRecursive(protocol))
+ return null;
+ try {
+ //first check for built in handlers
+ String builtInHandlers = secureAction.getProperty(PROTOCOL_HANDLER_PKGS);
+ Class clazz = getBuiltIn(protocol, builtInHandlers, false);
+ if (clazz != null)
+ return null; // let the VM handle it
+ URLStreamHandler result = null;
+ if (isMultiplexing()) {
+ if (findAuthorizedURLStreamHandler(protocol) != null)
+ result = new MultiplexingURLStreamHandler(protocol, this);
+ } else {
+ result = createInternalURLStreamHandler(protocol);
+ }
+ // if parent is present do parent lookup
+ if (result == null && parentFactory != null)
+ result = parentFactory.createURLStreamHandler(protocol);
+ return result; //result may be null; let the VM handle it (consider sun.net.protocol.www.*)
+ } finally {
+ releaseRecursive(protocol);
}
- // if parent is present do parent lookup
- if (result == null && parentFactory != null)
- result = parentFactory.createURLStreamHandler(protocol);
- return result; //result may be null; let the VM handle it (consider sun.net.protocol.www.*)
}
- public URLStreamHandler createInternalURLStreamHandler(String protocol) {
+ private boolean isRecursive(String protocol) {
+ List protocols = (List) creatingProtocols.get();
+ if (protocols == null) {
+ protocols = new ArrayList(1);
+ creatingProtocols.set(protocols);
+ }
+ if (protocols.contains(protocol))
+ return true;
+ protocols.add(protocol);
+ return false;
+ }
+
+ private void releaseRecursive(String protocol) {
+ List protocols = (List) creatingProtocols.get();
+ protocols.remove(protocol);
+ }
+ public URLStreamHandler createInternalURLStreamHandler(String protocol) {
//internal protocol handlers
String internalHandlerPkgs = secureAction.getProperty(Constants.INTERNAL_HANDLER_PKGS);
internalHandlerPkgs = internalHandlerPkgs == null ? INTERNAL_PROTOCOL_HANDLER_PKG : internalHandlerPkgs + '|' + INTERNAL_PROTOCOL_HANDLER_PKG;

Back to the top