Re: [cp-patches] FYI: Added rmic code generator to the /tools

2006-02-09 Thread Tom Tromey
> "Audrius" == Audrius Meskauskas <[EMAIL PROTECTED]> writes:

Audrius> This patch adds java.rmi version jdk 1.2+ stub generator to the
Audrius> classpath tools package.

We used to have rmic in classpath.  Then we moved it to
classpath-tools.  Then Archit rewrote it to use ASM instead of having
it generate java source code.

The rewrite was needed for performance.  See the original post:

http://lists.gnu.org/archive/html/classpath/2005-05/msg00085.html

Audrius> Source code (rather than binary) output
Audrius> and template system seems providing the easier maintenance.

Performance actually turns out to matter more, since this stuff is
used by things like jonas.  Also, emitting bytecode can be readable
and maintainable, it just needs to be done smartly (commented, use a
nice library like ASM), etc.

I'd really prefer we merge the cp-tools stuff back into classpath
proper, and find a way to import and build ASM as part of our build
process.

It seems kind of bad to have two rmic implementations (3 if you count
the fact that the old .java-producing one still lives in libgcj... we
never got around to our own ASM import there).

Tom



[cp-patches] RFC: Don't unnecessary double queue GtkComponentPeer.repaint() events

2006-02-09 Thread Mark Wielaard
Hi,

While debugging some awt gtk+ peer issues I noticed that we always route
repaint events through 2 queues. First we create a Timer and put it in
there. Second we put it in the actual system event queue. If the repaint
is requested immediately that is overkill. And looking at a couple of
sample programs it looks like delayed repaints are not that often
requested at all. So this patch defers the creation of the Timer till
the first time a delayed repaint request is actually made. And it
immediately posts the repaint event to the system event queue if no
delay is asked for.

2006-02-09  Mark Wielaard  <[EMAIL PROTECTED]>

* gnu/java/awt/peer/gtk/GtkComponentPeer.java (repaintTimer):
Removed field.
(repaint): Immediately post to queue when tm <= 0, otherwise call
RepaintTimerTask.schedule().
(RepaintTimerTask): Make static.
(RepaintTimerTask.repaintTimer): New static final field.
(RepaintTimerTask.awtComponent): New field.
(schedule): New static method.

OK to commit?

Cheers,

Mark
Index: gnu/java/awt/peer/gtk/GtkComponentPeer.java
===
RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GtkComponentPeer.java,v
retrieving revision 1.101
diff -u -r1.101 GtkComponentPeer.java
--- gnu/java/awt/peer/gtk/GtkComponentPeer.java	9 Feb 2006 17:44:30 -	1.101
+++ gnu/java/awt/peer/gtk/GtkComponentPeer.java	9 Feb 2006 23:29:38 -
@@ -1,5 +1,6 @@
 /* GtkComponentPeer.java -- Implements ComponentPeer with GTK
-   Copyright (C) 1998, 1999, 2002, 2004, 2005  Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2002, 2004, 2005, 2006
+   Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -87,8 +88,6 @@
 
   boolean isInRepaint;
 
-  static final Timer repaintTimer = new Timer (true);
-
   /* this isEnabled differs from Component.isEnabled, in that it
  knows if a parent is disabled.  In that case Component.isEnabled 
  may return true, but our isEnabled will always return false */
@@ -383,19 +389,32 @@
 if (x == 0 && y == 0 && width == 0 && height == 0)
   return;
 
-repaintTimer.schedule(new RepaintTimerTask(x, y, width, height), tm);
+System.err.println("UPDATE: " + awtComponent);
+Thread.dumpStack();
+if (tm <= 0)
+  q().postEvent(new PaintEvent(awtComponent, PaintEvent.UPDATE,
+   new Rectangle(x, y, width, height)));
+else
+  RepaintTimerTask.schedule(tm, x, y, width, height, awtComponent);
   }
 
-  private class RepaintTimerTask extends TimerTask
+  /**
+   * Used for scheduling delayed paint updates on the event queue.
+   */
+  private static class RepaintTimerTask extends TimerTask
   {
+private static final Timer repaintTimer = new Timer(true);
+
 private int x, y, width, height;
+private Component awtComponent;
 
-RepaintTimerTask(int x, int y, int width, int height)
+RepaintTimerTask(Component c, int x, int y, int width, int height)
 {
   this.x = x;
   this.y = y;
   this.width = width;
   this.height = height;
+  this.awtComponent = c;
 }
 
 public void run()
@@ -403,6 +422,12 @@
   q().postEvent (new PaintEvent (awtComponent, PaintEvent.UPDATE,
  new Rectangle (x, y, width, height)));
 }
+
+static void schedule(long tm, int x, int y, int width, int height,
+			 Component c)
+{
+  repaintTimer.schedule(new RepaintTimerTask(c, x, y, width, height), tm);
+}
   }
 
   public void requestFocus ()


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


[cp-patches] FYI: More styled text

2006-02-09 Thread Roman Kennke
Some more robustness, correctness and completeness fixes for
javax.swing.text Views.

This corrects a misinterpretation in modelToView. We have been throwing
BadLocationExceptions when the position is outside of the view's
bounds. However, this should really only be thrown if the position is
outside the document's bounds and for all other cases return something
reasonable (like the left or right edge of that view, like implemented
in CompositeView).

I also added some missing methods in BoxView. This includes some methods
that should (according to the specs) be overridden but were not. I added
these methods too and tagged them with a FIXME, so that it is more
obvious that there might be a problem.

2006-02-09  Roman Kennke  <[EMAIL PROTECTED]>

* javax/swing/text/BoxView.java
(getAxis): Added @since tag.
(setAxis): Added @since tag.
(layoutChanged): Added @since tag.
(isLayoutValid): Added @since tag.
(paint): Don't call setSize here. This is done in RootView already.
(getMaximumSpan): Reimplemented to return the requirements'
maximum size. Added API docs.
(getMinimumSpan): New method.
(layout): Fixed layout order.
(modelToView): Call layout instead of setSize here.
(getResizeWeight): New method.
(getChildAllocation): New method.
(forwardUpdate): New method.
(viewToModel): New method.
(flipEastEndWestEnds): New method.
* javax/swing/text/CompositeView.java
(modelToView): Made this method more robust by returning a default
location if it's not possible to calculate one via the children.
This default location returns the left or right edge of this
view.
(createDefaultLocation): New helper method.
* javax/swing/text/IconView.java
(modelToView): Don't throw BadLocationException. This should
really only be thrown if the position is outside the document
model, not if it's outside the view's boundary.

/Roman
Index: javax/swing/text/BoxView.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/text/BoxView.java,v
retrieving revision 1.13
diff -u -r1.13 BoxView.java
--- javax/swing/text/BoxView.java	9 Feb 2006 14:28:49 -	1.13
+++ javax/swing/text/BoxView.java	9 Feb 2006 23:11:49 -
@@ -43,6 +43,7 @@
 import java.awt.Shape;
 
 import javax.swing.SizeRequirements;
