[ http://issues.apache.org/jira/browse/HARMONY-1033?page=all ] Denis Kishenko updated HARMONY-1033: ------------------------------------ Attachment: Character.patch patch > [classlib][lang]compatibility: expected IndexOutOfBoundsException for Character.codePointAt > -------------------------------------------------------------------------------------------- > > Key: HARMONY-1033 > URL: http://issues.apache.org/jira/browse/HARMONY-1033 > Project: Harmony > Issue Type: Bug > Components: Classlib > Reporter: Denis Kishenko > Attachments: Character.patch > > > Specs 1.5 > Methods throws > NullPointerException - if a is null. > IndexOutOfBoundsException - if offset or count is negative, or if offset + count is larger than the length of the given array. > If first argument is null RI throws NPE only in the second test, it's strange, but we have to follow. > public class bug9276 { > public static void main (String[] args) { > try { > Character.codePointAt(null, 6, 4); > System.err.println("failed 1"); > } catch (IndexOutOfBoundsException e) { > System.err.println("passed 1"); > e.printStackTrace(); > } catch (Exception e) { > System.err.println("failed 1"); > e.printStackTrace(); > } > try { > Character.codePointAt(null, 4, 6); > System.err.println("failed 2"); > } catch (NullPointerException e) { > System.err.println("passed 2"); > e.printStackTrace(); > } catch (Exception e) { > System.err.println("failed 2"); > e.printStackTrace(); > } > try { > Character.codePointAt(null, 0, 0); > System.err.println("failed 3"); > } catch (IndexOutOfBoundsException e) { > System.err.println("passed 3"); > e.printStackTrace(); > } catch (Exception e) { > System.err.println("failed 3"); > e.printStackTrace(); > } > } > > } > Output > RI -------------------------------------------------------------------- > passed 1 > java.lang.IndexOutOfBoundsException > at java.lang.Character.codePointAt(Character.java:2400) > at bug9276.main(bug9276.java:6) > passed 2 > java.lang.NullPointerException > at java.lang.Character.codePointAt(Character.java:2399) > at bug9276.main(bug9276.java:16) > passed 3 > java.lang.IndexOutOfBoundsException > at java.lang.Character.codePointAt(Character.java:2400) > at bug9276.main(bug9276.java:26) > Harmony ----------------------------------------------------------- > failed 1 > java.lang.NullPointerException > at java.lang.Character.codePointAt(Character.java:1918) > at bug9276.main(bug9276.java:6) > passed 2 > java.lang.NullPointerException > at java.lang.Character.codePointAt(Character.java:1918) > at bug9276.main(bug9276.java:16) > failed 3 > java.lang.NullPointerException > at java.lang.Character.codePointAt(Character.java:1918) > at bug9276.main(bug9276.java:26) -- 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