harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ruth Cao (JIRA)" <j...@apache.org>
Subject [jira] Closed: (HARMONY-4224) [classlib][sql]SerialClob.setAsciiStream does not throw SerialException when its internal Clob.setAsciiStream returns null
Date Tue, 19 Jun 2007 03:19:26 GMT

     [ https://issues.apache.org/jira/browse/HARMONY-4224?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Ruth Cao closed HARMONY-4224.
-----------------------------


Thanks, Tony. The fix looks fine.

> [classlib][sql]SerialClob.setAsciiStream does not throw SerialException when its internal
Clob.setAsciiStream returns null
> --------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-4224
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4224
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: Windows XP/ Linux
>            Reporter: Ruth Cao
>            Assignee: Tony Wu
>         Attachments: Harmony-4224.diff
>
>
> Given the following test case:
> public void testSetAsciiStream() throws Exception { 
>         MockSerialClob mockClob = new MockSerialClob();
>         mockClob.characterStreamReader = new CharArrayReader(mockClob.buf);
>         mockClob.asciiInputStream = new ByteArrayInputStream(new byte[] { 1 });
>         SerialClob serialClob = new SerialClob(mockClob);
>         OutputStream os = null;
>         try {
>             os = serialClob.setAsciiStream(1);
>             fail("should throw SerialException");
>         } catch (SerialException e) {
>             // expected
>         }
> }
> static class MockSerialClob implements Clob {
>         public char[] buf = { 1, 2, 3 };
>         public Reader characterStreamReader;
>         
>         public Writer characterStreamWriter;
>         public InputStream asciiInputStream;
>         
>         public OutputStream asciiOutputStream;
>         
>         public boolean isGetAsciiStreamInvoked;
>         
>         public boolean isSetAsciiStreamInvoked;
>         public boolean isSetCharacterStreamInvoked;
>         public MockSerialClob() {
>         }
>         public InputStream getAsciiStream() throws SQLException {
>             isGetAsciiStreamInvoked = true;
>             return asciiInputStream;
>         }
>         public Reader getCharacterStream() throws SQLException {
>             return characterStreamReader;
>         }
>         public String getSubString(long pos, int length) throws SQLException {
>             return null;
>         }
>         public long length() throws SQLException {
>             return buf.length;
>         }
>         public long position(Clob searchstr, long start) throws SQLException {
>             return 0;
>         }
>         public long position(String searchstr, long start) throws SQLException {
>             return 0;
>         }
>         public OutputStream setAsciiStream(long pos) throws SQLException {
>             isSetAsciiStreamInvoked = true;
>             return asciiOutputStream;
>         }
>         public Writer setCharacterStream(long pos) throws SQLException {
>             isSetCharacterStreamInvoked = true;
>             return characterStreamWriter;
>         }
>         public int setString(long pos, String str) throws SQLException {
>             return 0;
>         }
>         public int setString(long pos, String str, int offset, int len)
>                 throws SQLException {
>             return 0;
>         }
>         public void truncate(long len) throws SQLException {
>         }
>     }
> RI passes while Harmony fails. The same problem seems to happen in setCharacterStream(long).
I'll create a patch for this soon, thanks.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message