+import javax.swing.event.DocumentEvent;
 
 /**
  * An implementation of [EMAIL PROTECTED] CompositeView} that arranges its children in
@@ -115,6 +116,8 @@
* Returns the axis along which this BoxView is laid out.
*
* @return the axis along which this BoxView is laid out
+   *
+   * @since 1.3
*/
   public int getAxis()
   {
@@ -128,6 +131,8 @@
* [EMAIL PROTECTED] View#Y_AXIS}.
*
* @param axis the axis along which this BoxView is laid out
+   *
+   * @since 1.3
*/
   public void setAxis(int axis)
   {
@@ -147,6 +152,8 @@
* [EMAIL PROTECTED] View#Y_AXIS}.
*
* @param axis an int value
+   *
+   * @since 1.3
*/
   public void layoutChanged(int axis)
   {
@@ -166,6 +173,8 @@
*
* @return true if the layout along the specified
* axis is valid, false otherwise
+   *
+   * @since 1.4
*/
   protected boolean isLayoutValid(int axis)
   {
@@ -264,12 +273,6 @@
*/
   public void paint(Graphics g, Shape a)
   {
-// Adjust size if the size is changed.
-Rectangle bounds = a.getBounds();
-
-if (bounds.width != getWidth() || bounds.height != getHeight())
-  setSize(bounds.width, bounds.height);
-
 Rectangle inside = getInsideAllocation(a);
 Rectangle copy = new Rectangle(inside);
 int count = getViewCount();
@@ -305,12 +308,54 @@
 return requirements[axis].preferred;
   }
 
+  /**
+   * Returns the maximum span of this view along the specified axis.
+   * This calculates the maximum span using
+   * [EMAIL PROTECTED] #calculateMajorAxisRequirements} or
+   * [EMAIL PROTECTED] #calculateMinorAxisRequirements} (depending on the axis) and
+   * returns the resulting maximum span.
+   *
+   * @param axis the axis
+   *
+   * @return the maximum span of this view along the specified axis
+   */
   public float getMaximumSpan(int axis)
   {
-if (axis == getAxis())
-  return getPreferredSpan(axis);
-else
-  return Integer.MAX_VALUE;
+if (!isLayoutValid(axis))
+  {
+if (axis == myAxis)
+  requirements[axis] = calculateMajorAxisRequirements(axis,
+   requirements[axis]);
+else
+  requirements[axis] = calculateMinorAxisRequirements(axis,
+   requirements[axis]);
+  }
+return requirements[axis].maximum;
+  }
+
+  /**
+   * Returns the minimum span of this view along the specified axis.
+   * This calculates the minimum span usi

[cp-patches] FYI: Tools build correction

2006-02-09 Thread Audrius Meskauskas

2006-02-09  Audrius Meskauskas  <[EMAIL PROTECTED]>

tools/makefile.am: Handle rmi and giop folders separately.
Index: Makefile.am
===
RCS file: /sources/classpath/classpath/tools/Makefile.am,v
retrieving revision 1.4
diff -u -r1.4 Makefile.am
--- Makefile.am	9 Feb 2006 20:22:07 -	1.4
+++ Makefile.am	9 Feb 2006 23:07:59 -
@@ -30,9 +30,16 @@
 BUILT_SOURCES = $(TOOLS_ZIP)
 
 # The templates that must be included into the generated zip file.
-# This covers both tools/giop/grmic/templates and tools/rmi/rmic/templates:
-TOOLS_TEMPLATES = $(srcdir)/gnu/classpath/tools/*/*/templates/*.jav
-TOOLS_HELPS = $(srcdir)/gnu/classpath/tools/giop/*.txt
+GRMIC_TEMPLATES = $(srcdir)/gnu/classpath/tools/giop/grmic/templates/*.jav 
+RMIC_TEMPLATES = $(srcdir)/gnu/classpath/tools/rmi/rmic/templates/*.jav
+
+TOOLS_TEMPLATES = $(GRMIC_TEMPLATES) $(RMIC_TEMPLATES)
+
+# This covers the built-in help texts, both for giop and rmic subpackages.
+GIOP_HELPS = $(srcdir)/gnu/classpath/tools/giop/*.txt
+RMI_HELPS = $(srcdir)/gnu/classpath/tools/rmi/*.txt
+
+TOOLS_HELPS = $(GIOP_HELPS) $(RMI_HELPS)
 
 # The tool specific README files.
 READMES = $(srcdir)/gnu/classpath/tools/giop/README
@@ -89,8 +96,11 @@
 # And copy the template files we use to the classes dir so they get also included.
 $(TOOLS_ZIP): $(TOOLS_JAVA_FILES)
 	mkdir -p classes/gnu/classpath/tools/giop/grmic/templates
-	cp $(TOOLS_TEMPLATES) classes/gnu/classpath/tools/*/*/templates
-	cp $(TOOLS_HELPS) classes/gnu/classpath/tools/giop/
+	mkdir -p classes/gnu/classpath/tools/rmi/rmic/templates
+	cp $(RMIC_TEMPLATES) classes/gnu/classpath/tools/rmi/rmic/templates
+	cp $(GRMIC_TEMPLATES) classes/gnu/classpath/tools/giop/grmic/templates	
+	cp $(RMI_HELPS) classes/gnu/classpath/tools/rmi/
+	cp $(GIOP_HELPS) classes/gnu/classpath/tools/giop/
 	$(JCOMPILER) -d classes $(TOOLS_JAVA_FILES) 
 	(cd classes; \
 	if test "$(ZIP)" != ""; then $(ZIP) -r ../$(TOOLS_ZIP) .; fi; \


[cp-patches] FYI: SpinnerDateModel/SpinnerNumberModel.java - API docs updated

2006-02-09 Thread David Gilbert

I committed this patch to fill in some API documentation:

2006-02-09  David Gilbert  <[EMAIL PROTECTED]>

* javax/swing/SpinnerDateModel.java: Updated API docs all over,
* javax/swing/SpinnerNumberModel.java: Likewise.

Regards,

Dave
Index: javax/swing/SpinnerDateModel.java
===
RCS file: /sources/classpath/classpath/javax/swing/SpinnerDateModel.java,v
retrieving revision 1.5
diff -u -r1.5 SpinnerDateModel.java
--- javax/swing/SpinnerDateModel.java   9 Feb 2006 22:35:51 -   1.5
+++ javax/swing/SpinnerDateModel.java   9 Feb 2006 22:42:46 -
@@ -1,5 +1,5 @@
 /* SpinnerDateModel.java --
-   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2006 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -42,21 +42,37 @@
 import java.util.Calendar;
 import java.util.Date;
 
+import javax.swing.event.ChangeEvent;
+
 /**
- * SpinnerDateModel
- *
- * Implements a SpinnerModel for dates, rotating a calendar field such as 
- * month, year, day, week, hour, minute.
+ * A date model used by the [EMAIL PROTECTED] JSpinner} component.  This 
implements a 
+ * spinner model for dates, rotating a calendar field such as  month, year, 
+ * day, week, hour, minute.
  *
  * @author Sven de Marothy
- * @version 0.1 (first implementation)
+ * @since 1.4
  */
 public class SpinnerDateModel extends AbstractSpinnerModel
   implements Serializable
 {
+  /** The current date. */
   private Calendar date;
+  
+  /** 
+   * The start or earliest permitted date (null for no 
+   * minimum). 
+   */
   private Comparable start;
+
+  /** 
+   * The end or latest permitted date (null for no 
+   * maximum). 
+   */
   private Comparable end;
+  
+  /**
+   * The calendar field used to calculate the previous or next date. 
+   */
   private int calendarField;
 
   /**
@@ -66,8 +82,9 @@
   private static final long serialVersionUID = -4802518107105940612L;
 
   /**
-   * Constructs a SpinnerDateModel using the current date,
-   * no start or end limit, and Calendar.DAY_OF_MONTH as the calendar field.
+   * Constructs a SpinnerDateModel using the current date,
+   * no start or end limit, and [EMAIL PROTECTED] Calendar#DAY_OF_MONTH} as 
the calendar 
+   * field.
*/
   public SpinnerDateModel()
   {
@@ -101,7 +118,10 @@
   }
 
   /**
-   * Returns the value of the Calendar field to spin.
+   * Returns the [EMAIL PROTECTED] Calendar} field used to calculate the 
previous and 
+   * next dates in the sequence.
+   * 
+   * @return The date field code.
*/
   public int getCalendarField()
   {
@@ -109,8 +129,9 @@
   }
 
   /**
-   * Returns the current date in the sequence.
-   * @return a Date object.
+   * Returns the current date.
+   * 
+   * @return The current date.
*/
   public Date getDate()
   {
@@ -118,8 +139,9 @@
   }
 
   /**
-   * Returns the starting limit of the SpinnerModel.
-   * @return a Date object, or null if there is no limit.
+   * Returns the start date, or null if there is no minimum date.
+   * 
+   * @return The start date.
*/
   public Comparable getStart()
   {
@@ -127,8 +149,9 @@
   }
 
   /**
-   * Returns the end limit of the SpinnerModel.
-   * @return a Date object, or null if there is no limit.
+   * Returns the end date, or null if there is no maximum date.
+   * 
+   * @return The end date.
*/
   public Comparable getEnd()
   {
@@ -136,9 +159,10 @@
   }
 
   /**
-   * Returns the current date in the sequence,
-   * this method returns the same as getDate().
-   * @return a Date object.
+   * Returns the current date in the sequence (this method returns the same as 
+   * [EMAIL PROTECTED] #getDate()}.
+   * 
+   * @return The current date.
*/
   public Object getValue()
   {
@@ -147,8 +171,10 @@
 
   /**
* Returns the next date in the sequence, or null if the
-   * next date is equal to or past the end limit.
-   * @return a Date object, or null.
+   * next date is after the end date.  The current date is not changed.
+   * 
+   * @return The next date, or null if the current value is
+   * the latest date represented by the model.
*/
   public Object getNextValue()
   {
@@ -164,8 +190,11 @@
 
   /**
* Returns the previous date in the sequence, or null if the
-   * next date is equal to or past the end limit.
-   * @return a Date object, or null.
+   * previous date is prior to the start date.  The current date is not 
+   * changed.
+   * 
+   * @return The previous date, or null if the current value is
+   * the earliest date represented by the model.
*/
   public Object getPreviousValue()
   {
@@ -180,9 +209,14 @@
   }
 
   /**
-   * Sets the date field to change. It must be a valid Calendar field,
-   * excluding Calendar.ZONE_OFFSET and Calendar.DST_OFFSET.
-   * @param calendarField - the calendar field to set.
+   * Sets the date field to change when calculating the next and previous 
+   * values. It mus

[cp-patches] FYI: SpinnerDateModel/SpinnerNumberModel.java - removed tabs

2006-02-09 Thread David Gilbert
I committed this patch to remove tabs from two files, these mess up the source code 
output in the gjdoc-generated API documentation:


2006-02-09  David Gilbert  <[EMAIL PROTECTED]>

* javax/swing/SpinnerDateModel.java: Removed tabs,
* javax/swing/SpinnerNumberModel.java: Likewise.

Regards,

Dave
Index: javax/swing/SpinnerDateModel.java
===
RCS file: /sources/classpath/classpath/javax/swing/SpinnerDateModel.java,v
retrieving revision 1.4
diff -u -r1.4 SpinnerDateModel.java
--- javax/swing/SpinnerDateModel.java   8 Feb 2006 16:54:51 -   1.4
+++ javax/swing/SpinnerDateModel.java   9 Feb 2006 22:31:41 -
@@ -158,7 +158,7 @@
 Date nextDate = nextCal.getTime();
 if (end != null)
   if (end.compareTo(nextDate) < 0)
-   return null;
+return null;
 return nextDate;
   }
 
@@ -193,8 +193,8 @@
 
 if (this.calendarField != calendarField)
   {
-   this.calendarField = calendarField;
-   fireStateChanged();
+this.calendarField = calendarField;
+fireStateChanged();
   }
   }
 
@@ -208,8 +208,8 @@
   {
 if (this.start != start)
   {
-   this.start = start;
-   fireStateChanged();
+this.start = start;
+fireStateChanged();
   }
   }
 
@@ -223,8 +223,8 @@
   {
 if (this.end != end)
   {
-   this.end = end;
-   fireStateChanged();
+this.end = end;
+fireStateChanged();
   }
   }
 
Index: javax/swing/SpinnerNumberModel.java
===
RCS file: /sources/classpath/classpath/javax/swing/SpinnerNumberModel.java,v
retrieving revision 1.8
diff -u -r1.8 SpinnerNumberModel.java
--- javax/swing/SpinnerNumberModel.java 8 Feb 2006 21:46:25 -   1.8
+++ javax/swing/SpinnerNumberModel.java 9 Feb 2006 22:31:42 -
@@ -128,13 +128,13 @@
   throw new IllegalArgumentException("value may not be null");
 if (minimum != null)
   {
-   if (minimum.compareTo(value) > 0)
- throw new IllegalArgumentException("minimum is not <= value");
+if (minimum.compareTo(value) > 0)
+  throw new IllegalArgumentException("minimum is not <= value");
   }
 if (maximum != null)
   {
-   if (maximum.compareTo(value) < 0)
- throw new IllegalArgumentException("maximum is not >= value");
+if (maximum.compareTo(value) < 0)
+  throw new IllegalArgumentException("maximum is not >= value");
   }
 
 this.value = value;
@@ -244,8 +244,8 @@
   {
 if (minimum != null ? !minimum.equals(newMinimum) : newMinimum != null)
   {
-   minimum = newMinimum;
-   fireStateChanged();
+minimum = newMinimum;
+fireStateChanged();
   }
   }
 
@@ -258,8 +258,8 @@
   {
 if (maximum != null ? !maximum.equals(newMaximum) : newMaximum != null)
   {
-   maximum = newMaximum;
-   fireStateChanged();
+maximum = newMaximum;
+fireStateChanged();
   }
   }
 
@@ -275,8 +275,8 @@
 
 if (!stepSize.equals(newStepSize))
   {
-   stepSize = newStepSize;
-   fireStateChanged();
+stepSize = newStepSize;
+fireStateChanged();
   }
   }
 }


Re: [cp-patches] RFC: HTTPURLConnection fixlet

2006-02-09 Thread David Daney

Wolfgang Baer wrote:

David Daney wrote:


Thanks, please update: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26081
as appropriate.

If this fixes that bug (which I think it does) the changelog should be
prefixed with 'PR classpath/26081'



Sorry forgot to include this in the changelog - I have updated it now.
Details are added to the bug report - however I have no bug manipulation
rights so its not yet marked as fixed.



I think the preferred form would be the exact string:

 'PR classpath/26081'

But it looks like many forms are used in classpath, so I would just 
leave it as is.


I will close the PR.

Thanks,
David Daney.



Re: [cp-patches] RFC: HTTPURLConnection fixlet

2006-02-09 Thread Wolfgang Baer
David Daney wrote:
> Thanks, please update: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26081
> as appropriate.
> 
> If this fixes that bug (which I think it does) the changelog should be
> prefixed with 'PR classpath/26081'

Sorry forgot to include this in the changelog - I have updated it now.
Details are added to the bug report - however I have no bug manipulation
rights so its not yet marked as fixed.

Wolfgang



Re: [cp-patches] RFC: HTTPURLConnection fixlet

2006-02-09 Thread David Daney

Wolfgang Baer wrote:

Hi all,

Wolfgang Baer wrote:


Hi,

David Daney wrote:

Perhaps make isError() a member of Response  


Yes, I also thought of this. Its in HTTPURLConnection because there is
already a method isRedirect(Response r). Both should be moved to Response.



Committed as attached. Changes over the previous patch are the move of the
isRedirect() and isError() methods to Response.java.

2006-02-09  Wolfgang Baer  <[EMAIL PROTECTED]>

* gnu/java/net/protocol/http/HTTPURLConnection.java:
(isRedirect): Removed, moved to Response.java.
(connect): If error condition redirect responseSink to errorSink.
(getInputStream): If error condition throw IOException, for the error
codes 404 and 410 throw a FileNotFoundException.
* gnu/java/net/protocol/http/Response.java (isError): New method.
(isRedirect): New method, moved from HTTPURLConnection.java.

Wolfgang


Thanks, please update: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26081 
as appropriate.


If this fixes that bug (which I think it does) the changelog should be 
prefixed with 'PR classpath/26081'


David Daney




Re: [cp-patches] RFC: HTTPURLConnection fixlet

2006-02-09 Thread Wolfgang Baer
Hi all,

Wolfgang Baer wrote:
> Hi,
> 
> David Daney wrote:
>>
>>Perhaps make isError() a member of Response  
> 
> Yes, I also thought of this. Its in HTTPURLConnection because there is
> already a method isRedirect(Response r). Both should be moved to Response.

Committed as attached. Changes over the previous patch are the move of the
isRedirect() and isError() methods to Response.java.

2006-02-09  Wolfgang Baer  <[EMAIL PROTECTED]>

* gnu/java/net/protocol/http/HTTPURLConnection.java:
(isRedirect): Removed, moved to Response.java.
(connect): If error condition redirect responseSink to errorSink.
(getInputStream): If error condition throw IOException, for the error
codes 404 and 410 throw a FileNotFoundException.
* gnu/java/net/protocol/http/Response.java (isError): New method.
(isRedirect): New method, moved from HTTPURLConnection.java.

Wolfgang


Index: gnu/java/net/protocol/http/HTTPURLConnection.java
===
RCS file: /cvsroot/classpath/classpath/gnu/java/net/protocol/http/HTTPURLConnection.java,v
retrieving revision 1.18
diff -u -r1.18 HTTPURLConnection.java
--- gnu/java/net/protocol/http/HTTPURLConnection.java	9 Feb 2006 09:37:08 -	1.18
+++ gnu/java/net/protocol/http/HTTPURLConnection.java	9 Feb 2006 20:39:42 -
@@ -254,7 +254,7 @@
   }
   }
 
-if (isRedirect(response) && getInstanceFollowRedirects())
+if (response.isRedirect() && getInstanceFollowRedirects())
   {
 	// Read the response body, if there is one.  If the
 	// redirect points us back at the same server, we will use
@@ -349,22 +349,13 @@
   {
 responseSink = response.getBody();
 
-if (response.getCode() == 404)
-	  {
-		errorSink = responseSink;
-		throw new FileNotFoundException(url.toString());
-	  }
+if (response.isError())
+	  errorSink = responseSink;
   }
   }
 while (retry);
 connected = true;
-  }
-
-  private static boolean isRedirect(Response response)
-  {
-int sc = response.getCode();
-return (sc != 304 && (sc / 100) == 3);
-  }
+  }  
 
   /**
* Returns a connection, from the pool if necessary.
@@ -525,6 +516,17 @@
   {
 throw new ProtocolException("doInput is false");
   }
+
+if (response.isError())
+  {
+int code = response.getCode();
+if (code == 404 || code == 410)
+  throw new FileNotFoundException(url.toString());
+  
+throw new IOException("Server returned HTTP response code " + code
+  + " for URL " + url.toString());
+  }
+
 return responseSink;
   }
 
Index: gnu/java/net/protocol/http/Response.java
===
RCS file: /cvsroot/classpath/classpath/gnu/java/net/protocol/http/Response.java,v
retrieving revision 1.3
diff -u -r1.3 Response.java
--- gnu/java/net/protocol/http/Response.java	12 Oct 2005 19:48:25 -	1.3
+++ gnu/java/net/protocol/http/Response.java	9 Feb 2006 20:39:42 -
@@ -1,5 +1,5 @@
 /* Response.java --
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2006 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -188,6 +188,28 @@
   {
 return headers.getDateValue(name);
   }
+  
+  /**
+   * Tests whether this response indicates a redirection.
+   * 
+   * @return true if, false otherwise.
+   */
+  public boolean isRedirect()
+  {
+return (code != 304 && getCodeClass() == 3);
+  }
+  
+  /**
+   * Tests whether this response indicates an error.
+   * Errors are the response codes 4xx - Client error and
+   * 5xx - Server error.
+   * 
+   * @return true if, false otherwise.
+   */
+  public boolean isError()
+  {
+return (getCodeClass() == 4 || getCodeClass() == 5);
+  }
 
   /**
* Returns an InputStream that returns the body of the response.


[cp-patches] FYI: Added rmic code generator to the /tools

2006-02-09 Thread Audrius Meskauskas
This patch adds java.rmi version jdk 1.2+ stub generator to the 
classpath tools package.

Unlike rmic from the cp-tools project (that generates classes but cannot
generate the source code) this version generates only source code that must
be compiled with any java compiler. Source code (rather than binary) output
and template system seems providing the easier maintenance.

The deprecated jdk 1.1 classes are not supporte by this compiler (seems low
priority now).

Unlike cp-tools rmic, this compiler is not dependent on any third party 
libraries.

The common rmic key -iiop forces to delegate work to the previoslu comitted
grmic.

2006-02-09  Audrius Meskauskas  <[EMAIL PROTECTED]>

   * tools/Makefile.am: Add tools/gnu/classpath/tools/rmi folder.
   * tools/gnu/classpath/tools/giop/GRMIC.txt: Explain it called from RMIC.
   * tools/gnu/classpath/tools/giop/grmic/Generator.java (getResource):
   Better diagnostic.
   * tools/gnu/classpath/tools/giop/grmic/GiopRmicCompiler.java:
   Rewritten.
   * tools/gnu/classpath/tools/giop/grmic/MethodGenerator.java: Implement
   AbstractMethodGenerator.
   * tools/gnu/classpath/tools/AbstractMethodGenerator.java,
   tools/gnu/classpath/tools/rmi/RMIC.java,
   tools/gnu/classpath/tools/rmi/RMIC.txt,
   tools/gnu/classpath/tools/rmi/rmic/RmiMethodGenerator.java,
   tools/gnu/classpath/tools/rmi/rmic/RmicCompiler.java,
   tools/gnu/classpath/tools/rmi/rmic/WrapUnWrapper.java,
   tools/gnu/classpath/tools/rmi/rmic/templates/Stub_12.jav,
   tools/gnu/classpath/tools/rmi/rmic/templates/Stub_12Method.jav,
   tools/gnu/classpath/tools/rmi/rmic/templates/Stub_12MethodVoid.jav:
   New files.
   * NEWS: Corrected entry about the tools.

Index: NEWS
===
RCS file: /sources/classpath/classpath/NEWS,v
retrieving revision 1.108
diff -u -r1.108 NEWS
--- NEWS	8 Feb 2006 12:14:04 -	1.108
+++ NEWS	9 Feb 2006 20:18:15 -
@@ -7,9 +7,10 @@
   `java.security.' `javax.crypto,' and `javax.net.ssl' packages, and
   are service providers implementing the underlying algorithms.
  
- * The new folder tools now contains GIOP tools, providing necessary support
-   for development using org.omg.* and javax.rmi.CORBA.* packages: GIOP
-   stub and tie code generator, IOR parser and naming service.
+* The new folder tools now contains GIOP and RMI tools, providing necessary
+  support for development using org.omg.*, javax.rmi.CORBA.* and java.rmi.* 
+  packages. The toll set includes GIOP and RMI stub and tie code generators,
+  IOR parser and GIOP naming service. 
 
 New in release 0.20 (Jan 13, 2006)
 
Index: tools/Makefile.am
===
RCS file: /sources/classpath/classpath/tools/Makefile.am,v
retrieving revision 1.3
diff -u -r1.3 Makefile.am
--- tools/Makefile.am	8 Feb 2006 12:34:19 -	1.3
+++ tools/Makefile.am	9 Feb 2006 20:18:48 -
@@ -29,8 +29,9 @@
 # Extra objects that will not exist until configure-time
 BUILT_SOURCES = $(TOOLS_ZIP)
 
-# the templates that must be included into the generated zip file
-TOOLS_TEMPLATES = $(srcdir)/gnu/classpath/tools/giop/grmic/templates/*.jav
+# The templates that must be included into the generated zip file.
+# This covers both tools/giop/grmic/templates and tools/rmi/rmic/templates:
+TOOLS_TEMPLATES = $(srcdir)/gnu/classpath/tools/*/*/templates/*.jav
 TOOLS_HELPS = $(srcdir)/gnu/classpath/tools/giop/*.txt
 
 # The tool specific README files.
@@ -88,7 +89,7 @@
 # And copy the template files we use to the classes dir so they get also included.
 $(TOOLS_ZIP): $(TOOLS_JAVA_FILES)
 	mkdir -p classes/gnu/classpath/tools/giop/grmic/templates
-	cp $(TOOLS_TEMPLATES) classes/gnu/classpath/tools/giop/grmic/templates
+	cp $(TOOLS_TEMPLATES) classes/gnu/classpath/tools/*/*/templates
 	cp $(TOOLS_HELPS) classes/gnu/classpath/tools/giop/
 	$(JCOMPILER) -d classes $(TOOLS_JAVA_FILES) 
 	(cd classes; \
Index: tools/gnu/classpath/tools/giop/GRMIC.txt
===
RCS file: /sources/classpath/classpath/tools/gnu/classpath/tools/giop/GRMIC.txt,v
retrieving revision 1.1
diff -u -r1.1 GRMIC.txt
--- tools/gnu/classpath/tools/giop/GRMIC.txt	8 Feb 2006 07:35:30 -	1.1
+++ tools/gnu/classpath/tools/giop/GRMIC.txt	9 Feb 2006 20:18:48 -
@@ -1,3 +1,4 @@
+GIOP stub and tie generator source code generator for javax.rmi.*, omg.org.*
 
 Copyright 2006 Free Software Foundation, Inc.
 This is free software; see the source for copying conditions.  There is NO
@@ -22,5 +23,6 @@
  and  can include one or more non abstract classes that implement
  Remote and are accessible via current class path.
 
-This tool generates the source code that must be compiled with java compiler. 
+* This tool generates the source code that must be compiled with java compiler. 
+* GRMIC is invoked from RMIC if the -iiop or -giop keys are specified.
 
Index: tools/gnu/classpath/tools/giop/grmic/Generator.java

Re: [cp-patches] RFC: Time out HTTP keep-alive connections

2006-02-09 Thread David Daney

David Daney wrote:

+class GetPropertiesAction
+  implements PrivilegedAction
+{
+  public Object run()
+  {
+String ttl = System.getProperty("classpath.net.http.keepAliveTTL");
+connectionTTL = (ttl != null && ttl.length() > 0) ?
+  1000 * Math.max(1, Integer.parseInt(ttl)) : 1;
+
+String mc = System.getProperty("http.maxConnections");
+maxConnections = (mc != null && mc.length() > 0) ?
+  Math.max(Integer.parseInt(mc), 1) : 5;
+if (maxConnections < 1)
+  maxConnections =  1;
+return null;
+  }
+}


Well in light of the existence of SystemProperties, I will change this 
part to use it.


I will probably have a follow-on patch to HTTPURLConnection.java to 
convert it to use SystemProperties as well.


David Daney



Re: [cp-patches] Patch: GtkPanelPeer and GtkWindowPeer fix

2006-02-09 Thread Lillian Angel
Added more to the checks to prevent any sort of painting assertion
errors.

2006-02-09  Lillian Angel  <[EMAIL PROTECTED]>

* gnu/java/awt/peer/gtk/GtkComponentPeer.java
(handleEvent): Added more to check to prevent assertion errors.
* gnu/java/awt/peer/gtk/GtkPanelPeer.java
(handleEvent): Likewise.
* gnu/java/awt/peer/gtk/GtkWindowPeer.java
(handleEvent): Likewise.

On Thu, 2006-02-09 at 10:43 -0500, Lillian Angel wrote:
> Many test cases I have, show that Sun does not call update(Graphics) on
> Panels or Windows. Only paint(Graphics) is called. Many widgets were
> being cleared and not repainted properly when update was called.
> 
> 2006-02-09  Lillian Angel  <[EMAIL PROTECTED]>
> 
> * gnu/java/awt/peer/gtk/GtkPanelPeer.java
> (handleEvent): Added code to handle PaintEvent.UPDATE.
> Sun does not call update(Graphics g) on Panels.
> * gnu/java/awt/peer/gtk/GtkWindowPeer.java
> (handleEvent): New method. Added code to handle 
>   PaintEvent.UPDATE. Sun does not call update(Graphics g) on 
>   Panels.
> 
Index: gnu/java/awt/peer/gtk/GtkComponentPeer.java
===
RCS file: /sources/classpath/classpath/gnu/java/awt/peer/gtk/GtkComponentPeer.java,v
retrieving revision 1.100
diff -u -r1.100 GtkComponentPeer.java
--- gnu/java/awt/peer/gtk/GtkComponentPeer.java	8 Feb 2006 14:35:10 -	1.100
+++ gnu/java/awt/peer/gtk/GtkComponentPeer.java	9 Feb 2006 17:41:38 -
@@ -308,13 +308,10 @@
   {
 Graphics g = getGraphics();
 
-if (awtComponent.getWidth() < 1 || awtComponent.getHeight() < 1)
+if (!awtComponent.isShowing()  || awtComponent.getWidth() < 1 
+|| awtComponent.getHeight() < 1 || g == null)
   break; 
 
-// Some peers like GtkFileDialogPeer are repainted by Gtk itself
-if (g == null)
-  break;
-
 g.setClip(((PaintEvent) event).getUpdateRect());
 
 if (id == PaintEvent.PAINT)
Index: gnu/java/awt/peer/gtk/GtkPanelPeer.java
===
RCS file: /sources/classpath/classpath/gnu/java/awt/peer/gtk/GtkPanelPeer.java,v
retrieving revision 1.20
diff -u -r1.20 GtkPanelPeer.java
--- gnu/java/awt/peer/gtk/GtkPanelPeer.java	9 Feb 2006 15:41:35 -	1.20
+++ gnu/java/awt/peer/gtk/GtkPanelPeer.java	9 Feb 2006 17:41:38 -
@@ -41,6 +41,7 @@
 import java.awt.AWTEvent;
 import java.awt.Graphics;
 import java.awt.Panel;
+import java.awt.event.ComponentEvent;
 import java.awt.event.MouseEvent;
 import java.awt.event.PaintEvent;
 import java.awt.peer.PanelPeer;
@@ -67,13 +68,18 @@
   }
 
 if (event.getID() == PaintEvent.UPDATE)
-  {
+  {
 Graphics g = getGraphics();
-if (!awtComponent.isShowing() || g == null)
+if (!awtComponent.isShowing() || awtComponent.getWidth() < 1 
+|| awtComponent.getHeight() < 1 || g == null)
   return;
 
+g.setClip(((PaintEvent) event).getUpdateRect());
+
 // Do not want to clear anything before painting.
 awtComponent.paint(g);
+
+g.dispose();
   }
 else
   super.handleEvent (event);
Index: gnu/java/awt/peer/gtk/GtkWindowPeer.java
===
RCS file: /sources/classpath/classpath/gnu/java/awt/peer/gtk/GtkWindowPeer.java,v
retrieving revision 1.43
diff -u -r1.43 GtkWindowPeer.java
--- gnu/java/awt/peer/gtk/GtkWindowPeer.java	9 Feb 2006 15:41:35 -	1.43
+++ gnu/java/awt/peer/gtk/GtkWindowPeer.java	9 Feb 2006 17:41:38 -
@@ -244,11 +244,16 @@
 if (event.getID() == PaintEvent.UPDATE)
   {
 Graphics g = getGraphics();
-if (!awtComponent.isShowing() || g == null)
+if (!awtComponent.isShowing() || awtComponent.getWidth() < 1 
+|| awtComponent.getHeight() < 1 || g == null)
   return;
 
+g.setClip(((PaintEvent) event).getUpdateRect());
+
 // Do not want to clear anything before painting.
 awtComponent.paint(g);
+
+g.dispose();
   }
 else
   super.handleEvent(event);


[cp-patches] FYI: AbstractDocument fix

2006-02-09 Thread Roman Kennke
(second try)

I fixed the AbstractDocument.remove() method so that everything is done
inside a write lock, and is done in the correct order.

2006-02-09  Roman Kennke  <[EMAIL PROTECTED]>

* javax/swing/text/AbstractDocument.java
(remove): Perform all operations within a write lock and in the
correct order.

/Roman
Index: javax/swing/text/AbstractDocument.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/text/AbstractDocument.java,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- javax/swing/text/AbstractDocument.java	7 Feb 2006 16:42:39 -	1.44
+++ javax/swing/text/AbstractDocument.java	9 Feb 2006 16:57:44 -	1.45
@@ -681,18 +681,18 @@
   new DefaultDocumentEvent(offset, length,
 			   DocumentEvent.EventType.REMOVE);
 
-removeUpdate(event);
-
-boolean shouldFire = content.getString(offset, length).length() != 0;
-
-writeLock();
-UndoableEdit temp = content.remove(offset, length);
-writeUnlock();
-
-postRemoveUpdate(event);
-
-if (shouldFire)
-  fireRemoveUpdate(event);
+try
+  {
+writeLock();
+UndoableEdit temp = content.remove(offset, length);
+removeUpdate(event);
+postRemoveUpdate(event);
+fireRemoveUpdate(event);
+  }
+finally
+  {
+writeUnlock();
+  } 
   }
 
   /**


[cp-patches] FYI: AbstractDocument fix

2006-02-09 Thread Roman Kennke
AbstractDocument.remove should perform all operations within a write lock
and the order is also fixed up by this patch.

2006-02-09  Roman Kennke  <[EMAIL PROTECTED]>

* javax/swing/text/AbstractDocument.java
(remove): Perform all operations within a write lock and in the
correct order.

/Roman
Index: javax/swing/text/AbstractDocument.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/text/AbstractDocument.java,v
retrieving revision 1.44
diff -u -r1.44 AbstractDocument.java
--- javax/swing/text/AbstractDocument.java	7 Feb 2006 16:42:39 -	1.44
+++ javax/swing/text/AbstractDocument.java	9 Feb 2006 16:56:43 -
@@ -681,18 +681,18 @@
   new DefaultDocumentEvent(offset, length,
 			   DocumentEvent.EventType.REMOVE);
 
-removeUpdate(event);
-
-boolean shouldFire = content.getString(offset, length).length() != 0;
-
-writeLock();
-UndoableEdit temp = content.remove(offset, length);
-writeUnlock();
-
-postRemoveUpdate(event);
-
-if (shouldFire)
-  fireRemoveUpdate(event);
+try
+  {
+writeLock();
+UndoableEdit temp = content.remove(offset, length);
+removeUpdate(event);
+postRemoveUpdate(event);
+fireRemoveUpdate(event);
+  }
+finally
+  {
+writeUnlock();
+  } 
   }
 
   /**


[cp-patches] FYI: DefaultCaret fix

2006-02-09 Thread Roman Kennke
I added some checks and code to make sure the dot location in
DefaultCaret is always valid.

2006-02-09  Roman Kennke  <[EMAIL PROTECTED]>

* javax/swing/text/DefaultCaret.java
(DocumentHandler.removeUpdate): When update policy is
'on eventqueue', and the update doesn't come from the
event queue, check if the current dot location is still
valid.
(moveDot): Make sure the new dot location is valid.
(setDot): Set the mark the same as the dot.

/Roman
/cvsroot/classpath/classpath/javax/swing/text/DefaultCaret.java,v  <--  javax/swing/text/DefaultCaret.java
new revision: 1.30; previous revision: 1.29


Re: [cp-patches] RFC: JTable.tableChanged(null)

2006-02-09 Thread Roman Kennke
Hi Mark,

Am Donnerstag, den 09.02.2006, 17:31 +0100 schrieb Mark Wielaard:
> Hi,
> 
> I got a program here (the hsqldb DatabaseManagerSwing) that expects to
> be able to fire null events to a TableModel when everything about the
> model has changed. JTable wasn't handling that. Here is a proposed
> patch:
> 
> 2006-02-09  Mark Wielaard  <[EMAIL PROTECTED]>
> 
> * javax/swing/JTable.java (tableChanged): Interpret null event as
> "everything changed".
> 
> OK?

Looks good.

/Roman



signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil


[cp-patches] RFC: JTable.tableChanged(null)

2006-02-09 Thread Mark Wielaard
Hi,

I got a program here (the hsqldb DatabaseManagerSwing) that expects to
be able to fire null events to a TableModel when everything about the
model has changed. JTable wasn't handling that. Here is a proposed
patch:

2006-02-09  Mark Wielaard  <[EMAIL PROTECTED]>

* javax/swing/JTable.java (tableChanged): Interpret null event as
"everything changed".

OK?

Cheers,

Mark
Index: javax/swing/JTable.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/JTable.java,v
retrieving revision 1.68
diff -u -r1.68 JTable.java
--- javax/swing/JTable.java	19 Jan 2006 22:22:04 -	1.68
+++ javax/swing/JTable.java	9 Feb 2006 16:23:33 -
@@ -1,5 +1,5 @@
 /* JTable.java -- 
-   Copyright (C) 2002, 2004, 2005  Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2005, 2006  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -1878,22 +1878,22 @@
 
   /**
* Invoked when the table changes.
+   * null means everything changed.
*/
   public void tableChanged (TableModelEvent event)
   {
 // update the column model from the table model if the structure has
 // changed and the flag autoCreateColumnsFromModel is set
-if ((event.getFirstRow() ==TableModelEvent.HEADER_ROW)
-&& autoCreateColumnsFromModel)
-
+if ((event == null || (event.getFirstRow() == TableModelEvent.HEADER_ROW))
+	&& autoCreateColumnsFromModel)
   createDefaultColumnsFromModel();
 
 // If the structure changes, we need to revalidate, since that might
 // affect the size parameters of the JTable. Otherwise we only need
 // to perform a repaint to update the view.
-if (event.getType() == TableModelEvent.INSERT)
+if (event == null || event.getType() == TableModelEvent.INSERT)
   revalidate();
-else if (event.getType() == TableModelEvent.DELETE)
+if (event == null || event.getType() == TableModelEvent.DELETE)
   {
 if (dataModel.getRowCount() == 0)
   clearSelection();


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


Re: [cp-patches] RFC: GtkScrollbarPeer min == max

2006-02-09 Thread Thomas Fitzsimmons
On Thu, 2006-02-09 at 13:37 +0100, Mark Wielaard wrote:
> Hi,
> 
> gtk_range_set_range doesn't allow setting min == max. But Scrollbar does
> allow that. The following patch makes sure that we set max to be bigger
> than min and make sure that the page_size is at least max - min so to
> the user it just looks like a scrollbar that cannot be adjusted (this
> works because the actual max value of the scrollbar is max - page_size).
> 
> 2006-02-09  Mark Wielaard  <[EMAIL PROTECTED]>
> 
> * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollbarPeer.c
> (Java_gnu_java_awt_peer_gtk_GtkScrollbarPeer_create): Make sure max is
> creater than min, adjusting page_size if necessary.
> (Java_gnu_java_awt_peer_gtk_GtkScrollbarPeer_setValues): Likewise.
> 
> Does this look sane?

Yes, this looks fine.

Tom





[cp-patches] Patch: GtkPanelPeer and GtkWindowPeer fix

2006-02-09 Thread Lillian Angel
Many test cases I have, show that Sun does not call update(Graphics) on
Panels or Windows. Only paint(Graphics) is called. Many widgets were
being cleared and not repainted properly when update was called.

2006-02-09  Lillian Angel  <[EMAIL PROTECTED]>

* gnu/java/awt/peer/gtk/GtkPanelPeer.java
(handleEvent): Added code to handle PaintEvent.UPDATE.
Sun does not call update(Graphics g) on Panels.
* gnu/java/awt/peer/gtk/GtkWindowPeer.java
(handleEvent): New method. Added code to handle 
PaintEvent.UPDATE. Sun does not call update(Graphics g) on 
Panels.

Index: gnu/java/awt/peer/gtk/GtkPanelPeer.java
===
RCS file: /sources/classpath/classpath/gnu/java/awt/peer/gtk/GtkPanelPeer.java,v
retrieving revision 1.19
diff -u -r1.19 GtkPanelPeer.java
--- gnu/java/awt/peer/gtk/GtkPanelPeer.java	2 Jul 2005 20:32:12 -	1.19
+++ gnu/java/awt/peer/gtk/GtkPanelPeer.java	9 Feb 2006 15:38:29 -
@@ -39,8 +39,10 @@
 package gnu.java.awt.peer.gtk;
 
 import java.awt.AWTEvent;
+import java.awt.Graphics;
 import java.awt.Panel;
 import java.awt.event.MouseEvent;
+import java.awt.event.PaintEvent;
 import java.awt.peer.PanelPeer;
 
 public class GtkPanelPeer extends GtkContainerPeer
@@ -63,7 +65,18 @@
 awtComponent.requestFocusInWindow ();
 break;
   }
-super.handleEvent (event);
+
+if (event.getID() == PaintEvent.UPDATE)
+  {
+Graphics g = getGraphics();
+if (!awtComponent.isShowing() || g == null)
+  return;
+
+// Do not want to clear anything before painting.
+awtComponent.paint(g);
+  }
+else
+  super.handleEvent (event);
   }
 
   native void connectSignals ();
Index: gnu/java/awt/peer/gtk/GtkWindowPeer.java
===
RCS file: /sources/classpath/classpath/gnu/java/awt/peer/gtk/GtkWindowPeer.java,v
retrieving revision 1.42
diff -u -r1.42 GtkWindowPeer.java
--- gnu/java/awt/peer/gtk/GtkWindowPeer.java	16 Nov 2005 15:58:05 -	1.42
+++ gnu/java/awt/peer/gtk/GtkWindowPeer.java	9 Feb 2006 15:38:29 -
@@ -38,9 +38,12 @@
 
 package gnu.java.awt.peer.gtk;
 
+import java.awt.AWTEvent;
 import java.awt.Component;
 import java.awt.Frame;
+import java.awt.Graphics;
 import java.awt.Window;
+import java.awt.event.PaintEvent;
 import java.awt.event.WindowEvent;
 import java.awt.peer.WindowPeer;
 
@@ -235,4 +238,19 @@
 // TODO Auto-generated method stub
 return false;
   }
+  
+  public void handleEvent(AWTEvent event)
+  {
+if (event.getID() == PaintEvent.UPDATE)
+  {
+Graphics g = getGraphics();
+if (!awtComponent.isShowing() || g == null)
+  return;
+
+// Do not want to clear anything before painting.
+awtComponent.paint(g);
+  }
+else
+  super.handleEvent(event);
+  }
 }


[cp-patches] RFC: gnu.regexp: nested character class expression supported

2006-02-09 Thread Ito Kazumitsu
I think gnu/regexp/RE.java is becoming too big. It would be better
if we could separate RE compiler and matcher. 

2006-02-09  Ito Kazumitsu  <[EMAIL PROTECTED]>

Fixes bug #26166
* gnu/regexp/RE.java(initialize): Parsing of character class expression
was moved to a new method parseCharClass.
(parseCharClass): New method originally in initialize. Added parsing
of nested character classes.
(ParseCharClassResult): New inner class used as a return value of
parseCharClass.
(getCharExpression),(getNamedProperty): Made static.
* gnu/regexp/RESyntax.java(RE_NESTED_CHARCLASS): New syntax flag.
* gnu/regexp/RETokenOneOf.java(addition): New Vector for storing
nested character classes.
(RETokenOneOf): New constructor accepting the Vector addition.
(getMinimumLength), (getMaximumLength): Returns 1 if the token
stands for only one character.
(match): Added the processing of the Vector addition.
(matchN), (matchP): Do not check next token if addition is used.
Index: classpath/gnu/regexp/RE.java
===
RCS file: /cvsroot/classpath/classpath/gnu/regexp/RE.java,v
retrieving revision 1.17
diff -u -r1.17 RE.java
--- classpath/gnu/regexp/RE.java9 Feb 2006 13:44:59 -   1.17
+++ classpath/gnu/regexp/RE.java9 Feb 2006 14:32:39 -
@@ -1,5 +1,5 @@
 /* gnu/regexp/RE.java
-   Copyright (C) 1998-2001, 2004, 2005 Free Software Foundation, Inc.
+   Copyright (C) 2006 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -427,116 +427,12 @@
   //  [...] | [^...]
 
   else if ((unit.ch == '[') && !(unit.bk || quot)) {
-   Vector options = new Vector();
-   boolean negative = false;
-   // FIXME: lastChar == 0 means lastChar is not set. But what if
-   // \u is used as a meaningful character?
-   char lastChar = 0;
-   if (index == pLength) throw new 
REException(getLocalizedMessage("unmatched.bracket"),REException.REG_EBRACK,index);
-   
-   // Check for initial caret, negation
-   if ((ch = pattern[index]) == '^') {
- negative = true;
- if (++index == pLength) throw new 
REException(getLocalizedMessage("class.no.end"),REException.REG_EBRACK,index);
- ch = pattern[index];
-   }
-
-   // Check for leading right bracket literal
-   if (ch == ']') {
- lastChar = ch;
- if (++index == pLength) throw new 
REException(getLocalizedMessage("class.no.end"),REException.REG_EBRACK,index);
-   }
-
-   while ((ch = pattern[index++]) != ']') {
- if ((ch == '-') && (lastChar != 0)) {
-   if (index == pLength) throw new 
REException(getLocalizedMessage("class.no.end"),REException.REG_EBRACK,index);
-   if ((ch = pattern[index]) == ']') {
- options.addElement(new RETokenChar(subIndex,lastChar,insens));
- lastChar = '-';
-   } else {
- if ((ch == '\\') && 
syntax.get(RESyntax.RE_BACKSLASH_ESCAPE_IN_LISTS)) {
-   CharExpression ce = getCharExpression(pattern, index, pLength, 
syntax);
-   if (ce == null)
- throw new REException("invalid escape sequence", 
REException.REG_ESCAPE, index);
-   ch = ce.ch;
-   index = index + ce.len - 1;
- }
- options.addElement(new RETokenRange(subIndex,lastChar,ch,insens));
- lastChar = 0;
- index++;
-   }
-  } else if ((ch == '\\') && 
syntax.get(RESyntax.RE_BACKSLASH_ESCAPE_IN_LISTS)) {
-if (index == pLength) throw new 
REException(getLocalizedMessage("class.no.end"),REException.REG_EBRACK,index);
-   int posixID = -1;
-   boolean negate = false;
-   // FIXME: asciiEsc == 0 means asciiEsc is not set. But what if
-   // \u is used as a meaningful character?
-char asciiEsc = 0;
-   NamedProperty np = null;
-   if (("dswDSW".indexOf(pattern[index]) != -1) && 
syntax.get(RESyntax.RE_CHAR_CLASS_ESC_IN_LISTS)) {
- switch (pattern[index]) {
- case 'D':
-   negate = true;
- case 'd':
-   posixID = RETokenPOSIX.DIGIT;
-   break;
- case 'S':
-   negate = true;
- case 's':
-   posixID = RETokenPOSIX.SPACE;
-   break;
- case 'W':
-   negate = true;
- case 'w':
-   posixID = RETokenPOSIX.ALNUM;
-   break;
- }
-   }
-   if (("pP".indexOf(pattern[index]) != -1) && 
syntax.get(RESyntax.RE_NAMED_PROPERTY)) {
- np = getNamedProperty(pattern, index - 1, pLength);
- if (np == null)
-   throw new REException("invalid escape sequence", 
REException.REG_ESCAPE, index);
- index =

[cp-patches] FYI: javax.swing.text update

2006-02-09 Thread Roman Kennke
The attached patch fixes a lot of issues with styled text in Swing and
make it more usable with respect to performance and rendering. Try
BeanShell for example.


2006-02-09  Roman Kennke  <[EMAIL PROTECTED]>

* javax/swing/text/BoxView.java
(myAxis): Made field private.
(xLayoutValid): Replaced by layoutValid array.
(yLayoutValid): Replaced by layoutValid array.
(layoutValid): New field.
(spansX): Replaced by spans array.
(spansY): Replaced by spans array.
(spans): New field.
(offsetsX): Replaced by offsets array.
(offsetsY): Replaced by offsets array.
(offsets): New field.
(requirements): New field.
(BoxView): Initialize new fields.
(layoutChanged): Rewritten to use the layoutValid array.
(isLayoutValid): Rewritten to use the layoutValid array.
(replace): Use the new arrays.
(getPreferredSpan): Rewritten to call calculateXXXRequirements
instead of baselineRequirements.
(baselineRequirements): Rewritten to calculate baseline requirements.
(baselineLayout): Rewritten to calculate baseline layout.
(childAllocation): Use new arrays.
(layout): Rewritten. Only update the layout if necessary.
(layoutMajorAxis): Directly set layoutValid.
(layoutMinorAxis): Directly set layoutValid. Use cached size
requirements.
(getWidth): Use new span array.
(getHeight): Likewise.
(setSize): Rewritten to simply call layout().
(validateLayout): Removed unneeded method.
(getSpan): Use new arrays.
(getOffset): Use new arrays.
(getAlignment): Use cached requirements if possible.
(preferenceChanged): Use new arrays.
* javax/swing/text/FlowView.java
(FlowStrategy.insertUpdate): Do nothing here.
(FlowStrategy.removeUpdate): Do nothing here.
(FlowStrategy.changedUpdate): Do nothing here.
(FlowStrategy.layoutRow): Rewritten.
(FlowStrategy.createView): Rewritten.
(FlowStrategy.adjustRow): New method.
(LogicalView.getViewIndex): Fixed condition for finding child
view.
(layoutDirty): New field indicating the state of the layout.
(FlowView): Initialize new field.
(loadChildren): Set parent on logical view so that preferenceChanges
get propagated upwards.
(layout): Rewritten to match the specs.
(insertUpdate): Set layout to dirty.
(removeUpdate): Set layout to dirty.
(changedUpdate): Set layout to dirty.
* javax/swing/text/GlyphView.java
(getBreakWeight): Rewritten to use the Utilities class. Commented
out though because that is broken.
(insertUpdate): Call preferenceChanged on this object instead of
parent.
* javax/swing/text/ParagraphView.java
(Row.loadChildren): Overridden to be a noop to prevent initial
creation of child views. This is carried out by the flow layout.
* javax/swing/text/View.java
(getPreferredSpan): Added API docs.
(getResizeWeight): Added API docs.
(getMaximumSpan): Added API docs. Rewritten to only have one exit
point.
(getMinimumSpan): Added API docs. Rewritten to return 0 when
resizable instead of Integer.MAX_VALUE.
(getAlignment): Added API docs.
(replace): Added API docs.
(forwardUpdate): Rewritten to only notify child views that need to
be notified.

/Roman
Index: javax/swing/text/BoxView.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/text/BoxView.java,v
retrieving revision 1.12
diff -u -r1.12 BoxView.java
--- javax/swing/text/BoxView.java	17 Nov 2005 20:56:38 -	1.12
+++ javax/swing/text/BoxView.java	9 Feb 2006 14:27:58 -
@@ -58,49 +58,32 @@
   /**
* The axis along which this BoxView is laid out.
*/
-  int myAxis;
+  private int myAxis;
 
   /**
-   * Indicates wether the layout in X_AXIS is valid.
+   * Indicates if the layout is valid along X_AXIS or Y_AXIS.
*/
-  boolean xLayoutValid;
+  private boolean[] layoutValid = new boolean[2];
 
   /**
-   * Indicates whether the layout in Y_AXIS is valid.
+   * The spans along the X_AXIS and Y_AXIS.
*/
-  boolean yLayoutValid;
+  private int[][] spans = new int[2][];
 
   /**
-   * The spans in X direction of the children.
+   * The offsets of the children along the X_AXIS and Y_AXIS.
*/
-  int[] spansX;
+  private int[][] offsets = new int[2][];
 
   /**
-   * The spans in Y direction of the children.
+   * The size requirements along the X_AXIS and Y_AXIS.
*/
-  int[] spansY;
+  private SizeRequirements[] requirements = new SizeRequirements[2];
 
   /**
-   * The offsets of the children in X direction relative to this BoxView's
-   * inner bounds.
+   * The current span along X_AXIS or Y_AXIS.
*/
-  int[] offsetsX;

[cp-patches] FYI: BasicTextUI fixlet

2006-02-09 Thread Roman Kennke
While hacking on text stuff and observing Sun's behaviour I noticed that
View.setSize() is always called before paint() by the RootView. That
makes sense, that makes sure that the layout of a view hierarchy is
updated correctly before painting anything.

2006-02-09  Roman Kennke  <[EMAIL PROTECTED]>

* javax/swing/plaf/basic/BasicTextUI.java
(RootView.paint): Call setSize() before painting the view.

/Roman
Index: javax/swing/plaf/basic/BasicTextUI.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicTextUI.java,v
retrieving revision 1.66
diff -u -r1.66 BasicTextUI.java
--- javax/swing/plaf/basic/BasicTextUI.java	7 Feb 2006 15:34:29 -	1.66
+++ javax/swing/plaf/basic/BasicTextUI.java	9 Feb 2006 13:55:35 -
@@ -246,7 +246,11 @@
 public void paint(Graphics g, Shape s)
 {
   if (view != null)
-view.paint(g, s);
+{
+  Rectangle b = s.getBounds();
+  view.setSize(b.width, b.height);
+  view.paint(g, s);
+}
 }
 
 


[cp-patches] RFC: GtkScrollbarPeer min == max

2006-02-09 Thread Mark Wielaard
Hi,

gtk_range_set_range doesn't allow setting min == max. But Scrollbar does
allow that. The following patch makes sure that we set max to be bigger
than min and make sure that the page_size is at least max - min so to
the user it just looks like a scrollbar that cannot be adjusted (this
works because the actual max value of the scrollbar is max - page_size).

2006-02-09  Mark Wielaard  <[EMAIL PROTECTED]>

* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollbarPeer.c
(Java_gnu_java_awt_peer_gtk_GtkScrollbarPeer_create): Make sure max is
creater than min, adjusting page_size if necessary.
(Java_gnu_java_awt_peer_gtk_GtkScrollbarPeer_setValues): Likewise.

Does this look sane?

Cheers,

Mark
? native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c.unlocked
Index: native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollbarPeer.c
===
RCS file: /cvsroot/classpath/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollbarPeer.c,v
retrieving revision 1.2
diff -u -r1.2 gnu_java_awt_peer_gtk_GtkScrollbarPeer.c
--- native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollbarPeer.c	14 Jul 2005 22:07:02 -	1.2
+++ native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollbarPeer.c	9 Feb 2006 12:37:22 -
@@ -86,6 +86,14 @@
 
   gdk_threads_enter ();
 
+  /* A little hack because gtk_range_set_range() doesn't allow min == max. */
+  if (min == max)
+{
+  if (visible_amount == 0)
+	visible_amount = 1;
+  max++;
+}
+
   adj = gtk_adjustment_new ((gdouble) value,
 (gdouble) min,
 (gdouble) max,
@@ -181,6 +189,14 @@
 
   gdk_threads_enter ();
 
+  /* A little hack because gtk_range_set_range() doesn't allow min == max. */
+  if (min == max)
+{
+  if (visible == 0)
+	visible = 1;
+  max++;
+}
+
   adj = gtk_range_get_adjustment (GTK_RANGE (ptr));
   adj->page_size = (gdouble) visible;
 


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


[cp-patches] FYI: Added ASN.1 encoding/decoding support to RSA keys

2006-02-09 Thread Raif S. Naffah
hello there,

the attached patch --already committed-- adds ASN.1 encoding and 
decoding capabilities to the RSA key-pair implementation.

2006-02-09  Raif S. Naffah  <[EMAIL PROTECTED]>

* gnu/java/security/key/rsa/RSAKeyPairX509Codec.java: New file.
* gnu/java/security/key/rsa/RSAKeyPairPKCS8Codec.java: Likewise.
* gnu/java/security/key/rsa/RSAKeyPairGenerator.java
(PREFERRED_ENCODING_FORMAT): New constant.
(DEFAULT_ENCODING_FORMAT): Likewise.
(preferredFormat): New field.
(setup): Add support for preferred encoding format.
(generate): Call key constructors with explicit format identifier.
* gnu/java/security/key/rsa/GnuRSAPublicKey.java (GnuRSAPublicKey(2)): 
Call constructor with 3 arguments..
(GnuRSAPublicKey(3)): New constructor.
(valueOf): Added support for ASN.1 format.
(getEncoded): Likewise.
* gnu/java/security/key/rsa/GnuRSAPrivateKey.java 
(GnuRSAPrivateKey(4)):
Call constructor with 5 arguments.
(GnuRSAPrivateKey(5)): New constructor.
(GnuRSAPrivateKey(9)): New constructor.
(valueOf): Added support for ASN.1 format.
(getEncoded): Likewise.
* gnu/java/security/key/rsa/GnuRSAKey.java (defaultFormat): New field.
(GnuRSAKey): Modified constructor.
(getFormat): Return preferred format identifier.
* gnu/java/security/key/dss/DSSKeyPairPKCS8Codec.java
(decodePrivateKey): Fixed documentation.
Check Version field.
* gnu/java/security/jce/sig/RSAKeyPairGeneratorSpi.java
(initialize(int,SecureRandom)): Set ASN.1 as the preferred encoding
format.
(initialize(AlgorithmParameterSpec,SecureRandom)): Likewise.
* gnu/java/security/jce/sig/EncodedKeyFactory.java
(engineGeneratePublic): Added support for RSA.
(engineGeneratePrivate): Likewise.


cheers;
rsn
Index: EncodedKeyFactory.java
===
RCS file: /cvsroot/classpath/classpath/gnu/java/security/jce/sig/EncodedKeyFactory.java,v
retrieving revision 1.1
diff -u -r1.1 EncodedKeyFactory.java
--- EncodedKeyFactory.java	7 Feb 2006 12:06:48 -	1.1
+++ EncodedKeyFactory.java	9 Feb 2006 11:45:50 -
@@ -41,6 +41,8 @@
 import gnu.java.security.Registry;
 import gnu.java.security.key.dss.DSSPrivateKey;
 import gnu.java.security.key.dss.DSSPublicKey;
+import gnu.java.security.key.rsa.GnuRSAPrivateKey;
+import gnu.java.security.key.rsa.GnuRSAPublicKey;

 import java.security.InvalidKeyException;
 import java.security.InvalidParameterException;
@@ -79,7 +81,14 @@
   {
   }

-// FIXME: try RSA
+// try RSA
+try
+{
+  return GnuRSAPublicKey.valueOf(input);
+}
+  catch (InvalidParameterException ignored)
+{
+}

 // FIXME: try DH

@@ -103,7 +112,14 @@
   {
   }

-// FIXME: try RSA
+// try RSA
+try
+{
+  return GnuRSAPrivateKey.valueOf(input);
+}
+  catch (InvalidParameterException ignored)
+{
+}

 // FIXME: try DH

Index: RSAKeyPairGeneratorSpi.java
===
RCS file: /cvsroot/classpath/classpath/gnu/java/security/jce/sig/RSAKeyPairGeneratorSpi.java,v
retrieving revision 1.1
diff -u -r1.1 RSAKeyPairGeneratorSpi.java
--- RSAKeyPairGeneratorSpi.java	26 Jan 2006 02:25:10 -	1.1
+++ RSAKeyPairGeneratorSpi.java	9 Feb 2006 11:46:24 -
@@ -1,4 +1,4 @@
-/* RSAKeyPairGeneratorSpi.java --
+/* RSAKeyPairGeneratorSpi.java -- JCE RSA KeyPairGenerator Adapter
Copyright (C) 2001, 2002, 2006 Free Software Foundation, Inc.

 This file is a part of GNU Classpath.
@@ -84,6 +84,8 @@
 attributes.put(RSAKeyPairGenerator.SOURCE_OF_RANDOMNESS, random);
   }

+attributes.put(RSAKeyPairGenerator.PREFERRED_ENCODING_FORMAT,
+   new Integer(Registry.ASN1_ENCODING_ID));
 adaptee.setup(attributes);
   }

@@ -106,6 +108,8 @@
 attributes.put(RSAKeyPairGenerator.SOURCE_OF_RANDOMNESS, random);
   }

+attributes.put(RSAKeyPairGenerator.PREFERRED_ENCODING_FORMAT,
+   new Integer(Registry.ASN1_ENCODING_ID));
 adaptee.setup(attributes);
   }
 }
Index: DSSKeyPairPKCS8Codec.java
===
RCS file: /cvsroot/classpath/classpath/gnu/java/security/key/dss/DSSKeyPairPKCS8Codec.java,v
retrieving revision 1.1
diff -u -r1.1 DSSKeyPairPKCS8Codec.java
--- DSSKeyPairPKCS8Codec.java	7 Feb 2006 12:06:48 -	1.1
+++ DSSKeyPairPKCS8Codec.java	9 Feb 2006 11:46:50 -
@@ -177,7 +177,7 @@

   /**
* @param input the byte array to unmarshall into a valid DSS
-   *  [EMAIL PROTECTED] PublicKey} instance. MUST NOT be null.
+   *  [EMAIL PROTECTED] PrivateKey} instance. MUST NOT be null.
* @return a new instance of a [EMAIL PROTECTED] DSSPrivateKey} decoded from the
* PrivateKeyInfo material fed as inp

Re: [cp-patches] RFC: Adding missing IllegalState and null value checks to HTTPURLConnection

2006-02-09 Thread Wolfgang Baer
Wolfgang Baer wrote:
> Hi,
> 
> this patch adds missing checks for "already connected" and a special treatment
> of null in getRequestProperty. This makes the yesterday committed mauve
> testcases  illegalStateException and nullPointerException and
> getRequestProperty pass.
> 
> 2006-02-05  Wolfgang Baer  <[EMAIL PROTECTED]>
> 
>   * java/net/URLConnection.java:
>   (setAllowUserInteraction): Throw IllegalStateException if connected.
>   (getRequestProperty): Document return value if key is null.
>   * gnu/java/net/protocol/http/HTTPURLConnection.java:
>   (getRequestProperty): Return null if key is null.
>   (getRequestProperties): Throw IllegalStateException if connected.
>   (setRequestProperty): Call super method for exception tests.
>   (addRequestProperty): Likewise.
> 

Committed without changes (except changelog date)

Wolfgang



Re: [cp-patches] RFC: Remove default 'Expect 100-continue' usage in HTTP Requests

2006-02-09 Thread Wolfgang Baer
Wolfgang Baer wrote:
> Hi,
> 
> this patch removes the default 'Expect 100-continue' usage if the content
> length exceeds a certain treshold (by default 4096 bytes). There is still
> support that user intended 'Expect 100-continue' headers will work. The
> background for this patch was explained in another thread:
> 
> http://thread.gmane.org/gmane.comp.java.classpath.patches/6658
> 
> I verified that SUN also never uses 'Expect 100-continue' without user 
> setting.
> 
> The change makes a field and its setter method useless and they are removed.
> 
> 2006-02-03  Wolfgang Baer  <[EMAIL PROTECTED]>
> 
>   * gnu/java/net/protocol/http/Request.java:
>   (Request): Remove initialization of removed field.
>   (requestBodyNegotiationThreshold): Removed now unused field.
>   (setRequestBodyNegotiationThreshold): Remove now unused method.
>   (dispatch): Do not use 'Expect 100-continue' header if content-length
>   is over a treshold. If user specified 'Expect 100-continue' still
>   initialize the expectingContinue variable.
> 
> OK to commit ?

Committed without changes (except changelog date), as nothing else came up
and David's only concern with the equals comparision was resolved.

Wolfgang