This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 142721

Summary: Input messed up by output
Product: platform Reporter: rost <rost>
Component: Output WindowAssignee: Jaroslav Havlin <jhavlin>
Status: RESOLVED FIXED    
Severity: blocker    
Priority: P4    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:

Description rost 2008-08-03 20:43:26 UTC
If you input something into the output window and some output comes in between, your input gets messed up completely.
This really breaks lots of interactive tests when running within NetBeans.

Here is a small test program:
--------------
import java.io.*;

public class Main {

    public static void main(String[] args) throws IOException {
        OutputThread outputThread = new OutputThread();
        outputThread.start();
        InputStreamReader streamReader = new InputStreamReader(System.in);
        BufferedReader stdIn = new BufferedReader(streamReader);
        String input = stdIn.readLine();
        outputThread.running = false;
        System.out.println("input=\"" + input + "\"");
        System.exit(0);
    }

    private static class OutputThread extends Thread {

        public boolean running = true;

        public void run() {
            while (running) {
                System.out.println("output");
                try {
                    Thread.sleep(100);
                } catch (InterruptedException ex) {
                }
            }
        }
    }
}
--------------

Start it and type slowly any string you want (with several characters). After pressing Enter take a look how your input
ends up at the program. In most of the cases the input will be reversed or randomized.
Comment 1 rost 2009-07-19 21:27:13 UTC
I just installed NetBeans-6.7 and the bug is still there.
Comment 2 Martin Entlicher 2011-02-01 10:28:32 UTC
System terminals have the same behavior. The Output window was designed this way, it would probably have to have two modes - one terminal-like and one with a separate input field like it had in the past.
Comment 3 Jaroslav Havlin 2011-10-12 08:40:29 UTC
core-main/rev/8e79faf3c5b4

System terminals do mix input and output characters, but input string is not reversed. Fixed.
Comment 4 Quality Engineering 2011-10-14 15:02:23 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/8e79faf3c5b4
User: Jaroslav Havlin <jhavlin@netbeans.org>
Log: #142721 - Input messed up by output