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 137232

Summary: Input reset does not work
Product: platform Reporter: Petr Hejl <phejl>
Component: Output WindowAssignee: t_h <t_h>
Status: RESOLVED FIXED    
Severity: blocker CC: pjiricka
Priority: P2    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Bug Depends on:    
Bug Blocks: 135670    

Description Petr Hejl 2008-06-14 15:28:54 UTC
When code relies on non-blocking operation getIn().ready() is providing wrong results.

This happens when IO is reused:
1) output does not contain any line from previous operation
2) getOut().reset() is called
3) because reuse() on NbIO.IOReader is not called getIn().ready() will report false forever (even if there is input
available)

One possible solution would be to change NbIO.IOReader.ready() symmetrically to its read methods:

         public boolean ready() throws IOException {        
             synchronized (lock) {
-                return !inputClosed && buffer().length() > 0;
+                if (inputClosed) {
+                    reuse();
+                    return false;
+                }
+                return buffer().length() > 0;
             }
         }

Other possible solution would be to fix NbWriter().reset() method to not to rely on ((OutWriter) out).isEmpty() in order
to perform real reset.
Comment 2 Quality Engineering 2008-06-20 15:56:25 UTC
Integrated into 'main-golden', available in NB_Trunk_Production #271 build
Changeset: http://hg.netbeans.org/main/rev/7ea1bf6a7428
User: Tomas Holy <t_h@netbeans.org>
Log: #137232: Input reset does not work