Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSarika Sinha2017-03-03 03:57:04 -0500
committerSarika Sinha2017-03-03 03:57:04 -0500
commitfd0dda7c8cf10980c2b9e0f2e83d640d8455f7b9 (patch)
treeb29fe72887cb7aee62e6eb951d5ebde7e70da44e
parenta01efbceb2a8b9d62410cd7a6e2542417a64c815 (diff)
downloadeclipse.platform.debug-fd0dda7c8cf10980c2b9e0f2e83d640d8455f7b9.tar.gz
eclipse.platform.debug-fd0dda7c8cf10980c2b9e0f2e83d640d8455f7b9.tar.xz
eclipse.platform.debug-fd0dda7c8cf10980c2b9e0f2e83d640d8455f7b9.zip
Revert "Bug 507664 - IOConsoleOutputStream does not handle multi-byte characters at buffer boundaries correctly"I20170303-2000
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/ConsoleTests.java3
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsoleOutputStream.java24
2 files changed, 5 insertions, 22 deletions
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/ConsoleTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/ConsoleTests.java
index f53a2a36c..3939c4d3a 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/ConsoleTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/ConsoleTests.java
@@ -55,9 +55,6 @@ public class ConsoleTests extends TestCase {
TestHelper.waitForJobs();
TestCase.assertEquals("whole test string should be written", testString, document.get()); //$NON-NLS-1$
}
- // after closing the stream, the document content should still be the
- // same
- TestCase.assertEquals("closing the stream should not alter the document", testString, document.get()); //$NON-NLS-1$
}
}
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 70291df00..7e78ddf6a 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
@@ -14,7 +14,6 @@ package org.eclipse.ui.console;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.charset.Charset;
-import java.nio.charset.CharsetDecoder;
import org.eclipse.swt.graphics.Color;
import org.eclipse.ui.internal.console.IOConsolePartitioner;
@@ -159,20 +158,6 @@ public class IOConsoleOutputStream extends OutputStream {
return closed;
}
- /**
- * Writes remaining characters stored in the decoder state.
- *
- * Must only be called from synchronized methods.
- *
- * @see CharsetDecoder#flush(java.nio.CharBuffer)
- * @throws IOException
- */
- private void finishDecoder() throws IOException {
- StringBuilder builder = new StringBuilder();
- this.decoder.finish(builder);
- this.encodedWrite(builder.toString());
- }
-
/*
* (non-Javadoc)
* @see java.io.OutputStream#close()
@@ -183,7 +168,6 @@ public class IOConsoleOutputStream extends OutputStream {
// Closeable#close() has no effect if already closed
return;
}
- this.finishDecoder();
if (prependCR) { // force writing of last /r
prependCR = false;
notifyParitioner("\r"); //$NON-NLS-1$
@@ -209,7 +193,7 @@ public class IOConsoleOutputStream extends OutputStream {
* @see java.io.OutputStream#write(byte[], int, int)
*/
@Override
- public synchronized void write(byte[] b, int off, int len) throws IOException {
+ public void write(byte[] b, int off, int len) throws IOException {
StringBuilder builder = new StringBuilder();
this.decoder.decode(builder, b, off, len);
encodedWrite(builder.toString());
@@ -333,8 +317,10 @@ public class IOConsoleOutputStream extends OutputStream {
* @throws IOException if the stream is closed
* @since 3.7
*/
- public synchronized void setCharset(Charset charset) throws IOException {
- this.finishDecoder();
+ public void setCharset(Charset charset) throws IOException {
+ StringBuilder builder = new StringBuilder();
+ this.decoder.finish(builder);
+ this.encodedWrite(builder.toString());
this.decoder = new StreamDecoder(charset);
}

Back to the top