1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-15 21:15:23 +02:00

[243699] [dstore] Loop in OutputHandler

This commit is contained in:
David McKnight 2008-08-13 15:33:45 +00:00
parent 006e65e149
commit 12ee882ba1

View file

@ -13,6 +13,7 @@
* *
* Contributors: * Contributors:
* David McKnight (IBM) - [207178] changing list APIs for file service and subsystems * David McKnight (IBM) - [207178] changing list APIs for file service and subsystems
* David McKnight (IBM) - [243699] [dstore] Loop in OutputHandler
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.internal.dstore.universal.miners.command; package org.eclipse.rse.internal.dstore.universal.miners.command;
@ -205,13 +206,19 @@ public class OutputHandler extends Handler {
// if output is not null, we assume the encoding was correct // if output is not null, we assume the encoding was correct
// and process the output // and process the output
if (fullOutput != null /* && fullOutput.length() == numRead */) { if (fullOutput != null) {
// tokenize the output so that we can get each line of // tokenize the output so that we can get each line of
// output // output
// the delimiters are therefore set to "\n\r" // the delimiters are therefore set to "\n\r"
StringTokenizer tokenizer = new StringTokenizer( StringTokenizer tokenizer = new StringTokenizer(
fullOutput, "\n\r"); //$NON-NLS-1$ fullOutput, "\n\r"); //$NON-NLS-1$
int numTokens = tokenizer.countTokens(); int numTokens = tokenizer.countTokens();
if (numTokens == 0){
output = new String[1];
output[0] = fullOutput;
return output;
}
output = new String[numTokens]; output = new String[numTokens];
int index = 0; int index = 0;
while (tokenizer.hasMoreTokens()) { while (tokenizer.hasMoreTokens()) {
@ -220,6 +227,8 @@ public class OutputHandler extends Handler {
} }
String lastLine = output[index - 1]; String lastLine = output[index - 1];
if (!_endOfStream && (!fullOutput.endsWith("\n") && !fullOutput.endsWith("\r"))) //$NON-NLS-1$ //$NON-NLS-2$ if (!_endOfStream && (!fullOutput.endsWith("\n") && !fullOutput.endsWith("\r"))) //$NON-NLS-1$ //$NON-NLS-2$
{ {
// our last line may be cut off // our last line may be cut off