Index: modules/swing/src/main/java/common/javax/swing/text/GapContent.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/text/GapContent.java (revision 475190) +++ modules/swing/src/main/java/common/javax/swing/text/GapContent.java (working copy) @@ -362,9 +362,13 @@ } final void insertItems(final int where, final Object addItems, - final int addSize) + final int addSize) throws BadLocationException { + if (addSize == 0) { + return; + } + if (where < 0 || where > length()) { throw new BadLocationException("Invalid insert position", where); } @@ -399,6 +403,10 @@ throw new BadLocationException("Invalid remove position", where); } + if (nitems == 0) { + return; + } + if (where + nitems == gapStart) { shiftGapStartDown(where); } else {