You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Paulex Yang (JIRA)" <ji...@apache.org> on 2006/09/18 10:34:23 UTC

[jira] Assigned: (HARMONY-1244) [classlib][text] AttributedString.addAttribute(null, ...) throws nothing while RI throws NPE

     [ http://issues.apache.org/jira/browse/HARMONY-1244?page=all ]

Paulex Yang reassigned HARMONY-1244:
------------------------------------

    Assignee: Paulex Yang

> [classlib][text] AttributedString.addAttribute(null, ...) throws nothing while RI throws NPE
> --------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-1244
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1244
>             Project: Harmony
>          Issue Type: Bug
>            Reporter: Denis Kishenko
>         Assigned To: Paulex Yang
>         Attachments: 1244-AttributeString.patch, 1244-AttributeStringTest.patch, 1244.diff
>
>
> Harmony implementation of AttributedString.addAttribute(null, ...) throws nothing while RI throws NPE.
> =============== Spec ======================
> public void addAttribute(AttributedCharacterIterator.Attribute attribute, Object value)
> Throws: 
> IllegalArgumentException - if the AttributedString has length 0 (attributes cannot be applied to a 0-length range).
> public void addAttribute(AttributedCharacterIterator.Attribute attribute, Object value, int beginIndex, int endIndex)
> Throws: 
> IllegalArgumentException - if beginIndex is less then 0, endIndex is greater than the length of the string, or beginIndex and endIndex together don't define a non-empty subrange of the string.
> ===================== Test =====================
> import java.text.*;
> import java.util.*;
> public class bug9291 {
>     public static void main (String[] args) {    
>         try {                                                                   
>             new AttributedString("123", new WeakHashMap()).addAttribute(null, new TreeSet());                               
>        } catch (Exception e) {
>            e.printStackTrace();
>        }
>        try {                                                                   
>            new AttributedString("123", new WeakHashMap()).addAttribute(null, new TreeSet(), 0, 1);                               
>       } catch (Exception e) {
>           e.printStackTrace();
>       }
>     }
> }
> =============== Output =====================
> RI
> java.lang.NullPointerException
>     at java.text.AttributedString.addAttribute(AttributedString.java:286)
>     at bug9291.main(bug9291.java:8)
> java.lang.NullPointerException
>     at java.text.AttributedString.addAttribute(AttributedString.java:311)
>     at bug9291.main(bug9291.java:13)
> Harmony
> <nothing>

-- 
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