Hi,
One of my last changes to SizeRequirements introduced the actual use of
the total parameter, which was ignored before. However, the BoxView used
to pass a null as total parameter, which then triggers a
NullPointerException. This patch fixes that.
2005-10-20 Roman Kennke <[EMAIL PROTECTED]>
* javax/swing/text/BoxView.java
(layoutMinorAxis): Calculate total requirements before calling
the SizeRequirements utility method. Avoids an NPE.
/Roman
Index: javax/swing/text/BoxView.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/text/BoxView.java,v
retrieving revision 1.8
diff -u -r1.8 BoxView.java
--- javax/swing/text/BoxView.java 14 Oct 2005 18:48:20 -0000 1.8
+++ javax/swing/text/BoxView.java 20 Oct 2005 18:32:53 -0000
@@ -563,7 +563,13 @@
SizeRequirements[] childReqs = getChildRequirements(axis);
// Calculate the spans and offsets using the SizeRequirements uility
// methods.
- SizeRequirements.calculateAlignedPositions(targetSpan, null, childReqs,
+ // TODO: This might be an opportunity for performance optimization. Here
+ // we could use a cached instance of SizeRequirements instead of passing
+ // null to baselineRequirements. However, this would involve rewriting
+ // the baselineRequirements() method to not use the SizeRequirements
+ // utility method, since they cannot reuse a cached instance.
+ SizeRequirements total = baselineRequirements(axis, null);
+ SizeRequirements.calculateAlignedPositions(targetSpan, total, childReqs,
offsets, spans);
validateLayout(axis);
}
_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches