Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrik Suzzi2016-11-18 22:53:40 +0000
committerAndrey Loskutov2017-01-20 09:28:04 +0000
commit983acc0cecfd1e5df8d5c79f6bf561e074d1a996 (patch)
treecfbf70ad4265e2e300178910b8922788b71da9ca
parent05278b2b01d3662d7d88a8b6bb816ac93887345f (diff)
downloadeclipse.platform.debug-983acc0cecfd1e5df8d5c79f6bf561e074d1a996.tar.gz
eclipse.platform.debug-983acc0cecfd1e5df8d5c79f6bf561e074d1a996.tar.xz
eclipse.platform.debug-983acc0cecfd1e5df8d5c79f6bf561e074d1a996.zip
Bug 507661 - IOConsoleOutputStream and IOConsoleInputStream throw IOEI20170122-2000I20170121-2000I20170121-0950I20170120-2000
According to Javadoc, java.io.Closeable#close() has no effect if already closed. With this change, IOConsoleOutputStream and IOConsoleInputStream are not throwing exception anymore when calling close() twice. Change-Id: I5fc4ae8eb4fbc276ff81c7e6cee606277ba91d39 Signed-off-by: Patrik Suzzi <psuzzi@gmail.com>
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsoleInputStream.java6
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsoleOutputStream.java6
2 files changed, 8 insertions, 4 deletions
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsoleInputStream.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsoleInputStream.java
index a29105d3a..74e32f2c1 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsoleInputStream.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsoleInputStream.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Patrik Suzzi <psuzzi@gmail.com> - Bug 507661
*******************************************************************************/
package org.eclipse.ui.console;
@@ -282,7 +283,8 @@ public class IOConsoleInputStream extends InputStream {
@Override
public synchronized void close() throws IOException {
if(closed) {
- throw new IOException("Input Stream Closed"); //$NON-NLS-1$
+ // Closeable#close() has no effect if already closed
+ return;
}
closed = true;
notifyAll();
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsoleOutputStream.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsoleOutputStream.java
index 267937c9b..08efd3bfd 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsoleOutputStream.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsoleOutputStream.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Patrik Suzzi <psuzzi@gmail.com> - Bug 507661
*******************************************************************************/
package org.eclipse.ui.console;
@@ -165,7 +166,8 @@ public class IOConsoleOutputStream extends OutputStream {
@Override
public synchronized void close() throws IOException {
if(closed) {
- throw new IOException("Output Stream is closed"); //$NON-NLS-1$
+ // Closeable#close() has no effect if already closed
+ return;
}
if (prependCR) { // force writing of last /r
prependCR = false;

Back to the top