Re: [cp-patches] RFC: NIO, Non-blocking Scatter/Gather (Again)

2006-04-06 Thread Mark Wielaard
Hi Michael,

On Mon, 2006-03-27 at 14:42 +0100, Michael Barker wrote:
 Another punt at the Non-blocking IO and Scatter/Gather stuff.  This
 patch also adds scatter/gather support to the FileChannelImpl.

 ChangeLog:
 
 2006-03-19  Michael Barker [EMAIL PROTECTED]
   
   * vm/reference/gnu/java/nio/VMChannel.java: Added, supports setting 
   non-blocking and scatter-gather io operations.
   * gnu/java/nio/PipeImpl.java: Retrofitted to use VMChannel
   * gnu/java/nio/SelectorImpl.java
   (register) Added condition for
 gnu.java.nio.SocketChannelSelectionKeyImpl
   * gnu/java/nio/SocketChannelSelectionKeyImpl.java Added.
   * gnu/java/nio/channels/FileChannelImpl.java: Retrofitted to use
 VMChannel
   * java/nio/FileChannel.java
   (read (ByteBuffer)) Changed to call abstract method.
   (write (ByteBuffer)) Changed to call abstract method.
   * include/gnu_java_nio_VMChannel.h: Added.
   * native/jni/java-nio/gnu_java_nio_VMChannel.c: Added.

My apologies for forgetting this patch. I'll try to look at it asap.
Clearly we don't have much other hackers working on nio at this time
(even though we have some bugs in this area). If someone else has time
and can go over this patch that would be appreciated (it has been a
while since I last looked at nio). Michael also already has paperwork on
file with the FSF. So if this is good we can immediately use it.

Michael, do you have some test programs that use this functionality
around?

Thanks,

Mark


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


[cp-patches] FYI: Reverse JAPI fixes for javax.xml.*

2006-04-06 Thread Wolfgang Baer
Hi,

subject says it all.

2006-04-06  Wolfgang Baer  [EMAIL PROTECTED]

* javax/xml/validation/SchemaFactory.java: Corrected since tag.
(getErrorHandler): Made method abstract.
(setErrorHanlder): Likewise.
* gnu/xml/validation/relaxng/RELAXNGSchemaFactory.java
(getErrorHandler): Implement abstract method from superclass.
(setErrorHandler): Likewise.
(errorHandler): New field.
* gnu/xml/validation/xmlschema/XMLSchemaSchemaFactory.java: 
(getErrorHandler): Implement abstract method from superclass.
(setErrorHandler): Likewise.
(errorHandler): New field.  
* javax/xml/XMLConstants.java: Corrected since tag.
(XMLConstants): Added private constructor.
* javax/xml/datatype/Duration.java: Corrected since tag.
(multiply): Made method abstract.
* javax/xml/datatype/DatatypeConstants.java: Corrected since tag.
(DatatypeConstants): Added private constructor.
* javax/xml/xpath/XPathConstants.java: Corrected since tag.
(XPathConstants): Added private constructor.

Wolfgang

