]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - eclipse/plugins/org.argeo.slc.ide.ui/src/main/java/org/argeo/slc/ide/ui/launch/osgi/OsgiLaunchHelper.java
Catch all exception types
[gpl/argeo-slc.git] / eclipse / plugins / org.argeo.slc.ide.ui / src / main / java / org / argeo / slc / ide / ui / launch / osgi / OsgiLaunchHelper.java
index 2e55f87f3bc452a27c0975aed1d935c1e93e0300..6f54e64d120536b2c40e63f2461f68ff05c9eb35 100644 (file)
@@ -9,7 +9,9 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
+import java.util.Set;
 import java.util.StringTokenizer;
+import java.util.TreeSet;
 
 import org.argeo.slc.ide.ui.SlcIdeUiPlugin;
 import org.eclipse.core.resources.IFile;
@@ -48,11 +50,11 @@ import org.eclipse.swt.widgets.Shell;
  */
 @SuppressWarnings("restriction")
 public class OsgiLaunchHelper implements OsgiLauncherConstants {
-       private static Boolean debug = false;
+       private static Boolean debug = true;
 
        private final static String DEFAULT_DATA_DIR = "data";
        private final static String DEFAULT_EXEC_DIR = "exec";
-       private final static String DEFAULT_VMARGS = "-Xmx128m";
+       private final static String DEFAULT_VMARGS = "-Xmx256m";
        private final static String DEFAULT_PROGRAM_ARGS = "-console";
 
        /** Sets default values on this configuration. */
@@ -358,14 +360,10 @@ public class OsgiLaunchHelper implements OsgiLauncherConstants {
                if (debug)
                        System.out.println("Original bundle list: " + original);
 
-               StringBuffer bufBundles = new StringBuffer(1024);
                StringTokenizer stComa = new StringTokenizer(original, ",");
-               boolean first = true;
+               // sort by bundle symbolic name
+               Set<String> bundleIds = new TreeSet<String>();
                bundles: while (stComa.hasMoreTokens()) {
-                       if (first)
-                               first = false;
-                       else
-                               bufBundles.append(',');
 
                        String bundleId = stComa.nextToken();
                        if (bundleId.indexOf('*') >= 0)
@@ -375,7 +373,6 @@ public class OsgiLaunchHelper implements OsgiLauncherConstants {
                                                                + " not properly formatted, clean your workspace projects");
 
                        int indexAt = bundleId.indexOf('@');
-                       boolean modified = false;
                        if (indexAt >= 0) {
                                bundleId = bundleId.substring(0, indexAt);
                        }
@@ -391,7 +388,17 @@ public class OsgiLaunchHelper implements OsgiLauncherConstants {
                                // skip simple configurator in order to avoid side-effects
                                continue bundles;
                        }
+                       bundleIds.add(bundleId);
+               }
 
+               StringBuffer bufBundles = new StringBuffer(1024);
+               boolean first = true;
+               for (String bundleId : bundleIds) {
+                       if (first)
+                               first = false;
+                       else
+                               bufBundles.append(',');
+                       boolean modified = false;
                        if (bundlesToStart.contains(bundleId)) {
                                bufBundles.append(bundleId).append('@').append("default:true");
                                modified = true;
@@ -401,6 +408,7 @@ public class OsgiLaunchHelper implements OsgiLauncherConstants {
 
                        if (!modified)
                                bufBundles.append(bundleId);
+
                }
                String output = bufBundles.toString();
                return output;
@@ -427,7 +435,7 @@ public class OsgiLaunchHelper implements OsgiLauncherConstants {
                try {
                        in = file.getContents();
                        props.load(in);
-               } catch (IOException e) {
+               } catch (Exception e) {
                        throw new CoreException(new Status(IStatus.ERROR,
                                        SlcIdeUiPlugin.ID, "Cannot read properties file", e));
                } finally {