|
From: <ls...@us...> - 2007-01-27 13:40:18
|
Revision: 3093
http://jnode.svn.sourceforge.net/jnode/?rev=3093&view=rev
Author: lsantha
Date: 2007-01-27 05:40:17 -0800 (Sat, 27 Jan 2007)
Log Message:
-----------
Replaced StringBuffer with StringBuilder.
Modified Paths:
--------------
trunk/shell/src/shell/org/jnode/shell/command/ThreadCommand.java
trunk/shell/src/shell/org/jnode/shell/command/plugin/PluginCommand.java
trunk/shell/src/shell/org/jnode/shell/help/argument/OptionArgument.java
Modified: trunk/shell/src/shell/org/jnode/shell/command/ThreadCommand.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/command/ThreadCommand.java 2007-01-27 12:57:10 UTC (rev 3092)
+++ trunk/shell/src/shell/org/jnode/shell/command/ThreadCommand.java 2007-01-27 13:40:17 UTC (rev 3093)
@@ -18,7 +18,7 @@
* along with this library; If not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-
+
package org.jnode.shell.command;
import java.io.InputStream;
@@ -34,7 +34,7 @@
/**
* Shell command to view threads or a specific thread.
- *
+ *
* @author Ewout Prangsma (ep...@us...)
* @author Martin Husted Hartvig (ha...@jn...)
*/
@@ -73,15 +73,13 @@
}
private void showGroup(ThreadGroup grp, PrintStream out, String threadName) {
- StringBuffer stringBuffer;
-
if (threadName == null
// preserve compatible behavior when piped
&& out == System.out) {
grp.list();
return;
}
-
+
if (threadName != null) {
out.print(group);
out.println(grp.getName());
@@ -92,45 +90,40 @@
grp.enumerate(ts);
+ for (int i = 0; i < max; i++) {
+ final Thread t = ts[i];
+ if (t != null) {
+ if ((threadName == null) || threadName.equals(t.getName())) {
+ out.print(slash_t);
+ StringBuilder buffer = new StringBuilder();
- for (int i = 0; i < max; i++) {
- final Thread t = ts[i];
- if (t != null) {
- if ((threadName == null) || threadName.equals(t.getName())) {
- out.print(slash_t);
- stringBuffer = new StringBuffer();
+ buffer.append(t.getId());
+ buffer.append(seperator);
+ buffer.append(t.getName());
+ buffer.append(seperator);
+ buffer.append(t.getPriority());
+ buffer.append(seperator);
+ buffer.append(t.getVmThread().getThreadStateName());
- stringBuffer.append(t.getId());
- stringBuffer.append(seperator);
- stringBuffer.append(t.getName());
- stringBuffer.append(seperator);
- stringBuffer.append(t.getPriority());
- stringBuffer.append(seperator);
- stringBuffer.append(t.getVmThread().getThreadStateName());
+ out.println(buffer.toString());
+ if (threadName != null) {
+ final Object[] trace = VmThread.getStackTrace(t.getVmThread());
+ final int traceLen = trace.length;
+ for (int k = 0; k < traceLen; k++) {
+ buffer = new StringBuilder();
+ buffer.append(slash_t);
+ buffer.append(slash_t);
+ buffer.append(trace[k]);
- out.println(stringBuffer.toString());
- stringBuffer = null;
+ out.println(buffer.toString());
+ }
- if (threadName != null) {
- final Object[] trace = VmThread.getStackTrace(t.getVmThread());
- final int traceLen = trace.length;
- for (int k = 0; k < traceLen; k++) {
- stringBuffer = new StringBuffer();
- stringBuffer.append(slash_t);
- stringBuffer.append(slash_t);
- stringBuffer.append(trace[k]);
+ return;
+ }
+ }
+ }
+ }
- out.println(stringBuffer.toString());
-
- stringBuffer = null;
- }
-
- return;
- }
- }
- }
- }
-
final int gmax = grp.activeGroupCount() * 2;
final ThreadGroup[] tgs = new ThreadGroup[gmax];
grp.enumerate(tgs);
Modified: trunk/shell/src/shell/org/jnode/shell/command/plugin/PluginCommand.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/command/plugin/PluginCommand.java 2007-01-27 12:57:10 UTC (rev 3092)
+++ trunk/shell/src/shell/org/jnode/shell/command/plugin/PluginCommand.java 2007-01-27 13:40:17 UTC (rev 3093)
@@ -190,7 +190,7 @@
throws PluginException {
final ArrayList<String> rows = new ArrayList<String>();
for (PluginDescriptor descr : mgr.getRegistry()) {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append(descr.getId());
sb.append("; state ");
sb.append((descr.getPlugin().isActive())?"active":"inactive");
Modified: trunk/shell/src/shell/org/jnode/shell/help/argument/OptionArgument.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/help/argument/OptionArgument.java 2007-01-27 12:57:10 UTC (rev 3092)
+++ trunk/shell/src/shell/org/jnode/shell/help/argument/OptionArgument.java 2007-01-27 13:40:17 UTC (rev 3093)
@@ -88,7 +88,7 @@
* @see java.lang.Object#toString()
*/
public String toString() {
- final StringBuffer sb = new StringBuffer();
+ final StringBuilder sb = new StringBuilder();
sb.append("Options: ");
for (Option option : options) {
sb.append(", ");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|