Index: javax/xml/XMLConstants.java
===
RCS file: /cvsroot/classpath/classpath/javax/xml/XMLConstants.java,v
retrieving revision 1.3
diff -u -r1.3 XMLConstants.java
--- javax/xml/XMLConstants.java	2 Jul 2005 20:32:52 -	1.3
+++ javax/xml/XMLConstants.java	3 Apr 2006 13:43:07 -
@@ -1,5 +1,5 @@
 /* XMLConstants.java -- 
-   Copyright (C) 2004, 2005  Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005, 2006  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -41,10 +41,15 @@
  * Repository for well-known XML constants.
  *
  * @author (a href='mailto:[EMAIL PROTECTED]'Chris Burdess/a)
- * @since 1.3
+ * @since 1.5
  */
 public final class XMLConstants
 {
+  
+  private XMLConstants()
+  {
+// to prevent instantiation
+  }
 
   /**
* Dummy namespace URI indicating that there is no namespace.
Index: javax/xml/xpath/XPathConstants.java
===
RCS file: /cvsroot/classpath/classpath/javax/xml/xpath/XPathConstants.java,v
retrieving revision 1.3
diff -u -r1.3 XPathConstants.java
--- javax/xml/xpath/XPathConstants.java	2 Jul 2005 20:32:52 -	1.3
+++ javax/xml/xpath/XPathConstants.java	3 Apr 2006 13:43:07 -
@@ -1,5 +1,5 @@
 /* XPathConstants.java -- 
-   Copyright (C) 2004, 2005  Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005, 2006  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -43,10 +43,14 @@
  * XPath constants.
  *
  * @author (a href='mailto:[EMAIL PROTECTED]'Chris Burdess/a)
- * @since 1.3
+ * @since 1.5
  */
 public class XPathConstants
 {
+  private XPathConstants()
+  {
+// to prevent instantiation
+  }
 
   /**
* The XPath 1.0 number data type.
Index: javax/xml/validation/SchemaFactory.java
===
RCS file: /cvsroot/classpath/classpath/javax/xml/validation/SchemaFactory.java,v
retrieving revision 1.4
diff -u -r1.4 SchemaFactory.java
--- javax/xml/validation/SchemaFactory.java	3 Mar 2006 19:19:02 -	1.4
+++ javax/xml/validation/SchemaFactory.java	3 Apr 2006 13:43:07 -
@@ -1,5 +1,5 @@
 /* SchemaFactory.java -- 
-   Copyright (C) 2004, 2005  Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005, 2006  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -52,13 +52,10 @@
  * Factory for obtaining schemata.
  *
  * @author Chris Burdess ([EMAIL PROTECTED])
- * @since 1.3
+ * @since 1.5
  */
 public abstract class SchemaFactory
 {
-
-  ErrorHandler errorHandler;
-
   protected SchemaFactory()
   {
   }
@@ -109,15 +106,9 @@
 throw new SAXNotRecognizedException(name);
   }
   
-  public ErrorHandler getErrorHandler()
-  {
-return errorHandler;
-  }
+  public abstract ErrorHandler getErrorHandler();
   
-  public void setErrorHandler(ErrorHandler errorHandler)
-  {
-this.errorHandler = errorHandler;
-  }
+  public abstract void setErrorHandler(ErrorHandler errorHandler);
 
   public abstract LSResourceResolver getResourceResolver();
 
Index: javax/xml/datatype/DatatypeConstants.java
===
RCS file: /cvsroot/classpath/classpath/javax/xml/datatype/DatatypeConstants.java,v
retrieving revision 1.3
diff -u -r1.3 DatatypeConstants.java
--- javax/xml/datatype/DatatypeConstants.java	2 Jul 2005 20:32:52 -	1.3
+++ javax/xml/datatype/DatatypeConstants.java	3 Apr 2006 13:43:07 -
@@ -1,5 +1,5 @@
 /* DatatypeConstants.java -- 
-   Copyright (C) 2004, 2005  Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005, 2006  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -43,11 +43,16 @@
  * Basic data type constants.
  *
  * @author (a href='mailto:[EMAIL PROTECTED]'Chris Burdess/a)
- * 

[cp-patches] FYI: Serialization fixlet for javax.naming.directory.BasicAttribute(s)

2006-04-06 Thread Wolfgang Baer
Hi,

this fixes the serialization issues reported. I will go later through
the remaining stuff of javax.naming.* to fix some more serialization stuff.

2006-04-06  Wolfgang Baer  [EMAIL PROTECTED]

Fixes bug #26995
* javax/naming/directory/BasicAttribute.java,
* javax/naming/directory/BasicAttributes.java:
(readObject): New deserialization method.
(writeObject): New serialization method.

Wolfgang

Index: javax/naming/directory/BasicAttribute.java
===
RCS file: /cvsroot/classpath/classpath/javax/naming/directory/BasicAttribute.java,v
retrieving revision 1.5
diff -u -r1.5 BasicAttribute.java
--- javax/naming/directory/BasicAttribute.java	3 Apr 2006 21:03:49 -	1.5
+++ javax/naming/directory/BasicAttribute.java	6 Apr 2006 09:23:48 -
@@ -1,5 +1,5 @@
 /* BasicAttribute.java --
-   Copyright (C) 2000, 2001, 2004  Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001, 2004, 2006  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -38,6 +38,9 @@
 
 package javax.naming.directory;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
 import java.util.NoSuchElementException;
 import java.util.Vector;
 
@@ -298,7 +301,25 @@
 
 return one.equals (two);
   }
-
+  
+  private void readObject(ObjectInputStream s)
+throws IOException, ClassNotFoundException
+  {
+s.defaultReadObject();
+int size = s.readInt();
+values = new Vector(size);
+for (int i=0; i  size; i++)
+  values.add(s.readObject());
+  }
+
+  private void writeObject(ObjectOutputStream s) throws IOException
+  {
+s.defaultWriteObject();
+s.writeInt(values.size());
+for (int i=0; i  values.size(); i++)
+  s.writeObject(values.get(i));
+  }
+  
   // Used when enumerating this attribute.
   private class BasicAttributeEnumeration implements NamingEnumeration
   {
Index: javax/naming/directory/BasicAttributes.java
===
RCS file: /cvsroot/classpath/classpath/javax/naming/directory/BasicAttributes.java,v
retrieving revision 1.6
diff -u -r1.6 BasicAttributes.java
--- javax/naming/directory/BasicAttributes.java	2 Jul 2005 20:32:45 -	1.6
+++ javax/naming/directory/BasicAttributes.java	6 Apr 2006 09:23:48 -
@@ -1,5 +1,5 @@
 /* BasicAttributes.java --
-   Copyright (C) 2000, 2001, 2004, 2005  Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001, 2004, 2005, 2006  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -38,6 +38,9 @@
 
 package javax.naming.directory;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
 import java.util.NoSuchElementException;
 import java.util.Vector;
 
@@ -196,6 +199,24 @@
   // Package-private to avoid a trampoline.
   transient Vector attributes;
 
+  private void readObject(ObjectInputStream s) throws IOException,
+  ClassNotFoundException
+  {
+s.defaultReadObject();
+int size = s.readInt();
+attributes = new Vector(size);
+for (int i = 0; i  size; i++)
+  attributes.add(s.readObject());
+  }
+
+  private void writeObject(ObjectOutputStream s) throws IOException
+  {
+s.defaultWriteObject();
+s.writeInt(attributes.size());
+for (int i = 0; i  attributes.size(); i++)
+  s.writeObject(attributes.get(i));
+  }
+
   // Used when enumerating.
   private class BasicAttributesEnumeration implements NamingEnumeration
   {


[cp-patches] FYI: Component/JComponent fixes

2006-04-06 Thread Roman Kennke
This patch fixes some things in JComponent and Component:
1. yesterday I got confused regarding the handling of the opaque
property wrt the accessibility method getAccessibleStateSet(). As it
turns out, this property is _not_ handled at all in
AccessibleAWTComponent, regardless of the value of the property. It's
only handled by the AccessibleJComponent.getAccessibleStateSet().
Probably that is because only in JComponent this property is a kind of
state that can change.

2. I implemented the remaining stubs in JComponent. These are all
methods that are left over from obsolete/deprecated APIs and only there
for compatibility. I implemented them using the newer APIs. For the
set/getNextFocusableComponent() methods I introduced a new helper class,
that maps this behaviour to a special FocusTraversPolicy.

2006-04-06  Roman Kennke  [EMAIL PROTECTED]

* java/awt/Component.java
(AccessibleAWTComponent.getAccessibleStateSet): Don't handle
opaque
state here. This is only done in JComponent.
* javax/swing/JComponent.java
(AccessibleJComponent.getAccessibleStateSet): Handle opaque flag
here.
(getNextFocusableComponent): Implemented stub method.
(grabFocus): Implemented stub method.
(unregisterKeyboardAction): Implemented stub method.
(setNextFocusableComponent): Implemented stub method.
* javax/swing/CompatibilityFocusTraversalPolicy.java: New file.
This is a helper class for providing compatibility with the
older
Swing focus API.

/Roman

Index: java/awt/Component.java
===
RCS file: /cvsroot/classpath/classpath/java/awt/Component.java,v
retrieving revision 1.111
diff -u -1 -0 -r1.111 Component.java
--- java/awt/Component.java	5 Apr 2006 10:31:26 -	1.111
+++ java/awt/Component.java	6 Apr 2006 10:10:00 -
@@ -5418,22 +5418,24 @@
  */
 public AccessibleStateSet getAccessibleStateSet()
 {
   AccessibleStateSet s = new AccessibleStateSet();
   if (Component.this.isEnabled())
 s.add(AccessibleState.ENABLED);
   if (isFocusable())
 s.add(AccessibleState.FOCUSABLE);
   if (isFocusOwner())
 s.add(AccessibleState.FOCUSED);
-  if (isOpaque())
-s.add(AccessibleState.OPAQUE);
+  // Note: While the java.awt.Component has an 'opaque' property, it
+  // seems that it is not added to the accessible state set here, even
+  // if this property is true. However, it is handled for
+  // javax.swing.JComponent, so we add it there.
   if (Component.this.isShowing())
 s.add(AccessibleState.SHOWING);
   if (Component.this.isVisible())
 s.add(AccessibleState.VISIBLE);
   return s;
 }
 
 /**
  * Returns the parent of this component, if it is accessible.
  *
Index: javax/swing/JComponent.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/JComponent.java,v
retrieving revision 1.113
diff -u -1 -0 -r1.113 JComponent.java
--- javax/swing/JComponent.java	5 Apr 2006 21:45:36 -	1.113
+++ javax/swing/JComponent.java	6 Apr 2006 10:10:00 -
@@ -330,24 +330,28 @@
   return super.getAccessibleChild(i);
 }
 
 /**
  * Returns the accessible state set of this component.
  *
  * @return the accessible state set of this component
  */
 public AccessibleStateSet getAccessibleStateSet()
 {
-  // TODO: The only JComponent property that is (theoretically) handled
-  // here seems to be 'opaque'. However, we already handle this in
-  // AccessibleAWTComponent and do not need to handle it here too.
-  return super.getAccessibleStateSet();
+  // Note: While the java.awt.Component has an 'opaque' property, it
+  // seems that it is not added to the accessible state set there, even
+  // if this property is true. However, it is handled for JComponent, so
+  // we add it here.
+  AccessibleStateSet state = super.getAccessibleStateSet();
+  if (isOpaque())
+state.add(AccessibleState.OPAQUE);
+  return state;
 }
 
 /**
  * Returns the localized name for this object. Generally this should
  * almost never return [EMAIL PROTECTED] Component#getName()} since that is not
  * a localized name. If the object is some kind of text component (like
  * a menu item), then the value of the object may be returned. Also, if
  * the object has a tooltip, the value of the tooltip may also be
  * appropriate.
  *
@@ -1386,21 +1390,26 @@
   /**
* Return the value of the codenextFocusableComponent/code property.
*
* @return The current value of the property, or codenull/code
* if none has been set.
* 
* @deprecated See [EMAIL PROTECTED] java.awt.FocusTraversalPolicy}
*/
   public Component getNextFocusableComponent()
   {
-return null;
+Container focusRoot = 

Re: [cp-patches] RFC: Path canonicalizer

2006-04-06 Thread Gary Benson
Tom Tromey wrote:
  Mark == Mark Wielaard [EMAIL PROTECTED] writes:
 
 Mark It does look good to me. But in theory the usage of PATH_MAX
 Mark PATH_MAX might be a problem.
 
 Yeah, this famously is not defined in Hurd.
 
 Do we really need a limit here?  Can't we just resize the buffer
 dynamically as needed?

It's possible, I suppose, but it seems over-complex when libgcj
manages to sidestep the PATH_MAX thing just fine with:

  #ifndef MAXPATHLEN
   #define MAXPATHLEN 4096
  #endif

Also, aren't malloc/realloc and friends slow calls?

Cheers,
Gary



Re: [cp-patches] RFC: Path canonicalizer

2006-04-06 Thread Gary Benson
Mark Wielaard wrote:
 ...I assume this is normally called on absolute paths that are
 already in canonical form.

Not necessarily.  For example, the way JPackage makes Tomcat FHS
compliant (with symlinks all over the place) means that just about
every FilePermission check will involve following links.

Cheers,
Gary



[cp-patches] FYI: AccessibleAbstractButton

2006-04-06 Thread Roman Kennke
I implemented some more stubs in the AccessibleAbstractButton.

2006-04-06  Roman Kennke  [EMAIL PROTECTED]

* javax/swing/AbstractButton.java
(AccessibleAbstractButton.getAccessibleIcon): Implemented stub.
(AccessibleAbstractButton.getAccessibleRelationSet): Implemented
stub.
(AccessibleAbstractButton.getIndexAtPoint): Implemented stub.
(AccessibleAbstractButton.getAccessibleIcon): Implemented stub.
(AccessibleAbstractButton.getCharacterBounds): Implemented stub.
(AccessibleAbstractButton.getCharCount): Implemented stub.
(AccessibleAbstractButton.getCaretPosition): Implemented stub.
(AccessibleAbstractButton.getCharacterAttribute): Implemented
stub.
(AccessibleAbstractButton.getSelectionStart): Implemented stub.
(AccessibleAbstractButton.getSelectionEnd): Implemented stub.
(AccessibleAbstractButton.getSelectedText): Implemented stub.
(AccessibleAbstractButton.getTextRectangle): Removed unneeded
private method.

/Roman

Index: javax/swing/AbstractButton.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/AbstractButton.java,v
retrieving revision 1.55
diff -u -1 -0 -r1.55 AbstractButton.java
--- javax/swing/AbstractButton.java	5 Apr 2006 21:52:23 -	1.55
+++ javax/swing/AbstractButton.java	6 Apr 2006 10:42:32 -
@@ -38,41 +38,49 @@
 package javax.swing;
 
 import gnu.classpath.NotImplementedException;
 
 import java.awt.Graphics;
 import java.awt.Image;
 import java.awt.Insets;
 import java.awt.ItemSelectable;
 import java.awt.Point;
 import java.awt.Rectangle;
+import java.awt.Shape;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.awt.event.ItemEvent;
 import java.awt.event.ItemListener;
 import java.awt.image.ImageObserver;
 import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
 import java.io.Serializable;
+import java.util.Enumeration;
 
+import javax.accessibility.Accessible;
 import javax.accessibility.AccessibleAction;
+import javax.accessibility.AccessibleContext;
 import javax.accessibility.AccessibleIcon;
+import javax.accessibility.AccessibleRelation;
 import javax.accessibility.AccessibleRelationSet;
 import javax.accessibility.AccessibleState;
 import javax.accessibility.AccessibleStateSet;
 import javax.accessibility.AccessibleText;
 import javax.accessibility.AccessibleValue;
 import javax.swing.event.ChangeEvent;
 import javax.swing.event.ChangeListener;
 import javax.swing.plaf.ButtonUI;
 import javax.swing.plaf.basic.BasicHTML;
 import javax.swing.text.AttributeSet;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.Position;
+import javax.swing.text.View;
 
 
 /**
  * Provides an abstract implementation of common button behaviour,
  * data model and look amp; feel.
  *
  * pThis class is supposed to serve as a base class for
  * several kinds of buttons with similar but non-identical semantics:
  * toggle buttons (radio buttons and checkboxes), simple push buttons,
  * menu items, etc./p
@@ -455,31 +463,75 @@
  * Returns the accessible name for the button.
  */
 public String getAccessibleName()
 {
   String result = super.getAccessibleName();
   if (result == null)
 result = text;
   return result;
 }
 
+/**
+ * Returns the accessible icons of this object. If the AbstractButton's
+ * icon is an Accessible, and it's AccessibleContext is an AccessibleIcon,
+ * then this AccessibleIcon is returned, otherwise codenull/code.
+ *
+ * @return the accessible icons of this object, or codenull/code if
+ * there is no accessible icon
+ */
 public AccessibleIcon[] getAccessibleIcon()
-  throws NotImplementedException
 {
-  return null; // TODO
+  AccessibleIcon[] ret = null;
+  Icon icon = getIcon();
+  if (icon instanceof Accessible)
+{
+  AccessibleContext ctx = ((Accessible) icon).getAccessibleContext();
+  if (ctx instanceof AccessibleIcon)
+{
+  ret = new AccessibleIcon[]{ (AccessibleIcon) ctx };
+}
+}
+  return ret;
 }
 
+/**
+ * Returns the accessible relations of this AccessibleAbstractButton.
+ * If the AbstractButton is part of a ButtonGroup, then all the buttons
+ * in this button group are added as targets in a MEMBER_OF relation,
+ * otherwise an empty relation set is returned (from super).
+ *
+ * @return the accessible relations of this AccessibleAbstractButton
+ */
 public AccessibleRelationSet getAccessibleRelationSet()
-  throws NotImplementedException
 {
-  // TODO: What should be modified here?
-  return super.getAccessibleRelationSet();
+  AccessibleRelationSet relations = super.getAccessibleRelationSet();
+  ButtonModel model = getModel();
+  if (model 

[cp-patches] FYI: Accessibility initialization

2006-04-06 Thread Roman Kennke
The attached patch enables the initialization of assistive technologies
via the documented system property
javax.accessibility.assistive_technologies. This property holds a comma
separated list of classes that are loaded when the AWT Toolkit is first
initialized. Alternativly, this system property can be read from
~/.accessibility.properties of
$(JAVA_HOME)/lib/accessibility.properties. In this case the prefix
javax.accessibility. must not be specified.

This code also loads the properties screen_magnifier_present and
screen_reader_present from the config files and sets the system
properties appropriately, so that other (application) classes can make
use of them.

2006-04-06  Roman Kennke  [EMAIL PROTECTED]

* java/awt/Toolkit.java
(getDefaultToolkit): Initialize accessibility after setting
up the toolkit.
(initAccessibility): New helper method to setup accessibility.

/Roman

Index: java/awt/Toolkit.java
===
RCS file: /cvsroot/classpath/classpath/java/awt/Toolkit.java,v
retrieving revision 1.36
diff -u -1 -0 -r1.36 Toolkit.java
--- java/awt/Toolkit.java	9 Mar 2006 21:29:58 -	1.36
+++ java/awt/Toolkit.java	6 Apr 2006 12:08:42 -
@@ -32,20 +32,21 @@
 independent module, the terms and conditions of the license of that
 module.  An independent module is a module which is not derived from
 or based on this library.  If you modify this library, you may extend
 this exception to your version of the library, but you are not
 obligated to do so.  If you do not wish to do so, delete this
 exception statement from your version. */
 
 
 package java.awt;
 
+import gnu.classpath.SystemProperties;
 import gnu.java.awt.peer.GLightweightPeer;
 
 import java.awt.datatransfer.Clipboard;
 import java.awt.dnd.DragGestureEvent;
 import java.awt.dnd.DragGestureListener;
 import java.awt.dnd.DragGestureRecognizer;
 import java.awt.dnd.DragSource;
 import java.awt.dnd.peer.DragSourceContextPeer;
 import java.awt.event.AWTEventListener;
 import java.awt.event.AWTEventListenerProxy;
@@ -71,24 +72,29 @@
 import java.awt.peer.MenuPeer;
 import java.awt.peer.PanelPeer;
 import java.awt.peer.PopupMenuPeer;
 import java.awt.peer.ScrollPanePeer;
 import java.awt.peer.ScrollbarPeer;
 import java.awt.peer.TextAreaPeer;
 import java.awt.peer.TextFieldPeer;
 import java.awt.peer.WindowPeer;
 import java.beans.PropertyChangeListener;
 import java.beans.PropertyChangeSupport;
+import java.io.File;
+import java.io.FileInputStream;
 import java.net.URL;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.util.ArrayList;
 import java.util.Map;
 import java.util.Properties;
+import java.util.StringTokenizer;
 
 /**
  * The AWT system uses a set of native peer objects to implement its
  * widgets.  These peers are provided by a peer toolkit, that is accessed
  * via a subclass of this superclass.  The system toolkit is retrieved
  * by the static methods codegetDefaultToolkit/code.  This method
  * determines the system toolkit by examining the system property
  * codeawt.toolkit/code.  That property is set to the name of the
  * codeToolkit/code subclass for the specified peer set.  If the
  * codeawt.toolkit/code property is not set, then the default
@@ -528,20 +534,22 @@
 String toolkit_name = System.getProperty(awt.toolkit,
  default_toolkit_name);
 try
   {
 Class cls = Class.forName(toolkit_name);
 Object obj = cls.newInstance();
 if (!(obj instanceof Toolkit))
   throw new AWTError(toolkit_name +  is not a subclass of  +
  java.awt.Toolkit);
 toolkit = (Toolkit) obj;
+
+initAccessibility();
 return toolkit;
   }
 catch (ThreadDeath death)
   {
 throw death;
   }
 catch (Throwable t)
   {
 	AWTError e = new AWTError(Cannot load AWT toolkit:  + toolkit_name);
 	throw (AWTError) e.initCause(t);
@@ -1208,11 +1216,145 @@
 AWTEventListenerProxy proxy = awtEventListeners[i];
 if ((proxy.getEventMask()  AWTEvent.eventIdToMask(ev.getID())) != 0)
   proxy.eventDispatched(ev);
   }
   }
 
   /**
* @since 1.3
*/
   public abstract Map mapInputMethodHighlight(InputMethodHighlight highlight);
+
+  /**
+   * Initializes the accessibility framework. In particular, this loads the
+   * properties javax.accessibility.screen_magnifier_present and
+   * javax.accessibility.screen_reader_present and loads
+   * the classes specified in javax.accessibility.assistive_technologies.
+   */
+  private static void initAccessibility()
+  {
+AccessController.doPrivileged
+(new PrivilegedAction()
+ {
+   public Object run()
+   {
+ Properties props = new Properties();
+ String sep = File.separator;
+
+ // Try the user configuration.
+ try
+   {
+ File 

[cp-patches] FYI: No getClassLoader() security check for bootstrap classes

2006-04-06 Thread Mark Wielaard
Hi,

While playing a bit with the next security manager I noticed it didn't
except a security check on getClassLoader() when it would return null
(for bootstrap classes). This seems consistent with our documentation.
And it makes sense since we are not giving the caller anything they can
actually use (forName() will do a security check when given a null
loader).

2006-04-06  Mark Wielaard  [EMAIL PROTECTED]

* java/lang/Class.java (getClassLoader): Don't do security check
when loader is null.

I also added a Mauve check for this.

Committed,

Mark

 diff -u -r1.45 Class.java
 --- java/lang/Class.java5 Apr 2006 09:32:44 -   1.45
 +++ java/lang/Class.java6 Apr 2006 12:59:15 -
 @@ -264,7 +264,7 @@
  ClassLoader loader = VMClass.getClassLoader(this);
  // Check if we may get the classloader
  SecurityManager sm = SecurityManager.current;
 -if (sm != null)
 +if (loader != null  sm != null)
{
  // Get the calling classloader
 ClassLoader cl = VMStackWalker.getCallingClassLoader();


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


Re: [cp-patches] RFC: NIO, Non-blocking Scatter/Gather (Again)

2006-04-06 Thread Michael Barker
On Thu, 2006-04-06 at 09:26 +0200, Mark Wielaard wrote:
 My apologies for forgetting this patch. I'll try to look at it asap.

No worries.

 Michael, do you have some test programs that use this functionality
 around?

I have some mauve tests that covers most of it.  There are a few edge
cases that I might not of covered yet.

Mike.






Re: [cp-patches] FYI: Accessibility initialization

2006-04-06 Thread Tom Tromey
 Roman == Roman Kennke [EMAIL PROTECTED] writes:

Roman Alternativly, this system property can be read from
Roman ~/.accessibility.properties

Is this a JDK-specified location?
Otherwise, what about putting it in $HOME/.classpath?  That is where
the current prefs are stored... it would be nice to have a policy for
this FWIW.

Roman + File propsFile = new 
File(System.getProperty(java.home)
Roman +   + sep + lib + sep
Roman +   + 
accessibility.properties);

We've got the gnu.classpath.home.url property for this kind of
thing.  It is a URL that by default points to file://$JAVA_HOME/lib.

Tom



Re: [cp-patches] RFC: Path canonicalizer

2006-04-06 Thread Tom Tromey
 Gary == Gary Benson [EMAIL PROTECTED] writes:

Gary It's possible, I suppose, but it seems over-complex when libgcj
Gary manages to sidestep the PATH_MAX thing just fine with:
Gary   #ifndef MAXPATHLEN
Gary#define MAXPATHLEN 4096
Gary   #endif

Yeah, I suppose so.

Gary Also, aren't malloc/realloc and friends slow calls?

Not compared to readlink.

Tom



Re: [cp-patches] Patch: X500Principal fixlet

2006-04-06 Thread Tom Tromey
 Nektarios == Nektarios K Papadopoulos [EMAIL PROTECTED] writes:

Nektarios A small fix for the readAttributeValue

Thanks for the patch.  I checked it in.

Tom



[cp-patches] FYI: Serialization fixlet javax.naming

2006-04-06 Thread Wolfgang Baer
Hi,

I have checked all the classes of the javax.naming subpackages and
found one more serialization problem which is fixed by this patch.

2006-04-06  Wolfgang Baer  [EMAIL PROTECTED]

* javax/naming/CompositeName.java:
(readObject): New deserialization method.
(writeObject): New serialization method.

Wolfgang

Index: javax/naming/CompositeName.java
===
RCS file: /cvsroot/classpath/classpath/javax/naming/CompositeName.java,v
retrieving revision 1.4
diff -u -r1.4 CompositeName.java
--- javax/naming/CompositeName.java	2 Jul 2005 20:32:45 -	1.4
+++ javax/naming/CompositeName.java	6 Apr 2006 17:58:56 -
@@ -1,5 +1,5 @@
 /* CompositeName.java --
-   Copyright (C) 2001, 2005  Free Software Foundation, Inc.
+   Copyright (C) 2001, 2005, 2006  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -38,6 +38,9 @@
 
 package javax.naming;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
 import java.io.Serializable;
 import java.util.Enumeration;
 import java.util.NoSuchElementException;
@@ -45,10 +48,6 @@
 
 /**
  * @author Tom Tromey ([EMAIL PROTECTED])
- * @date May 16, 2001
- *
- * FIXME: must write readObject and writeObject to conform to
- * serialization spec.
  */
 public class CompositeName implements Name, Cloneable, Serializable
 {
@@ -316,6 +315,22 @@
   }
 return result.toString ();
   }
+  
+  private void readObject(ObjectInputStream s) 
+throws IOException, ClassNotFoundException
+  {
+int size = s.readInt();
+elts = new Vector(size);
+for (int i = 0; i  size; i++)
+  elts.add(s.readObject());
+  }
+
+  private void writeObject(ObjectOutputStream s) throws IOException
+  {
+s.writeInt(elts.size());
+for (int i = 0; i  elts.size(); i++)
+  s.writeObject(elts.get(i));
+  }
 
   private transient Vector elts;
 }


[cp-patches] FYI: Documentation and new methods in javax.naming.NameClassPair

2006-04-06 Thread Wolfgang Baer
Hi all,

checking for serialization issues I found that javax/naming/NameClassPair.java
has two new methods in 1.5. I added them and wrote api docs for this simple
class and its subclass.


2006-04-06  Wolfgang Baer  [EMAIL PROTECTED]

* javax/naming/Binding.java: Added API docs.
* javax/naming/NameClassPair.java: Added API docs.
(fullName): New field.
(setNameInNamespace): New 1.5 method.
(getNameInNamespace): Likewise.

Wolfgang

Index: javax/naming/NameClassPair.java
===
RCS file: /cvsroot/classpath/classpath/javax/naming/NameClassPair.java,v
retrieving revision 1.4
diff -u -r1.4 NameClassPair.java
--- javax/naming/NameClassPair.java	3 Mar 2006 22:50:55 -	1.4
+++ javax/naming/NameClassPair.java	6 Apr 2006 18:10:01 -
@@ -41,18 +41,43 @@
 import java.io.Serializable;
 
 /**
+ * codeNameClassPair/code represents the name-classname mapping pair 
+ * of a binding in a context.
+ * p
+ * Bindings are mappings of a name to an object and this class is used to
+ * specify the mapping of the name to the class type of the bound object.
+ * As classname the fully qualified classname is used.
+ * /p
+ * 
  * @author Tom Tromey ([EMAIL PROTECTED])
- * @date May 16, 2001
+ * @since 1.3
  */
 public class NameClassPair implements Serializable
 {
   private static final long serialVersionUID = 5620776610160863339L;
 
+  /**
+   * Constructs an instance with the given name and classname.
+   * 
+   * @param name the name of the binding relative to the target context
+   * (may not be codenull/code)
+   * @param className the name of the class. If codenull/code the bound
+   * object is also codenull/code
+   */
   public NameClassPair (String name, String className)
   {
 this (name, className, true);
   }
 
+  /**
+   * Constructs an instance with the given name and classname and a 
+   * flag indicating if the name is relative to the target context.
+   * 
+   * @param name the name of the binding (may not be codenull/code)
+   * @param className the name of the class. If codenull/code the bound
+   * object is also codenull/code
+   * @param isRelative flag indicating if the name is relative or not
+   */
   public NameClassPair (String name, String className, boolean isRelative)
   {
 this.name = name;
@@ -60,36 +85,105 @@
 this.isRel = isRelative;
   }
 
+  /**
+   * Returns the classname of the binding.
+   * @return The fully qualified classname or codenull/code if the 
+   * bound object is null.
+   */
   public String getClassName ()
   {
 return className;
   }
 
+  /**
+   * Returns the name of the binding.
+   * @return The name.
+   */
   public String getName ()
   {
 return name;
   }
 
+  /**
+   * Checks whether the name is relative to the target context or not.
+   * @return codetrue/code if the name is relative, 
+   * codefalse/code otherwise.
+   */
   public boolean isRelative ()
   {
 return isRel;
   }
 
+  /**
+   * Sets the classname of the bound object.
+   * @param name the classname to set (maybe codenull/code)
+   */
   public void setClassName (String name)
   {
 this.className = name;
   }
 
+  /**
+   * Sets the name of the binding.
+   * @param name the name to set
+   */
   public void setName (String name)
   {
 this.name = name;
   }
 
+  /**
+   * Sets if the name is relative to the target context.
+   * @param r codetrue/code to mark as relative
+   */
   public void setRelative (boolean r)
   {
 this.isRel = r;
   }
-
+  
+  /**
+   * Sets the full name for this binding. Setting the full name by this 
+   * method is the only way to initialize full names of bindings if 
+   * supported by a specific naming system.
+   * 
+   * @param fullName the full name of this binding. If not set or set to 
+   * codenull/code the codegetNameInNamespace()/code method will
+   * throw an exception
+   * 
+   * @see #getNameInNamespace()
+   * 
+   * @since 1.5
+   */
+  public void setNameInNamespace(String fullName) 
+  {
+this.fullName = fullName;
+  }
+  
+  /**
+   * Returns the full name for this binding. The full name of a binding is
+   * defined as the absolute name in its own namespace and is not valid 
+   * outside.
+   * 
+   * @return The full name in the bindings namespace.
+   * @throws UnsupportedOperationException if no full name is applicable in 
+   * the specific naming system.
+   * 
+   * @see Context#getNameInNamespace()
+   * 
+   * @since 1.5
+   */
+  public String getNameInNamespace()
+  {
+if (this.fullName == null)
+  throw new UnsupportedOperationException();
+
+return this.fullName;
+  }
+
+  /**
+   * Returns the string representation.
+   * @return The string codegetName() + : + getClassName()/code.
+   */
   public String toString ()
   {
 // Specified by class documentation.
@@ -100,4 +194,5 @@
   private String name;
   private String className;
   private boolean isRel;
+  private 

Re: [cp-patches] FYI: Manifest re-factoring

2006-04-06 Thread Mark Wielaard
Hi,

On Wed, 2006-04-05 at 13:42 +0200, Mark Wielaard wrote:
 The usage of util.loggging.Logger in JarUtils which is now used in
 Manifest in combination with the logging cleanup patch seems to have
 broken -jar support in cacao. I do actually think this is a bug in cacao
 which seems to do some nasty trick to use the JarFile class directly
 confusing the logging code and making it unable to find the context
 class loader. But I didn't look very deeply into it.
 
 Christian, you might want to review the cacao -jar option handling since
 other runtimes seem to have no trouble with it.

My apologies. This seems to have been some strange issue with my local
setup. Everything works fine now again. Cacao is great!

Cheers,

Mark


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


Re: [cp-patches] FYI: Accessibility initialization

2006-04-06 Thread Roman Kennke
Am Donnerstag, den 06.04.2006, 11:06 -0600 schrieb Tom Tromey:
  Roman == Roman Kennke [EMAIL PROTECTED] writes:
 
 Roman Alternativly, this system property can be read from
 Roman ~/.accessibility.properties
 
 Is this a JDK-specified location?

I have read about that somewhere, either in the online docs from Sun, or
in the OReilly book. However, I don't really care too much about it, we
can just as well put it into  ~/.classpath/

 Roman + File propsFile = new 
 File(System.getProperty(java.home)
 Roman +   + sep + lib + sep
 Roman +   + 
 accessibility.properties);
 
 We've got the 
-- 
“Improvement makes straight roads, but the crooked roads, without
Improvement, are roads of Genius.” - William Blake


signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil


[cp-patches] FYI: Some more AWT fixlets

2006-04-06 Thread Roman Kennke
I moved the hook to the global event dispatching from
Component.dispatchEventImpl() to Component.dispatchEvent(), so that
subclasses do not override this. This prevented the accessibility
utilities to work correctly, because they missed some Window events.

http://kennke.org/~roman/accessibility-monkey.png

(This is Monkey, one of the accessibility technology examples from Sun's
accessibility utilities, running in the background of the our Swing
demo, on top of Classpath/Free Swing/JamVM. When configured correctly,
this accessibility utility -like any other accessibility technology- is
loaded everytime when a Swing app is fired up.)

So starting with 0.91 we can say to support accessible technologies :-D

I also changed the use of the java.home property to
gnu.classpath.home.url. Thinking about the user configuration thing, it
might be useful to also have such a property like
'gnu.classpath.userconfig' or whatever, that would per default point to
System.getProperty('user.home') (because that's what Sun does afaik, all
XXX.properties files that are in java.home + /lib can be mirrored as
~/.XXX.properties file one a per user level. Having this configurable
like the system configuration directory would be nice for packagers, so
they can change this to /etc/classpath and ~/.classpath or whatever.

2006-04-06  Roman Kennke  [EMAIL PROTECTED]

* java/awt/Toolkit.java
(initAccessibility): Use the 'gnu.classpath.home.url' property
to determine the system confiuration directory.
* java/awt/Component.java
(dispatchEvent): Trigger Toolkit dispatching here.
(dispatchEventImpl): Moved Toolkit dispatching to dispatchEvent,
so it can't be overridden by subclasses and is performed in
any case.

/Roman
-- 
“Improvement makes straight roads, but the crooked roads, without
Improvement, are roads of Genius.” - William Blake
Index: java/awt/Component.java
===
RCS file: /cvsroot/classpath/classpath/java/awt/Component.java,v
retrieving revision 1.112
diff -u -1 -0 -r1.112 Component.java
--- java/awt/Component.java	6 Apr 2006 10:15:34 -	1.112
+++ java/awt/Component.java	6 Apr 2006 20:36:45 -
@@ -2306,20 +2306,24 @@
* /ul
*
* @param e the event to dispatch
*/
   public final void dispatchEvent(AWTEvent e)
   {
 Event oldEvent = translateEvent(e);
 if (oldEvent != null)
   postEvent (oldEvent);
 
+// Give toolkit a chance to dispatch the event
+// to globally registered listeners.
+Toolkit.getDefaultToolkit().globalDispatchEvent(e);
+
 // Some subclasses in the AWT package need to override this behavior,
 // hence the use of dispatchEventImpl().
 dispatchEventImpl(e);
   }
 
   /**
* AWT 1.0 event handler.
*
* This method simply calls handleEvent and returns the result.
*
@@ -5007,24 +5011,20 @@
* translates codee/code to an AWT 1.0 event and sends the
* result to [EMAIL PROTECTED] #postEvent}.  If the AWT 1.0 event is not
* handled, and events of type codee/code are enabled for this
* component, e is passed on to [EMAIL PROTECTED] #processEvent}.
*
* @param e the event to dispatch
*/
 
   void dispatchEventImpl(AWTEvent e)
   {
-// Give toolkit a chance to dispatch the event
-// to globally registered listeners.
-Toolkit.getDefaultToolkit().globalDispatchEvent(e);
-
 // This boolean tells us not to process focus events when the focus
 // opposite component is the same as the focus component.
 boolean ignoreFocus = 
   (e instanceof FocusEvent  
((FocusEvent)e).getComponent() == ((FocusEvent)e).getOppositeComponent());
 
 if (eventTypeEnabled (e.id))
   {
 if (e.id != PaintEvent.PAINT  e.id != PaintEvent.UPDATE
  !ignoreFocus)
Index: java/awt/Toolkit.java
===
RCS file: /cvsroot/classpath/classpath/java/awt/Toolkit.java,v
retrieving revision 1.37
diff -u -1 -0 -r1.37 Toolkit.java
--- java/awt/Toolkit.java	6 Apr 2006 12:10:23 -	1.37
+++ java/awt/Toolkit.java	6 Apr 2006 20:36:46 -
@@ -1252,23 +1252,23 @@
  catch (Exception ex)
{
  // User configuration not present, ignore.
}
 
  // Try the system configuration if there was no user configuration.
  if (props.size() == 0)
{
  try
{
- File propsFile = new File(System.getProperty(java.home)
-   + sep + lib + sep
-   + accessibility.properties);
+ File propsFile =
+   new File(System.getProperty(gnu.classpath.home.url)
++ sep + accessibility.properties);
  FileInputStream in = new FileInputStream(propsFile);
  props.load(in);

[cp-patches] FYI: JRootPane accessibility

2006-04-06 Thread Roman Kennke
The Monkey utility pointed out the the JRootPane doesn't return a valid
AccessibleContext. This patch fixes this:

2006-04-06  Roman Kennke  [EMAIL PROTECTED]

* javax/swing/JRootPane.java
(getAccessibleContext): New method. Provides an
accessibleContext
for JRootPanes.

/Roman

-- 
“Improvement makes straight roads, but the crooked roads, without
Improvement, are roads of Genius.” - William Blake
Index: javax/swing/JRootPane.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/JRootPane.java,v
retrieving revision 1.37
diff -u -1 -0 -r1.37 JRootPane.java
--- javax/swing/JRootPane.java	25 Mar 2006 00:01:59 -	1.37
+++ javax/swing/JRootPane.java	6 Apr 2006 21:11:01 -
@@ -43,20 +43,21 @@
 import java.awt.Container;
 import java.awt.Dimension;
 import java.awt.IllegalComponentStateException;
 import java.awt.Insets;
 import java.awt.LayoutManager;
 import java.awt.LayoutManager2;
 import java.awt.Rectangle;
 import java.io.Serializable;
 
 import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleContext;
 import javax.accessibility.AccessibleRole;
 import javax.swing.plaf.RootPaneUI;
 
 /**
  * This class is where JComponents are added to. Unlike awt where you could
  * just say frame.add(), with swing you need to say frame.getRootPane()
  * (which delivers an instance of this class) and add your components to
  * that. It is implemented by several 'layers' (pane() should be read as
  * plane()) each on top of the others where you can add components to.
  * (getContentPane(), getGlassPane(), getLayeredPane())
@@ -670,11 +671,24 @@
* (the only other direct child is a JLayeredPane which must figure its
* codeoptimizeDrawingEnabled/code state on its own).
*
* @return codetrue/code if the codeglassPane/code is not
* visible
*/
   public boolean isOptimizedDrawingEnable()
   {
 return ! glassPane.isVisible();
   }
+
+  /**
+   * Returns the accessible context for this JRootPane. This will be
+   * an instance of [EMAIL PROTECTED] AccessibleJRootPane}.
+   *
+   * @return the accessible context for this JRootPane
+   */
+  public AccessibleContext getAccessibleContext()
+  {
+if (accessibleContext == null)
+  accessibleContext = new AccessibleJRootPane();
+return accessibleContext;
+  }
 }


signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil


[cp-patches] FYI: More AccessibleAWTComponent fixes

2006-04-06 Thread Roman Kennke
The methods getBounds(), getSize() and getLocation in
AccessibleAWTComponent must delegate to the Component methods,
regardless of the isShowing() state of the Component.

The Monkey utility was complaining about a null pointer from the
getBounds() method, fixing it like this made this program work better
and a quick test in BeanShell shows, that this is indeed the right thing
to do.

2006-04-06  Roman Kennke  [EMAIL PROTECTED]

* java/awt/Component.java
(AccessibleAWTComponent.getBounds): Return the component
bounds regardless of its showing state.
(AccessibleAWTComponent.getLocation): Return the component
location regardless of its showing state.
(AccessibleAWTComponent.getSize): Return the component
size regardless of its showing state.

/Roman

-- 
“Improvement makes straight roads, but the crooked roads, without
Improvement, are roads of Genius.” - William Blake
Index: java/awt/Component.java
===
RCS file: /cvsroot/classpath/classpath/java/awt/Component.java,v
retrieving revision 1.113
diff -u -1 -0 -r1.113 Component.java
--- java/awt/Component.java	6 Apr 2006 20:37:39 -	1.113
+++ java/awt/Component.java	6 Apr 2006 21:49:56 -
@@ -5705,21 +5705,21 @@
 /**
  * Returns the location of this object relative to its parent's coordinate
  * system, or null if it is not showing.
  *
  * @return the location
  * @see #getBounds()
  * @see #getLocationOnScreen()
  */
 public Point getLocation()
 {
-  return Component.this.isShowing() ? Component.this.getLocation() : null;
+  return Component.this.getLocation();
 }
 
 /**
  * Sets the location of this relative to its parent's coordinate system.
  *
  * @param p the location
  * @throws NullPointerException if p is null
  * @see #getLocation()
  */
 public void setLocation(Point p)
@@ -5729,21 +5729,21 @@
 
 /**
  * Gets the bounds of this component, or null if it is not on screen.
  *
  * @return the bounds
  * @see #contains(Point)
  * @see #setBounds(Rectangle)
  */
 public Rectangle getBounds()
 {
-  return Component.this.isShowing() ? Component.this.getBounds() : null;
+  return Component.this.getBounds();
 }
 
 /**
  * Sets the bounds of this component.
  *
  * @param r the bounds
  * @throws NullPointerException if r is null
  * @see #getBounds()
  */
 public void setBounds(Rectangle r)
@@ -5752,21 +5752,21 @@
 }
 
 /**
  * Gets the size of this component, or null if it is not showing.
  *
  * @return the size
  * @see #setSize(Dimension)
  */
 public Dimension getSize()
 {
-  return Component.this.isShowing() ? Component.this.getSize() : null;
+  return Component.this.getSize();
 }
 
 /**
  * Sets the size of this component.
  *
  * @param d the size
  * @throws NullPointerException if d is null
  * @see #getSize()
  */
 public void setSize(Dimension d)


signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil


[cp-patches] RFC: java.io.ObjectStreamConstants documented

2006-04-06 Thread Carsten Neumann


Hi all,

in addition to the documentation I also added two fields that were added 
in 1.5 (TC_ENUM and SC_ENUM).
Please note that my copyright assignment is in snail mail, I'll ping 
this message when the paper shuffling is finished.


Thanks,
Carsten

The Changelog is:

2006-04-07  Carsten Neumann  [EMAIL PROTECTED]

* java/io/ObjectStreamConstants.java: Documented fields.
(TC_ENUM): New field.
(SC_ENUM): New field.
(TC_MAX): Changed to reflect addition of TC_ENUM.
Index: ObjectStreamConstants.java
===
RCS file: /sources/classpath/classpath/java/io/ObjectStreamConstants.java,v
retrieving revision 1.14
diff -u -r1.14 ObjectStreamConstants.java
--- ObjectStreamConstants.java	22 Mar 2006 17:52:33 -	1.14
+++ ObjectStreamConstants.java	6 Apr 2006 21:48:25 -
@@ -50,8 +50,6 @@
  */
 public interface ObjectStreamConstants
 {
-  // FIXME: Javadoc comment these values.
-  
   /** 
* The serialization stream protocol version 1. This version was
* the default serialization protocol before JDK 1.2.
@@ -70,37 +68,159 @@
*/
   int PROTOCOL_VERSION_2 = 2;
 
+  /**
+   * The magic number that is written as part of the stream header.
+   */
   short STREAM_MAGIC = (short)0xaced;
+  
+  /**
+   * The stream version number that is written as part of the stream header.
+   * Note that this is different from the protocol version that specifies
+   * the data format for the stream.
+   */
   short STREAM_VERSION = 5;
 
+  /**
+   * Tag value to designate a codenull/code reference in the stream.
+   */
   byte TC_NULL = (byte)112;//0x70
+  
+  /**
+   * Tag value to designate a reference to an already serialized object.
+   */
   byte TC_REFERENCE = (byte)113;   //0x71
+  
+  /**
+   * Tag value to designate a class descriptor is next in the stream.
+   */
   byte TC_CLASSDESC = (byte)114;   //0x72
+  
+  /**
+   * Tag value to designate a new object is next in the stream. 
+   */
   byte TC_OBJECT = (byte)115;  //0x73
+  
+  /**
+   * Tag value to designate a new string is next in the stream.
+   */
   byte TC_STRING = (byte)116;  //0x74
+  
+  /**
+   * Tag value to designate a new array is next in the stream.
+   */
   byte TC_ARRAY = (byte)117;   //0x75
+  
+  /**
+   * Tag reference to designate a reference to a class.
+   */
   byte TC_CLASS = (byte)118;   //0x76
+  
+  /**
+   * Tag value to designate a block of primitive data is next in the stream.
+   * The next byte in the stream holds the size of the block (in bytes).
+   */
   byte TC_BLOCKDATA = (byte)119;   //0x77
+  
+  /**
+   * Tag value to designate the end of a block of primitve data.
+   */
   byte TC_ENDBLOCKDATA = (byte)120;//0x78
+  
+  /**
+   * Tag value to designate a reset of the stream state.
+   */
   byte TC_RESET = (byte)121;   //0x79
+  
+  /**
+   * Tag value to designate a long block of primitive data is next in the
+   * stream. The next long in the stream holds the size of the block
+   * (in bytes). 
+   */
   byte TC_BLOCKDATALONG = (byte)122;   //0x7A
+  
+  /**
+   * Tag value to designate an exception occured during serialization.
+   */
   byte TC_EXCEPTION = (byte)123;   //0x7B
+  
+  /**
+   * Tag value to designate a long string is next in the stream.
+   */
   byte TC_LONGSTRING = (byte)124;  //0x7C
+  
+  /**
+   * Tag value to designate a proxy class descriptor is next in the stream.
+   */
   byte TC_PROXYCLASSDESC = (byte)125;  //0x7D
 
+  /**
+   * Tag value to designate an enum constant is next in the stream.
+   * 
+   * @since 1.5
+   */
+  byte TC_ENUM = (byte)126;//0x7E
+  
+  /**
+   * The first tag value.
+   */
   byte TC_BASE = TC_NULL;
-  byte TC_MAX = TC_PROXYCLASSDESC;
+  
+  /**
+   * The last tag value.
+   */
+  byte TC_MAX = TC_ENUM;
 
+  /**
+   * The first handle that will be assigned to an object, for later references.
+   */
   int baseWireHandle = 0x7e;
 
+  /**
+   * Flag used in codeObjectStreamClass/code to designate that the class
+   * defines the codewriteObject/code method.
+   */
   byte SC_WRITE_METHOD = 0x01;
+  
+  /**
+   * Flag used in codeObjectStreamClass/code to designate that the class
+   * is serializeable.
+   */
   byte SC_SERIALIZABLE = 0x02;
+  
+  /**
+   * Flag used in codeObjectStreamClass/code to designate that the class
+   * is externalizable.
+   */
   byte SC_EXTERNALIZABLE = 0x04;
+  
+  /**
+   * Flag used in codeObjectStreamClass/code to designate that
+   * externalizable data is written in block data mode.
+   * 
+   * @since 1.2
+   */
   byte SC_BLOCK_DATA = 0x08;
 
+  /**
+   * Flag used in codeObjectStreamClass/code to designate that the class
+   * is an enum constant.
+   * 
+   * @since 1.5
+   */
+  byte SC_ENUM = 0x10;
+  
+  /**
+   * Constant for use with a codeSecurityManager/code to check if
+   * substitution of objects 

[cp-patches] Patch: FYI: a few missing java.awt.image methods

2006-04-06 Thread Tom Tromey
I'm checking this in.

This implements the easy parts of
java.awt.image.renderable.RenderableImageProducer.

Tom

2006-04-06  Tom Tromey  [EMAIL PROTECTED]

* java/awt/image/renderable/RenderableImageProducer.java
(image, context, consumers): New fields.
(RenderableImageProducer): Implemented.
(setRenderContext): Likewise.
(addConsumer): Likewise.
(isConsumer): Likewise.
(removeConsumer): Likewise.
(startProduction): Likewise.

Index: java/awt/image/renderable/RenderableImageProducer.java
===
RCS file: 
/cvsroot/classpath/classpath/java/awt/image/renderable/RenderableImageProducer.java,v
retrieving revision 1.3
diff -u -r1.3 RenderableImageProducer.java
--- java/awt/image/renderable/RenderableImageProducer.java  22 Mar 2006 
19:15:25 -  1.3
+++ java/awt/image/renderable/RenderableImageProducer.java  6 Apr 2006 
23:44:47 -
@@ -42,39 +42,54 @@
 
 import java.awt.image.ImageConsumer;
 import java.awt.image.ImageProducer;
+import java.util.ArrayList;
 
 public class RenderableImageProducer implements ImageProducer, Runnable
 {
+  private RenderableImage image;
+  private RenderContext context;
+  private ArrayList consumers = new ArrayList();
+
   public RenderableImageProducer(RenderableImage image, RenderContext context)
-throws NotImplementedException
   {
-throw new Error(not implemented);
+this.image = image;
+this.context = context;
   }
 
   public void setRenderContext(RenderContext context)
-throws NotImplementedException
   {
+this.context = context;
   }
 
   public void addConsumer(ImageConsumer consumer)
-throws NotImplementedException
   {
+synchronized (consumers)
+  {
+if (! consumers.contains(consumer))
+  consumers.add(consumer);
+  }
   }
 
   public boolean isConsumer(ImageConsumer consumer)
-throws NotImplementedException
   {
-return false;
+synchronized (consumers)
+  {
+return consumers.contains(consumer);
+  }
   }
 
   public void removeConsumer(ImageConsumer consumer)
-throws NotImplementedException
   {
+synchronized (consumers)
+  {
+consumers.remove(consumer);
+  }
   }
 
   public void startProduction(ImageConsumer consumer)
-throws NotImplementedException
   {
+Thread t = new Thread(this, RenderableImageProducerWorker);
+t.start();
   }
 
   public void requestTopDownLeftRightResend(ImageConsumer consumer)