This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Patch: FYI: Classpath mergelet
- From: Tom Tromey <tromey at redhat dot com>
- To: GCC libjava patches <java-patches at gcc dot gnu dot org>
- Date: 20 Sep 2003 15:21:43 -0600
- Subject: Patch: FYI: Classpath mergelet
- Reply-to: tromey at redhat dot com
I'm checking this in on the trunk.
This merges a couple Classpath changes.
Tom
Index: ChangeLog
from Tom Tromey <tromey@redhat.com>
* java/awt/Component.java: Indentation cleanup from Classpath.
2003-09-07 Dalibor Topic <robilad@kaffe.org>
* java/awt/BasicStroke.java (BasicStroke): Fixed illegal argument
checking to follow 1.4.2 spec.
Index: java/awt/BasicStroke.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/BasicStroke.java,v
retrieving revision 1.2
diff -u -r1.2 BasicStroke.java
--- java/awt/BasicStroke.java 2 Jan 2003 00:14:22 -0000 1.2
+++ java/awt/BasicStroke.java 20 Sep 2003 21:28:50 -0000
@@ -67,7 +67,8 @@
* @param join May be either JOIN_ROUND, JOIN_BEVEL, or JOIN_MITER.
* @param miterlimit the limit to trim the miter join. The miterlimit must be
* greater than or equal to 1.0f.
- * @param dash The array representing the dashing pattern.
+ * @param dash The array representing the dashing pattern. There must be at
+ * least one non-zero entry.
* @param dash_phase is negative and dash is not null.
*
* @exception IllegalArgumentException If one input parameter doesn't meet
@@ -76,13 +77,40 @@
public BasicStroke(float width, int cap, int join, float miterlimit,
float[] dash, float dashPhase)
{
- if (width < 0 ||
- miterlimit < 1.0f ||
- cap < CAP_BUTT ||
- cap > CAP_SQUARE ||
- join < JOIN_MITER ||
- join > JOIN_BEVEL)
- throw new IllegalArgumentException();
+ if (width < 0.0f )
+ throw new IllegalArgumentException("width " + width + " < 0");
+ else if (cap < CAP_BUTT || cap > CAP_SQUARE)
+ throw new IllegalArgumentException("cap " + cap + " out of range ["
+ + CAP_BUTT + ".." + CAP_SQUARE + "]");
+ else if (miterlimit < 1.0f && join == JOIN_MITER)
+ throw new IllegalArgumentException("miterlimit " + miterlimit
+ + " < 1.0f while join == JOIN_MITER");
+ else if (join < JOIN_MITER || join > JOIN_BEVEL)
+ throw new IllegalArgumentException("join " + join + " out of range ["
+ + JOIN_MITER + ".." + JOIN_BEVEL
+ + "]");
+ else if (dashPhase < 0.0f && dash != null)
+ throw new IllegalArgumentException("dashPhase " + dashPhase
+ + " < 0.0f while dash != null");
+ else if (dash != null)
+ if (dash.length == 0)
+ throw new IllegalArgumentException("dash.length is 0");
+ else
+ {
+ boolean allZero = true;
+
+ for ( int i = 0; i < dash.length; ++i)
+ {
+ if (dash[i] != 0.0f)
+ {
+ allZero = false;
+ break;
+ }
+ }
+
+ if (allZero)
+ throw new IllegalArgumentException("all dashes are 0.0f");
+ }
this.width = width;
this.cap = cap;
Index: java/awt/Component.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/Component.java,v
retrieving revision 1.28
diff -u -r1.28 Component.java
--- java/awt/Component.java 25 Aug 2003 19:02:29 -0000 1.28
+++ java/awt/Component.java 20 Sep 2003 21:28:51 -0000
@@ -1870,12 +1870,12 @@
{
Image returnValue = null;
if (!GraphicsEnvironment.isHeadless ())
- {
- if (isLightweight () && parent != null)
- returnValue = parent.createImage (width, height);
- else if (peer != null)
- returnValue = peer.createImage (width, height);
- }
+ {
+ if (isLightweight () && parent != null)
+ returnValue = parent.createImage (width, height);
+ else if (peer != null)
+ returnValue = peer.createImage (width, height);
+ }
return returnValue;
}