You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "George Harley (JIRA)" <ji...@apache.org> on 2006/05/15 13:17:06 UTC

[jira] Resolved: (HARMONY-436) [classlib][luni] lang: Harmony should throw exceptions in a way similar to RI's one.

     [ http://issues.apache.org/jira/browse/HARMONY-436?page=all ]
     
George Harley resolved HARMONY-436:
-----------------------------------

    Resolution: Fixed

Hi Dmitry, 

Modified version of your patch committed in revision 406614. As discussed on the dev list the agreed project approach to exception throwing compatibility is to throw the same runtime class (or a subclass of) as the RI. I have updated your proposed changes accordingly. Please could you verify that you are happy with what I have done.  

With regards to the unit test changes, I did not add in your StringBufferTest::test_insert$CII() method as it was not actually testing any insert(..) method of StringBuffer. It's implementation appeared to be a copy of one of your other new test methods, StringBufferTest::test_append$CII_2(). Perhaps you are planning other enhancements in this area and the current patch inadvertantly included some work in progress ?

Many thanks for highlighting this incompatibility issue and for your enhancements. 

Best regards, 
George

> [classlib][luni] lang: Harmony should throw exceptions in a way similar to RI's one.
> ------------------------------------------------------------------------------------
>
>          Key: HARMONY-436
>          URL: http://issues.apache.org/jira/browse/HARMONY-436
>      Project: Harmony
>         Type: Bug

>   Components: Classlib
>     Reporter: Dmitry M. Kononov
>     Assignee: George Harley
>     Priority: Minor
>  Attachments: lang.cumulative.diff
>
> 1) java.lang.StringBuilder.insert(int offset, char c):
> Harmony throws StringIndexOutOfBoundsException when offset <0,
> while RI throws ArrayIndexOutOfBoundsException. 
> Specification mentions neither StringIndexOutOfBoundsException
> nor ArrayIndexOutOfBoundsException throwing, but says: 
> "Throws:
> IndexOutOfBoundsException - if the offset is invalid".
> 2) java.lang.StringBuffer.append(char[] str, int offset, int len):
> Harmony throws StringIndexOutOfBoundsException when str is not
> null, offset or/and len <0, while RI throws
> ArrayIndexOutOfBoundsException. Specification mentions neither
> StringIndexOutOfBoundsException nor
> ArrayIndexOutOfBoundsException throwing.
> 3) java.lang.StringBuffer.append(char[] str, int offset, int len):
> Harmony throws StringIndexOutOfBoundsException when str = null,
> offset or/and len <0, while RI throws NullPointerException.
> Specification mentions neither StringIndexOutOfBoundsException
> nor NullPointerException throwing.
> 4) java.lang.StringBuffer.getChars(int srcBegin,int srcEnd,char[] dst, int dstBegin):
> Harmony throws StringIndexOutOfBoundsException when dstBegin <0,
> while RI throws ArrayIndexOutOfBoundsException.
> Specification says:
> "Throws: 
> IndexOutOfBoundsException - if any of the following is true: 
> ...
> dstBegin is negative". 
> So RI does not comply with spec as well as Harmony does not comply with it.
> 5) java.lang.StringBuffer.insert(int offset, char c):
> Harmony throws StringIndexOutOfBoundsException when offset <0,
> while RI throws ArrayIndexOutOfBoundsException.
> Specification says:
> "The offset argument must be greater than or equal to 0 ... 
> Throws: 
> IndexOutOfBoundsException - if the offset is invalid."
> So RI does not comply with spec as well as Harmony does not comply with it.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira