You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2020/05/01 22:37:56 UTC

[GitHub] [netbeans] eirikbakke commented on a change in pull request #2102: [NETBEANS-4203] for InputOutput.reset() do NbWriter.reset() as needed

eirikbakke commented on a change in pull request #2102:
URL: https://github.com/apache/netbeans/pull/2102#discussion_r418763449



##########
File path: platform/core.output2/src/org/netbeans/core/output2/NbIOProvider.java
##########
@@ -214,7 +214,17 @@ public Lookup getIOLookup(InputOutput io) {
     @Override
     public void resetIO(InputOutput io) {
         if (io instanceof NbIO) {
-            ((NbIO) io).reset();
+            if(io.getOut() instanceof NbWriter) {
+                try {
+                    // NbWriter does OutWriter fixup,
+                    // then NbWriter invokes ((NbIO) io).reset()
+                    io.getOut().reset();

Review comment:
       The comment seems correct. At first I thought maybe io.getIn().reset() would also need to be called, but as the comment says, we the implementation of NbWriter will call NbIO.reset() in turn..

##########
File path: platform/core.output2/src/org/netbeans/core/output2/NbIOProvider.java
##########
@@ -214,7 +214,17 @@ public Lookup getIOLookup(InputOutput io) {
     @Override
     public void resetIO(InputOutput io) {
         if (io instanceof NbIO) {
-            ((NbIO) io).reset();
+            if(io.getOut() instanceof NbWriter) {

Review comment:
       space after if

##########
File path: platform/core.output2/src/org/netbeans/core/output2/NbIOProvider.java
##########
@@ -214,7 +214,17 @@ public Lookup getIOLookup(InputOutput io) {
     @Override
     public void resetIO(InputOutput io) {
         if (io instanceof NbIO) {
-            ((NbIO) io).reset();
+            if(io.getOut() instanceof NbWriter) {
+                try {
+                    // NbWriter does OutWriter fixup,
+                    // then NbWriter invokes ((NbIO) io).reset()
+                    io.getOut().reset();
+                } catch(IOException ex) {
+                    Exceptions.printStackTrace(ex);

Review comment:
       This seems to be the way errors are handled in this class, I guess.

##########
File path: platform/core.output2/src/org/netbeans/core/output2/NbIOProvider.java
##########
@@ -214,7 +214,17 @@ public Lookup getIOLookup(InputOutput io) {
     @Override
     public void resetIO(InputOutput io) {
         if (io instanceof NbIO) {
-            ((NbIO) io).reset();
+            if(io.getOut() instanceof NbWriter) {
+                try {
+                    // NbWriter does OutWriter fixup,
+                    // then NbWriter invokes ((NbIO) io).reset()
+                    io.getOut().reset();
+                } catch(IOException ex) {

Review comment:
       space before (




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists