Index: AttributedStringTest.java =================================================================== --- AttributedStringTest.java (revision 433220) +++ AttributedStringTest.java (working copy) @@ -17,6 +17,7 @@ import java.text.AttributedCharacterIterator; import java.text.AttributedString; import java.text.CharacterIterator; +import java.util.TreeSet; public class AttributedStringTest extends junit.framework.TestCase { @@ -59,4 +60,33 @@ // Expected } } + + public void test_addAttributeBad() { + // Regression test HARMONY-1244 + AttributedString as = new AttributedString("test"); + try { + as.addAttribute(null, new TreeSet()); + } catch (NullPointerException e) { + // expected + } + as = new AttributedString(""); + try { + as.addAttribute(null, new TreeSet()); + } catch (NullPointerException e) { + // expected + } + as = new AttributedString("test"); + try { + as.addAttribute(null, new TreeSet(), 0, 1); + } catch (NullPointerException e) { + // expected + } + as = new AttributedString(""); + try { + as.addAttribute(null, new TreeSet(), 0, 1); + } catch (NullPointerException e) { + // expected + } + } + }