Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Tiede2012-11-16 07:53:03 -0500
committerMarkus Tiede2012-11-16 07:53:03 -0500
commitf1f7b7eff6949d7d48b7f00a42ce956d0a12d775 (patch)
tree905670bbf323b5c935ddf667ce92009664fe3c9b /org.eclipse.jubula.autagent
parent955cfda52f66cf571e80e14393368fc55dae251f (diff)
downloadorg.eclipse.jubula.core-f1f7b7eff6949d7d48b7f00a42ce956d0a12d775.tar.gz
org.eclipse.jubula.core-f1f7b7eff6949d7d48b7f00a42ce956d0a12d775.tar.xz
org.eclipse.jubula.core-f1f7b7eff6949d7d48b7f00a42ce956d0a12d775.zip
Non-sprint task - implementation for enhancement http://bugs.eclipse.org/394460.
Diffstat (limited to 'org.eclipse.jubula.autagent')
-rw-r--r--org.eclipse.jubula.autagent/src/org/eclipse/jubula/autagent/commands/AbstractStartToolkitAut.java72
1 files changed, 42 insertions, 30 deletions
diff --git a/org.eclipse.jubula.autagent/src/org/eclipse/jubula/autagent/commands/AbstractStartToolkitAut.java b/org.eclipse.jubula.autagent/src/org/eclipse/jubula/autagent/commands/AbstractStartToolkitAut.java
index 4aa253ae7..10e919825 100644
--- a/org.eclipse.jubula.autagent/src/org/eclipse/jubula/autagent/commands/AbstractStartToolkitAut.java
+++ b/org.eclipse.jubula.autagent/src/org/eclipse/jubula/autagent/commands/AbstractStartToolkitAut.java
@@ -268,47 +268,59 @@ public abstract class AbstractStartToolkitAut implements IStartAut {
* an empty array will be returned.
*/
public static String[] getClasspathEntriesForBundleId(String bundleId) {
- Bundle bundle = Platform.getBundle(bundleId);
+ Bundle mainBundle = Platform.getBundle(bundleId);
- if (bundle == null) {
+ if (mainBundle == null) {
log.error("No bundle found for ID '" + bundleId + "'."); //$NON-NLS-1$//$NON-NLS-2$
return new String[0];
}
+ List<Bundle> bundleAndFragmentList = new ArrayList<Bundle>();
+ bundleAndFragmentList.add(mainBundle);
+
+ Bundle[] mainBundleFragments = Platform.getFragments(mainBundle);
+ if (mainBundleFragments != null) {
+ for (Bundle fragment : mainBundleFragments) {
+ bundleAndFragmentList.add(fragment);
+ }
+ }
+
List<String> classpathEntries = new ArrayList<String>();
- try {
- File bundleFile = FileLocator.getBundleFile(bundle);
- if (bundleFile.isFile()) {
- // bundle file is not a directory, so we assume it's a JAR file
- classpathEntries.add(bundleFile.getAbsolutePath());
-
- // since the classloader cannot handle nested JARs, we need to extract
- // all known nested JARs and add them to the classpath
- try {
- // assuming that it's a JAR/ZIP file
- File[] createdFiles = ZipUtil.unzipTempJars(bundleFile);
- for (int i = 0; i < createdFiles.length; i++) {
- classpathEntries.add(createdFiles[i].getAbsolutePath());
+ for (Bundle bundle : bundleAndFragmentList) {
+ try {
+ File bundleFile = FileLocator.getBundleFile(bundle);
+ if (bundleFile.isFile()) {
+ // bundle file is not a directory, so we assume it's a JAR file
+ classpathEntries.add(bundleFile.getAbsolutePath());
+
+ // since the classloader cannot handle nested JARs, we need to extract
+ // all known nested JARs and add them to the classpath
+ try {
+ // assuming that it's a JAR/ZIP file
+ File[] createdFiles = ZipUtil.unzipTempJars(bundleFile);
+ for (int i = 0; i < createdFiles.length; i++) {
+ classpathEntries.add(
+ createdFiles[i].getAbsolutePath());
+ }
+ } catch (IOException e) {
+ log.error("An error occurred while trying to extract nested JARs from " + bundleId, e); //$NON-NLS-1$
}
- } catch (IOException e) {
- log.error("An error occurred while trying to extract nested JARs from " + bundleId, e); //$NON-NLS-1$
- }
- } else {
- Enumeration<URL> e = bundle.findEntries(
- "/", "*.jar", true); //$NON-NLS-1$//$NON-NLS-2$
- if (e != null) {
- while (e.hasMoreElements()) {
- URL jarUrl = e.nextElement();
- classpathEntries.add(
- new File(bundleFile + jarUrl.getFile())
- .getAbsolutePath());
+ } else {
+ Enumeration<URL> e = bundle.findEntries(
+ "/", "*.jar", true); //$NON-NLS-1$//$NON-NLS-2$
+ if (e != null) {
+ while (e.hasMoreElements()) {
+ URL jarUrl = e.nextElement();
+ classpathEntries.add(
+ new File(bundleFile + jarUrl.getFile())
+ .getAbsolutePath());
+ }
}
}
+ } catch (IOException ioe) {
+ log.error("Bundle with ID '" + bundleId + "' could not be resolved to a file.", ioe); //$NON-NLS-1$//$NON-NLS-2$
}
- } catch (IOException ioe) {
- log.error("Bundle with ID '" + bundleId + "' could not be resolved to a file.", ioe); //$NON-NLS-1$//$NON-NLS-2$
}
-
return classpathEntries.toArray(new String[classpathEntries.size()]);
}

Back to the top