Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 76677 - Console Input incorrect
Summary: Console Input incorrect
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 3.1   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.1 M3   Edit
Assignee: Darin Swanson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-10-20 13:18 EDT by Kevin Barnes CLA
Modified: 2018-09-11 01:46 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kevin Barnes CLA 2004-10-20 13:18:52 EDT
1. Run the following program

public class ConsoleTest {
    public static void main(String[] args) {
        try {
	        byte[] b = new byte[100];
	        for(;;) {
	            int read = System.in.read(b);
	            System.out.write(b, 0, read);
	        }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

2. Enter '123' in the console
3. replace '2' with 'x'
4. hit 'enter'

console output is 13x instead of 1x3.
Comment 1 Kevin Barnes CLA 2004-10-20 18:04:17 EDT
IOConsolePartitioner incorrectly assumed user input was always at the end of the document.
Fixed in IOConsolePartitioner and IOConsolePartition.
Comment 2 Kevin Barnes CLA 2004-10-20 18:04:40 EDT
DarinS, please verify
Comment 3 Darin Swanson CLA 2004-10-20 19:22:09 EDT
I changed the method name to insert and to use StringBuffer.insert(int, 
String) instead of replace. Makes the code more clear to me.

Verified.