Index: modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/LogStreamTest.java =================================================================== --- modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/LogStreamTest.java (revision 452703) +++ modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/LogStreamTest.java (working copy) @@ -41,6 +41,30 @@ } catch (NullPointerException e) { // expected } - } + } + public void testwrite_BA_I_I() { + // Regression test HARMONY-1691 + try { + LogStream obj = LogStream.log("proba"); + obj.write(new byte[]{1,1},-2,-6); + fail("IndexOutOfBoundsException should be thrown"); + } catch (IndexOutOfBoundsException e) { + //expected + } + try { + LogStream obj = LogStream.log("proba"); + obj.write(new byte[]{1,1},6,1); + fail("IndexOutOfBoundsException should be thrown"); + } catch (IndexOutOfBoundsException e) { + //expected + } + try { + LogStream obj = LogStream.log("proba"); + obj.write(new byte[]{1,1},0,6); + fail("IndexOutOfBoundsException should be thrown"); + } catch (IndexOutOfBoundsException e) { + //expected + } + } }