Index: modules/luni/src/test/java/tests/api/java/io/OutputStreamWriterTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/io/OutputStreamWriterTest.java (revision 463130) +++ modules/luni/src/test/java/tests/api/java/io/OutputStreamWriterTest.java (working copy) @@ -94,6 +94,21 @@ fail(); } catch (IOException e) { } + // Regression for HARMONY-1849 + OutputStreamWriter osw = new OutputStreamWriter(new FileOutputStream( + "file")); + try { + // write a surrogate pair char, then, write a char 0x0001 in order + // to create a malformed surrogate element, expect nothing since + // specification + // says the behavior is unspecified. + osw.write(0xD800); + osw.write(1); + } catch (Throwable e) { + // expected + } finally { + osw.close(); + } } public void testFlush() throws Exception {