You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Tony Wu (JIRA)" <ji...@apache.org> on 2007/06/19 04:50:26 UTC
[jira] Resolved: (HARMONY-4224)
[classlib][sql]SerialClob.setAsciiStream does not throw SerialException
when its internal Clob.setAsciiStream returns null
[ https://issues.apache.org/jira/browse/HARMONY-4224?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Tony Wu resolved HARMONY-4224.
------------------------------
Resolution: Fixed
Patch applied at r548565 , please verify. Thanks.
> [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.