Return-Path: Delivered-To: apmail-incubator-harmony-commits-archive@www.apache.org Received: (qmail 82561 invoked from network); 7 Nov 2006 13:50:35 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 7 Nov 2006 13:50:35 -0000 Received: (qmail 24949 invoked by uid 500); 7 Nov 2006 13:50:46 -0000 Delivered-To: apmail-incubator-harmony-commits-archive@incubator.apache.org Received: (qmail 24921 invoked by uid 500); 7 Nov 2006 13:50:46 -0000 Mailing-List: contact harmony-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: harmony-dev@incubator.apache.org Delivered-To: mailing list harmony-commits@incubator.apache.org Received: (qmail 24910 invoked by uid 99); 7 Nov 2006 13:50:46 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Nov 2006 05:50:46 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Nov 2006 05:50:34 -0800 Received: by eris.apache.org (Postfix, from userid 65534) id CD5611A984A; Tue, 7 Nov 2006 05:50:07 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r472115 - /incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/GapContent.java Date: Tue, 07 Nov 2006 13:50:07 -0000 To: harmony-commits@incubator.apache.org From: apetrenko@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20061107135007.CD5611A984A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: apetrenko Date: Tue Nov 7 05:50:07 2006 New Revision: 472115 URL: http://svn.apache.org/viewvc?view=rev&rev=472115 Log: Patch for HARMONY-1809 "[classlib][swing]javax.swing.text.GapContent.replace(int, int, java.lang.Object, int) throws unspescified BadLocationException" Modified: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/GapContent.java Modified: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/GapContent.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/GapContent.java?view=diff&rev=472115&r1=472114&r2=472115 ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/GapContent.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/GapContent.java Tue Nov 7 05:50:07 2006 @@ -26,12 +26,15 @@ import java.io.Serializable; import java.util.Vector; +import javax.swing.text.ContentPositions.DocumentMark; import javax.swing.undo.UndoableEdit; +@SuppressWarnings("serial") public class GapContent implements AbstractDocument.Content, Serializable { - private final class GapContentEdit extends AbstractContentUndoableEdit implements UndoableEdit { + private final class GapContentEdit extends AbstractContentUndoableEdit + implements UndoableEdit { public GapContentEdit(final int where, final String chars, final boolean isInsertCommand) @@ -40,6 +43,7 @@ super(where, chars, isInsertCommand); } + @Override protected Vector getPositionsInRange(final Vector positions, final int where, final int length) { @@ -47,11 +51,13 @@ length); } + @Override protected void updateUndoPositions(final Vector undoPos) { GapContent.this.updateUndoPositions(undoPos, pos, len); } + @Override protected void insertItems(final int where, final String chars) { try { GapContent.this.insertItems(where, chars.toCharArray(), len); @@ -59,6 +65,7 @@ } + @Override protected void removeItems(final int where, final int length) { try { GapContent.this.removeItems(where, length); @@ -66,7 +73,7 @@ } } - private class GapContentPositions extends ContentPositions { + private final class GapContentPositions extends ContentPositions { /** * Resets internal index in Position implementation to be zero if * the position offset is zero. This ensures that position isn't moved @@ -76,6 +83,7 @@ GapContent.this.resetMarksAtZero(); } + @Override protected int setOffsetForDocumentMark(final int offset) { if (offset == 0 || offset < gapStart) { return offset; @@ -83,6 +91,7 @@ return offset + (gapEnd - gapStart); } + @Override protected int getOffsetForDocumentMark(final int index) { if (index == 0 || index < gapStart) { return index; @@ -203,7 +212,7 @@ return new char[len]; } - protected Object getArray() { + protected final Object getArray() { return array; } @@ -214,14 +223,14 @@ /** * Returns the index of the first character right after the gap. */ - protected int getGapEnd() { + protected final int getGapEnd() { return gapEnd; } /** * Returns the index of the first character in the gap. */ - protected int getGapStart() { + protected final int getGapStart() { return gapStart; } @@ -237,11 +246,12 @@ } protected void replace(final int position, final int rmSize, - final Object addItems, final int addSize) - throws BadLocationException { - - removeItems(position, rmSize); - insertItems(position, addItems, addSize); + final Object addItems, final int addSize) { + try { + removeItems(position, rmSize); + insertItems(position, addItems, addSize); + } catch (BadLocationException e) { + } } protected void resetMarksAtZero() { @@ -252,9 +262,8 @@ } for (int i = 0; i < gapContentPositions.positionList.size(); i++) { - ContentPositions.DocumentMark dm = - (ContentPositions.DocumentMark)gapContentPositions.positionList - .get(i); + DocumentMark dm = + (DocumentMark)gapContentPositions.positionList.get(i); if (dm.index <= gapEnd) { dm.index = 0;