Revision: 5941
          http://jnode.svn.sourceforge.net/jnode/?rev=5941&view=rev
Author:   galatnm
Date:     2012-12-21 15:17:21 +0000 (Fri, 21 Dec 2012)
Log Message:
-----------
NET : fix padding for netstat command output.

Modified Paths:
--------------
    trunk/cli/src/commands/org/jnode/command/net/NetstatCommand.java

Modified: trunk/cli/src/commands/org/jnode/command/net/NetstatCommand.java
===================================================================
--- trunk/cli/src/commands/org/jnode/command/net/NetstatCommand.java    
2012-12-21 15:07:28 UTC (rev 5940)
+++ trunk/cli/src/commands/org/jnode/command/net/NetstatCommand.java    
2012-12-21 15:17:21 UTC (rev 5941)
@@ -60,7 +60,6 @@
     
     private void showStats(PrintWriter out, NetworkLayer nl, int maxWidth) 
throws NetworkException {
         out.format(fmt_stat, nl.getName(), nl.getProtocolID());
-        padOutput(out, 4);
         showStats(out, nl.getStatistics(), 4);
         for (TransportLayer tl : nl.getTransportLayers()) {
             padOutput(out, 4);
@@ -72,20 +71,27 @@
     
     private void showStats(PrintWriter out, Statistics stat, int padSize)
         throws NetworkException {
-       padOutput(out, padSize);
         final Statistic[] statistics = stat.getStatistics();
         if (statistics.length == 0) {
             out.print(str_none);
         } else {
                StringBuffer buffer = new StringBuffer();
                for(Statistic statistic : statistics){
-                       buffer.append(statistic.getName()).append(' 
').append(statistic.getValue()).append("\n");
+                       
buffer.append(paddedString(padSize)).append(statistic.getName()).append(' 
').append(statistic.getValue()).append("\n");
                }
                out.print(buffer.toString());
         }
         out.println();
     }
     
+    private String paddedString(int padSize) {
+       String result = "";
+       for(int i = 0; i < padSize; i++){
+                       result += " ";  
+               }
+       return result;
+    }
+    
        private void padOutput(PrintWriter out, int size) {
                for(int i = 0; i < size; i++){
                        out.print(" "); 

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


------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Jnode-svn-commits mailing list
Jnode-svn-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jnode-svn-commits

Reply via email to