Lines 105-116
Link Here
|
105 |
if (this.bundleContext == null) |
105 |
if (this.bundleContext == null) |
106 |
throw new BundleException("This region is not connected to an OSGi Framework.", BundleException.INVALID_OPERATION); //$NON-NLS-1$ |
106 |
throw new BundleException("This region is not connected to an OSGi Framework.", BundleException.INVALID_OPERATION); //$NON-NLS-1$ |
107 |
setRegionThreadLocal(); |
107 |
setRegionThreadLocal(); |
|
|
108 |
Bundle installed = null; |
108 |
try { |
109 |
try { |
109 |
input = checkFileProtocol(location, input); |
110 |
input = checkFileProtocol(location, input); |
110 |
return this.bundleContext.installBundle(location + REGION_LOCATION_DELIMITER + this.regionName, input); |
111 |
installed = this.bundleContext.installBundle(location + REGION_LOCATION_DELIMITER + this.regionName, input); |
111 |
} finally { |
112 |
} finally { |
112 |
removeRegionThreadLocal(); |
113 |
removeRegionThreadLocal(); |
113 |
} |
114 |
} |
|
|
115 |
|
116 |
if (regionDigraph.getRegion(installed) == null) { |
117 |
// This bundle has been blacklisted; uninstall it |
118 |
BundleException dup = new BundleException("The symbolic name and version of the installed bundle already exists: " + installed.getSymbolicName() + " - " + installed.getVersion()); //$NON-NLS-1$ //$NON-NLS-2$ |
119 |
try { |
120 |
installed.uninstall(); |
121 |
} catch (BundleException e) { |
122 |
// ok, now we are in a bad state |
123 |
// we have a bundle we cannot uninstall! |
124 |
// better make it part of the region or it will become part of the system region on restart |
125 |
addBundle(installed.getBundleId()); |
126 |
throw new IllegalStateException("Error occurred cleaning up duplicate bundle.", e); //$NON-NLS-1$ |
127 |
} |
128 |
throw dup; |
129 |
} |
130 |
return installed; |
114 |
} |
131 |
} |
115 |
|
132 |
|
116 |
private InputStream checkFileProtocol(String location, InputStream input) throws BundleException { |
133 |
private InputStream checkFileProtocol(String location, InputStream input) throws BundleException { |