Revision: 4665
          http://sourceforge.net/p/vexi/code/4665
Author:   mkpg2
Date:     2014-02-25 10:37:54 +0000 (Tue, 25 Feb 2014)
Log Message:
-----------
Fix Fork=no
- incorrectly interpreting parameter
- no home dir, need to give log file absolute path

Modified Paths:
--------------
    trunk/org.vexi-launcher/src/main/java/org/vexi/launcher/Launcher.java
    trunk/org.vexi-launcher/src/main/java/org/vexi/launcher/LauncherApplet.java

Modified: trunk/org.vexi-launcher/src/main/java/org/vexi/launcher/Launcher.java
===================================================================
--- trunk/org.vexi-launcher/src/main/java/org/vexi/launcher/Launcher.java       
2014-02-22 01:51:53 UTC (rev 4664)
+++ trunk/org.vexi-launcher/src/main/java/org/vexi/launcher/Launcher.java       
2014-02-25 10:37:54 UTC (rev 4665)
@@ -356,8 +356,10 @@
                if("auto".equals(forkParam)){
                        // TODO should detect if proxy exists and then only 
fork if it does not
                        fork = false;
+               }else if("no".equals(forkParam)){
+                       fork = false;
                }else{
-                       fork = "yes".equals(forkParam) || 
"no".equals(forkParam);       
+                       fork = true; 
                }
                
                 
@@ -392,7 +394,11 @@
             if (logfile!=null) {
                 createLog(logfile);
                 args.add("-l");
-                args.add("logs/"+logfile);
+                if(fork){
+                       args.add("logs/"+logfile);
+                }else{
+                       args.add(new 
File(dotvexi.getBaseDir(),"logs/"+logfile).getAbsolutePath());
+                }
             }
             
             args.add("-biscuitid");
@@ -456,8 +462,9 @@
 
                    
                    
-                   spawn(args, fork);
+                   spawn(command);
             }else{
+
                String[] argsArr = (String[])args.toArray(new 
String[args.size()]);
                URL[] urls = new URL[]{corefile.toURI().toURL()};
                URLClassLoader cl = new URLClassLoader(urls);
@@ -475,7 +482,7 @@
     
     /** spawns the Vexi core
      * @param command contains the full command - including java */
-    private void spawn(List commandList, boolean fork) throws IOException { 
+    private void spawn(List commandList) throws IOException { 
         File dir = dotvexi.getBaseDir();
         String[] commandArr = (String[])commandList.toArray(new 
String[commandList.size()]);
         log("in directory : " + dir.getCanonicalPath());
@@ -484,35 +491,33 @@
             log("    \"" + commandArr[i] + "\"");
         }
 
-        if(fork){
-               final Process p = 
Runtime.getRuntime().exec(commandArr,null,dir);
-               
-               new Thread(new Runnable() {
-                   public void run() {
-                       // catch output
-                       StreamReader errorstream = new StreamReader(log, 
p.getErrorStream(), "ERROR", true);
-                       StreamReader outputstream = new StreamReader(log, 
p.getInputStream(), "OUTPUT", false);
-                       // kick off output streams
-                       errorstream.start();
-                       outputstream.start();
-                       try {
-                               log.status("Vexi loaded");
-                           int exitValue = p.waitFor();
-                           if (exitValue != 0) {
-                               log.error("Vexi exited abnormally with error 
code '"+exitValue+"', see log output");
-                           } else {
-                               log.status("Vexi has finished running");
-                               log.log("Exiting...");
-                               context.exited();
-                           }
-                       } catch (Throwable t) {
-                               log.error("Error exiting... " + p.exitValue());
-                           log.error(t);
-                           log.flush();
-                       }
-                   }
-               }).start();
-        }
+        final Process p = Runtime.getRuntime().exec(commandArr,null,dir);
+        
+        new Thread(new Runnable() {
+            public void run() {
+                // catch output
+                StreamReader errorstream = new StreamReader(log, 
p.getErrorStream(), "ERROR", true);
+                StreamReader outputstream = new StreamReader(log, 
p.getInputStream(), "OUTPUT", false);
+                // kick off output streams
+                errorstream.start();
+                outputstream.start();
+                try {
+                       log.status("Vexi loaded");
+                    int exitValue = p.waitFor();
+                    if (exitValue != 0) {
+                       log.error("Vexi exited abnormally with error code 
'"+exitValue+"', see log output");
+                    } else {
+                       log.status("Vexi has finished running");
+                        log.log("Exiting...");
+                       context.exited();
+                    }
+                } catch (Throwable t) {
+                       log.error("Error exiting... " + p.exitValue());
+                    log.error(t);
+                    log.flush();
+                }
+            }
+        }).start();
     }
 
     

Modified: 
trunk/org.vexi-launcher/src/main/java/org/vexi/launcher/LauncherApplet.java
===================================================================
--- trunk/org.vexi-launcher/src/main/java/org/vexi/launcher/LauncherApplet.java 
2014-02-22 01:51:53 UTC (rev 4664)
+++ trunk/org.vexi-launcher/src/main/java/org/vexi/launcher/LauncherApplet.java 
2014-02-25 10:37:54 UTC (rev 4665)
@@ -122,13 +122,14 @@
         g.setColor(Color.white);
         g.fillRect(0, 0, getSize().width, getSize().height);
         
-        int centerOffset = (getSize().width-(int)font.getStringBounds(text, 
g.getFontRenderContext()).getWidth())/2;
-        g.setColor(color);
-        g.setFont(font);
-        g.drawString(text, centerOffset, 15);
-        
+        if(text!=null){
+               int centerOffset = 
(getSize().width-(int)font.getStringBounds(text, 
g.getFontRenderContext()).getWidth())/2;
+               g.setColor(color);
+               g.setFont(font);
+               g.drawString(text, centerOffset, 15);
+        }
         g2.setClip(0, 0, getSize().width, getSize().height);
-        g2.drawImage(backbuffer, 0, 0, null);
+        g2.drawImage(backbuffer, 0, 0, null);        
     }
 
 

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis & security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
_______________________________________________
Vexi-svn mailing list
Vexi-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vexi-svn

Reply via email to