Use BundleContext.getProperty() rather System.getProperty(). (FELIX-2543)


git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@999086 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/gogo/shell/src/main/java/org/apache/felix/gogo/shell/Activator.java b/gogo/shell/src/main/java/org/apache/felix/gogo/shell/Activator.java
index af47f6b..471d2a9 100644
--- a/gogo/shell/src/main/java/org/apache/felix/gogo/shell/Activator.java
+++ b/gogo/shell/src/main/java/org/apache/felix/gogo/shell/Activator.java
@@ -34,15 +34,17 @@
 
 public class Activator implements BundleActivator, Runnable
 {
+    private BundleContext context;
     private ServiceTracker commandProcessorTracker;
     private Set<ServiceRegistration> regs = new HashSet<ServiceRegistration>();
     private CommandSession session;
     private Shell shell;
     private Thread thread;
 
-    public void start(final BundleContext context) throws Exception
+    public void start(final BundleContext ctxt) throws Exception
     {
-        commandProcessorTracker = processorTracker(context);
+        context = ctxt;
+        commandProcessorTracker = processorTracker();
     }
 
     public void stop(BundleContext context) throws Exception
@@ -68,7 +70,8 @@
         try
         {
             Thread.sleep(100);    // wait for gosh command to be registered
-            String args = System.getProperty("gosh.args", "");
+            String args = context.getProperty("gosh.args");
+            args = (args == null) ? "" : args;
             session.execute("gosh --login " + args);
         }
         catch (Exception e)
@@ -120,7 +123,7 @@
         thread.start();
     }
 
-    private ServiceTracker processorTracker(BundleContext context)
+    private ServiceTracker processorTracker()
     {
         ServiceTracker t = new ServiceTracker(context, CommandProcessor.class.getName(),
             null)
@@ -147,5 +150,4 @@
         t.open();
         return t;
     }
-
-}
+}
\ No newline at end of file
diff --git a/gogo/shell/src/main/java/org/apache/felix/gogo/shell/Shell.java b/gogo/shell/src/main/java/org/apache/felix/gogo/shell/Shell.java
index 3082a35..8bd4eaf 100644
--- a/gogo/shell/src/main/java/org/apache/felix/gogo/shell/Shell.java
+++ b/gogo/shell/src/main/java/org/apache/felix/gogo/shell/Shell.java
@@ -49,7 +49,8 @@
     {
         this.context = context;
         this.processor = processor;
-        String baseDir = System.getProperty("gosh.home", System.getProperty("user.dir"));
+        String baseDir = context.getProperty("gosh.home");
+        baseDir = (baseDir == null) ? context.getProperty("user.dir") : baseDir;
         baseURI = new File(baseDir).toURI();
     }