Hi,

On Fri, 2005-09-02 at 00:20 +0200, Mark Wielaard wrote:
> Running the Mauve testsuite (CVS) in preparation of 0.18:
>
> With the following regressions:
>
> +FAIL: gnu.testlet.javax.swing.text.AbstractDocument.AbstractDocumentTest: 
> uncaught exception at "testCreateLeafElement" number 1: 
> java.lang.NullPointerException

This one can be trivially fixed by the attached patch that allows a null
parent for createLeafElement(). But I haven't actually studied if this
is the correct behavior.

Roman, could you take a look at this?

Thanks,

Mark
Index: javax/swing/text/AbstractDocument.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/text/AbstractDocument.java,v
retrieving revision 1.26
diff -u -r1.26 AbstractDocument.java
--- javax/swing/text/AbstractDocument.java	29 Aug 2005 17:02:02 -0000	1.26
+++ javax/swing/text/AbstractDocument.java	2 Sep 2005 11:59:10 -0000
@@ -1864,16 +1864,30 @@
                        int end)
     {
       super(parent, attributes);
-      try
 	{
-	  startPos = parent.getDocument().createPosition(start);
-	  endPos = parent.getDocument().createPosition(end);
-	}
-      catch (BadLocationException ex)
-	{
-	  throw new AssertionError("BadLocationException must not be thrown "
-				   + "here. start=" + start + ", end=" + end
-				   + ", length=" + getLength());
+	  try
+	    {
+	      if (parent != null)
+		{
+		  startPos = parent.getDocument().createPosition(start);
+		  endPos = parent.getDocument().createPosition(end);
+		}
+	      else
+		{
+		  startPos = createPosition(start);
+		  endPos = createPosition(end);
+		}
+	    }
+	  catch (BadLocationException ex)
+	    {
+	      AssertionError as;
+	      as = new AssertionError("BadLocationException thrown "
+				      + "here. start=" + start
+				      + ", end=" + end
+				      + ", length=" + getLength());
+	      as.initCause(ex);
+	      throw as;
+	    }
 	}
     }
 

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Classpath mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath

Reply via email to