Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 267218 Details for
Bug 513367
IllegalStateException while decoding output to Console Stream
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Test cases for writing to closed streams / streams with closed documents
tests closed stream.patch (text/plain), 3.53 KB, created by
Andreas Loth
on 2017-03-11 05:52:29 EST
(
hide
)
Description:
Test cases for writing to closed streams / streams with closed documents
Filename:
MIME Type:
Creator:
Andreas Loth
Created:
2017-03-11 05:52:29 EST
Size:
3.53 KB
patch
obsolete
>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 b683fe2..fb05f3e 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 >@@ -65,7 +65,7 @@ > String testString = "a\r"; //$NON-NLS-1$ > byte[] testStringBuffer = testString.getBytes(StandardCharsets.UTF_8); > TestCase.assertEquals("Test string \"" + testString + "\" should consist of 2 UTF-8 bytes", 2, testStringBuffer.length); //$NON-NLS-1$ //$NON-NLS-2$ >- MessageConsole console = new MessageConsole("Test Console", //$NON-NLS-1$ >+ MessageConsole console = new MessageConsole("Test Console 2", //$NON-NLS-1$ > IConsoleConstants.MESSAGE_CONSOLE_TYPE, null, StandardCharsets.UTF_8.name(), true); > IDocument document = console.getDocument(); > TestHelper.waitForJobs(); >@@ -82,4 +82,57 @@ > TestCase.assertEquals("closing the stream should write the pending \\r", testString, document.get()); //$NON-NLS-1$ > } > >+ public void testConsoleOutputStreamDocumentClosed() throws IOException { >+ MessageConsole console = new MessageConsole("Test Console 3", //$NON-NLS-1$ >+ IConsoleConstants.MESSAGE_CONSOLE_TYPE, null, StandardCharsets.UTF_8.name(), true); >+ IDocument document = console.getDocument(); >+ try (IOConsoleOutputStream outStream = console.newOutputStream()) { >+ outStream.write("write1"); //$NON-NLS-1$ >+ document.getDocumentPartitioner().disconnect(); >+ try { >+ outStream.write("write2"); //$NON-NLS-1$ >+ TestCase.fail("IOException with message \"Document is closed\" expected"); //$NON-NLS-1$ >+ } catch (IOException ioe) { >+ TestCase.assertEquals("Document is closed", ioe.getMessage()); //$NON-NLS-1$ >+ } >+ } >+ } >+ >+ public void testConsoleOutputStreamClosed() throws IOException { >+ MessageConsole console = new MessageConsole("Test Console 4", //$NON-NLS-1$ >+ IConsoleConstants.MESSAGE_CONSOLE_TYPE, null, StandardCharsets.UTF_8.name(), true); >+ try (IOConsoleOutputStream outStream = console.newOutputStream()) { >+ outStream.write("test1".getBytes(StandardCharsets.UTF_8)); //$NON-NLS-1$ >+ outStream.close(); >+ try { >+ outStream.write("test2".getBytes(StandardCharsets.UTF_8)); //$NON-NLS-1$ >+ TestCase.fail("IOException with message \"Output Stream is closed\" expected"); //$NON-NLS-1$ >+ } catch (IOException ioe) { >+ TestCase.assertEquals("Output Stream is closed", ioe.getMessage()); //$NON-NLS-1$ >+ } >+ } >+ } >+ >+ public void testConsoleOutputStreamDocumentStreamClosed() throws IOException { >+ MessageConsole console = new MessageConsole("Test Console 5", //$NON-NLS-1$ >+ IConsoleConstants.MESSAGE_CONSOLE_TYPE, null, StandardCharsets.UTF_8.name(), true); >+ IDocument document = console.getDocument(); >+ try (IOConsoleOutputStream outStream = console.newOutputStream()) { >+ outStream.write("write1"); //$NON-NLS-1$ >+ document.getDocumentPartitioner().disconnect(); >+ try { >+ outStream.write("write2"); //$NON-NLS-1$ >+ TestCase.fail("IOException with message \"Document is closed\" expected"); //$NON-NLS-1$ >+ } catch (IOException ioe) { >+ TestCase.assertEquals("Document is closed", ioe.getMessage()); //$NON-NLS-1$ >+ } >+ try { >+ outStream.write("write3"); //$NON-NLS-1$ >+ TestCase.fail("IOException with message \"Output Stream is closed\" expected"); //$NON-NLS-1$ >+ } catch (IOException ioe) { >+ TestCase.assertEquals("Output Stream is closed", ioe.getMessage()); //$NON-NLS-1$ >+ } >+ } >+ } >+ > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 513367
:
267217
| 267218 |
267466