[jbossnative-commits] JBoss Native SVN: r1059 - trunk/sight/examples/org/jboss/sight.

jbossnative-commits at lists.jboss.org jbossnative-commits at lists.jboss.org
Fri Sep 28 09:02:51 EDT 2007


Author: jfrederic.clere at jboss.com
Date: 2007-09-28 09:02:51 -0400 (Fri, 28 Sep 2007)
New Revision: 1059

Modified:
   trunk/sight/examples/org/jboss/sight/ListProcesses.java
Log:
Print argument only if they exist (no argument for kernel threads in Linux).


Modified: trunk/sight/examples/org/jboss/sight/ListProcesses.java
===================================================================
--- trunk/sight/examples/org/jboss/sight/ListProcesses.java	2007-09-28 12:57:13 UTC (rev 1058)
+++ trunk/sight/examples/org/jboss/sight/ListProcesses.java	2007-09-28 13:02:51 UTC (rev 1059)
@@ -42,11 +42,18 @@
             for (Process p : Process.getProcesses()) {
                 User u  = new User(p.UserId);
                 Group g = new Group(p.GroupId);
-                System.out.println("Process\t[" + p.Id + "] \t" +
+                if (p.Arguments==null)
+                    System.out.println("Process\t[" + p.Id + "] \t" +
                                    p.State + " : " + p.BaseName +
                                    " User(" + u.Name + ") Group(" +
                                    g.Name +")" + "\t " +
-                                   p.CurrentWorkingDirectory + "\t" +
+                                   p.CurrentWorkingDirectory);
+                else
+                    System.out.println("Process\t[" + p.Id + "] \t" +
+                                   p.State + " : " + p.BaseName +
+                                   " User(" + u.Name + ") Group(" +
+                                   g.Name +")" + "\t " +
+                                   p.CurrentWorkingDirectory + "\t " +
                                    p.Arguments[0]);
             }
         } catch (Exception e) {




More information about the jbossnative-commits mailing list