Re: [cp-patches] RFC: Most reverse japi fixes in org.omg

2006-04-09 Thread Wolfgang Baer
Hi,

I check this in. Audrius approved it off list.

Wolfgang

Wolfgang Baer wrote:
 Hi,
 
 this patch fixes most of the reverse japi issues. Things that
 remain (will be seen if the patch is applied after a japi run)
 will require deep knowledge of the Corba stuff. So I will leave
 that to Audrius :-)
 
 Most stuff in the patch is that some classes does not extend
 from _DynAnyStub and therefore the methods are copied into this
 classes from there. There are also some methods which must be
 abstract and therefore the default implementation to be removed or
 moved into the implementation classes.
 
 Posted as RFC to give Audrius a change to look at it. Everything
 compiles and the Corba example still works.
 
 2006-04-08  Wolfgang Baer  [EMAIL PROTECTED]
 
   * org/omg/PortableServer/ServantLocatorPOA.java:
   (preinvoke, postinvoke): Remove default implementation.
   * org/omg/PortableServer/ServantActivatorPOA.java:
   (incarnate, etherealize): Remove default implementation.
   * org/omg/PortableInterceptor/ObjectReferenceFactory.java:
   Extends from ValueBase and not from ObjectReferenceFactoryOperations.
   (make_object): Moved method from ObjectReferenceFactoryOperations.
   * org/omg/PortableInterceptor/ObjectReferenceFactoryOperations.java:
   Removed unspecified interface.  
   * org/omg/DynamicAny/_DynAnyStub.java:
   (_DynAnyStub(Delegate)): Removed constructor.
   * org/omg/DynamicAny/_DynArrayStub.java,
   * org/omg/DynamicAny/_DynAnyFactoryStub.java,
   * org/omg/DynamicAny/_DynEnumStub.java,
   * org/omg/DynamicAny/_DynFixedStub.java,
   * org/omg/DynamicAny/_DynSequenceStub.java,
   * org/omg/DynamicAny/_DynStructStub.java,
   * org/omg/DynamicAny/_DynUnionStub.java,
   * org/omg/DynamicAny/_DynValueStub.java:
   Extend from ObjectImpl and not from _DynAnyStub.
   (type, next, destroy, copy, rewind, assign, component_count,
   current_component, equal, from_any, get_any, get_boolean, get_char,
   get_double, get_dyn_any, get_float, get_long, get_longlong, get_octet,
   get_reference, get_short, get_string, get_typecode, get_ulong,
   get_ulonglong, get_ushort, get_val, get_wchar, get_wstring, insert_any,
   insert_boolean, insert_char, insert_double, insert_dyn_any, 
 insert_float,
   insert_long, insert_longlong, insert_octet, insert_reference,
   insert_short, insert_string, insert_typecode, insert_ulong,
   insert_ulonglong, insert_ushort, insert_val, insert_wchar,
   insert_wstring, seek, to_any): New methods copied from _DynAnyStub. 
 
   * org/omg/CosNaming/_BindingIteratorStub.java:
   (_BindingIteratorStub(Delegate)): Made package private.
   * org/omg/CosNaming/_NamingContextExtStub.java:
   (_NamingContextExtStub(Delegate)): Made package private.
   * org/omg/CosNaming/_NamingContextStub.java:
   (_NamingContextStub(Delegate)): Made package private.
   (throw4, throw5): Likewise.
   * gnu/CORBA/NamingService/NameParser.java (resolve):
   Adapt to package private constructor. Use _set_delegate instead.
   * org/omg/CosNaming/NamingContextOperations.java: Do not extend 
 IDLEntity.
   * org/omg/CORBA/ORB.java:
   (create_recursive_sequence_tc): Made abstract.
   (get_default_context): Likewise.
   * gnu/CORBA/OrbRestricted.java:
   (create_recursive_sequence_tc): New moved method.
   (get_default_context): Likewise.
   * org/omg/CORBA/ParameterMode.java:
   (PARAM_IN, PARAM_OUT, PARAM_INOUT): Made final. 
 
 The patch does not include the removal of
 org/omg/PortableInterceptor/ObjectReferenceFactoryOperations.java
 
 Wolfgang
 




Re: [cp-patches] RFC: Dialog fixlets and documentation

2006-04-08 Thread Wolfgang Baer
Mark Wielaard wrote:
 Hi Wolfgang,
 
 On Fri, 2006-04-07 at 21:29 +0200, Wolfgang Baer wrote:
 2006-04-07  Wolfgang Baer  [EMAIL PROTECTED]

  * java/awt/Dialog.java: Improved documentation all over.
  (Dialog(Frame)): If gc is null use the owners GraphicsConfiguration.
  (Dialog(Dialog)): Likewise.

 OK to commit ?
 
 Yes, this looks fine to me.

Committed.

Thanks,
Wolfgang




[cp-patches] FYI: More reverse japi fixes

2006-04-08 Thread Wolfgang Baer
Hi,

this patch moves the initialization of some fields into a
static initializer so they are no longer constants. Also
weird thats what the JDK does and is reported by reverse japi.

2006-04-08  Wolfgang Baer  [EMAIL PROTECTED]

* javax/swing/plaf/basic/BasicInternalFrameTitlePane.java:
(CLOSE_CMD, ICONIFY_CMD, MAXIMIZE_CMD, MOVE_CMD, RESTORE_CMD, SIZE_CMD):
No longer constants.
* javax/accessibility/AccessibleRelation.java (LABEL_FOR, LABELED_BY,
MEMBER_OF, CONTROLLER_FOR, CONTROLLED_BY): No longer constants.

Wolfgang

Index: javax/accessibility/AccessibleRelation.java
===
RCS file: /cvsroot/classpath/classpath/javax/accessibility/AccessibleRelation.java,v
retrieving revision 1.4
diff -u -r1.4 AccessibleRelation.java
--- javax/accessibility/AccessibleRelation.java	13 Jul 2005 13:45:00 -	1.4
+++ javax/accessibility/AccessibleRelation.java	8 Apr 2006 13:36:36 -
@@ -61,7 +61,7 @@
* @see #LABELED_BY
* @see #MEMBER_OF
*/
-  public static final String LABEL_FOR = labelFor;
+  public static final String LABEL_FOR;
 
   /**
* Indicates the object is labeled by other objects.
@@ -72,7 +72,7 @@
* @see #LABEL_FOR
* @see #MEMBER_OF
*/
-  public static final String LABELED_BY = labeledBy;
+  public static final String LABELED_BY;
 
   /**
* Indicates an object is a member of a group of target objects.
@@ -83,7 +83,7 @@
* @see #LABEL_FOR
* @see #LABELED_BY
*/
-  public static final String MEMBER_OF = memberOf;
+  public static final String MEMBER_OF;
 
   /**
* Indicates an object is a controller for other objects.
@@ -94,7 +94,7 @@
* @see #LABELED_BY
* @see #MEMBER_OF
*/
-  public static final String CONTROLLER_FOR = controllerFor;
+  public static final String CONTROLLER_FOR;
 
   /**
* Indicates an object is controlled by other objects.
@@ -105,7 +105,7 @@
* @see #LABELED_BY
* @see #MEMBER_OF
*/
-  public static final String CONTROLLED_BY = controlledBy;
+  public static final String CONTROLLED_BY;
 
   /** Indicates that the label target group has changed. */
   public static final String LABEL_FOR_PROPERTY = labelForProperty;
@@ -124,6 +124,16 @@
 
   /** An empty set of targets. */
   private static final Object[] EMPTY_TARGETS = { };
+  
+  static
+{
+  // not constants in JDK
+  LABEL_FOR = labelFor;
+  LABELED_BY = labeledBy;
+  MEMBER_OF = memberOf;
+  CONTROLLER_FOR = controllerFor;
+  CONTROLLED_BY = controlledBy;
+}
 
   /**
* The related objects.
Index: javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java,v
retrieving revision 1.21
diff -u -r1.21 BasicInternalFrameTitlePane.java
--- javax/swing/plaf/basic/BasicInternalFrameTitlePane.java	15 Mar 2006 18:25:05 -	1.21
+++ javax/swing/plaf/basic/BasicInternalFrameTitlePane.java	8 Apr 2006 13:36:36 -
@@ -520,22 +520,22 @@
   }
 
   /** The action command for the Close action. */
-  protected static final String CLOSE_CMD = Close;
+  protected static final String CLOSE_CMD;
 
   /** The action command for the Minimize action. */
-  protected static final String ICONIFY_CMD = Minimize;
+  protected static final String ICONIFY_CMD;
 
   /** The action command for the Maximize action. */
-  protected static final String MAXIMIZE_CMD = Maximize;
+  protected static final String MAXIMIZE_CMD;
 
   /** The action command for the Move action. */
-  protected static final String MOVE_CMD = Move;
+  protected static final String MOVE_CMD;
 
   /** The action command for the Restore action. */
-  protected static final String RESTORE_CMD = Restore;
+  protected static final String RESTORE_CMD;
 
   /** The action command for the Size action. */
-  protected static final String SIZE_CMD = Size;
+  protected static final String SIZE_CMD;
 
   /** The action associated with closing the JInternalFrame. */
   protected Action closeAction;
@@ -614,6 +614,17 @@
* This is package-private to avoid an accessor method.
*/
   transient JLabel title;
+  
+  static
+{
+  // not constants in JDK
+  CLOSE_CMD = Close;
+  ICONIFY_CMD = Minimize;
+  MAXIMIZE_CMD = Maximize;
+  MOVE_CMD = Move;
+  RESTORE_CMD = Restore;
+  SIZE_CMD = Size;
+}
 
   /**
* Creates a new BasicInternalFrameTitlePane object that is used in the


Re: [cp-patches] FYI: More reverse japi fixes

2006-04-08 Thread Wolfgang Baer
Wolfgang Baer wrote:
 Hi,
 
 this patch moves the initialization of some fields into a
 static initializer so they are no longer constants. Also
 weird thats what the JDK does and is reported by reverse japi.

Sorry, changelogs missed some stuff:

2006-04-08  Wolfgang Baer  [EMAIL PROTECTED]

* javax/swing/plaf/basic/BasicInternalFrameTitlePane.java:
(CLOSE_CMD, ICONIFY_CMD, MAXIMIZE_CMD, MOVE_CMD, RESTORE_CMD, SIZE_CMD):
No longer constants.
(static_initializer): Added to initialize above fields.
* javax/accessibility/AccessibleRelation.java (LABEL_FOR, LABELED_BY,
MEMBER_OF, CONTROLLER_FOR, CONTROLLED_BY): No longer constants.
(static_initializer): Added to initialize above fields.

Wolfgang



[cp-patches] FYI: Removing one not existent method

2006-04-08 Thread Wolfgang Baer
Hi,

this patch removes one method which does not exist in the abstract
SynthPainter class (pointed out by reverse japi).

2006-04-08  Wolfgang Baer  [EMAIL PROTECTED]

* javax/swing/plaf/synth/SynthPainter.java:
(paintSplitPaneDividerBorder): Removed.

Wolfgang



Index: javax/swing/plaf/synth/SynthPainter.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/synth/SynthPainter.java,v
retrieving revision 1.3
diff -u -r1.3 SynthPainter.java
--- javax/swing/plaf/synth/SynthPainter.java	22 Mar 2006 20:05:02 -	1.3
+++ javax/swing/plaf/synth/SynthPainter.java	8 Apr 2006 13:46:34 -
@@ -1418,23 +1418,6 @@
   }
 
   /**
-   * Paints the border of a split pane's divider.
-   *
-   * @param ctx the synth context identifying the component and region for
-   *painting
-   * @param g the graphics context to use for painting
-   * @param x the X coordinate of the area to paint
-   * @param y the Y coordinate of the area to paint 
-   * @param w the width of the area to paint
-   * @param h the height of the area to paint
-   */
-  public void paintSplitPaneDividerBorder(SynthContext ctx, Graphics g, int x,
-   int y, int w, int h)
-  {
-// Nothing to do here.
-  }
-
-  /**
* Paints the background of a tabbed pane.
*
* @param ctx the synth context identifying the component and region for


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

2006-04-07 Thread Wolfgang Baer
Hi Carsten,

Carsten Neumann wrote:
 
 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.

TC_ENUM and SC_ENUM were already added on the generics branch some days
ago when enum serialization/deserialization was implemented.

I don't know if the change to TC_MAX can cause problems with serialization
on the trunk. Anybody knows ?

Wolfgang




[cp-patches] FYI: java.awt.Dialog reformatted

2006-04-07 Thread Wolfgang Baer
Hi,

I reformatted java.awt.Dialog for upcoming changes.

2006-04-07  Wolfgang Baer  [EMAIL PROTECTED]

* java/awt/Dialog.java: Reformatted

Wolfgang

Index: java/awt/Dialog.java
===
RCS file: /cvsroot/classpath/classpath/java/awt/Dialog.java,v
retrieving revision 1.25
diff -u -r1.25 Dialog.java
--- java/awt/Dialog.java	2 Nov 2005 22:22:01 -	1.25
+++ java/awt/Dialog.java	7 Apr 2006 18:06:58 -
@@ -1,39 +1,40 @@
 /* Dialog.java -- An AWT dialog box
-   Copyright (C) 1999, 2000, 2001, 2002, 2005  Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001, 2002, 2005, 2006  
+ Free Software Foundation, Inc.
 
-This file is part of GNU Classpath.
+ This file is part of GNU Classpath.
 
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING.  If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library.  Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-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. */
+ GNU Classpath is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU Classpath is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING.  If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA.
+
+ Linking this library statically or dynamically with other modules is
+ making a combined work based on this library.  Thus, the terms and
+ conditions of the GNU General Public License cover the whole
+ combination.
+
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent
+ modules, and to copy and distribute the resulting executable under
+ terms of your choice, provided that you also meet, for each linked
+ 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;
@@ -47,456 +48,386 @@
 
 /**
  * A dialog box widget class.
- *
+ * 
  * @author Aaron M. Renn ([EMAIL PROTECTED])
  * @author Tom Tromey ([EMAIL PROTECTED])
  */
 public class Dialog extends Window
 {
+  // Serialization constant
+  private static final long serialVersionUID = 5920926903803293709L;
 
-/*
- * Static Variables
- */
-
-// Serialization constant
-private static final long serialVersionUID = 5920926903803293709L;
-
-/*/
-
-/*
- * Instance Variables
- */
-
-/**
-  * @serial Indicates whether or not this dialog box is modal.
-  */
-private boolean modal;
-
-/**
-  * @serial Indicates whether or not this dialog box is resizable.
-  */
-private boolean resizable = true;
-
-/**
-  * @serial The title string for this dialog box, which can be
-  * codenull/code.
-  */
-private String

[cp-patches] RFC: Dialog fixlets and documentation

2006-04-07 Thread Wolfgang Baer
Hi all,

I improved the Dialog documentation a bit.

Thereby I found that it is specified that if the GraphicsConfiguration is null
the parents GraphicsConfiguration should be used. We are doing wrong here.

For the constructor with a Frame as owner we only pass the given
GraphicsConfiguration to the super constructor. For the constructor with a
Dialog as owner we didn't used the given GraphicsConfiguration at all.

2006-04-07  Wolfgang Baer  [EMAIL PROTECTED]

* java/awt/Dialog.java: Improved documentation all over.
(Dialog(Frame)): If gc is null use the owners GraphicsConfiguration.
(Dialog(Dialog)): Likewise.

OK to commit ?

Wolfgang

Index: java/awt/Dialog.java
===
RCS file: /cvsroot/classpath/classpath/java/awt/Dialog.java,v
retrieving revision 1.27
diff -u -r1.27 Dialog.java
--- java/awt/Dialog.java	7 Apr 2006 18:33:38 -	1.27
+++ java/awt/Dialog.java	7 Apr 2006 19:06:52 -
@@ -47,7 +47,14 @@
 import javax.accessibility.AccessibleStateSet;
 
 /**
- * A dialog box widget class.
+ * codeDialog/code provides a top-level window normally used to receive 
+ * user input in applications.
+ * p
+ * A dialog always has another top-level window as owner and is only visible
+ * if this owner is visible to the user. The default layout of dialogs is the 
+ * codeBorderLayout/code. Dialogs can be modal (blocks user input to other
+ * components) or non-modal (user input in other components are allowed).
+ * /p 
  * 
  * @author Aaron M. Renn ([EMAIL PROTECTED])
  * @author Tom Tromey ([EMAIL PROTECTED])
@@ -163,7 +170,9 @@
* @param title The title string for this dialog box.
* @param modal codetrue/code if this dialog box is modal,
* codefalse/code otherwise.
-   * @param gc The codeGraphicsConfiguration/code object to use.
+   * @param gc The codeGraphicsConfiguration/code object to use. If 
+   * codenull/code the codeGraphicsConfiguration/code of the target 
+   * frame is used.
* 
* @exception IllegalArgumentException If owner is null, the
*  GraphicsConfiguration is not a screen device or
@@ -173,7 +182,7 @@
   public Dialog(Frame parent, String title, boolean modal,
 GraphicsConfiguration gc)
   {
-super(parent, gc);
+super(parent, (gc == null) ? parent.getGraphicsConfiguration() : gc);
 
 // A null title is equivalent to an empty title
 this.title = (title != null) ? title : ;
@@ -187,6 +196,8 @@
* Initializes a new instance of codeDialog/code with the specified,
* parent, that is resizable.
* 
+   * @param owner The parent frame of this dialog box.
+   * 
* @exception IllegalArgumentException If parent is null. This exception is
* always thrown when GraphicsEnvironment.isHeadless() returns true.
* 
@@ -201,6 +212,9 @@
* Initializes a new instance of codeDialog/code with the specified,
* parent and title, that is resizable.
* 
+   * @param owner The parent frame of this dialog box.
+   * @param title The title string for this dialog box.
+   * 
* @exception IllegalArgumentException If parent is null. This exception is
*  always thrown when GraphicsEnvironment.isHeadless() returns
*  true.
@@ -215,6 +229,11 @@
* Initializes a new instance of codeDialog/code with the specified,
* parent, title and modality, that is resizable.
* 
+   * @param owner The parent frame of this dialog box.
+   * @param title The title string for this dialog box.
+   * @param modal codetrue/code if this dialog box is modal,
+   * codefalse/code otherwise.
+   * 
* @exception IllegalArgumentException If parent is null. This exception is
* always thrown when GraphicsEnvironment.isHeadless() returns true.
* @since 1.2
@@ -229,6 +248,14 @@
* parent, title, modality and codeGraphicsConfiguration/code, that is
* resizable.
* 
+   * @param parent The parent frame of this dialog box.
+   * @param title The title string for this dialog box.
+   * @param modal codetrue/code if this dialog box is modal,
+   * codefalse/code otherwise.
+   * @param gc The codeGraphicsConfiguration/code object to use. If 
+   * codenull/code the codeGraphicsConfiguration/code of the target 
+   * frame is used.
+   * 
* @exception IllegalArgumentException If parent is null, the
* GraphicsConfiguration is not a screen device or 
* GraphicsEnvironment.isHeadless() returns true.
@@ -238,7 +265,7 @@
   public Dialog(Dialog parent, String title, boolean modal,
 GraphicsConfiguration gc)
   {
-super(parent, parent.getGraphicsConfiguration());
+super(parent, (gc == null) ? parent.getGraphicsConfiguration() : gc);
 
 // A null title is equivalent to an empty title
 this.title = (title != null) ? title : ;
@@ -261,7 +288,8 @@
   /**
* Sets the title of this dialog box to the specified string.
* 
-   * @param title The new title.
+   * @param title

[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

[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: 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

[cp-patches] RFC: java.awt.Window fixlet

2006-03-23 Thread Wolfgang Baer
Hi,

reverse japi points out that some methods must be overriden and
made final in Window. A mauve test for this is committed
(gnu/testlet/java/awt/Window/focusCycleRootTest.java).

The API docs describe that these methods always return the same or
do nothing at all for Window. I needed to adjust one method
in Container to prevent a NPE. You can observe this NPE in the Swing
Demo if you use the ThemeEditor (try with and without the Container
NPE fixlet).

Playing around with the Swing/Awt demos showed no further problems.

2006-03-23  Wolfgang Baer  [EMAIL PROTECTED]

* java/awt/Window.java: 
(setFocusCycleRoot): New overriden method.
(isFocusCycleRoot): Likewise.
(getFocusCycleRootAncestor): Likewise.
* java/awt/Container.java:
(getFocusTraversalPolicy): Check also for anchestor == null.

OK to commit, comments ?

Wolfgang


Index: java/awt/Window.java
===
RCS file: /cvsroot/classpath/classpath/java/awt/Window.java,v
retrieving revision 1.66
diff -u -r1.66 Window.java
--- java/awt/Window.java	22 Mar 2006 19:15:21 -	1.66
+++ java/awt/Window.java	23 Mar 2006 21:44:41 -
@@ -1146,6 +1146,47 @@
   {
 this.focusableWindowState = focusableWindowState;
   }
+  
+  /**
+   * Check whether this Container is a focus cycle root.
+   * Returns always codetrue/code as Windows are the 
+   * root of the focus cycle.
+   *
+   * @return Always codetrue/code.
+   *
+   * @since 1.4
+   */
+  public final boolean isFocusCycleRoot()
+  {
+return true;
+  }
+
+  /**
+   * Set whether or not this Container is the root of a focus
+   * traversal cycle. Windows are the root of the focus cycle
+   * and therefore this method does nothing.
+   * 
+   * @param focusCycleRoot ignored.
+   *
+   * @since 1.4
+   */
+  public final void setFocusCycleRoot(boolean focusCycleRoot)
+  {
+// calls to the method are ignored
+  }
+
+  /**
+   * Returns the root container that owns the focus cycle where this
+   * component resides. Windows have no ancestors and this method
+   * returns always codenull/code.
+   *
+   * @return Always codenull/code.
+   * @since 1.4
+   */
+  public final Container getFocusCycleRootAncestor()
+  {
+return null;
+  }
 
   /**
* Generate a unique name for this window.
Index: java/awt/Container.java
===
RCS file: /cvsroot/classpath/classpath/java/awt/Container.java,v
retrieving revision 1.89
diff -u -r1.89 Container.java
--- java/awt/Container.java	15 Mar 2006 19:34:29 -	1.89
+++ java/awt/Container.java	23 Mar 2006 21:44:42 -
@@ -1465,7 +1465,7 @@
   {
 Container ancestor = getFocusCycleRootAncestor ();
 
-	if (ancestor != this)
+	if (ancestor != this  ancestor !=  null)
 	  return ancestor.getFocusTraversalPolicy ();
 	else
 	  {


Re: [cp-patches] RFC: java.awt.Window fixlet

2006-03-23 Thread Wolfgang Baer
Hi Robert,

Robert Schuster wrote:
 Hi Wolfgang,
 can you check whether this fixes 
 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26837 ?

Seems so. I could traverse the textcomponents with the tab key without any
NPEs.

Wolfgang



Re: [cp-patches] RFC: ObjectStreamOutput setDefaultProtocolVersion() removal

2006-03-22 Thread Wolfgang Baer
Wolfgang Baer wrote:
 Hi all,
 
 looking at the reverse japi results I noticed that we provide a static
 setDefaultProtocolVersion() method which is not part of the API. 

[...]

 2006-03-21  Wolfgang Baer  [EMAIL PROTECTED]
 
   * java/io/ObjectStreamConstants.java: Added since tag.
   (PROTOCOL_VERSION_1): Added javadoc.
   (PROTOCOL_VERSION_2): Likewise.
   * java/io/ObjectOutputStream.java:
   (setDefaultProtocolVersion): Removed.
   (useProtocolVersion): Fixed parameter tests. Updated javadoc.

Committed.

Wolfgang



[cp-patches] RFC: ObjectStreamOutput setDefaultProtocolVersion() removal

2006-03-21 Thread Wolfgang Baer
Hi all,

looking at the reverse japi results I noticed that we provide a static
setDefaultProtocolVersion() method which is not part of the API. I think
we don't want such api additions, right ?

This patch removes this method, documents the non-static useProtocolVersion()
public API method a bit more and fixes its parameter testing (mauve test will
be committed with the patch).

This patch is send as RFC as I don't know if there was maybe a reason behind
this GNU classpath specific API method.

2006-03-21  Wolfgang Baer  [EMAIL PROTECTED]

* java/io/ObjectStreamConstants.java: Added since tag.
(PROTOCOL_VERSION_1): Added javadoc.
(PROTOCOL_VERSION_2): Likewise.
* java/io/ObjectOutputStream.java:
(setDefaultProtocolVersion): Removed.
(useProtocolVersion): Fixed parameter tests. Updated javadoc.


Wolfgang
Index: java/io/ObjectOutputStream.java
===
RCS file: /cvsroot/classpath/classpath/java/io/ObjectOutputStream.java,v
retrieving revision 1.66
diff -u -r1.66 ObjectOutputStream.java
--- java/io/ObjectOutputStream.java	15 Feb 2006 18:43:04 -	1.66
+++ java/io/ObjectOutputStream.java	21 Mar 2006 20:23:03 -
@@ -549,53 +549,37 @@
* different protocols, specified by codePROTOCOL_VERSION_1/code
* and codePROTOCOL_VERSION_2/code.  This implementation writes
* data using codePROTOCOL_VERSION_2/code by default, as is done
-   * by the JDK 1.2.
-   *
-   * A non-portable method, codesetDefaultProtocolVersion (int
-   * version)/code is provided to change the default protocol
-   * version.
-   *
+   * since the JDK 1.2.
+   * p
* For an explanation of the differences between the two protocols
-   * see XXX: the Java ObjectSerialization Specification.
-   *
-   * @exception IOException if codeversion/code is not a valid
-   * protocol
-   *
-   * @see #setDefaultProtocolVersion(int)
+   * see the Java Object Serialization Specification.
+   * /p
+   * 
+   * @param version the version to use.
+   * 
+   * @throws IllegalArgumentException if codeversion/code is not a valid 
+   * protocol.
+   * @throws IllegalStateException if called after the first the first object
+   * was serialized.
+   * @throws IOException if an I/O error occurs.
+   * 
+   * @see ObjectStreamConstants#PROTOCOL_VERSION_1
+   * @see ObjectStreamConstants#PROTOCOL_VERSION_2
+   * 
+   * @since 1.2
*/
   public void useProtocolVersion(int version) throws IOException
   {
 if (version != PROTOCOL_VERSION_1  version != PROTOCOL_VERSION_2)
-  throw new IOException(Invalid protocol version requested.);
+  throw new IllegalArgumentException(Invalid protocol version requested.);
+
+if (nextOID != baseWireHandle)
+  throw new IllegalStateException(Protocol version cannot be changed  
+  + after serialization started.);
 
 protocolVersion = version;
   }
 
-
-  /**
-   * emGNU $classpath specific/em
-   *
-   * Changes the default stream protocol used by all
-   * codeObjectOutputStream/codes.  There are currently two
-   * different protocols, specified by codePROTOCOL_VERSION_1/code
-   * and codePROTOCOL_VERSION_2/code.  The default default is
-   * codePROTOCOL_VERSION_1/code.
-   *
-   * @exception IOException if codeversion/code is not a valid
-   * protocol
-   *
-   * @see #useProtocolVersion(int)
-   */
-  public static void setDefaultProtocolVersion(int version)
-throws IOException
-  {
-if (version != PROTOCOL_VERSION_1  version != PROTOCOL_VERSION_2)
-  throw new IOException(Invalid protocol version requested.);
-
-defaultProtocolVersion = version;
-  }
-
-
   /**
* An empty hook that allows subclasses to write extra information
* about classes to the stream.  This method is called the first
Index: java/io/ObjectStreamConstants.java
===
RCS file: /cvsroot/classpath/classpath/java/io/ObjectStreamConstants.java,v
retrieving revision 1.13
diff -u -r1.13 ObjectStreamConstants.java
--- java/io/ObjectStreamConstants.java	2 Jul 2005 20:32:38 -	1.13
+++ java/io/ObjectStreamConstants.java	21 Mar 2006 20:23:03 -
@@ -1,6 +1,6 @@
 /* ObjectStreamConstants.java -- Interface containing constant values
used in reading and writing serialized objects
-   Copyright (C) 1998, 1999, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2003, 2006 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -45,11 +45,29 @@
  * codeObjectInputStream/code, and codeObjectStreamClass/code.
  * The values for these constants are specified by the Java library
  * specification.
+ * 
+ * @since 1.1
  */
 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.
+   * 
+   * @see

[cp-patches] FYI: Reverse japi fixes in org.omg

2006-03-17 Thread Wolfgang Baer
Hi,

here are some more obvious fixes making some classes final.

2006-03-17  Wolfgang Baer  [EMAIL PROTECTED]

* org/omg/DynamicAny/DynAnyPackage/InvalidValue.java: Now final.
* org/omg/DynamicAny/DynAnyPackage/TypeMismatch.java: Likewise.
* org/omg/DynamicAny/DynAnyFactoryPackage/InconsistentTypeCode.java:
Likewise.   
* org/omg/CORBA/portable/RemarshalException.java: Likewise
* org/omg/CORBA/TypeCodePackage/BadKind.java: Likewise.
* org/omg/CORBA/TypeCodePackage/Bounds.java: Likewise.
* org/omg/CORBA/ORBPackage/InvalidName.java: Likewise.
* org/omg/CORBA/ORBPackage/InconsistentTypeCode.java: Likewise.
* org/omg/CORBA/DynAnyPackage/TypeMismatch.java: Likewise.
* org/omg/CORBA/DynAnyPackage/InvalidValue.java: Likewise.
* org/omg/CORBA/DynAnyPackage/InvalidSeq.java: Likewise.
* org/omg/CORBA/DynAnyPackage/Invalid.java: Likewise.
* org/omg/Dynamic/Parameter.java: Now final, javadoc fixes.

Wolfgang

Index: org/omg/CORBA/DynAnyPackage/Invalid.java
===
RCS file: /cvsroot/classpath/classpath/org/omg/CORBA/DynAnyPackage/Invalid.java,v
retrieving revision 1.3
diff -u -r1.3 Invalid.java
--- org/omg/CORBA/DynAnyPackage/Invalid.java	28 Aug 2005 11:23:36 -	1.3
+++ org/omg/CORBA/DynAnyPackage/Invalid.java	17 Mar 2006 15:04:41 -
@@ -1,5 +1,5 @@
 /* Invalid.java --
-   Copyright (C) 2005 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -49,7 +49,7 @@
  *
  * @author Audrius Meskauskas ([EMAIL PROTECTED])
  */
-public class Invalid
+public final class Invalid
   extends UserException
   implements Serializable, IDLEntity
 {
Index: org/omg/CORBA/DynAnyPackage/InvalidSeq.java
===
RCS file: /cvsroot/classpath/classpath/org/omg/CORBA/DynAnyPackage/InvalidSeq.java,v
retrieving revision 1.3
diff -u -r1.3 InvalidSeq.java
--- org/omg/CORBA/DynAnyPackage/InvalidSeq.java	28 Aug 2005 11:23:36 -	1.3
+++ org/omg/CORBA/DynAnyPackage/InvalidSeq.java	17 Mar 2006 15:04:41 -
@@ -1,5 +1,5 @@
 /* InvalidSeq.java --
-   Copyright (C) 2005 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -48,7 +48,7 @@
  *
  * @author Audrius Meskauskas ([EMAIL PROTECTED])
  */
-public class InvalidSeq
+public final class InvalidSeq
   extends UserException
   implements Serializable, IDLEntity
 {
Index: org/omg/CORBA/DynAnyPackage/InvalidValue.java
===
RCS file: /cvsroot/classpath/classpath/org/omg/CORBA/DynAnyPackage/InvalidValue.java,v
retrieving revision 1.3
diff -u -r1.3 InvalidValue.java
--- org/omg/CORBA/DynAnyPackage/InvalidValue.java	28 Aug 2005 11:23:36 -	1.3
+++ org/omg/CORBA/DynAnyPackage/InvalidValue.java	17 Mar 2006 15:04:41 -
@@ -1,5 +1,5 @@
 /* InvalidValue.java --
-   Copyright (C) 2005 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -48,7 +48,7 @@
  *
  * @author Audrius Meskauskas ([EMAIL PROTECTED])
  */
-public class InvalidValue
+public final class InvalidValue
   extends UserException
   implements Serializable, IDLEntity
 {
Index: org/omg/CORBA/DynAnyPackage/TypeMismatch.java
===
RCS file: /cvsroot/classpath/classpath/org/omg/CORBA/DynAnyPackage/TypeMismatch.java,v
retrieving revision 1.3
diff -u -r1.3 TypeMismatch.java
--- org/omg/CORBA/DynAnyPackage/TypeMismatch.java	28 Aug 2005 11:23:36 -	1.3
+++ org/omg/CORBA/DynAnyPackage/TypeMismatch.java	17 Mar 2006 15:04:41 -
@@ -1,5 +1,5 @@
 /* TypeMismatch.java --
-   Copyright (C) 2005 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -48,7 +48,7 @@
  *
  * @author Audrius Meskauskas ([EMAIL PROTECTED])
  */
-public class TypeMismatch
+public final class TypeMismatch
   extends UserException
   implements Serializable, IDLEntity
 {
Index: org/omg/CORBA/ORBPackage/InconsistentTypeCode.java
===
RCS file: /cvsroot/classpath/classpath/org/omg/CORBA/ORBPackage/InconsistentTypeCode.java,v
retrieving revision 1.2
diff -u -r1.2 InconsistentTypeCode.java
--- org/omg/CORBA/ORBPackage/InconsistentTypeCode.java	2 Jul 2005 20:32:58 -	1.2
+++ org/omg/CORBA/ORBPackage/InconsistentTypeCode.java	17 Mar 2006 15:04:41 -
@@ -1,5 +1,5 @@
 /* InconsistentTypeCode.java --
-   Copyright (C) 2005 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -51,7 +51,7 @@
  *
  * @author Audrius Meskauskas ([EMAIL PROTECTED])
  */
-public

Re: [cp-patches] FYI: Made some classes final as pointed out by JAPI

2006-03-15 Thread Wolfgang Baer
Hi Audrius,

Audrius Meskauskas wrote:
 Great job!

There are a lot more of these issues as pointed out by reverse japi.
http://www.kaffe.org/~stuart/japi/htmlout/h-classpath-jdk15.html

I will try continue to address these issues from time to time.

Wolfgang



[cp-patches] FYI: News update for printing support

2006-03-14 Thread Wolfgang Baer
Hi,

I've committed a NEWS update as requested.

2006-03-14  Wolfgang Baer  [EMAIL PROTECTED]

* NEWS: Added entry about printing support.

Wolfgang

Index: NEWS
===
RCS file: /cvsroot/classpath/classpath/NEWS,v
retrieving revision 1.123
diff -u -r1.123 NEWS
--- NEWS	6 Mar 2006 21:56:32 -	1.123
+++ NEWS	14 Mar 2006 17:44:10 -
@@ -1,3 +1,13 @@
+New in release 0.91 (UNRELEASED)
+
+* Experimental printing support: The API implementation of the javax.print 
+  packages has been finished and work on the printing provider implementation
+  started. Currently supported features from the Java Print Service API are 
+  print service discovery (CUPS registered printers), single document print 
+  jobs and support for client-formatted print data. An example application
+  (see: examples/gnu/classpath/examples/print/Demo) has been added to show 
+  the API usage for service discovery and printing of files.
+
 New in release 0.90 (March 6, 2006)
 
 * Free Swing improvements: JTable columns are rearrangeable and


[cp-patches] FYI: Made some classes final as pointed out by JAPI

2006-03-14 Thread Wolfgang Baer
Hi,

looking at the reverse japi results there are several classes pointed
out which are final or abstract in the JDK and non-final / concrete
in classpath. The patch fixes some of them.

2006-03-14  Wolfgang Baer  [EMAIL PROTECTED]

* org/omg/PortableInterceptor/ORBInitInfoPackage/ObjectIdHelper.java,
* org/omg/PortableServer/ServantActivatorPOA.java,
* org/omg/PortableServer/ServantLocatorPOA.java:
Make class abstract and minor api docs fixlets.
* org/omg/PortableServer/ForwardRequest.java,
* org/omg/PortableServer/ServantLocatorPackage/CookieHolder.java,
* org/omg/PortableServer/POAPackage/AdapterAlreadyExists.java,
* org/omg/PortableServer/POAPackage/AdapterNonExistent.java,
* org/omg/PortableServer/POAPackage/InvalidPolicy.java,
* org/omg/PortableServer/POAPackage/NoServant.java,
* org/omg/PortableServer/POAPackage/ObjectAlreadyActive.java,
* org/omg/PortableServer/POAPackage/ObjectNotActive.java,
* org/omg/PortableServer/POAPackage/ServantAlreadyActive.java,
* org/omg/PortableServer/POAPackage/ServantNotActive.java,
* org/omg/PortableServer/POAPackage/WrongAdapter.java,
* org/omg/PortableServer/POAPackage/WrongPolicy.java,
* org/omg/PortableServer/POAManagerPackage/AdapterInactive.java,
* org/omg/PortableInterceptor/ORBInitInfoPackage/InvalidName.java,
* org/omg/PortableInterceptor/ORBInitInfoPackage/DuplicateName.java,
* org/omg/PortableServer/CurrentPackage/NoContext.java:
Make class final.

Wolfgang

Index: org/omg/PortableInterceptor/ORBInitInfoPackage/ObjectIdHelper.java
===
RCS file: /cvsroot/classpath/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/ObjectIdHelper.java,v
retrieving revision 1.4
diff -u -r1.4 ObjectIdHelper.java
--- org/omg/PortableInterceptor/ORBInitInfoPackage/ObjectIdHelper.java	28 Oct 2005 12:04:47 -	1.4
+++ org/omg/PortableInterceptor/ORBInitInfoPackage/ObjectIdHelper.java	14 Mar 2006 17:59:39 -
@@ -1,5 +1,5 @@
 /* ObjectIdHelper.java --
-   Copyright (C) 2005 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -53,10 +53,10 @@
  *
  * @author Audrius Meskauskas, Lithuania ([EMAIL PROTECTED])
  */
-public class ObjectIdHelper
+public abstract class ObjectIdHelper
 {
   /**
-   * Insert the Object Id into Any (uses [EMAIL PROTECTED] Any.insert_string}).
+   * Insert the Object Id into Any (uses [EMAIL PROTECTED] Any#insert_string(String)}).
*
* @param a the Any to insert into.
* @param that the string to insert.
@@ -67,7 +67,7 @@
   }
 
   /**
-   * Extract the Object Id from Any ((uses [EMAIL PROTECTED] Any.extract_string}).
+   * Extract the Object Id from Any (uses [EMAIL PROTECTED] Any#extract_string()}).
*
* @param a the Any to extract from.
*/
@@ -105,7 +105,7 @@
   }
 
   /**
-   * Calls [EMAIL PROTECTED] OutputStream#write_string()}.
+   * Calls [EMAIL PROTECTED] OutputStream#write_string(String)}.
*
* @param output the stream to write into.
* @param value the string (Object Id) value to write.
Index: org/omg/PortableInterceptor/ORBInitInfoPackage/InvalidName.java
===
RCS file: /cvsroot/classpath/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/InvalidName.java,v
retrieving revision 1.3
diff -u -r1.3 InvalidName.java
--- org/omg/PortableInterceptor/ORBInitInfoPackage/InvalidName.java	28 Aug 2005 11:23:37 -	1.3
+++ org/omg/PortableInterceptor/ORBInitInfoPackage/InvalidName.java	14 Mar 2006 17:59:39 -
@@ -1,5 +1,5 @@
 /* InvalidName.java --
-   Copyright (C) 2005 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -52,7 +52,7 @@
  *
  * @author Audrius Meskauskas, Lithiania ([EMAIL PROTECTED])
  */
-public class InvalidName extends UserException implements IDLEntity,
+public final class InvalidName extends UserException implements IDLEntity,
   Serializable
 {
   /**
Index: org/omg/PortableInterceptor/ORBInitInfoPackage/DuplicateName.java
===
RCS file: /cvsroot/classpath/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/DuplicateName.java,v
retrieving revision 1.3
diff -u -r1.3 DuplicateName.java
--- org/omg/PortableInterceptor/ORBInitInfoPackage/DuplicateName.java	28 Aug 2005 11:23:37 -	1.3
+++ org/omg/PortableInterceptor/ORBInitInfoPackage/DuplicateName.java	14 Mar 2006 17:59:39 -
@@ -1,5 +1,5 @@
 /* DuplicateName.java --
-   Copyright (C) 2005 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -54,7 +54,7 @@
  *
  * @author Audrius Meskauskas, Lithiania ([EMAIL PROTECTED

Re: [cp-patches] Patch: Printing support

2006-03-13 Thread Wolfgang Baer
Hi,

Tom Tromey wrote:
Wolfgang == Wolfgang Baer [EMAIL PROTECTED] writes:
 
 
 Wolfgang finally I found the time to clean up all the printing stuff
 Wolfgang on my disk.  It's now in a state where I don't expect
 Wolfgang anymore to move files around.
 
 This patch is very impressive.  Great job!
 
 Wolfgang Further possible enhancements:
 Wolfgang - Implementing of a printing About UI (via ServiceUIFactory)
 Wolfgang - Providing extension panels to browse all printing attributes
 Wolfgang - Providing properties to specify username/password for
 Wolfgang   secured cups print services
 Wolfgang - Providing properties to specify cups host
 Wolfgang   (if not running on localhost)
 
 How possible is it to use native print dialogs?  This definitely is
 *not* a requirement for checking in your work -- I just thought I'd
 ask as you're clearly the expert here.  It seems to me that good
 platform integration here would be a nice to have feature.

Well, sure it should be possible to use native printing dialogs instead
of the (in patch included) swing one. However I don't know anything about
gtk/qt (nor C programming) to give any advice here. But the resulting printing
settings should be mappable to the IPP ones. One problem might be that the
selection of printer in the native dialog must be restricted to cups printers.
Other native printers (supported by native printing systems e.g. lprng) cannot
be used with the java ipp/cups backend.

Just for clarification the Sun way of printing dialogs:
- In javax.print (class ServiceUI) always the Swing dialog is used
- In java.awt.print there are 4 methods to call a print/pagesetup dialog
  one of the print and pagesetup dialogs always shows the Swing dialog.
  The other methods display native dialogs in 1.4 and in 1.5 only if no
  cups but only native printers are found.

 Wolfgang Beyond javax.print:
 Wolfgang - Implementation of java.awt.print based on javax.print
 Wolfgang   (needs implementation of service-formatted data support)
 
 Last time I looked here, it looked like a couple of the methods here
 could be implemented already, they just wouldn't work until your print
 stuff was done.

Well, I have a patch which implements most of the stuff. However as
java.awt.print is only for printing *service-formatted* data this needs
to be implemented in javax.print first before it will work. Currently
*client-formatted* data is supported, the *service-formatted* implementation
is the one I talked at FOSDEM about. There I am thinking about using iText
or another Postscript/PDF generator to produce the formatted data.
However this is currently only in my head - nothing tried out.
 
 Wolfgang I would like to know if you are OK with the directory layout and 
 with
 Wolfgang the addition of the IPP component for debugging support.
 
 Yes, this is perfect.
 
 I skimmed through the source.  It looks quite nice to me -- generally
 documented, commented, well-laid-out, etc.
 
 One question I had is whether IppException should derive from
 PrintException, instead of Exception as it now does.

Good catch. IppException could be directly passed to the user in
most cases. I will have a look into this and change if possible.
 
 But in any case I think this is ok to check in immediately.

OK, after I had a look at the IppException.
 
 Wolfgang All the stuff is currently only tested against the debian
 Wolfgang cups version (1.1.23) and a virtual pdf printer (I myself
 Wolfgang have no printer atm).
 
 It would be cool to have a printing demo application -- either
 standalone or just by adding printing to one of the existing demos.
 But again, this is just a random wish, not any kind of requirement.

Its already in the patch. See last entry: gnu.classpath.examples.print.Demo

Thanks,
Wolfgang




[cp-patches] FYI: Missing documentation bits for javax.print

2006-03-12 Thread Wolfgang Baer
Hi,

this adds the missing class documentations for javax.print.

The Java Print Service API should now be completely documented. Although,
the documentation of the printing attributes could be quite enhanced
if there will be a positive decision about the usage of RFC documents
at sometime.

2006-03-12  Wolfgang Baer  [EMAIL PROTECTED]

* javax/print/MultiDocPrintService.java,
* javax/print/MultiDocPrintJob.java,
* javax/print/MultiDoc.java: Added and enhanced documentation.

Regards,
Wolfgang


Index: javax/print/MultiDoc.java
===
RCS file: /cvsroot/classpath/classpath/javax/print/MultiDoc.java,v
retrieving revision 1.2
diff -u -r1.2 MultiDoc.java
--- javax/print/MultiDoc.java	2 Jul 2005 20:32:45 -	1.2
+++ javax/print/MultiDoc.java	12 Mar 2006 19:00:05 -
@@ -1,5 +1,5 @@
 /* MultiDoc.java --
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2006 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -42,6 +42,25 @@
 
 
 /**
+ * codeMultiDoc/code defines the interface for objects providing multiple
+ * documents for use in a print job.
+ * p
+ * Implementations of this interface are used to pass multiple documents, to be
+ * printed as one print job, to the codeMultiDocPrintJob/code instance.  
+ * /pp
+ * There exists no implementation of this interface in the Java Print Service 
+ * API. Implementors may assume the following usage in print jobs and the needed
+ * behaviour for implementations: The print job fetches the single documents via 
+ * iteration by consecutive calls of the [EMAIL PROTECTED] #getDoc()} method to obtain the 
+ * current document follwing calls of the [EMAIL PROTECTED] #next()} method to get the next 
+ * multidoc object for the next codegetDoc()/code method call (if returned
+ * multidoc object is not codenull/code). The print service will fetch the 
+ * document object and then retrieve the print data from the document before it 
+ * proceeds with the next call for the next MultiDoc object in the sequence.
+ * /pp
+ * Implementations of this interface have to be multiple thread-safe.
+ * /p
+ * 
  * @author Michael Koch ([EMAIL PROTECTED])
  */
 public interface MultiDoc
@@ -49,16 +68,18 @@
   /**
* Returns the current document.
* 
-   * @return the current document
+   * @return The current document.
* 
* @throws IOException if an error occurs
*/
   Doc getDoc() throws IOException;
 
   /**
-   * Returns the next codeMultiDoc/code object.
+   * Returns the next codeMultiDoc/code object that contains the
+   * next document for retrieval.
* 
-   * @return the next codeMultiDoc/code object
+   * @return The next codeMultiDoc/code object, or codenull/code
+   * if no more documents are available.
* 
* @throws IOException if an error occurs
*/
Index: javax/print/MultiDocPrintJob.java
===
RCS file: /cvsroot/classpath/classpath/javax/print/MultiDocPrintJob.java,v
retrieving revision 1.2
diff -u -r1.2 MultiDocPrintJob.java
--- javax/print/MultiDocPrintJob.java	2 Jul 2005 20:32:45 -	1.2
+++ javax/print/MultiDocPrintJob.java	12 Mar 2006 19:00:05 -
@@ -1,5 +1,5 @@
 /* MultiDocPrintJob.java --
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2006 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -42,17 +42,34 @@
 
 
 /**
+ * codeMultiDocPrintJob/code represents a print job which supports 
+ * printing of multiple documents as one print job.
+ * p
+ * An instance can be obtained from every codeMultiDocPrintService/code
+ * available by calling the 
+ * [EMAIL PROTECTED] javax.print.MultiDocPrintService#createMultiDocPrintJob()} method. 
+ * A print job is bound to the print service it is created from.
+ * /p
+ * 
  * @author Michael Koch ([EMAIL PROTECTED])
  */
 public interface MultiDocPrintJob extends DocPrintJob
 {
   /**
-   * Request a print of a codeMultiDoc/code object.
+   * Prints the documents supplied in the given codeMultiDoc/code object 
+   * as one print job with the given printing attributes.
* 
-   * @param multiDoc the document to print
-   * @param attributes the printing attributes to apply
+   * @param multiDoc the documents to print. Every document must have a 
+   * flavor supported by the bound print service.
+   * @param attributes the printing attributes to apply to the print job. If 
+   * codenull/code the default attribute values will be used.
* 
-   * @throws PrintExeption if an error occurs
+   * @throws PrintException if an error occurs. The thrown exception may 
+   * implement refining print exception interface to provide more detail of 
+   * the error.
+   * 
+   * @see FlavorException
+   * @see AttributeException
*/
   void print(MultiDoc multiDoc, PrintRequestAttributeSet attributes)
 throws PrintException;
Index: javax/print

Re: [cp-patches] RFC: Headers fixlet

2006-03-10 Thread Wolfgang Baer
Hi all,

Wolfgang Baer wrote:
 Hi David,
 
 David Daney wrote:
[...]

I wrote both put and putAll to mimic their old bahavior.  I wanted to
change the behavior as little as possible, while still fixing it.

putAll() IIRC is only used internally, to propagate the headers into the
Request object.  I question whether it should be changed.

I am checking this in now. Just for clarification: The patch attached (and
committed) does not change the putAll() method anymore (it only uses
one iteration instead of two).

Committed with updated changelog.

Wolfgang

 2006-03-07  Wolfgang Baer  [EMAIL PROTECTED]
 
   * gnu/java/net/protocol/http/Headers.java: Added documentation all over.
   (dateFormat): Made private.
   (put): Replace only the last occurance and the value.
   (putAll): Save one iteration. Clarified documenation.
 

 
 
 
 Index: Headers.java
 ===
 RCS file: 
 /cvsroot/classpath/classpath/gnu/java/net/protocol/http/Headers.java,v
 retrieving revision 1.7
 diff -u -r1.7 Headers.java
 --- Headers.java  3 Mar 2006 23:05:33 -   1.7
 +++ Headers.java  7 Mar 2006 07:52:04 -
 @@ -50,7 +50,6 @@
  import java.util.Iterator;
  import java.util.LinkedHashMap;
  import java.util.Map;
 -import java.util.Set;
  
  /**
   * A collection of HTTP header names and associated values.  The
 @@ -65,12 +64,18 @@
  {
/**
 * A list of HeaderElements
 -   *
 */
private final ArrayList headers = new ArrayList();

 -  static final DateFormat dateFormat = new HTTPDateFormat();
 +  /**
 +   * The HTTP dateformat used to parse date header fields.
 +   */
 +  private static final DateFormat dateFormat = new HTTPDateFormat();
  
 +  /**
 +   * Class for a Header element consisting of
 +   * a name and value String.
 +   */
static class HeaderElement
{
  String name;
 @@ -83,8 +88,12 @@
  }
}
  
 +  /**
 +   * Default constructor.
 +   */
public Headers()
{
 +// nothing to do
}
  
/**
 @@ -99,8 +108,11 @@
}

/**
 -   * Returns the value of the specified header as a string.  If
 +   * Returns the value of the specified header as a string. If
 * multiple values are present, the last one is returned.
 +   * 
 +   * @param header the header name (case insensitive search)
 +   * @return The header value or codenull/code if not found.
 */
public String getValue(String header)
{
 @@ -116,8 +128,12 @@
}
  
/**
 -   * Returns the value of the specified header as an integer,
 -   * or -1 if the header is not present or not an integer.
 +   * Returns the value of the specified header as an integer. If
 +   * multiple values are present, the last one is returned.
 +   * 
 +   * @param header the header name (case insensitive search)
 +   * @return The header value or code-1/code if not present or
 +   * not an integer value.
 */
public int getIntValue(String header)
{
 @@ -132,13 +148,18 @@
}
  catch (NumberFormatException e)
{
 +// fall through
}
  return -1;
}
  
/**
 -   * Returns the value of the specified header as a long, or -1 if the
 -   * header is not present or cannot be parsed as a long.
 +   * Returns the value of the specified header as a long. If
 +   * multiple values are present, the last one is returned.
 +   * 
 +   * @param header the header name (case insensitive search)
 +   * @return The header value or code-1/code if not present or
 +   * not a long value.
 */
public long getLongValue(String header)
{
 @@ -153,13 +174,18 @@
}
  catch (NumberFormatException e)
{
 +// fall through
}
  return -1;
}
  
/**
 -   * Returns the value of the specified header as a date,
 -   * or codenull/code if the header is not present or not a date.
 +   * Returns the value of the specified header as a date. If
 +   * multiple values are present, the last one is returned.
 +   * 
 +   * @param header the header name (case insensitive search)
 +   * @return The header value or codenull/code if not present or
 +   * not a date value.
 */
public Date getDateValue(String header)
{
 @@ -180,23 +206,35 @@
  
/**
 * Add a header to this set of headers.  If there is an existing
 -   * header with the same name, it is discarded.
 +   * header with the same name it's value is replaced with the new value.
 +   * If multiple headers of the same name exist only the last one's value 
 +   * is replaced.
 *
 * @param name the header name
 * @param value the header value
 *
 -   * @see #addValue
 +   * @see #addValue(String, String)
 */
public void put(String name, String value)
 -  {
 -remove(name);
 -headers.add(headers.size(), new HeaderElement(name, value));
 +  {
 +for (int i = headers.size() - 1; i = 0; i

Re: [cp-patches] RFC/RFT: HTTP header handling rewrite.

2006-03-03 Thread Wolfgang Baer
David Daney wrote:
 Wolfgang Baer wrote:
[...]

 Not correct.

 These Maps are only modified internally to classpath.  The RFC requires
 header name comparisons to be case insensitive.  The only way to make
 the Map work with String keys is to ensure that the keys get transformed
 to a consistant case.  When the Maps make their way into user code,
 there is no way to know the case so the only operation that makes sense
 WTR user code is iteration.  You have to know a priori that they are
 lower-cased.  I will document this.



 In general you are right. However SUN clearly uses the key name in the
 Map
 returned by getHeaderFields() as it is and not lowercased. And there
 is nothing
 in the javadoc which would make a programmer assume that he must query
 with
 a lowercased name. So if programs use the getHeaderFields() returned
 Map not
 only by iteration their code will break.

 
 What do they do if there are two headers where the name differs only by
 case?  

Depends if you use getHeaderFields() to get a Map first or if you directly
query with getHeaderField(String). See example below.

 Does it have two entries in the map or only one?  

In the Map - two.

 What happens when you do a get on the map with a key of the wrong case?

Returns null.

An example:

Suppose a server returns the following set of headers. Notice that
the last two are lowercase.

HTTP/1.0 200 OK
Server: TestServer
Key: value
Key: value1
key: value2
key: value3

For getHeaderFields() Sun will return a Map with size 4

Key [value1, value]
key [value3, value2]
null [HTTP/1.0 200 OK]
Server [TestServer]

So they are treated (for getHeaderFields ONLY) case sensitiv !

For getHeaderField() Sun treats them case-insensitive according
to the RFC. This leads to:

getHeaderField(Key) and getHeaderField(key) will both return value3
as this is the last value received.

 On the map returned by Sun is it possible to find a String s where
 
 map.containsKey(s) == true
 
 but where:
 
 found = false;
 for (Iterator it = map.keySet().iterator; it.hasNext(); ) {
   String k = (String)it.next();
   if (k.equals(s)) {found = true; break;}
 }
 
 Results in found having a value of false?

No - if the key is found in the map it will also be found by iteration.

 Or I guess put more succinctly: Can the map (with String keys) be
 queried (with Map.get()) in a case insensitive manner?

No

 I really don't want to use a case insensitive horked up map, but I guess
 we can if it is necessary.

I don't understand this one. Don't you mean case sensitive here ?
What does horked up mean - can't find it in any dictionary.

Wolfgang








[cp-patches] RFC: Fixlet for gnu/java/net/protocol/jar/Connection.java

2006-03-02 Thread Wolfgang Baer
Hi,

during running some http tests I found that the testcase
gnu/testlet/java/net/URLConnection/Jar.java is failing.

I added a specialised test to confirm that the FileNotFoundException
needs to be thrown from connect(). Therefore I removed the duplicate
code in getInputStream() as jar_entry cannot be null here.

2006-03-02  Wolfgang Baer  [EMAIL PROTECTED]

* gnu/java/net/protocol/jar/Connection.java:
(connect): Throw FileNotFoundException.
(getInputStream): Remove duplicated code.

OK to commit ?

Wolfgang

Index: Connection.java
===
RCS file: /cvsroot/classpath/classpath/gnu/java/net/protocol/jar/Connection.java,v
retrieving revision 1.12
diff -u -r1.12 Connection.java
--- Connection.java	17 Nov 2005 18:00:59 -	1.12
+++ Connection.java	2 Mar 2006 18:52:44 -
@@ -1,5 +1,5 @@
 /* Connection - jar url connection for java.net
-   Copyright (C) 1999, 2002, 2003, 2005 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002, 2003, 2005, 2006 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -39,6 +39,7 @@
 package gnu.java.net.protocol.jar;
 
 import java.io.File;
+import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
@@ -145,7 +146,7 @@
 jar_entry = (JarEntry) jar_file.getEntry (entry_name);
 
 if(jar_entry == null)
-  throw new IOException (No entry for  + entry_name +  exists.);
+  throw new FileNotFoundException(No entry for  + entry_name +  exists.);
   }
 
 connected = true;
@@ -159,9 +160,6 @@
 if (! doInput)
   throw new ProtocolException(Can't open InputStream if doInput is false);
 
-if (jar_entry == null)
-  throw new IOException (jar_url +  couldn't be found.);
-
 return jar_file.getInputStream (jar_entry);
   }
 


Re: [cp-patches] RFC/RFT: HTTP header handling rewrite.

2006-03-02 Thread Wolfgang Baer
David Daney wrote:
 Wolfgang Baer wrote:
 
 Nice to see you have removed that now useless inner Header class. This
 was one
 of the comments I wanted to make. I worked this day on mauve testcases
 for this
 rewrite.

 These exposed two small bugs in Headers.java:


 Index: gnu/java/net/protocol/http/Headers.java
 ===
 RCS file:
 /sources/classpath/classpath/gnu/java/net/protocol/http/Headers.java,v
 retrieving revision 1.6
 diff -c -p -r1.6 Headers.java
 *** gnu/java/net/protocol/http/Headers.java2 Mar 2006 00:26:57
 -1.6
 --- gnu/java/net/protocol/http/Headers.java2 Mar 2006 20:40:32 -



 [...]


 ! !   /**
 !* Get a new Map containing all the headers.  The keys of the Map
 !* are Strings (the header names).  The values of the Map are
 !* unmodifiable Lists containing Strings (the header values).
 !*
 !* p
 !* !* The returned map is modifiable.  Changing it will not
 effect this
 !* collection of Headers in any way.
 !*
 !* @return a Map containing all the headers.
 !*/
 !   public Map getAsMap()
{
 ! LinkedHashMap m = new LinkedHashMap();
 ! for (Iterator it = headers.iterator(); it.hasNext(); )
{
 ! HeaderElement e = (HeaderElement)it.next();
 ! String k = e.name.toLowerCase();



 No lowercase here. Otherwise keys with uppercase names won't be found.

 String k = e.name;

 
 Not correct.
 
 These Maps are only modified internally to classpath.  The RFC requires
 header name comparisons to be case insensitive.  The only way to make
 the Map work with String keys is to ensure that the keys get transformed
 to a consistant case.  When the Maps make their way into user code,
 there is no way to know the case so the only operation that makes sense
 WTR user code is iteration.  You have to know a priori that they are
 lower-cased.  I will document this.
 

In general you are right. However SUN clearly uses the key name in the Map
returned by getHeaderFields() as it is and not lowercased. And there is nothing
in the javadoc which would make a programmer assume that he must query with
a lowercased name. So if programs use the getHeaderFields() returned Map not
only by iteration their code will break.

Wolfgang



[cp-patches] FYI: Added docs to ServiceUIFactory

2006-02-28 Thread Wolfgang Baer
Hi,

I added some docs to ServiceUIFactory.

2006-02-28  Wolfgang Baer  [EMAIL PROTECTED]

* javax/print/ServiceUIFactory.java: Added documentation to class.

Wolfgang

Index: ServiceUIFactory.java
===
RCS file: /cvsroot/classpath/classpath/javax/print/ServiceUIFactory.java,v
retrieving revision 1.3
diff -u -r1.3 ServiceUIFactory.java
--- ServiceUIFactory.java	2 Jul 2005 20:32:46 -	1.3
+++ ServiceUIFactory.java	28 Feb 2006 21:14:39 -
@@ -1,5 +1,5 @@
 /* ServiceUIFactory.java --
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2006 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -39,18 +39,47 @@
 package javax.print;
 
 /**
+ * codeServiceUIFactory/code enables print services to provide additional 
+ * user interface dialogs.
+ * p
+ * A print service may provide a codeServiceUIFactory/code implementation 
+ * if its codegetServiceUIFactory()/code method is called. If a factory
+ * object is returned it can be queried for provided user interface dialogs. 
+ * Different roles are defined to denote dialogs providing informations about
+ * the print service, dialogs for administration of a print service and for 
+ * end-user browsing dialogs.
+ * /pp
+ * The factory can support providing these UI roles in different dialog types 
+ * (AWT, Swing, JComponent, Panel). The support and use of Swing interfaces is
+ * however preferred.
+ * /p
+ * 
  * @author Michael Koch
  */
 public abstract class ServiceUIFactory
 {
+  /** A user interface providing informations about the print service. */
   public static final int ABOUT_UIROLE = 1;
+  
+  /** A user interface to administer the print service. */
   public static final int ADMIN_UIROLE = 2;
+  
+  /** A user interface for end-user browsing of the print service. */
   public static final int MAIN_UIROLE = 3;
+  
+  /** Role IDs greater than this may be used for other private roles. */
   public static final int RESERVED_UIROLE = 99;
 
+  /** Identifies a UI provided as an AWT dialog. */
   public static final String DIALOG_UI = java.awt.Dialog;
+  
+  /** Identifies a UI provided as a Swing JComponent. */
   public static final String JCOMPONENT_UI = javax.swing.JComponent;
+  
+  /** Identifies a UI provided as a Swing JDialog. */
   public static final String JDIALOG_UI = javax.swing.JDialog;
+  
+  /** Identifies a UI provided as an AWT Panel. */
   public static final String PANEL_UI = java.awt.Panel;
 
   /**


[cp-patches] FYI: DocFlavor fixlets, documentation

2006-02-23 Thread Wolfgang Baer
Hi,

I documented DocFlavor and fixed the implementation so it now
passes all the mauve tests I committed for this class. Also
serialization works now correctly between SUN JDK and GNU classpath.

2006-02-23  Wolfgang Baer  [EMAIL PROTECTED]

* javax/print/DocFlavor.java: Added documentation all over.
(BYTE_ARRAY.TEXT_HTML_HOST): Include host charset encoding to mimetype.
(BYTE_ARRAY.TEXT_PLAIN_HOST): Likewise.
(INPUT_STREAM.TEXT_HTML_HOST): Likewise.
(INPUT_STREAM.TEXT_PLAIN_HOST): Likewise.
(URL.TEXT_HTML_HOST): Likewise.
(URL.TEXT_PLAIN_HOST): Likewise.
(hostEncoding): Initialize with host default charset encoding.
(mediaSubtype): Made transient.
(mediaType): Likewise.
(params): Made transient. Changed type to TreeMap.
(className): Removed, changed to myClassName.
(myClassName): New field as defined in serialized form.
(DocFlavor): Adapted to new variable types, names.
(parseMimeType): Reimplemented.
(getParameter): Search with lowercase name.
(getRepresentationClassName): Adapted to changed variable name.
(hashCode): Likewise.
(toString): Reimplemented.
(readObject): New method for serialization.
(writeObject): Likewise.

Wolfgang

Index: javax/print/DocFlavor.java
===
RCS file: /cvsroot/classpath/classpath/javax/print/DocFlavor.java,v
retrieving revision 1.9
diff -u -r1.9 DocFlavor.java
--- javax/print/DocFlavor.java	20 Sep 2005 20:19:01 -	1.9
+++ javax/print/DocFlavor.java	23 Feb 2006 15:37:08 -
@@ -1,5 +1,5 @@
 /* DocFlavor.java --
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2006 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -38,17 +38,108 @@
 
 package javax.print;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
 import java.io.Serializable;
-import java.util.HashMap;
+import java.io.StreamTokenizer;
+import java.io.StringReader;
+import java.nio.charset.Charset;
 import java.util.Iterator;
 import java.util.Map;
+import java.util.TreeMap;
 
 /**
+ * codeDocFlavor/code provides a description of the format in which the 
+ * print data will be supplied in a print job to the print service.
+ * p
+ * A doc flavor consists of two parts:
+ * ul
+ * li
+ * The MIME type (Multipurpose Internet Mail Extensions types as described 
+ * in RFC 2045/2046) specifying the media format of the print data.
+ * /lili
+ * The representation class name which is the fully qualified name of the 
+ * class providing the print data to the print job. For example if the print 
+ * data is supplied as a byte array the representation class name will be 
+ * code[B/code or for an input stream codejava.io.InputStream/code.
+ * /li
+ * /ul
+ * The codeDocFlavor/code class is therefore used in several places in the 
+ * Java Print Service API. A print service provides its supported document 
+ * flavors as an array of DocFlavor objects and a print job gets the flavor of
+ * its data to print from the codeDoc/code object provided as a DocFlavor
+ * instance.
+ * /p
+ * p
+ * It has to be differentiated between bclient formatted/b and bservice 
+ * formatted/b print data. Client formatted print data is already provided 
+ * formatted by the client e.g. in an image format or as postscript. For 
+ * service formatted print data, the Java Print Service instance produces 
+ * the formatted print data. Here the doc flavor's representation class name 
+ * does specify an interface instead of the actual print data source. The 
+ * print service will call the methods of the given implementation of this
+ * interface with a special Graphics object capable of producing formatted
+ * print data from the graphics routines inside the interface methods.
+ * /p
+ * p
+ * h3Client formatted print data document flavors/h3
+ * The print service uses the representation class of the doc flavor to know 
+ * how to retrieve the print data. If the representation class is a 
+ * codeURL/code it will open the URL to read the print data from it. If it is 
+ * a codebyte[]/code it will directly use the array and send it to the 
+ * printer. There are predefined doc flavor as inner class for the most common 
+ * representation class types:
+ * ul
+ * liCharacter arrays (codechar[]/code): The characters of the array 
+ * represent the print data./li
+ * liCharacter streams (codejava.io.Reader/code): The whole characters 
+ * read from the stream represent the print data./li
+ * liString (codejava.lang.String/code): The characters of the String 
+ * represent the print data./li
+ * liByte arrays (codebyte[]/code): The bytes of the array represent the 
+ * print data. Encoding if text content is given in the mime type./li
+ * liByte streams (codejava.io.InputStream/code): The whole bytes read 
+ * from the stream represent the print data. If text

[cp-patches] FYI: Serialization fixlets for javax.print

2006-02-23 Thread Wolfgang Baer
Hi,

this patch fixes all incompatibilities with serialization in the javax.print
namespace. If I haven't forgot something all is now conformant to the JDK
classes serialized form.

2006-02-23  Wolfgang Baer  [EMAIL PROTECTED]

* javax/print/attribute/standard/MediaSize.java:
(media): Field renamed to mediaName for serialization.
(MediaSize): Adapted to new fieldname.
(getMediaSizeName): Likewise.
* javax/print/attribute/HashAttributeSet.java:
(interfaceName): Field renamed to myInterface for serialization.
(HashAttributeSet): Adapted to the new fieldname.
(add): Likewise.
(addAll): Likewise.
(addInternal): Likewise.
(attributeMap): Made transient.
(readObject): New serialization method.
(writeObject): Likewise.
* javax/print/attribute/AttributeSetUtilities.java:
(SynchronizedAttributeSet.set): Field renamed to attrset for 
serialization.
(SynchronizedAttributeSet.add): Adapted to the new fieldname.
(SynchronizedAttributeSet.addAll): Likewise.
(SynchronizedAttributeSet.clear): Likewise.
(SynchronizedAttributeSet.containsKey): Likewise.
(SynchronizedAttributeSet.containsValue): Likewise. 
(SynchronizedAttributeSet.equals): Likewise.
(SynchronizedAttributeSet.get): Likewise.
(SynchronizedAttributeSet.hashCode): Likewise.  
(SynchronizedAttributeSet.isEmpty): Likewise.
(SynchronizedAttributeSet.remove): Likewise.
(SynchronizedAttributeSet.size): Likewise.  
(SynchronizedAttributeSet.toArray): Likewise.   
(UnmodifiableAttributeSet.set): Field renamed to attrset for 
serialization.
(UnmodifiableAttributeSet.add): Adapted to the new fieldname.
(UnmodifiableAttributeSet.addAll): Likewise.
(UnmodifiableAttributeSet.clear): Likewise.
(UnmodifiableAttributeSet.containsKey): Likewise.
(UnmodifiableAttributeSet.containsValue): Likewise. 
(UnmodifiableAttributeSet.equals): Likewise.
(UnmodifiableAttributeSet.get): Likewise.
(UnmodifiableAttributeSet.hashCode): Likewise.  
(UnmodifiableAttributeSet.isEmpty): Likewise.
(UnmodifiableAttributeSet.remove): Likewise.
(UnmodifiableAttributeSet.size): Likewise.  
(UnmodifiableAttributeSet.toArray): Likewise.   
* javax/print/attribute/standard/MediaPrintableArea.java:
(width): Field renamed to w for serialization.
(height): Field renamed to h for serialization.
(MediaPrintableArea): Adapted to the new fieldnames.
(MediaPrintableArea): Likewise.
(equals): Likewise.
(hashCode): Likewise.
(getHeight): Likewise.
(getWidth): Likewise.


Wolfgang

Index: javax/print/attribute/HashAttributeSet.java
===
RCS file: /cvsroot/classpath/classpath/javax/print/attribute/HashAttributeSet.java,v
retrieving revision 1.5
diff -u -r1.5 HashAttributeSet.java
--- javax/print/attribute/HashAttributeSet.java	14 Nov 2005 20:56:59 -	1.5
+++ javax/print/attribute/HashAttributeSet.java	23 Feb 2006 18:18:32 -
@@ -37,6 +37,9 @@
 
 package javax.print.attribute;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
 import java.io.Serializable;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -49,8 +52,8 @@
 {
   private static final long serialVersionUID = 5311560590283707917L;
   
-  private Class interfaceName;
-  private HashMap attributeMap = new HashMap();
+  private Class myInterface;
+  private transient HashMap attributeMap = new HashMap();
 
   /**
* Creates an empty codeHashAttributeSet/code object.
@@ -112,7 +115,7 @@
 if (interfaceName == null)
   throw new NullPointerException(interfaceName may not be null);
 
-this.interfaceName = interfaceName;
+myInterface = interfaceName;
   }
   
   /**
@@ -192,7 +195,7 @@
*/
   public boolean add(Attribute attribute)
   {
-return addInternal(attribute, interfaceName);
+return addInternal(attribute, myInterface);
   }
 
   private boolean addInternal(Attribute attribute, Class interfaceName)
@@ -201,7 +204,7 @@
   throw new NullPointerException(attribute may not be null);
 
 AttributeSetUtilities.verifyAttributeCategory(interfaceName,
-		  this.interfaceName);
+  myInterface);
 
 Object old = attributeMap.put
   (attribute.getCategory(), AttributeSetUtilities.verifyAttributeValue
@@ -220,7 +223,7 @@
*/
   public boolean addAll(AttributeSet attributes)
   {
-return addAllInternal(attributes, interfaceName);
+return addAllInternal(attributes, myInterface);
   }
 
   private boolean addAllInternal(AttributeSet attributes, Class interfaceName)
@@ -393,4 +396,24 @@
 
 return array

Re: [cp-patches] RFC: Fixlets for java.awt.CardLayout

2006-02-21 Thread Wolfgang Baer
Wolfgang Baer wrote:
 Hi,
 
 I tested an application here which called CardLayout's show method with a null
 parameter triggering a wrong NPE. The changes are backed by the recently
 committed mauve tests for this class.
 
 2006-02-11  Wolfgang Baer  [EMAIL PROTECTED]
 
   * java/awt/CardLayout.java:
   (first): Updated api documentation.
   (last): Likewise.
   (next): Likewise.
   (previous): Likewise.
   (show): Clarified api docs. Return if name is null. Throw
   IllegalArgumentException if layout of container is not this.
   (gotoComponent): Updated api documentation. Throw
   IllegalArgumentException if layout of container is not this.

As no one objected so far, committed with updated changelog date.

Wolfgang



[cp-patches] FYI: Documentation update for StreamPrintService

2006-02-21 Thread Wolfgang Baer
Hi,

changelog says all.

2006-02-21  Wolfgang Baer  [EMAIL PROTECTED]

* javax/print/StreamPrintService.java: Added and enhanced documentation.


Wolfgang

Index: javax/print/StreamPrintService.java
===
RCS file: /cvsroot/classpath/classpath/javax/print/StreamPrintService.java,v
retrieving revision 1.2
diff -u -r1.2 StreamPrintService.java
--- javax/print/StreamPrintService.java	2 Jul 2005 20:32:46 -	1.2
+++ javax/print/StreamPrintService.java	21 Feb 2006 15:34:44 -
@@ -1,5 +1,5 @@
 /* StreamPrintService.java --
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2006 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -42,6 +42,15 @@
 
 
 /**
+ * codeStreamPrintService/code is a special print service capable of
+ * printing into a supplied output stream.
+ * p
+ * Beside providing the same functionality as a print service it additionally
+ * allows to specify the output stream for the print data. A stream print 
+ * service is obtained via the [EMAIL PROTECTED] javax.print.StreamPrintServiceFactory} 
+ * by looking for services supporting a given output format type.
+ * /p
+ * 
  * @author Michael Koch ([EMAIL PROTECTED])
  */
 public abstract class StreamPrintService implements PrintService
@@ -68,16 +77,18 @@
   }
 
   /**
-   * Returns the document format emited by this print service.
+   * Returns the document format emitted by this print service.
+   * The returned string is a MIME type compatible with the 
+   * [EMAIL PROTECTED] DocFlavor} class.
* 
-   * @return the document format
+   * @return The document format of the output.
*/
   public abstract String getOutputFormat();
 
   /**
* Returns the codeOutputStream/code of this object.
* 
-   * @return the codeOutputStream/code
+   * @return The codeOutputStream/code
*/
   public OutputStream getOutputStream()
   {


[cp-patches] FYI: Formatted some files in java.awt.print

2006-02-13 Thread Wolfgang Baer
Hi,

I formatted the files in java.awt.print which didn't follow
our coding style.

2006-02-13  Wolfgang Baer  [EMAIL PROTECTED]

* java/awt/print/PrinterGraphics.java: Reformatted.
* java/awt/print/Paper.java: Likewise.
* java/awt/print/PageFormat.java: Likewise.
* java/awt/print/Pageable.java: Likewise.

Wolfgang




[cp-patches] FYI: New file for javax.print

2006-02-13 Thread Wolfgang Baer
Hi,

changelog says all.

2006-02-13  Wolfgang Baer  [EMAIL PROTECTED]

* javax/print/StreamPrintServiceFactory.java: New file.

Wolfgang

/* StreamPrintServiceFactory.java -- 
   Copyright (C) 2006 Free Software Foundation, Inc.

This file is part of GNU Classpath.

GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.

GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
General Public License for more details.

You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING.  If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.

Linking this library statically or dynamically with other modules is
making a combined work based on this library.  Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.

As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
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 javax.print;

import gnu.classpath.ServiceFactory;

import java.io.OutputStream;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;

/**
 * codeStreamPrintServiceFactory/code provides a static method to lookup 
 * registered factories to construct codeStreamPrintService/code instances.
 * p
 * codeStreamPrintService/code are used to print into a provided output 
 * stream in the document format provided by the stream print service 
 * implementation.
 * /pp
 * Implementations are located and loaded automatically through the SPI JAR 
 * file specification. Therefore implementation classes must provide a default 
 * constructor for instantiation.
 * /p
 * 
 * @author Wolfgang Baer ([EMAIL PROTECTED])
 */
public abstract class StreamPrintServiceFactory
{   
  /**
   * Default public constructor.
   * Used for automatic loading and instantiation through 
   * the SPI jar file specification.
   */
  public StreamPrintServiceFactory()
  {
// nothing to do
  }
  
  /**
   * Searches for matching factories providing stream print services that  
   * support the printing of documents with the given document flavor into 
   * the given output mime type.
   * 
   * @param flavor the document flavor needed, codenull/code doesn't 
   * constrain the lookup result.
   * @param outputMimeType the mime type needed, codenull/code doesn't 
   * constrain the lookup result.
   * 
   * @return The matching codeStreamPrintServiceFactory/code instances.
   */
  public static StreamPrintServiceFactory[] lookupStreamPrintServiceFactories(
DocFlavor flavor, String outputMimeType)
  {
HashSet set = new HashSet();

Iterator it = 
  ServiceFactory.lookupProviders(StreamPrintServiceFactory.class);

while (it.hasNext())
  {
StreamPrintServiceFactory tmp = (StreamPrintServiceFactory) it.next();
if (tmp.getOutputFormat().equals(outputMimeType)
 Arrays.asList(tmp.getSupportedDocFlavors()).contains(flavor))
  set.add(tmp);  
  }

StreamPrintServiceFactory[] tmp = new StreamPrintServiceFactory[set.size()];
return (StreamPrintServiceFactory[]) set.toArray(tmp);  
  } 
  
  /**
   * Returns the output format supported by this factory.
   * 
   * @return The mime type of the output format as string representation.
   */
  public abstract String getOutputFormat();
  
  /**
   * Returns the document flavors this factory supports as flavors
   * for the input documents.
   * 
   * @return The array of supported document flavors.
   */
  public abstract DocFlavor[] getSupportedDocFlavors();
  
  /**
   * Constructs a codeStreamPrintService/code which directs its output
   * the given output stream.
   * 
   * @param out the output stream for the produced document.
   * @return The constructed stream print service.
   */
  public abstract StreamPrintService getPrintService(OutputStream out);
}


[cp-patches] FYI: Reformatted two rmi classes

2006-02-12 Thread Wolfgang Baer
Hi,

i reformatted two rmi classes to be able to add javadocs.

2006-02-12  Wolfgang Baer  [EMAIL PROTECTED]

* java/rmi/MarshalledObject.java: Reformatted.
* java/rmi/Naming.java: Likewise.   

Wolfgang

Index: java/rmi/Naming.java
===
RCS file: /cvsroot/classpath/classpath/java/rmi/Naming.java,v
retrieving revision 1.10
diff -u -r1.10 Naming.java
--- java/rmi/Naming.java	2 Jul 2005 20:32:40 -	1.10
+++ java/rmi/Naming.java	12 Feb 2006 11:35:19 -
@@ -1,5 +1,6 @@
 /* Naming.java --
-   Copyright (c) 1996, 1997, 1998, 1999, 2004  Free Software Foundation, Inc.
+   Copyright (c) 1996, 1997, 1998, 1999, 2004, 2006  
+   Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -76,136 +77,150 @@
  * @author Andrew John Hughes ([EMAIL PROTECTED])
  * @since 1.1
  */
-public final class Naming {
-
+public final class Naming
+{
   /**
* This class isn't intended to be instantiated.
*/
-  private Naming() {}
+  private Naming()
+  {
+  }
 
-/**
- * Looks for the remote object that is associated with the named service.
- * Name and location is given in form of a URL without a scheme:
- *
- * pre
- * //host:port/service-name
- * /pre
- *  
- * The port is optional.
- * 
- * @param name the service name and location
- * @return Remote-object that implements the named service
- * @throws NotBoundException if no object implements the service
- * @throws MalformedURLException 
- * @throws RemoteException
- */
-public static Remote lookup(String name) throws NotBoundException, MalformedURLException, RemoteException {
-URL u = parseURL(name);
-	String serviceName = getName(u);
-	return (getRegistry(u).lookup(serviceName));
-}
+  /**
+   * Looks for the remote object that is associated with the named service. 
+   * Name and location is given in form of a URL without a scheme:
+   * 
+   * pre
+   * //host:port/service-name
+   * /pre
+   * 
+   * The port is optional.
+   * 
+   * @param name the service name and location
+   * @return Remote-object that implements the named service
+   * @throws NotBoundException if no object implements the service
+   * @throws MalformedURLException
+   * @throws RemoteException
+   */
+  public static Remote lookup(String name) throws NotBoundException,
+MalformedURLException, RemoteException
+  {
+URL u = parseURL(name);
+String serviceName = getName(u);
+return (getRegistry(u).lookup(serviceName));
+  }
 
-/**
- * Try to bind the given object to the given service name. 
- * @param name
- * @param obj
- * @throws AlreadyBoundException
- * @throws MalformedURLException
- * @throws RemoteException
- */
-public static void bind(String name, Remote obj) throws AlreadyBoundException, MalformedURLException, RemoteException {
-URL u = parseURL(name);
-	String serviceName = getName(u);
-	getRegistry(u).bind(serviceName, obj);
-}
+  /**
+   * Try to bind the given object to the given service name.
+   * 
+   * @param name
+   * @param obj
+   * @throws AlreadyBoundException
+   * @throws MalformedURLException
+   * @throws RemoteException
+   */
+  public static void bind(String name, Remote obj)
+throws AlreadyBoundException, MalformedURLException, RemoteException
+  {
+URL u = parseURL(name);
+String serviceName = getName(u);
+getRegistry(u).bind(serviceName, obj);
+  }
 
-/**
- * Remove a binding for a given service name.
- * @param name
- * @throws RemoteException
- * @throws NotBoundException
- * @throws MalformedURLException
- */
-public static void unbind(String name) throws RemoteException, NotBoundException, MalformedURLException {
-URL u = parseURL(name);
-	String serviceName = getName(u);
-	getRegistry(u).unbind(serviceName);
-}
+  /**
+   * Remove a binding for a given service name.
+   * 
+   * @param name
+   * @throws RemoteException
+   * @throws NotBoundException
+   * @throws MalformedURLException
+   */
+  public static void unbind(String name) throws RemoteException,
+NotBoundException, MalformedURLException
+  {
+URL u = parseURL(name);
+String serviceName = getName(u);
+getRegistry(u).unbind(serviceName);
+  }
 
-/**
- * Forces the binding between the given Remote-object and the given service name, even 
- * if there was already an object bound to this name. 
- * @param name
- * @param obj
- * @throws RemoteException
- * @throws MalformedURLException
- */
-public static void rebind(String name, Remote obj) throws RemoteException, MalformedURLException {
-URL u = parseURL(name);
-	String serviceName = getName(u);
-	getRegistry(u).rebind(serviceName, obj);
-}
+  /**
+   * Forces the binding between the given Remote-object and the given service
+   * name, even if there was already an object bound to this name.
+   * 
+   * @param name
+   * @param obj
+   * @throws RemoteException
+   * @throws MalformedURLException
+   */
+  public static void rebind(String name, Remote obj

[cp-patches] FYI: Javadoc updates for java.rmi

2006-02-12 Thread Wolfgang Baer
Hi,

I had some javadoc fixes in my local tree and expanded them today
to cover the whole package.

2006-02-12  Wolfgang Baer  [EMAIL PROTECTED]

* java/rmi/MarshalledObject.java: Added api docs to the class.
* java/rmi/Remote.java: Added interface api docs.
* java/rmi/package.html: Added package description.
* java/rmi/AccessException.java: Minor api doc fixes.
* java/rmi/NoSuchObjectException.java: Likewise.
* java/rmi/AlreadyBoundException.java: Likewise.
* java/rmi/RemoteException.java: Likewise.
* java/rmi/NotBoundException.java: Likewise.
* java/rmi/RMISecurityException.java: Likewise.
* java/rmi/StubNotFoundException.java: Likewise.

Wolfgang

Index: java/rmi/AccessException.java
===
RCS file: /cvsroot/classpath/classpath/java/rmi/AccessException.java,v
retrieving revision 1.4
diff -u -r1.4 AccessException.java
--- java/rmi/AccessException.java	2 Jul 2005 20:32:40 -	1.4
+++ java/rmi/AccessException.java	12 Feb 2006 12:23:08 -
@@ -1,5 +1,6 @@
 /* AccessException.java -- thrown if the caller does not have access
-   Copyright (c) 1996, 1997, 1998, 1999, 2002 Free Software Foundation, Inc.
+   Copyright (c) 1996, 1997, 1998, 1999, 2002, 2006 
+   Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -43,7 +44,7 @@
  *
  * @author unknown
  * @see Naming
- * @see ActivationSystem
+ * @see java.rmi.activation.ActivationSystem
  * @since 1.1
  */
 public class AccessException extends RemoteException
Index: java/rmi/AlreadyBoundException.java
===
RCS file: /cvsroot/classpath/classpath/java/rmi/AlreadyBoundException.java,v
retrieving revision 1.4
diff -u -r1.4 AlreadyBoundException.java
--- java/rmi/AlreadyBoundException.java	2 Jul 2005 20:32:40 -	1.4
+++ java/rmi/AlreadyBoundException.java	12 Feb 2006 12:23:08 -
@@ -1,5 +1,6 @@
 /* AlreadyBoundException.java -- thrown if a binding is already bound
-   Copyright (c) 1996, 1997, 1998, 1999, 2002 Free Software Foundation, Inc.
+   Copyright (c) 1996, 1997, 1998, 1999, 2002, 2006 
+   Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -42,8 +43,8 @@
  * bound.
  *
  * @author unknown
- * @see Naming#bind(String, Remote)
- * @see Registry#bind(String, Remote)
+ * @see java.rmi.Naming#bind(String, Remote)
+ * @see java.rmi.registry.Registry#bind(String, Remote)
  * @since 1.1
  * @status updated to 1.4
  */
Index: java/rmi/NoSuchObjectException.java
===
RCS file: /cvsroot/classpath/classpath/java/rmi/NoSuchObjectException.java,v
retrieving revision 1.4
diff -u -r1.4 NoSuchObjectException.java
--- java/rmi/NoSuchObjectException.java	2 Jul 2005 20:32:40 -	1.4
+++ java/rmi/NoSuchObjectException.java	12 Feb 2006 12:23:08 -
@@ -1,5 +1,6 @@
 /* NoSuchObjectException.java -- thrown if the remote object no longer exists
-   Copyright (c) 1996, 1997, 1998, 1999, 2002 Free Software Foundation, Inc.
+   Copyright (c) 1996, 1997, 1998, 1999, 2002, 2006 
+   Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -43,9 +44,9 @@
  * obey the semantics of at most once.
  *
  * @author unknown
- * @see RemoteObject#toStub(Remote)
- * @see UnicastRemoteObject#unexportObject(Remote, boolean)
- * @see Activatable#unexportObject(Remote, boolean)
+ * @see java.rmi.server.RemoteObject#toStub(Remote)
+ * @see java.rmi.server.UnicastRemoteObject#unexportObject(Remote, boolean)
+ * @see java.rmi.activation.Activatable#unexportObject(Remote, boolean)
  * @since 1.1
  * @status updated to 1.4
  */
Index: java/rmi/NotBoundException.java
===
RCS file: /cvsroot/classpath/classpath/java/rmi/NotBoundException.java,v
retrieving revision 1.4
diff -u -r1.4 NotBoundException.java
--- java/rmi/NotBoundException.java	2 Jul 2005 20:32:40 -	1.4
+++ java/rmi/NotBoundException.java	12 Feb 2006 12:23:08 -
@@ -1,5 +1,6 @@
 /* NotBoundException.java -- attempt to use a registry name with no binding
-   Copyright (c) 1996, 1997, 1998, 1999, 2002 Free Software Foundation, Inc.
+   Copyright (c) 1996, 1997, 1998, 1999, 2002, 2006 
+   Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -42,10 +43,10 @@
  * associated binding.
  *
  * @author unknown
- * @see Naming#lookup(String)
- * @see Naming#unbind(String)
- * @see Registry#lookup(String)
- * @see Registry#unbind(String)
+ * @see java.rmi.Naming#lookup(String)
+ * @see java.rmi.Naming#unbind(String)
+ * @see java.rmi.registry.Registry#lookup(String)
+ * @see java.rmi.registry.Registry#unbind(String)
  * @since 1.1
  * @status updated to 1.4
  */
Index: java/rmi/RemoteException.java
===
RCS file: /cvsroot/classpath/classpath/java/rmi

[cp-patches] RFC: Fixlets for java.awt.CardLayout

2006-02-11 Thread Wolfgang Baer
Hi,

I tested an application here which called CardLayout's show method with a null
parameter triggering a wrong NPE. The changes are backed by the recently
committed mauve tests for this class.

2006-02-11  Wolfgang Baer  [EMAIL PROTECTED]

* java/awt/CardLayout.java:
(first): Updated api documentation.
(last): Likewise.
(next): Likewise.
(previous): Likewise.
(show): Clarified api docs. Return if name is null. Throw
IllegalArgumentException if layout of container is not this.
(gotoComponent): Updated api documentation. Throw
IllegalArgumentException if layout of container is not this.

OK, to commit ?

Wolfgang


Index: CardLayout.java
===
RCS file: /cvsroot/classpath/classpath/java/awt/CardLayout.java,v
retrieving revision 1.14
diff -u -r1.14 CardLayout.java
--- CardLayout.java	2 Jul 2005 20:32:23 -	1.14
+++ CardLayout.java	11 Feb 2006 12:30:18 -
@@ -117,7 +117,7 @@
   /**
* Cause the first component in the container to be displayed.
*
-   * @param parent The parent container
+   * @param parent The parent container, not codenull/code.
*/
   public void first (Container parent)
   {
@@ -181,7 +181,7 @@
   /**
* Cause the last component in the container to be displayed.
* 
-   * @param parent The parent container
+   * @param parent The parent container, not codenull/code.
*/
   public void last (Container parent)
   {
@@ -247,7 +247,7 @@
* this current card is the  last one in the deck, the first
* component is displayed.
* 
-   * @param parent The parent container
+   * @param parent The parent container, not codenull/code.
*/
   public void next (Container parent)
   {
@@ -271,7 +271,7 @@
* If this current card is the first one in the deck, the last
* component is displayed.
* 
-   * @param parent The parent container
+   * @param parent The parent container, not codenull/code.
*/
   public void previous (Container parent)
   {
@@ -321,13 +321,19 @@
 
   /**
* Cause the named component to be shown.  If the component name is
-   * unknown, this method does nothing.
+   * unknown or codenull/code, this method does nothing.
* 
-   * @param parent The parent container
-   * @param name The name of the component to show
+   * @param parent The parent container, not codenull/code.
+   * @param name The name of the component to show 
*/
   public void show (Container parent, String name)
   {
+if (name == null)
+  return;
+   
+if (parent.getLayout() != this)
+  throw new IllegalArgumentException(parent's layout is not this CardLayout);
+
 Object target = tab.get (name);
 if (target != null)
   {
@@ -362,9 +368,15 @@
* 
* @param parent The parent container
* @param what The type of goto: FIRST, LAST, NEXT or PREV
+   * 
+   * @throws IllegalArgumentException if parent has not this 
+   * CardLayout set as its layout.
*/
   private void gotoComponent (Container parent, int what)
   {
+if (parent.getLayout() != this)
+  throw new IllegalArgumentException(parent's layout is not this CardLayout);
+
 synchronized (parent.getTreeLock ())
   {
 	int num = parent.ncomponents;


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



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: 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 codetrue/code if, codefalse/code otherwise.
+   */
+  public boolean isRedirect()
+  {
+return (code != 304  getCodeClass() == 3);
+  }
+  
+  /**
+   * Tests whether this response indicates an error.
+   * Errors are the response codes code4xx/code - Client error and
+   * code5xx/code - Server error.
+   * 
+   * @return codetrue/code if, codefalse/code otherwise.
+   */
+  public boolean isError()
+  {
+return (getCodeClass() == 4 || getCodeClass() == 5);
+  }
 
   /**
* Returns an InputStream that returns the body of the response.


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



[cp-patches] FYI: Compatibility fixes for javax.print.attribute.standard

2006-02-06 Thread Wolfgang Baer
Hi,

I am checking in some compatibility fixes pointed out by reverse japi.

2006-02-06  Wolfgang Baer  [EMAIL PROTECTED]

* javax/print/attribute/standard/Compression.java,
* javax/print/attribute/standard/Finishings.java,
* javax/print/attribute/standard/JobMediaSheets.java,
* javax/print/attribute/standard/JobSheets.java,
* javax/print/attribute/standard/JobState.java,
* javax/print/attribute/standard/JobStateReason.java,
* javax/print/attribute/standard/ReferenceUriSchemesSupported.java,
* javax/print/attribute/standard/PrintQuality.java,
* javax/print/attribute/standard/Media.java,
* javax/print/attribute/standard/MultipleDocumentHandling.java,
* javax/print/attribute/standard/PrinterStateReason.java,
* javax/print/attribute/standard/PDLOverrideSupported.java:
(getName): Make method final.
(getCategory): Likewise.
* javax/print/attribute/standard/MediaSize.java:
(getName): Make method final.
(getCategory): Likewise.
(ISO): Added private default constructor.
(NA): Likewise.
(JIS): Likewise.
(Other): Likewise.
(Engineering): Likewise.

Wolfgang

Index: javax/print/attribute/standard/Compression.java
===
RCS file: /cvsroot/classpath/classpath/javax/print/attribute/standard/Compression.java,v
retrieving revision 1.5
diff -u -r1.5 Compression.java
--- javax/print/attribute/standard/Compression.java	30 Nov 2005 18:34:59 -	1.5
+++ javax/print/attribute/standard/Compression.java	6 Feb 2006 11:06:21 -
@@ -1,5 +1,5 @@
 /* Compression.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.
 
@@ -91,7 +91,7 @@
*
* @return The class codeCompression/code itself.
*/
-  public Class getCategory()
+  public final Class getCategory()
   {
 return Compression.class;
   }
@@ -101,7 +101,7 @@
*
* @return The name compression.
*/
-  public String getName()
+  public final String getName()
   {
 return compression;
   }
Index: javax/print/attribute/standard/Finishings.java
===
RCS file: /cvsroot/classpath/classpath/javax/print/attribute/standard/Finishings.java,v
retrieving revision 1.5
diff -u -r1.5 Finishings.java
--- javax/print/attribute/standard/Finishings.java	15 Dec 2005 21:31:33 -	1.5
+++ javax/print/attribute/standard/Finishings.java	6 Feb 2006 11:06:21 -
@@ -1,5 +1,5 @@
 /* Finishings.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.
 
@@ -238,7 +238,7 @@
*
* @return the class codeFinishings/code itself
*/
-  public Class getCategory()
+  public final Class getCategory()
   {
 return Finishings.class;
   }
@@ -248,7 +248,7 @@
*
* @return The name finishings.
*/
-  public String getName()
+  public final String getName()
   {
 return finishings;
   }
Index: javax/print/attribute/standard/JobMediaSheets.java
===
RCS file: /cvsroot/classpath/classpath/javax/print/attribute/standard/JobMediaSheets.java,v
retrieving revision 1.5
diff -u -r1.5 JobMediaSheets.java
--- javax/print/attribute/standard/JobMediaSheets.java	16 Dec 2005 22:10:08 -	1.5
+++ javax/print/attribute/standard/JobMediaSheets.java	6 Feb 2006 11:06:21 -
@@ -1,5 +1,5 @@
 /* JobMediaSheets.java -- 
-   Copyright (C) 2003, 2005 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2005, 2006 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -107,7 +107,7 @@
*
* @return The class codeJobMediaSheets/code itself.
*/
-  public Class getCategory()
+  public final Class getCategory()
   {
 return JobMediaSheets.class;
   }
@@ -117,7 +117,7 @@
*
* @return The name job-media-sheets.
*/
-  public String getName()
+  public final String getName()
   {
 return job-media-sheets;
   }
Index: javax/print/attribute/standard/JobSheets.java
===
RCS file: /cvsroot/classpath/classpath/javax/print/attribute/standard/JobSheets.java,v
retrieving revision 1.5
diff -u -r1.5 JobSheets.java
--- javax/print/attribute/standard/JobSheets.java	16 Dec 2005 19:27:47 -	1.5
+++ javax/print/attribute/standard/JobSheets.java	6 Feb 2006 11:06:21 -
@@ -1,5 +1,5 @@
 /* JobSheets.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.
 
@@ -88,7 +88,7 @@
*
* @return The class codeJobSheets/code itself.
*/
-  public Class getCategory()
+  public final

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

2006-02-05 Thread Wolfgang Baer
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.

OK to commit ?

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.17
diff -u -r1.17 HTTPURLConnection.java
--- gnu/java/net/protocol/http/HTTPURLConnection.java	20 Jan 2006 22:15:58 -	1.17
+++ gnu/java/net/protocol/http/HTTPURLConnection.java	4 Feb 2006 16:50:13 -
@@ -449,21 +448,31 @@
 
   public String getRequestProperty(String key)
   {
+if (key == null)
+  return null;
+
 return requestHeaders.getValue(key);
   }
 
   public Map getRequestProperties()
   {
+if (connected)
+  throw new IllegalStateException(Already connected);
+
 return requestHeaders;
   }
 
   public void setRequestProperty(String key, String value)
   {
+super.setRequestProperty(key, value);
+
 requestHeaders.put(key, value);
   }
 
   public void addRequestProperty(String key, String value)
   {
+super.addRequestProperty(key, value);
+
 String old = requestHeaders.getValue(key);
 if (old == null)
   {
Index: java/net/URLConnection.java
===
RCS file: /cvsroot/classpath/classpath/java/net/URLConnection.java,v
retrieving revision 1.35
diff -u -r1.35 URLConnection.java
--- java/net/URLConnection.java	29 Sep 2005 23:45:17 -	1.35
+++ java/net/URLConnection.java	4 Feb 2006 16:50:14 -
@@ -598,6 +598,9 @@
*/
   public void setAllowUserInteraction(boolean allow)
   {
+if (connected)
+  throw new IllegalStateException(Already connected);
+
 allowUserInteraction = allow;
   }
 
@@ -776,7 +779,7 @@
*
* @param key The name of the property
*
-   * @return Value of the property
+   * @return Value of the property, or codenull/code if key is null.
*
* @exception IllegalStateException If already connected
*


[cp-patches] RFC: Throwing ConnectException in Sockets

2006-02-05 Thread Wolfgang Baer
Hi all,

I have a test here that shows that SUN throws a java.net.ConnectException
if a connection to a socket fails (e.g. nothing is listening). GNU classpath
currently throws an IOException.

I have no clue of this C stuff but I tried a first patch :-)

2006-02-05  Wolfgang Baer  [EMAIL PROTECTED]

* native/jni/java-net/javanet.c (_javanet_connect):
Throw ConnectException instead of IOException if connection failed.
* native/jni/java-net/javanet.h:
Add a define for java.net.ConnectException

Does this look correct ?

Wolfgang

Index: native/jni/java-net/javanet.c
===
RCS file: /cvsroot/classpath/classpath/native/jni/java-net/javanet.c,v
retrieving revision 1.32
diff -u -r1.32 javanet.c
--- native/jni/java-net/javanet.c	25 Jan 2006 10:40:12 -	1.32
+++ native/jni/java-net/javanet.c	5 Feb 2006 14:02:53 -
@@ -559,7 +559,7 @@
 	   (TARGET_NATIVE_LAST_ERROR ()
 	  != TARGET_NATIVE_ERROR_INTERRUPT_FUNCTION_CALL))
 	{
-	  JCL_ThrowException (env, IO_EXCEPTION,
+	  JCL_ThrowException (env, CONNECT_EXCEPTION,
 			  TARGET_NATIVE_LAST_ERROR_STRING ());
 	  return;
 	}
Index: native/jni/java-net/javanet.h
===
RCS file: /cvsroot/classpath/classpath/native/jni/java-net/javanet.h,v
retrieving revision 1.12
diff -u -r1.12 javanet.h
--- native/jni/java-net/javanet.h	25 Jan 2006 10:40:12 -	1.12
+++ native/jni/java-net/javanet.h	5 Feb 2006 14:02:53 -
@@ -50,6 +50,7 @@
 /* Exception Classes */
 #define BIND_EXCEPTION java/net/BindException
 #define IO_EXCEPTION java/io/IOException
+#define CONNECT_EXCEPTION java/net/ConnectException
 #define SOCKET_EXCEPTION java/net/SocketException
 #define UNKNOWN_HOST_EXCEPTION java/net/UnknownHostException
 


Re: [cp-patches] RFC: HTTPURLConnection fixlet

2006-02-05 Thread Wolfgang Baer
Hi all,

David Daney wrote:
 After thinking about it a bit more (and reading Sun's API reference), I
 think that the exception should be thrown from getInputStream().  On any
 4??, 5?? response code getInputStream should throw an IOException.  On
 404 it should the FileNotFoundException.  Any time getInputStream()
 throws an exception because of a 4?? or 5?? status code,
 getErrorStream() must contain the response body if any.
 
 connect() should only throw an exception if there are socket level
 IOExceptions.
 
 I will update PR 26081 to reflect my new understanding.

I can confirm this understanding and updated the PR. Its exactly as David
states above with the additional special case that also a FileNotFoundException
is thrown for HTTP code 410. The fileNotFound mauve test is updated to test the
behaviour of connect, getInputStream, getErrorStream for a 404 case.

I propose the following revised patch as fix.

2006-02-05  Wolfgang Baer  [EMAIL PROTECTED]

Fixes Bug #26081
* gnu/java/net/protocol/http/HTTPURLConnection.java:
(isError): New helper method to see if response is an error.
(connect): If error condition redirect responseSink to errorSink.
(getInputStream): If error condition throw IOException, for the error
codes 404 and 410 throw a FileNotFoundException.

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.17
diff -u -r1.17 HTTPURLConnection.java
--- gnu/java/net/protocol/http/HTTPURLConnection.java	20 Jan 2006 22:15:58 -	1.17
+++ gnu/java/net/protocol/http/HTTPURLConnection.java	5 Feb 2006 17:15:03 -
@@ -349,11 +349,8 @@
   {
 responseSink = response.getBody();
 
-if (response.getCode() == 404)
-	  {
-		errorSink = responseSink;
-		throw new FileNotFoundException(url.toString());
-	  }
+if (isError(response))
+  errorSink = responseSink;  
   }
   }
 while (retry);
@@ -365,6 +362,12 @@
 int sc = response.getCode();
 return (sc != 304  (sc / 100) == 3);
   }
+  
+  private static boolean isError(Response response)
+  {
+int sc = response.getCodeClass();
+return (sc == 4 || sc == 5);
+  }
 
   /**
* Returns a connection, from the pool if necessary.
@@ -515,6 +526,17 @@
   {
 throw new ProtocolException(doInput is false);
   }
+
+if (isError(response))
+  {
+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;
   }
 


Re: [cp-patches] RFC: HTTPURLConnection fixlet

2006-02-05 Thread Wolfgang Baer
Hi,

David Daney wrote:
 Wolfgang Baer wrote:
 @@ -365,6 +362,12 @@
  int sc = response.getCode();
  return (sc != 304  (sc / 100) == 3);
}
 +  +  private static boolean isError(Response response)
 +  {
 +int sc = response.getCodeClass();
 +return (sc == 4 || sc == 5);
 +  }
  
/**
 * Returns a connection, from the pool if necessary.
 
 
 Perhaps make isError() a member of Response (probably with default
 visibility) as it is really a property of the Response.  Then you can do:

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

 With that small change, I think this is a good patch.  There does not
 seem to be a formal acceptance policy here, so I would say that if no
 one else objects within a couple of days, commit it.

Thanks for your review.

 Thanks for doing this.  As you can see from my PRs, this is something
 that I was looking at and you just saved me a bunch of work.

Well, the bugs just stopped my normal work on printing support.
So I had to fix them :-)

Wolfgang



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

2006-02-04 Thread Wolfgang Baer
Hi,

David Daney wrote:
 Wolfgang Baer wrote:
 
 +String expect = getHeader(Expect);
 +if (expect != null  expect.equals(100-continue))
 
  ^
 
 This *may* have to be a case insensitive compare.  I think RFC2616
 allows either upper or lower case.

I am not sure about this, Section 4.2 Message Headers of the RFC only
explicitly talks about case insensitiveness for the field name (which
is respected througth the getHeader() method) and nothing about the
field value.

I am fine with comparing through equalsIgnoreCase if you think so. I am
not familiar with reading RFC's - maybe its noted somewhere else and I
didn't found it.

Thanks,
Wolfgang




[cp-patches] RFC: HTTPURLConnection fixlet

2006-02-04 Thread Wolfgang Baer
Hi,

this is the first fixlet for the failing fileNotFound test committed
to mauve.

2006-02-04  Wolfgang Baer  [EMAIL PROTECTED]

* gnu/java/net/protocol/http/HTTPURLConnection.java:
(connect): Don't throw FileNotFoundException.

OK to commit ?

Wolfgang
Index: HTTPURLConnection.java
===
RCS file: /cvsroot/classpath/classpath/gnu/java/net/protocol/http/HTTPURLConnection.java,v
retrieving revision 1.17
diff -u -r1.17 HTTPURLConnection.java
--- HTTPURLConnection.java	20 Jan 2006 22:15:58 -	1.17
+++ HTTPURLConnection.java	4 Feb 2006 14:24:42 -
@@ -352,7 +352,6 @@
 if (response.getCode() == 404)
 	  {
 		errorSink = responseSink;
-		throw new FileNotFoundException(url.toString());
 	  }
   }
   }


Re: [cp-patches] RFC: HTTPURLConnection fixlet

2006-02-04 Thread Wolfgang Baer
Hi Chris,

Chris Burdess wrote:
 Wolfgang Baer wrote:

 Index: HTTPURLConnection.java
 ===
 RCS file: /cvsroot/classpath/classpath/gnu/java/net/protocol/http/
 HTTPURLConnection.java,v
 retrieving revision 1.17
 diff -u -r1.17 HTTPURLConnection.java
 --- HTTPURLConnection.java20 Jan 2006 22:15:58 -1.17
 +++ HTTPURLConnection.java4 Feb 2006 14:24:42 -
 @@ -352,7 +352,6 @@
  if (response.getCode() == 404)
{
  errorSink = responseSink;
 -throw new FileNotFoundException(url.toString());
}
}
}
 
 
 Woah there. This was definitely there for a reason - I believe we are 
 supposed to throw FileNotFoundException for a 404.

I looked a bit closer and found a FileNotFoundException being mentioned
in the getErrorStream method ...responds with a 404, which will cause a
FileNotFoundException to be thrown in connect

So its specified there but apparently (as the mauve test shows) it is
not done in the reference implementation. The question is what we should
do, following the api documentation of what the reference implementation does ?

Wolfgang




[cp-patches] RFC: HTTPURLConnection changes needed for CUPS

2006-01-30 Thread Wolfgang Baer

Hi all,

Cups uses IPP over HTTP for communication. However the current cups versions
don't correctly implement HTTP 1.1. In particular they fail if 'Expect: 
100-continue' header is set. And thats the default in GNU classpath.


The bug is known upstream and will be fixed in CUPS 1.2.

I currently work in my local tree with an addition to Request and
HTTPURLConnection to disable 'Expect: 100-continue' on request.

2006-01-30  Wolfgang Baer  [EMAIL PROTECTED]

* gnu/java/net/protocol/http/HTTPURLConnection.java:
(disableExpect): New field.
(disableExpectHeader): New method.
(connect): If disableExpect is true set requestBodyNegotiationThreshold
to -1 to diable 'Expect: 100-continue' usage.
* gnu/java/net/protocol/http/Request.java
(dispatch): Don't use 'Expect: 100-continue' if
requestBodyNegotiationThreshold is negative as explained in api docs.   
I don't know if its good to introduce a new public method which could be used
at least per reflection, as HTTPURLConnection is the GNU specific
implementation class for java.net.HttpURLConnection. The default behaviour is
not changed by this patch.

The change to Request is actually a fix to implement the behaviour as
advertised by the API documentation of the setRequestBodyNegotiationThreshold
method.

Comments, or other ideas how I can use the class without expect header ?

Thanks,
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.17
diff -u -r1.17 HTTPURLConnection.java
--- gnu/java/net/protocol/http/HTTPURLConnection.java	20 Jan 2006 22:15:58 -	1.17
+++ gnu/java/net/protocol/http/HTTPURLConnection.java	30 Jan 2006 14:00:59 -
@@ -87,6 +87,7 @@
   int proxyPort;
   String agent;
   boolean keepAlive;
+  boolean disableExpect;
 
   private Request request;
   private Headers requestHeaders;
@@ -204,6 +205,10 @@
 try
   {
 request = connection.newRequest(method, file);
+if (disableExpect)
+  {
+request.setRequestBodyNegotiationThreshold(-1);
+  }
 if (!keepAlive)
   {
 request.setHeader(Connection, close);
@@ -216,6 +221,7 @@
 if (requestSink != null)
   {
 byte[] content = requestSink.toByteArray();
+System.out.println(Length X:  + content.length);
 RequestBodyWriter writer = new ByteArrayRequestBodyWriter(content);
 request.setRequestBodyWriter(writer);
   }
@@ -710,6 +716,19 @@
   }
 return handshakeEvent.getPeerCertificates();
   }
+  
+  /**
+   * Disable 'Expect: 100-Continue' handshake.
+   * p
+   * 'Expect: 100-Continue' handshake may cause problems
+   * if the server only supports HTTP 1.0 or otherwise
+   * does not support this handshake.
+   * /p 
+   */
+  public void disableExpectHeader() {
+  disableExpect = true;
+  }
+ 
 
   // HandshakeCompletedListener
 
Index: gnu/java/net/protocol/http/Request.java
===
RCS file: /cvsroot/classpath/classpath/gnu/java/net/protocol/http/Request.java,v
retrieving revision 1.7
diff -u -r1.7 Request.java
--- gnu/java/net/protocol/http/Request.java	16 Jan 2006 20:43:20 -	1.7
+++ gnu/java/net/protocol/http/Request.java	30 Jan 2006 14:00:59 -
@@ -291,7 +291,8 @@
 if (requestBodyWriter != null)
   {
 contentLength = requestBodyWriter.getContentLength();
-if (contentLength  requestBodyNegotiationThreshold)
+if (requestBodyNegotiationThreshold  0 
+ contentLength  requestBodyNegotiationThreshold)
   {
 expectingContinue = true;
 setHeader(Expect, 100-continue);


Re: [cp-patches] RFC: HTTPURLConnection changes needed for CUPS

2006-01-30 Thread Wolfgang Baer

Hi David,

David Daney wrote:

Wolfgang Baer wrote:


Comments, or other ideas how I can use the class without expect header ?



I don't like this approach because the basic idea behind classpath is to 
make a compatible implementation of the java runtime.  Adding secret 
methods that have to be called depending on the version of the runtime 
seems contrary to that goal.


This method has nothing to do with the version of the runtime, whatever
you mean with that. It would be called form the gnu.* namespace by a few GNU
internal classes implementing IPP.


It is not improbable that there are bugs in this area of the 
HTTPURLConnection, I would prefer to try to find a deeper underlying 
problem rather than apply a patch that masks it.


Can you do this:

1) Emperically determine what Sun's runtime does with respect ro Expect 
headers.  Does it work with CUPS  1.2?


There is nothing one could determine in Sun's runtime. Printing is not
specified at all for the internals. I even don't know if SUN (it supports
CUPS since 1.5) implements a java only or native connection to cups.

2) Would it make sense to never send an Expect header UNLESS it was 
explicitly set by the calling code?  My reading of RFC 2616 makes me 
think that this is what we should do.  If this makes sense submit a 
patch that does this.


Thats actually what the apache commons-httpclient library does. One has
to explicitly enable the use of Expect. Thats how I found the bug/problem btw.

However, I have no clue at all in the HTTP / java.net area so I cannot
provide a patch which correctly would address such a change. Beside that,
if it would be done the same way as this patch it would also introduce a
public method in the implementation class of URLConnection to enable Expect
header usage.

Wolfgang



Re: [cp-patches] RFC: HTTPURLConnection changes needed for CUPS

2006-01-30 Thread Wolfgang Baer

Hi David,

David Daney wrote:


Thats actually what the apache commons-httpclient library does. One has
to explicitly enable the use of Expect. Thats how I found the 
bug/problem btw.


However, I have no clue at all in the HTTP / java.net area so I cannot
provide a patch which correctly would address such a change.



Well you understand it well enough to have created your first patch.


I meant not the patch to remove the expect usage itself. I more thought
of if there are actually places where it should be enabled in the remaining
codebase after its removed as default (e.g. wiht the method you showed below).

OK, I will try to come up with a patch for the removal.


Beside that,
if it would be done the same way as this patch it would also introduce a
public method in the implementation class of URLConnection to enable 
Expect

header usage.

Not true: java.net.URLConnection.addRequestProperty(Expect, 
100-Continue);


Thanks, wouldn't have thought of this myself. Too obvious :-)

Wolfgang





Re: [cp-patches] [FYI]: Patch for javax.print.attribute.standard package

2006-01-16 Thread Wolfgang Baer

Hi,

Mark Wielaard wrote:

Hi Wolfgang,

On Fri, 2006-01-13 at 23:44 +0100, Wolfgang Baer wrote:

Evrything I do here is to call one instance of every container class
so it gets loaded and everyone of its static MediaSize objects are
instantiated. Should I put a comment here ?



Please do. I see now how initializing one static field makes sure all
static fields are initialized, but since I had to ask it wasn't
immediately obvious (at least to me).

[...]

I still think this is kind of strange. It means any user can register
new MediaSizes even by accident. Please also add a good comment about
this to the MediaSize constructor.


This adds the comment to the static initializer and every constructor.

2006-01-16  Wolfgang Baer  [EMAIL PROTECTED]

* javax/print/attribute/standard/MediaSize.java:
(static_initializer): Added comment.
(MediaSize): Added javadoc to mention cache registration.
(MediaSize): Likewise.
(MediaSize): Likewise.
(MediaSize): Likewise.

Wolfgang

Index: MediaSize.java
===
RCS file: /cvsroot/classpath/classpath/javax/print/attribute/standard/MediaSize.java,v
retrieving revision 1.5
diff -u -r1.5 MediaSize.java
--- MediaSize.java	14 Jan 2006 10:29:58 -	1.5
+++ MediaSize.java	16 Jan 2006 09:05:19 -
@@ -72,7 +72,14 @@
   static
 {
   mediaCache = new ArrayList();
-
+  
+  // We call one instance of every container class to make sure it gets
+  // loaded during class initialization and therefore all other static
+  // fields of this container class also.
+  
+  // This is needed to put all MediaSize instance into the mediaCache
+  // for use by the static methods in this class.
+  
   MediaSize tmp = MediaSize.ISO.A0;
   tmp = MediaSize.JIS.B0;
   tmp = MediaSize.Engineering.A;
@@ -83,13 +90,18 @@
   private MediaSizeName media;
   
   /**
-   * Creates a codeMediaSize/code object.
+   * Creates a codeMediaSize/code object. The created object will be added 
+   * to an internal cache used in the static methods of this class for lookup 
+   * of available codeMediaSize/code instances.
*
* @param x the size in x direction
* @param y the size in y direction
* @param units the units to use for the sizes
*
* @exception IllegalArgumentException if x or y lt; 0 or units lt; 1
+   * 
+   * @see #findMedia(float, float, int)
+   * @see #getMediaSizeForName(MediaSizeName)
*/
   public MediaSize(float x, float y, int units)
   {
@@ -99,7 +111,9 @@
   
   /**
* Creates a codeMediaSize/code object associated with the given
-   * media name.
+   * media name. The created object will be added to an internal cache used 
+   * in the static methods of this class for lookup of available 
+   * codeMediaSize/code instances.
*
* @param x the size in x direction
* @param y the size in y direction
@@ -107,6 +121,9 @@
* @param media the media name to associate
*
* @exception IllegalArgumentException if x or y lt; 0 or units lt; 1
+   * 
+   * @see #findMedia(float, float, int)
+   * @see #getMediaSizeForName(MediaSizeName)
*/
   public MediaSize(float x, float y, int units, MediaSizeName media)
   {
@@ -116,13 +133,18 @@
   }
   
   /**
-   * Creates a codeMediaSize/code object.
+   * Creates a codeMediaSize/code object. The created object will be added 
+   * to an internal cache used in the static methods of this class for lookup 
+   * of available codeMediaSize/code instances.
*
* @param x the size in x direction
* @param y the size in y direction
* @param units the units to use for the sizes
*
* @exception IllegalArgumentException if x or y lt; 0 or units lt; 1
+   * 
+   * @see #findMedia(float, float, int)
+   * @see #getMediaSizeForName(MediaSizeName)
*/
   public MediaSize(int x, int y, int units)
   {
@@ -132,7 +154,9 @@
   
   /**
* Creates a codeMediaSize/code object associated with the given
-   * media name.
+   * media name. The created object will be added to an internal cache used 
+   * in the static methods of this class for lookup of available 
+   * codeMediaSize/code instances.
*
* @param x the size in x direction
* @param y the size in y direction
@@ -140,6 +164,9 @@
* @param media the media name to associate
*
* @exception IllegalArgumentException if x or y lt; 0 or units lt; 1
+   * 
+   * @see #findMedia(float, float, int)
+   * @see #getMediaSizeForName(MediaSizeName)
*/
   public MediaSize(int x, int y, int units, MediaSizeName media)
   {
___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


Re: [cp-patches] [generics] RFC: Genericize return type in PrinterStateReasons

2006-01-15 Thread Wolfgang Baer

Hi,

Andrew John Hughes wrote:

On Sat, 2006-01-14 at 11:54 +0100, Wolfgang Baer wrote:



The patch looks fine to me; I think I already did some similiar edits on
this particular file when merging, so please make sure your patch is
against the latest version before committing.


Done.


Generally, I think these kind of edits are okay, but I'd save the
majority of it, where possible, to after the generics branch is
re-merged.  There are cases where it has to be done, and I also don't
see any problem with fixing the bits that are part of the API (this is
especially important for those who worship JAPI).  Additionally, it
could possibly catch the odd bug... though I've not seen it yet.


So I only committing the part of the API and just ignore the eclipse
warning for the stuff inside the method.

2006-01-15  Wolfgang Baer  [EMAIL PROTECTED]

* javax/print/attribute/standard/PrinterStateReasons.java:
(printerStateReasonSet): Genericize the return type.

Thanks,
Wolfgang




Index: PrinterStateReasons.java
===
RCS file: /cvsroot/classpath/classpath/javax/print/attribute/standard/PrinterStateReasons.java,v
retrieving revision 1.2.2.5
diff -u -r1.2.2.5 PrinterStateReasons.java
--- PrinterStateReasons.java	10 Jan 2006 15:59:42 -	1.2.2.5
+++ PrinterStateReasons.java	15 Jan 2006 13:39:47 -
@@ -139,7 +139,7 @@
* @param severity the severity level for the constructed set.
* @return The set of printer state reasons.
*/
-  public Set printerStateReasonSet(Severity severity)
+  public SetPrinterStateReason printerStateReasonSet(Severity severity)
   {
 if (severity == null)
   throw new NullPointerException(severity is null);
___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


[cp-patches] [generics] RFC: Genericize return type in PrinterStateReasons

2006-01-14 Thread Wolfgang Baer

Hi,

as this is my first patch for the generics branch I would like a
comment if the patch is OK.

Also I would like to know if one should only genericize the API
or also (as I did in this patch) genericize the method body and
remove no longer needed stuff. I did this to get rid of a bunch
of eclipse warnings but maybe this is not wanted at this stage
as it might make merging harder.

Thanks,
Wolfgang

2006-01-14  Wolfgang Baer  [EMAIL PROTECTED]

* javax/print/attribute/standard/PrinterStateReasons.java:
Remove no longer needed import of Iterator.
(printerStateReasonSet): Genericize return type and method body.
(put): Remove no longer needed casts.

Index: PrinterStateReasons.java
===
RCS file: /cvsroot/classpath/classpath/javax/print/attribute/standard/PrinterStateReasons.java,v
retrieving revision 1.2.2.5
diff -u -r1.2.2.5 PrinterStateReasons.java
--- PrinterStateReasons.java	10 Jan 2006 15:59:42 -	1.2.2.5
+++ PrinterStateReasons.java	14 Jan 2006 10:43:36 -
@@ -41,7 +41,6 @@
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
 
@@ -139,16 +138,14 @@
* @param severity the severity level for the constructed set.
* @return The set of printer state reasons.
*/
-  public Set printerStateReasonSet(Severity severity)
+  public SetPrinterStateReason printerStateReasonSet(Severity severity)
   {
 if (severity == null)
   throw new NullPointerException(severity is null);
 
-HashSet set = new HashSet();
-Iterator it = entrySet().iterator();
-while (it.hasNext())
+HashSetPrinterStateReason set = new HashSetPrinterStateReason();
+for (Map.EntryPrinterStateReason,Severity entry : entrySet())
   {
-Map.Entry entry = (Map.Entry) it.next();
 if (entry.getValue().equals(severity))
   set.add(entry.getKey());
   }
@@ -178,7 +175,7 @@
 if (severity == null)
   throw new NullPointerException(severity is null);
 
-return put((PrinterStateReason) reason, (Severity) severity);
+return put(reason, severity);
   }   
   
   /**
___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


[cp-patches] FYI: New MediaSize instance added in 1.5

2006-01-14 Thread Wolfgang Baer

Hi,

subject says all.

Wolfgang

2006-01-14  Wolfgang Baer  [EMAIL PROTECTED]

* javax/print/attribute/standard/MediaSize.java:
(Other.TABLOID): New MediaSize added in 1.5

Index: javax/print/attribute/standard/MediaSize.java
===
RCS file: /cvsroot/classpath/classpath/javax/print/attribute/standard/MediaSize.java,v
retrieving revision 1.4
diff -u -r1.4 MediaSize.java
--- javax/print/attribute/standard/MediaSize.java	30 Dec 2005 13:07:47 -	1.4
+++ javax/print/attribute/standard/MediaSize.java	14 Jan 2006 10:27:20 -
@@ -1,5 +1,5 @@
 /* MediaSize.java -- 
-   Copyright (C) 2005  Free Software Foundation, Inc.
+   Copyright (C) 2005, 2006  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -820,6 +820,13 @@
  * Japanese double postcard, 148 mm x 200 mm
  */
 public static final MediaSize JAPANESE_DOUBLE_POSTCARD = new MediaSize(148, 200, MediaSize.MM, MediaSizeName.JAPANESE_DOUBLE_POSTCARD);
+
+/**
+ * Tabloid size, 11 inch x 17 inch.
+ * @since 1.5
+ */
+public static final MediaSize TABLOID = 
+  new MediaSize(11, 17, Size2DSyntax.INCH, MediaSizeName.TABLOID);
   }
 }
 
___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


[cp-patches] FYI: New class for javax.print

2006-01-14 Thread Wolfgang Baer

Hi,

changelog says all. Several mauve tests backing the implementation of
this class will be checked into mauve soon.

Regards,
Wolfgang

2006-01-14  Wolfgang Baer  [EMAIL PROTECTED]

Fixes bug #25387
* javax/print/Doc.java: Added and enhanced documentation.
* javax/print/SimpleDoc.java: New file.

Index: javax/print/Doc.java
===
RCS file: /cvsroot/classpath/classpath/javax/print/Doc.java,v
retrieving revision 1.3
diff -u -r1.3 Doc.java
--- javax/print/Doc.java	2 Jul 2005 20:32:45 -	1.3
+++ javax/print/Doc.java	14 Jan 2006 10:59:48 -
@@ -1,5 +1,5 @@
 /* Doc.java --
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2006 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -45,51 +45,102 @@
 import javax.print.attribute.DocAttributeSet;
 
 /**
+ * codeDoc/code specifies the interface for print services how to obtain 
+ * the print data and document specific attributes for printing. 
+ * p
+ * The print data is always passed to a [EMAIL PROTECTED] javax.print.DocPrintJob} object 
+ * as a codeDoc/code object which allows the print services to:
+ * ul
+ * liDetermine the actual document format of the supplied print data. This
+ *  is supplied as a [EMAIL PROTECTED] javax.print.DocFlavor} object with the MIME type
+ *  and the representation class of the print data./li
+ * liObtain the print data either in its representation class or depending
+ *  on the document format through convenience methods as a 
+ *  [EMAIL PROTECTED] java.io.Reader} or an [EMAIL PROTECTED] java.io.InputStream}./li
+ * liObtain the document's attribute set specifying the attributes which
+ *  apply to this document instance./li
+ * /ul 
+ * /pp
+ * Every method of a codeDoc/code implementation has to return always the 
+ * same object on every method call. Therefore if the print job consumes the 
+ * print data via a stream or a reader object it can read only once the 
+ * supplied print data. Implementations of this interface have to be thread 
+ * safe. 
+ * /p
+ * 
  * @author Michael Koch ([EMAIL PROTECTED])
  */
 public interface Doc
 {
   /**
-   * Returns a set of attributes applying to this document.
+   * Returns the unmodifiable view of the attributes of this doc object.
+   * p
+   * The attributes of this doc's attributes set overrides attributes of 
+   * the same category in the print job's attribute set. If an attribute 
+   * is not available in this doc's attributes set or codenull/code
+   * is returned the attributes of the same category of the print job are
+   * used. 
+   * /p
* 
-   * @return the attributes
+   * @return The unmodifiable attributes set, or codenull/code.
*/
   DocAttributeSet getAttributes();
 
   /**
-   * Returns the flavor in which this document will provide its print data.
-   *  
-   * @return the document flavor for printing
+   * Returns the flavor of this doc objects print data.
+   * 
+   * @return The document flavor.
*/
   DocFlavor getDocFlavor();
 
   /**
-   * Returns the print data of this document represented in a format that supports
-   * the document flavor.
-   * 
-   * @return the print data
-   * 
-   * @throws IOException if an error occurs
+   * Returns the print data of this doc object.
+   * p
+   * The returned object is an instance as described by the associated
+   * document flavor ([EMAIL PROTECTED] DocFlavor#getRepresentationClassName()})
+   * and can be cast to this representation class.
+   * /p
+   * 
+   * @return The print data in the representation class.
+   * @throws IOException if representation class is a stream and I/O
+   * exception occures.
*/
   Object getPrintData() throws IOException;
 
   /**
* Returns a codeReader/code object for extracting character print data
* from this document.
+   * p
+   * This method is supported if the document flavor is of type:
+   * ul
+   * licodechar[]/code/li
+   * licodejava.lang.String/code/li
+   * licodejava.io.Reader/code/li
+   * /ul
+   * otherwise this method returns codenull/code.
+   * /p 
* 
-   * @return the codeReader/code object
+   * @return The codeReader/code object, or codenull/code.
* 
-   * @throws IOException if an error occurs
+   * @throws IOException if an error occurs.
*/
   Reader getReaderForText() throws IOException;
 
   /**
* Returns an codeInputStream/code object for extracting byte print data
* from this document.
+   * p
+   * This method is supported if the document flavor is of type:
+   * ul
+   * licodebyte[]/code/li
+   * licodejava.io.InputStream/code/li
+   * /ul
+   * otherwise this method returns codenull/code.
+   * /p 
* 
-   * @return the codeInputStream/code object
+   * @return The codeInputStream/code object, or codenull/code.
* 
-   * @throws IOException if an error occurs
+   * @throws IOException if an error occurs.
*/
   InputStream getStreamForBytes() throws

Re: [cp-patches] [FYI]: Patch for javax.print.attribute.standard package

2006-01-13 Thread Wolfgang Baer

Hi Mark,

sorry for the late response.

Mark Wielaard wrote:

Hi Wolfgang,

On Fri, 2005-12-30 at 14:07 +0100, Wolfgang Baer wrote:


2005-12-30  Wolfgang Baer  [EMAIL PROTECTED]

* javax/print/attribute/standard/package.html: Added description.
* javax/print/attribute/standard/MediaSize.java:
Added and updated javadocs to class and methods.
(static_initializer): Initialize nested class constants.
(MediaSize): Add instances to the cache.
(MediaSize): Likewise.
(MediaSize): Likewise.
(MediaSize): Likewise.
[...]
+  private static ArrayList mediaCache;
+  
+  static

+{
+  mediaCache = new ArrayList();
+
+  MediaSize tmp = MediaSize.ISO.A0;
+  tmp = MediaSize.JIS.B0;
+  tmp = MediaSize.Engineering.A;
+  tmp = MediaSize.NA.LEGAL;
+  tmp = MediaSize.Other.EXECUTIVE;
+}



It took me a while to realize what was going on here. I think a comment
is in place (and how do you guarantee that all the other inner classes
are registered? Like MediaSize.ISO.A4 for example.).


All the static instances in the inner container classes like ISO or
OTHER should be automatically added as they are static. Or do I miss
something ? At least every instance is added as far as I can see.

Evrything I do here is to call one instance of every container class
so it gets loaded and everyone of its static MediaSize objects are
instantiated. Should I put a comment here ?


Are you sure that every newly created MediaSize object should
automagically be added to the mediaCache and not just the standard
MediaSizes? I see there is no other method to register a new standard
MediaSize, but adding it through the public constructor seems asking for
confusion.


The just commited mauve test userClass shows that user constructed
MediaSize subclass instances are added to the cache used by findMedia
and the other static methods. So I am think I am right here.

Regards,
Wolfgang


___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


[cp-patches] [FYI]: Patch for javax.print.attribute.standard package

2005-12-30 Thread Wolfgang Baer

Hi all,

this patch completes the javax.print.attribute.standard package.
Changelog should explain the rest.

Regards,
Wolfgang

2005-12-30  Wolfgang Baer  [EMAIL PROTECTED]

* javax/print/attribute/standard/package.html: Added description.
* javax/print/attribute/standard/MediaSize.java:
Added and updated javadocs to class and methods.
(static_initializer): Initialize nested class constants.
(MediaSize): Add instances to the cache.
(MediaSize): Likewise.
(MediaSize): Likewise.
(MediaSize): Likewise.
(findMedia): New method.
(equals): Likewise.


Index: javax/print/attribute/standard/MediaSize.java
===
RCS file: /cvsroot/classpath/classpath/javax/print/attribute/standard/MediaSize.java,v
retrieving revision 1.3
diff -u -r1.3 MediaSize.java
--- javax/print/attribute/standard/MediaSize.java	24 Nov 2005 20:33:58 -	1.3
+++ javax/print/attribute/standard/MediaSize.java	30 Dec 2005 12:58:06 -
@@ -43,47 +43,171 @@
 import javax.print.attribute.Attribute;
 import javax.print.attribute.Size2DSyntax;
 
+/**
+ * The codeMediaSize/code printing attribute class specifies the size
+ * of a printing media. The size is defined in portrait orientation with 
+ * x at the bottom edge and y at the left edge.
+ * p
+ * There are several media sizes predefined through the nested classes. Further
+ * sizes may be provided by the application. codeMediaSize/code is not used
+ * as a printing attribute currently. It may be used to get the actual sizes 
+ * for a named media or to find a suitable codeMediaSizeName/code instance
+ * by querying with the needed sizes.
+ * /p 
+ * p
+ * bIPP Compatibility:/b MediaSize is not an IPP 1.1 attribute.
+ * /p
+ * @see javax.print.attribute.standard.MediaSizeName
+ * 
+ * @author Michael Koch ([EMAIL PROTECTED])
+ * @author Wolfgang Baer ([EMAIL PROTECTED])
+ */
 public class MediaSize extends Size2DSyntax
   implements Attribute
 {
   private static final long serialVersionUID = -1967958664615414771L;
 
-  private static ArrayList mediaCache = new ArrayList();
+  private static ArrayList mediaCache;
+  
+  static
+{
+  mediaCache = new ArrayList();
+
+  MediaSize tmp = MediaSize.ISO.A0;
+  tmp = MediaSize.JIS.B0;
+  tmp = MediaSize.Engineering.A;
+  tmp = MediaSize.NA.LEGAL;
+  tmp = MediaSize.Other.EXECUTIVE;
+}
   
   private MediaSizeName media;
   
+  /**
+   * Creates a codeMediaSize/code object.
+   *
+   * @param x the size in x direction
+   * @param y the size in y direction
+   * @param units the units to use for the sizes
+   *
+   * @exception IllegalArgumentException if x or y lt; 0 or units lt; 1
+   */
   public MediaSize(float x, float y, int units)
   {
 super(x, y, units);
+mediaCache.add(this);
   }
   
+  /**
+   * Creates a codeMediaSize/code object associated with the given
+   * media name.
+   *
+   * @param x the size in x direction
+   * @param y the size in y direction
+   * @param units the units to use for the sizes
+   * @param media the media name to associate
+   *
+   * @exception IllegalArgumentException if x or y lt; 0 or units lt; 1
+   */
   public MediaSize(float x, float y, int units, MediaSizeName media)
   {
 super(x, y, units);
 this.media = media;
+mediaCache.add(this);
   }
   
+  /**
+   * Creates a codeMediaSize/code object.
+   *
+   * @param x the size in x direction
+   * @param y the size in y direction
+   * @param units the units to use for the sizes
+   *
+   * @exception IllegalArgumentException if x or y lt; 0 or units lt; 1
+   */
   public MediaSize(int x, int y, int units)
   {
 super(x, y, units);
+mediaCache.add(this);
   }
   
+  /**
+   * Creates a codeMediaSize/code object associated with the given
+   * media name.
+   *
+   * @param x the size in x direction
+   * @param y the size in y direction
+   * @param units the units to use for the sizes
+   * @param media the media name to associate
+   *
+   * @exception IllegalArgumentException if x or y lt; 0 or units lt; 1
+   */
   public MediaSize(int x, int y, int units, MediaSizeName media)
   {
 super(x, y, units);
 this.media = media;
+mediaCache.add(this);
   }
   
   /**
* Returns category of this class.
*
-   * @return the class codeMediaSize/code itself
+   * @return The class codeMediaSize/code itself.
*/
   public Class getCategory()
   {
 return MediaSize.class;
   }
+
+  /**
+   * Searches for a MediaSize object with the given dimensions.
+   * If none is found with exact dimensions, the closest match is used.
+   * Afterwards the MediaSizeName of the found MediaSize object is 
+   * returned - which might be null if none is specified.
+   * 
+   * @param x the dimension for x
+   * @param y the dimension for y
+   * @param units the units to be used for comparison
+   * @return the corresponding MediaSizeName object, or null

[cp-patches] [FYI]: API docs additions for javax.print

2005-12-30 Thread Wolfgang Baer

Hi,

this patch adds class and method documentation to the
javax.print exception stuff.

Regards,
Wolfgang

2005-12-30  Wolfgang Baer  [EMAIL PROTECTED]

* javax/print/AttributeException.java,
* javax/print/URIException.java,
* javax/print/FlavorException.java,
* javax/print/PrintException.java,
Added and updated javadocs to class and methods.


Index: javax/print/AttributeException.java
===
RCS file: /cvsroot/classpath/classpath/javax/print/AttributeException.java,v
retrieving revision 1.2
diff -u -r1.2 AttributeException.java
--- javax/print/AttributeException.java	2 Jul 2005 20:32:45 -	1.2
+++ javax/print/AttributeException.java	30 Dec 2005 14:51:35 -
@@ -1,5 +1,5 @@
-/* CancelablePrintJob.java --
-   Copyright (C) 2004 Free Software Foundation, Inc.
+/* AttributeException.java --
+   Copyright (C) 2004, 2005 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -41,23 +41,36 @@
 import javax.print.attribute.Attribute;
 
 /**
+ * codeAttributeException/code specifies two methods a specific
+ * subclass of [EMAIL PROTECTED] javax.print.PrintException} may implement to
+ * provide further information of printing errors if unsupported
+ * attribute classes or values of attributes are involved.
+ * p
+ * There exists no codePrintException/code class implementing this 
+ * interface. Providing these extensions in codePrintException/code 
+ * subclasses is left to the concrete print service implementation. 
+ * /p 
+ * 
  * @author Michael Koch ([EMAIL PROTECTED])
  */
 public interface AttributeException
 {
   /**
* Returns the unsupported printing attribute classes for a print service
-   * that does not support them.
+   * that does not support the attribute category at all. The returned 
+   * class instances are sublcasses of the base interface [EMAIL PROTECTED] Attribute}.
* 
-   * @return array of unsupported attribute classes, or null
+   * @return The unsupported attribute classes, or codenull/code if there
+   * are no such attribute classes.
*/
   Class[] getUnsupportedAttributes();
   
   /**
-   * Returns the unsupported values of printing attributes for a print service
-   * that does not support them.
+   * Returns the unsupported attribute values of printing attributes a specific
+   * print service does support but not the particular provided value.
*   
-   * @return array of unsupperted attribute values, or null
+   * @return The unsupported attribute values, or codenull/code if there
+   * are no such attributes values.
*/
   Attribute[] getUnsupportedValues();
 }
Index: javax/print/FlavorException.java
===
RCS file: /cvsroot/classpath/classpath/javax/print/FlavorException.java,v
retrieving revision 1.2
diff -u -r1.2 FlavorException.java
--- javax/print/FlavorException.java	2 Jul 2005 20:32:45 -	1.2
+++ javax/print/FlavorException.java	30 Dec 2005 14:51:35 -
@@ -1,5 +1,5 @@
 /* FlavorException.java --
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -39,6 +39,16 @@
 package javax.print;
 
 /**
+ * codeFlavorException/code specifies a method a specific
+ * subclass of [EMAIL PROTECTED] javax.print.PrintException} may implement to
+ * provide further information of printing errors if unsupported
+ * document flavors are involved.
+ * p
+ * There exists no codePrintException/code class implementing this 
+ * interface. Providing this extension in codePrintException/code 
+ * subclasses is left to the concrete print service implementation.
+ * /p
+ * 
  * @author Michael Koch ([EMAIL PROTECTED])
  */
 public interface FlavorException
@@ -46,7 +56,7 @@
   /**
* Returns the unsupported document flavors.
* 
-   * @return the unsupported document flavors
+   * @return The unsupported document flavors.
*/
   DocFlavor[] getUnsupportedFlavors();
 }
\ No newline at end of file
Index: javax/print/URIException.java
===
RCS file: /cvsroot/classpath/classpath/javax/print/URIException.java,v
retrieving revision 1.2
diff -u -r1.2 URIException.java
--- javax/print/URIException.java	2 Jul 2005 20:32:46 -	1.2
+++ javax/print/URIException.java	30 Dec 2005 14:51:35 -
@@ -1,5 +1,5 @@
 /* URIException.java --
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -41,25 +41,48 @@
 import java.net.URI;
 
 /**
+ * codeURIException/code specifies methods a specific subclass of 
+ * [EMAIL PROTECTED] javax.print.PrintException} may implement to provide further 
+ * informations of printing errors if URI problems are involved.
+ * p
+ * There exists no codePrintException/code class implementing

Re: [cp-patches] FYI: Patch for EnumSyntax attributes in the print api

2005-12-19 Thread Wolfgang Baer

Chris Burdess wrote:

Mark Wielaard wrote:


On Fri, 2005-12-16 at 20:22 +0100, Wolfgang Baer wrote:


+  /**
+   * Tests if the given object is equal to this object.
+   * The objects are considered equal if both are of the same
+   * Media subclass, not null and the values are equal.
+   *
+   * @param obj the object to test
+   *
+   * @return codetrue/code if both objects are equal, 
+   * codefalse/code otherwise.

+   */
+  public boolean equals(Object obj)
+  {
+if ((obj instanceof MediaName  this instanceof MediaName)
+|| (obj instanceof MediaTray  this instanceof MediaTray)
+|| (obj instanceof MediaSizeName  this instanceof MediaSizeName))
+  {
+return ((Media) obj).getValue() == this.getValue();
+  }
+
+return false;

+  }


Wouldn't it be a bit more robust to write this as:

return (obj.getClass() == this.getClass()
 ((Media) obj).getValue() == this.getValue());

Then you also accept any future subclasses.



Except when obj == null. Then it's less robust.


Yes, it might be null. Also I don't think there will be more
subclasses in the future except the IPP standard will be extended.

Marc, I can use your way with an additional null check if you
prefer ?

if (obj == null)
  return false;

return (obj.getClass() == this.getClass()
 ((Media) obj).getValue() == this.getValue());

Wolfgang



___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


[cp-patches] FYI: Added missing stuff to JobStateReasons and PrinterStateReasons

2005-12-19 Thread Wolfgang Baer

Hi,

this add the missing methods / constructors too 
javax.print.attribute.standard.JobStateReasons and

javax.print.attribute.standard.PrinterStateReasons.

Regards,
Wolfgang

2005-12-19  Wolfgang Baer  [EMAIL PROTECTED]

* javax/print/attribute/standard/JobStateReasons.java:
Added and updated javadocs to class and methods.
(JobStateReasons): New constructor.
(JobStateReasons): Likewise.
(JobStateReasons): Likewise.
(JobStateReasons): Likewise.
(add): New overridden method.
* javax/print/attribute/standard/PrinterStateReasons.java:
Added and updated javadocs to class and methods.
(PrinterStateReasons): New constructor.
(PrinterStateReasons): Likewise.
(PrinterStateReasons): Likewise.
(PrinterStateReasons): Likewise.
(printerStateReasonSet): New method.
(put): New overridden method.   
Index: javax/print/attribute/standard/JobStateReasons.java
===
RCS file: /cvsroot/classpath/classpath/javax/print/attribute/standard/JobStateReasons.java,v
retrieving revision 1.4
diff -u -r1.4 JobStateReasons.java
--- javax/print/attribute/standard/JobStateReasons.java	2 Jul 2005 20:32:46 -	1.4
+++ javax/print/attribute/standard/JobStateReasons.java	19 Dec 2005 09:28:14 -
@@ -1,5 +1,5 @@
 /* JobStateReasons.java --
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -38,12 +38,23 @@
 
 package javax.print.attribute.standard;
 
+import java.util.Collection;
 import java.util.HashSet;
+import java.util.Iterator;
 
 import javax.print.attribute.PrintJobAttribute;
 
 /**
+ * The codeJobStateReasons/code attribute provides the set of 
+ * additional informations available about the current state of a print job. 
+ * p
+ * bIPP Compatibility:/b JobStateReasons is an IPP 1.1 attribute.
+ * /p
+ * @see javax.print.attribute.standard.JobState
+ * @see javax.print.attribute.standard.JobStateReason
+ * 
  * @author Michael Koch ([EMAIL PROTECTED])
+ * @author Wolfgang Baer ([EMAIL PROTECTED])
  */
 public final class JobStateReasons extends HashSet
   implements PrintJobAttribute
@@ -51,9 +62,82 @@
   private static final long serialVersionUID = 8849088261264331812L;
 
   /**
+   * Constructs an empty codeJobStateReasons/code attribute.
+   */  
+  public JobStateReasons()
+  {
+super();
+  }
+
+  /**
+   * Constructs an empty codeJobStateReasons/code attribute
+   * with the given initial capacity and load factor.
+   * 
+   * @param initialCapacity the intial capacity.
+   * @param loadFactor the load factor of the underlying HashSet.
+   * 
+   * @throws IllegalArgumentException if initialCapacity lt; 0
+   * @throws IllegalArgumentException if initialCapacity or loadFactor lt; 0
+   */
+  public JobStateReasons(int initialCapacity, float loadFactor)
+  {
+super(initialCapacity, loadFactor);
+  }
+
+  /**
+   * Constructs an empty codeJobStateReasons/code attribute
+   * with the given initial capacity and the default load factor.
+   * 
+   * @param initialCapacity the intial capacity.
+   * 
+   * @throws IllegalArgumentException if initialCapacity lt; 0
+   */
+  public JobStateReasons(int initialCapacity)
+  {
+super(initialCapacity);
+  }
+
+  /**
+   * Constructs a codeJobStateReasons/code attribute
+   * with the content of the given collection.
+   * 
+   * @param collection the collection for the initial values.
+   * 
+   * @throws NullPointerException if collection or any value is 
+   * codenull/code.
+   * @throws ClassCastException if values of collection are not of type 
+   * codeJobStateReason/code.
+   */
+  public JobStateReasons(Collection collection)
+  {
+super(collection.size(), 0.75f);
+Iterator it = collection.iterator();
+while (it.hasNext())
+  add(it.next());
+  }
+
+  /**
+   * Adds the given job state reason object to the set.
+   * 
+   * @param o the reason of type codeJobStateReason/code.
+   * @return codetrue/code if set changed, codefalse/code otherwise.
+   * 
+   * @throws NullPointerException if given object is codenull/code.
+   * @throws ClassCastException if given object is not an instance of
+   * codeJobStateReason/code.
+   */
+  public boolean add(Object o)
+  {
+if (o == null)
+  throw new NullPointerException(reason is null);  
+
+return add((JobStateReason) o);
+  }
+  
+  /**
* Returns category of this class.
*
-   * @return the class codeColorSupported/code itself
+   * @return The class codeJobStateReasons/code itself.
*/
   public Class getCategory()
   {
@@ -63,7 +147,7 @@
   /**
* Returns the name of this attribute.
*
-   * @return the name
+   * @return The name job-state-reasons.
*/
   public String getName()
   {
Index: javax/print/attribute/standard/PrinterStateReasons.java

[cp-patches] FYI: Api docs updates for TextSyntax derived printing attributes

2005-12-18 Thread Wolfgang Baer

Hi,

this time only api doc additions and updates to complete
the TextSyntax derived printing attributes.

Regards,
Wolfgang

2005-12-18  Wolfgang Baer  [EMAIL PROTECTED]

* javax/print/attribute/standard/JobOriginatingUserName.java,
* javax/print/attribute/standard/RequestingUserName.java,
* javax/print/attribute/standard/JobMessageFromOperator.java,
* javax/print/attribute/standard/JobName.java,
* javax/print/attribute/standard/OutputDeviceAssigned.java,
* javax/print/attribute/standard/PrinterInfo.java,
* javax/print/attribute/standard/PrinterLocation.java,
* javax/print/attribute/standard/PrinterMakeAndModel.java,
* javax/print/attribute/standard/PrinterMessageFromOperator.java,
* javax/print/attribute/standard/DocumentName.java,
* javax/print/attribute/standard/PrinterName.java:
Added and updated javadocs to class and methods.

Index: javax/print/attribute/standard/JobOriginatingUserName.java
===
RCS file: /cvsroot/classpath/classpath/javax/print/attribute/standard/JobOriginatingUserName.java,v
retrieving revision 1.5
diff -u -r1.5 JobOriginatingUserName.java
--- javax/print/attribute/standard/JobOriginatingUserName.java	2 Jul 2005 20:32:46 -	1.5
+++ javax/print/attribute/standard/JobOriginatingUserName.java	18 Dec 2005 11:52:55 -
@@ -1,5 +1,5 @@
 /* JobOriginatingUserName.java -- 
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -44,6 +44,12 @@
 import javax.print.attribute.TextSyntax;
 
 /**
+ * The codeJobOriginatingUserName/code attribute specifies the name of 
+ * the user which submitted the print job.
+ * p
+ * bIPP Compatibility:/b JobOriginatingUserName is an IPP 1.1 attribute.
+ * /p
+ * 
  * @author Michael Koch ([EMAIL PROTECTED])
  */
 public final class JobOriginatingUserName extends TextSyntax
@@ -55,8 +61,10 @@
* Creates a codeJobOriginatingUserName/code object.
*
* @param userName the user name
+   * @param locale the locale to use, if codenull/code the default
+   * locale is used.
*
-   * @exception NullPointerException if userName is null
+   * @exception NullPointerException if userName is codenull/code.
*/
   public JobOriginatingUserName(String userName, Locale locale)
   {
@@ -64,11 +72,12 @@
   }
 
   /**
-   * Tests of obj is equal to this object.
+   * Tests if the given object is equal to this object.
*
* @param obj the object to test
*
-   * @return true if both objects are equal, false otherwise.
+   * @return codetrue/code if both objects are equal, 
+   * codefalse/code otherwise.
*/
   public boolean equals(Object obj)
   {
@@ -81,7 +90,7 @@
   /**
* Returns category of this class.
*
-   * @return the class codeJobOriginatingUserName/code itself
+   * @return The class codeJobOriginatingUserName/code itself.
*/
   public Class getCategory()
   {
@@ -89,9 +98,9 @@
   }
 
   /**
-   * Returns name of this class.
+   * Returns the name of this attribute.
*
-   * @return the string job-originating-user-name
+   * @return The name job-originating-user-name.
*/
   public String getName()
   {
Index: javax/print/attribute/standard/RequestingUserName.java
===
RCS file: /cvsroot/classpath/classpath/javax/print/attribute/standard/RequestingUserName.java,v
retrieving revision 1.5
diff -u -r1.5 RequestingUserName.java
--- javax/print/attribute/standard/RequestingUserName.java	2 Jul 2005 20:32:46 -	1.5
+++ javax/print/attribute/standard/RequestingUserName.java	18 Dec 2005 11:52:55 -
@@ -1,5 +1,5 @@
 /* RequestingUserName.java -- 
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -44,6 +44,12 @@
 import javax.print.attribute.TextSyntax;
 
 /**
+ * The codeRequestingUserName/code attribute provides the name of 
+ * the user which requests the printing of the given job.
+ * p
+ * bIPP Compatibility:/b RequestingUserName is an IPP 1.1 attribute.
+ * /p
+ * 
  * @author Michael Koch ([EMAIL PROTECTED])
  */
 public final class RequestingUserName extends TextSyntax
@@ -54,10 +60,11 @@
   /**
* Creates a codeRequestingUserName/code object.
*
-   * @param userName the job name
-   * @param locale the locale of the user, null means default locale
+   * @param userName the user name
+   * @param locale the locale to use, if codenull/code the default
+   * locale is used.
*
-   * @exception NullPointerException if userName is null
+   * @exception NullPointerException if userName is codenull/code.
*/
   public RequestingUserName(String userName, Locale locale)
   {
@@ -65,11 +72,12 @@
   }
 
   /**
-   * Tests of obj is equal to this object.
+   * Tests if the given

[cp-patches] FYI: Further updates for javax.print.attribute.standard

2005-12-17 Thread Wolfgang Baer

Hi all,

this patch completes the URISyntax, ResolutionSyntax, DateTimeSyntax
and SetOfIntegerSyntax derived printing attribute classes.

Mostly api docs updates, some overridden equals methods and one constructor
update.

Regards,
Wolfgang

2005-12-17  Wolfgang Baer  [EMAIL PROTECTED]

* javax/print/attribute/standard/CopiesSupported.java:
Added and updated javadocs to class and methods.
(CopiesSupported): Throw IllegalArgumentException if
lowerBound is less than 1.
(CopiesSupported): Throw IllegalArgumentException
if member less than 1.
(equals): New overridden method.
* javax/print/attribute/standard/JobKOctetsSupported.java:
Added and updated javadocs to class and methods.
(JobKOctetsSupported): Throw IllegalArgumentException if
lowerBound is less than 1.
(equals): New overridden method.
* javax/print/attribute/standard/JobImpressionsSupported.java:
Added and updated javadocs to class and methods.
(JobImpressionsSupported): Throw IllegalArgumentException if
lowerBound is less than 1.
(equals): New overridden method.
* javax/print/attribute/standard/JobMediaSheetsSupported.java:
Added and updated javadocs to class and methods.
(JobMediaSheetsSupported): Throw IllegalArgumentException if
lowerBound is less than 1.
(equals): New overridden method.
* javax/print/attribute/standard/PageRanges.java:
Added and updated javadocs to class and methods.
(PageRanges): Throw IllegalArgumentException if member less than 1.
(PageRanges): Throw IAE if lowerBound is less than 1.
(PageRanges): Throw NPE if members is null.
(PageRanges): New constructor.
(equals): New overridden method.
* javax/print/attribute/standard/NumberUpSupported.java:
Added and updated javadocs to class and methods.
(NumberUpSupported): Throw IllegalArgumentException if
member less than 1.
(NumberUpSupported): Throw IAE if lowerbound less than 1.
(NumberUpSupported): Throw NPE if members is null.
(equals): New overridden method.
* javax/print/attribute/standard/JobHoldUntil.java,
* javax/print/attribute/standard/DateTimeAtProcessing.java,
* javax/print/attribute/standard/DateTimeAtCompleted.java,
* javax/print/attribute/standard/DateTimeAtCreation.java:
Added and updated javadocs to class and methods.
* javax/print/attribute/standard/PrinterURI.java,
* javax/print/attribute/standard/PrinterMoreInfoManufacturer.java,
* javax/print/attribute/standard/PrinterMoreInfo.java,
* javax/print/attribute/standard/Destination.java,
* javax/print/attribute/standard/PrinterResolution.java:
Added and updated javadocs to class and methods.
(equals): New overridden method.

Index: javax/print/attribute/standard/CopiesSupported.java
===
RCS file: /cvsroot/classpath/classpath/javax/print/attribute/standard/CopiesSupported.java,v
retrieving revision 1.4
diff -u -r1.4 CopiesSupported.java
--- javax/print/attribute/standard/CopiesSupported.java	2 Jul 2005 20:32:46 -	1.4
+++ javax/print/attribute/standard/CopiesSupported.java	17 Dec 2005 20:23:57 -
@@ -1,5 +1,5 @@
 /* CopiesSupported.java --
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -42,7 +42,15 @@
 
 
 /**
+ * The codeCopiesSupported/code attribute specifies the supported
+ * value or range of values for the 
+ * [EMAIL PROTECTED] javax.print.attribute.standard.Copies} attribute. 
+ * p
+ * bIPP Compatibility:/b CopiesSupported is an IPP 1.1 attribute.
+ * /p
+ * 
  * @author Michael Koch ([EMAIL PROTECTED])
+ * @author Wolfgang Baer ([EMAIL PROTECTED])
  */
 public final class CopiesSupported extends SetOfIntegerSyntax
   implements SupportedValuesAttribute
@@ -50,25 +58,59 @@
   private static final long serialVersionUID = 6927711687034846001L;
 
   /**
-   * Constructs a codeCopiesSupported/code object.
+   * Constructs a codeCopiesSupported/code object with
+   * the given value. This means that only this value is 
+   * supported for copies.
+   * 
+   * @param member the member value
+   * @exception IllegalArgumentException if member is lt; 1
*/
   public CopiesSupported(int member)
   {
 super(member);
+
+if (member  1)
+  throw new IllegalArgumentException(member may not be less than 1);
   }
 
   /**
-   * Constructs a codeCopiesSupported/code object.
+   * Constructs a codeCopiesSupported/code object with
+   * the given range of values. This means that values for 
+   * copies are supported inside the specified range.
+   * 
+   * @param lowerBound the lower bound value
+   * @param upperBound the upper bound value

[cp-patches] FYI: Patch for EnumSyntax attributes in the print api

2005-12-16 Thread Wolfgang Baer

Hi all,

this patch completes the classes extending javax.print.attribute.EnumSyntax
which are needing some methods to be overriden. There are also several fixes 
found during work on the internals.


Regards,
Wolfgang


2005-12-16  Wolfgang Baer  [EMAIL PROTECTED]

* javax/print/attribute/standard/MediaSizeName.java:
Added and updated javadocs to class and methods.
(getStringTable): Implemented.
(getEnumValueTable): Implemented.
(stringTable): New field.
(enumValueTable): New field.
* javax/print/attribute/standard/MediaName.java:
Added and updated javadocs to class and methods.
(getStringTable): Implemented.
(getEnumValueTable): Implemented.
(stringTable): New field.
(enumValueTable): New field.
(NA_LETTER_WHITE): Fixed value of enum.
(NA_LETTER_TRANSPARENT): Likewise.
(ISO_A4_WHITE): Likewise.
(ISO_A4_TRANSPARENT): Likewise.
(serialVersionUID): New field.
* javax/print/attribute/standard/Media.java:
Added and updated javadocs to class and methods.
(equals): New overridden method.
* javax/print/attribute/standard/MediaTray.java:
Added and updated javadocs to class and methods.
(getStringTable): Implemented.
(getEnumValueTable): Implemented.
(stringTable): New field.
(enumValueTable): New field.
(TOP): Fixed value of enum.
(MIDDLE): Likewise.
(BOTTOM): Likewise.
(ENVELOPE): Likewise.
(LARGE_CAPACITY): Likewise.
(MAIN): Likewise.
(SIDE): Likewise.
(serialVersionUID): New field.
* javax/print/attribute/standard/PrinterState.java:
Added and updated javadocs to class and methods.
(getStringTable): New overridden method.
(getEnumValueTable): New overridden method.
(stringTable): New field.
(enumValueTable): New field.
(IDLE): Fixed value of enum.
(PROCESSING): Likewise.
(STOPPED): Likewise.
* javax/print/attribute/standard/JobState.java:
Added and updated javadocs to class and methods.
(getStringTable): New overridden method.
(getEnumValueTable): New overridden method.
(stringTable): New field.
(enumValueTable): New field.
(PENDING): Fixed value of enum.
(PENDING_HELD): Likewise.
(PROCESSING): Likewise.
(PROCESSING_STOPPED): Likewise.
(CANCELED): Likewise.
(ABORTED): Likewise.
(COMPLETED): Likewise.
* javax/print/attribute/standard/SheetCollate.java,
* javax/print/attribute/standard/PresentationDirection.java,
* javax/print/attribute/standard/ReferenceUriSchemesSupported.java,
* javax/print/attribute/standard/PrinterStateReason.java,
* javax/print/attribute/standard/JobStateReason.java,
* javax/print/attribute/standard/JobSheets.java:
Added and updated javadocs to class and methods.
(getStringTable): New overridden method.
(getEnumValueTable): New overridden method.
(stringTable): New field.
(enumValueTable): New field.




EnumSyntaxSubclasses_2.patch.gz
Description: GNU Zip compressed data
___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


[cp-patches] FYI: Api doc updates for IntegerSyntax based printing attributes.

2005-12-16 Thread Wolfgang Baer

Hi all,

only api doc updates except one minor fix to return the correct
name of the attribute class.

Regards,
Wolfgang

2005-12-16  Wolfgang Baer  [EMAIL PROTECTED]

* javax/print/attribute/standard/JobImpressionsCompleted.java:
Added and updated javadocs to class and methods.
(getName): Fixed name returned by this attribute class.
* javax/print/attribute/standard/JobMediaSheetsCompleted.java,
* javax/print/attribute/standard/JobKOctetsProcessed.java,
* javax/print/attribute/standard/JobImpressions.java,
* javax/print/attribute/standard/JobKOctets.java,
* javax/print/attribute/standard/JobMediaSheets.java,
* javax/print/attribute/standard/NumberOfInterveningJobs.java,
* javax/print/attribute/standard/JobPriority.java,
* javax/print/attribute/standard/JobPrioritySupported.java,
* javax/print/attribute/standard/NumberOfDocuments.java,
* javax/print/attribute/standard/QueuedJobCount.java,
* javax/print/attribute/standard/NumberUp.java,
* javax/print/attribute/standard/PagesPerMinuteColor.java,
* javax/print/attribute/standard/PagesPerMinute.java,
* javax/print/attribute/standard/Copies.java:
Added and updated javadocs to class and methods.

Index: javax/print/attribute/standard/JobImpressionsCompleted.java
===
RCS file: /cvsroot/classpath/classpath/javax/print/attribute/standard/JobImpressionsCompleted.java,v
retrieving revision 1.5
diff -u -r1.5 JobImpressionsCompleted.java
--- javax/print/attribute/standard/JobImpressionsCompleted.java	2 Jul 2005 20:32:46 -	1.5
+++ javax/print/attribute/standard/JobImpressionsCompleted.java	16 Dec 2005 22:01:03 -
@@ -1,5 +1,5 @@
 /* JobImpressionsCompleted.java -- 
-   Copyright (C) 2003, 2004  Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -41,6 +41,23 @@
 import javax.print.attribute.PrintJobAttribute;
 
 /**
+ * The codeJobImpressionsCompleted/code printing attribute reports
+ * the number of impressions already processed.
+ * p
+ * An impression is specified by the IPP specification as the image imposed 
+ * onto a single media sheet. This attribute will not include a multiplication 
+ * factor from the number of copies.
+ * /p
+ * p
+ * This attribute belongs to a group of job progress attributes which are 
+ * reporting on the progress of a print job.
+ * /p
+ * p
+ * bIPP Compatibility:/b JobImpressionsCompleted is an IPP 1.1 attribute.
+ * /p
+ * @see javax.print.attribute.standard.JobMediaSheetsCompleted
+ * @see javax.print.attribute.standard.JobKOctetsProcessed
+ * 
  * @author Michael Koch ([EMAIL PROTECTED])
  */
 public final class JobImpressionsCompleted extends IntegerSyntax
@@ -53,7 +70,7 @@
*
* @param value the number of completed impressions
*
-   * @exception IllegalArgumentException if value  0
+   * @exception IllegalArgumentException if value lt; 0
*/
   public JobImpressionsCompleted(int value)
   {
@@ -64,11 +81,12 @@
   }
   
   /**
-   * Tests of obj is equal to this object.
+   * Tests if the given object is equal to this object.
*
* @param obj the object to test
*
-   * @return true if both objects are equal, false otherwise.
+   * @return codetrue/code if both objects are equal, 
+   * codefalse/code otherwise.
*/
   public boolean equals(Object obj)
   {
@@ -81,7 +99,7 @@
   /**
* Returns category of this class.
*
-   * @return the class codeJobImpressionsCompleted/code itself
+   * @return The class codeJobImpressionsCompleted/code itself.
*/
   public Class getCategory()
   {
@@ -89,12 +107,12 @@
   }
 
   /**
-   * Returns name of this class.
+   * Returns the name of this attribute.
*
-   * @return the string job-impressions-completed
+   * @return The name job-impressions-completed.
*/
   public String getName()
   {
-return job-impressions;
+return job-impressions-completed;
   }
 }
Index: javax/print/attribute/standard/JobMediaSheetsCompleted.java
===
RCS file: /cvsroot/classpath/classpath/javax/print/attribute/standard/JobMediaSheetsCompleted.java,v
retrieving revision 1.5
diff -u -r1.5 JobMediaSheetsCompleted.java
--- javax/print/attribute/standard/JobMediaSheetsCompleted.java	2 Jul 2005 20:32:46 -	1.5
+++ javax/print/attribute/standard/JobMediaSheetsCompleted.java	16 Dec 2005 22:01:03 -
@@ -1,5 +1,5 @@
 /* JobMediaSheetsCompleted.java -- 
-   Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -41,6 +41,18 @@
 import javax.print.attribute.PrintJobAttribute;
 
 /**
+ * The codeJobMediaSheetsCompleted/code printing attribute reports
+ * the number of media sheets already

Re: [cp-patches] javax.print standard attribute enums

2005-11-28 Thread Wolfgang Baer

Hi Sven,

Sven de Marothy wrote:

2005-11-24  Sven de Marothy  [EMAIL PROTECTED]

* javax/print/attribute/standard/MediaSize.java:
Added ISO, NA, JIS and Other enumerations of standard sizes.


I also implemented this stuff this weekend :-)

Are you going to implement more on javax.print (including internals) ? As I
also work here (as can be seen on several mails on the list) it would be nice
if we can arrange who is doing what on the javax.print stuff (including 
internals).

Cheers,
Wolfgang




___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


[cp-patches] FYI: ResolutionSyntax API docs additions and minor fixlet

2005-11-19 Thread Wolfgang Baer

Hi,

I added and enhanced the api docs for ResolutionsSyntax.

There are also two simple fixlets which are backed by
the mauve testcases checked in earlier.

2005-11-19  Wolfgang Baer  [EMAIL PROTECTED]

* javax/print/attribute/ResolutionSyntax.java:
Added and enhanced api docs for this class.
(getFeedResolution): Use correct feedresolution variable
and do not add an additional unit to the resolution.
(getCrossFeedResolution): Do not add additional unit to resolution.

Regards,
Wolfgang

Index: javax/print/attribute/ResolutionSyntax.java
===
RCS file: /cvsroot/classpath/classpath/javax/print/attribute/ResolutionSyntax.java,v
retrieving revision 1.4
diff -u -r1.4 ResolutionSyntax.java
--- javax/print/attribute/ResolutionSyntax.java	2 Jul 2005 20:32:46 -	1.4
+++ javax/print/attribute/ResolutionSyntax.java	19 Nov 2005 10:53:25 -
@@ -1,5 +1,5 @@
 /* ResolutionSyntax.java -- 
-   Copyright (C) 2003, 2004  Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -40,7 +40,42 @@
 import java.io.Serializable;
 
 /**
- * @author Michael Koch
+ * codeResolutionSyntax/code is the abstract base class of all attribute 
+ * classes which provide a resolution as value (e.g. printer resolution).
+ * p
+ * A codeResolutionSyntax/code instance consists of two integer values
+ * describing the resolution in feed and cross feed direction. The units of 
+ * the given values is determined by two defined constants:
+ * ul
+ * liDPCM - dots per centimeter/li
+ * liDPI - dots per inch/li
+ * /ul
+ * /p
+ * p
+ * A resolutions attribute is constructed by two values for the resolution and
+ * one of the two constants defining the actual units of the given values.
+ * /p
+ * p
+ * There are different methods provided to return the resolution values in 
+ * either of the both units and to compare if a resolution is less than or
+ * equal to a given other resolution attribute.
+ * /p
+ * p
+ * bInternal storage:/bbr
+ * The resolutions are stored internally as dots per 100 inches (dphi). The 
+ * values of the provided constants for dots per inch (value 100) and dots
+ * per centimeter (value 254) are used as conversion factors to the internal
+ * storage units. To get the internal dphi values a multiplication of a given
+ * resolution value with its units constant value is needed. Retrieving the 
+ * resolution for specific units is done by dividing the internal stored 
+ * value through the units constant value. Clients are therefore able to 
+ * provide their own resolution units by supplying other conversion factors.
+ * Subclasses of codeResolutionSyntax/code have access to the internal
+ * resolution values through the protected methods 
+ * [EMAIL PROTECTED] #getCrossFeedResolutionDphi()} and [EMAIL PROTECTED] #getFeedResolutionDphi()}.
+ * /p
+ * 
+ * @author Michael Koch ([EMAIL PROTECTED])
  */
 public abstract class ResolutionSyntax
   implements Cloneable, Serializable
@@ -65,7 +100,7 @@
*
* @param crossFeedResolution the cross feed resolution
* @param feedResolution the feed resolution
-   * @param units the unit to use
+   * @param units the unit to use (e.g. [EMAIL PROTECTED] #DPCM} or [EMAIL PROTECTED] #DPI})
*
* @exception IllegalArgumentException if preconditions fail
*/
@@ -82,11 +117,12 @@
   }
 
   /**
-   * Tests of obj is equal to this object.
+   * Tests if the given object is equal to this object.
*
* @param obj the object to test
*
-   * @return true if both objects are equal, false otherwise.
+   * @return codetrue/code if both objects are equal, 
+   * codefalse/code otherwise.
*/
   public boolean equals(Object obj)
   {
@@ -100,24 +136,25 @@
   }
 
   /**
-   * Returns the cross feed resolution in units.
+   * Returns the cross feed resolution for the given units.
*
-   * @return the resolution
+   * @param units the unit to use (e.g. [EMAIL PROTECTED] #DPCM} or [EMAIL PROTECTED] #DPI})
+   * @return The resolution for the given units.
*
-   * @exception IllegalArgumentException if units  1
+   * @exception IllegalArgumentException if units lt; 1
*/
   public int getCrossFeedResolution(int units)
   {
 if (units  1)
   throw new IllegalArgumentException(units may not be less then 1);
 
-return (crossFeedResolution + units) / units;
+return crossFeedResolution / units;
   }
 
   /**
-   * Returns the raw cross feed resolution in units.
+   * Returns the raw cross feed resolution in dots per 100 inches.
*
-   * @return the raw resolution
+   * @return The raw resolution.
*/
   protected int getCrossFeedResolutionDphi()
   {
@@ -125,24 +162,25 @@
   }
 
   /**
-   * Returns the feed resolution in units.
+   * Returns the feed resolution for the given units.
*
-   * @return the resolution
+   * @param units the unit to use (e.g. [EMAIL

[cp-patches] FYI: SetOfIntegerSyntax API docs additions and minor fixlet

2005-11-19 Thread Wolfgang Baer

Hi,

I added and enhanced the api docs for SetOfIntegerSyntax

There is also one fix included to create an empty set in case the
given string for one of the constructors is null.

This change is backed by the mauve test additions checked in earlier.

2005-11-19  Wolfgang Baer  [EMAIL PROTECTED]

* javax/print/attribute/SetOfIntegerSyntax.java:
Added and enhanced api docs for this class. 
(SetOfIntegerSyntax(String)): Create empty set if given string is null.

Regards,
Wolfgang


Index: javax/print/attribute/SetOfIntegerSyntax.java
===
RCS file: /cvsroot/classpath/classpath/javax/print/attribute/SetOfIntegerSyntax.java,v
retrieving revision 1.4
diff -u -r1.4 SetOfIntegerSyntax.java
--- javax/print/attribute/SetOfIntegerSyntax.java	6 Oct 2005 17:46:31 -	1.4
+++ javax/print/attribute/SetOfIntegerSyntax.java	19 Nov 2005 11:53:26 -
@@ -1,5 +1,5 @@
 /* SetOfIntegerSyntax.java -- 
-   Copyright (C) 2003, 2004  Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -45,7 +45,55 @@
 import java.util.Comparator;
 
 /**
- * @author Michael Koch
+ * codeSetOfIntegerSyntax/code is the abstract base class of all attribute 
+ * classes which provide a set of non-negative integers as value (e.g. the
+ * page ranges to print) represented as single values or ranges of values.
+ * p
+ * A codeSetOfIntegerSyntax/code instance consists of an integer array of
+ * ranges. Ranges may have the same lower and upper bound representing a single
+ * integer value. Ranges with a lower bound greater than the upper bound are 
+ * null ranges and discarded. Ranges may overlap in their values. In no case 
+ * negative integers are allowed.
+ * /p
+ * p
+ * There are several constructors available:
+ * ul
+ * licodeSetOfIntegerSyntax(int member)/codebr
+ * Constructor for an instance with only one integer value.
+ * /libr
+ * licodeSetOfIntegerSyntax(int lowerBound, int upperBound)/codebr
+ * Constructor for an instance with one range of integer values.
+ * /libr
+ * licodeSetOfIntegerSyntax(int[][] members)/codebr
+ * Flexible constructor for an instance with several single integer values 
+ * and/or several ranges of integer values. The allowed array form is an 
+ * array of integer arrays of length one or two. Examples are: 
+ * codeint[0][]/code for empty set of integers, codeint[][] {{1}}/code
+ * , codeint[][] {{1,5}}/code, codeint[][] {{1,5},{7,9}}/code,
+ * codeint[][] {{3,7},{19}}/code.
+ * /libr
+ * licodeSetOfIntegerSyntax(String s)/codebr
+ * Flexible constructor for an instance with several single integer values 
+ * and/or several ranges of integer values. The allowed String instance have
+ * to be a String with comma separated ranges of integer values or single 
+ * values. Ranges are represented by two integer with a hypen (-) or colon (:)
+ * between the lower and upper bound value. Whitespace characters are ignored.
+ * Examples are: code/code for an empty set of integers, 
+ * code1/code, code1-5/code, code1-5,7-9/code, 
+ * code3-7,19/code and code1:2,4/code.
+ * /li
+ * /ul
+ * /p
+ * p
+ * bInternal storage:/bbr
+ * The set of integers are stored internally in a normalized array form.
+ * In the normalized array form the set of integer ranges are represented
+ * in as few ranges as possible and overlapping ranges are merged. The ranges 
+ * are always represented as an integer array of length two with ranges 
+ * stored in {lower bound, upper bound} form. The ranges are stored in 
+ * ascending order, without any null ranges.
+ * /p
+ * @author Michael Koch ([EMAIL PROTECTED])
  */
 public abstract class SetOfIntegerSyntax
   implements Cloneable, Serializable
@@ -96,7 +144,7 @@
*
* @param member the member value
*
-   * @exception IllegalArgumentException if member is  0
+   * @exception IllegalArgumentException if member is lt; 0
*/
   protected SetOfIntegerSyntax(int member)
   {
@@ -109,7 +157,8 @@
   /**
* Creates a codeSetOfIntegerSyntax/code object.
*
-   * @param members the members to use in this set
+   * @param members the members to use in this set. If
+   * codenull/code an empty set is created.
*
* @exception IllegalArgumentException if any element is invalid
* @exception NullPointerException if any element of members is null
@@ -176,55 +225,68 @@
 return readAny;
   }
 
+  /**
+   * Creates a codeSetOfIntegerSyntax/code object.
+   *
+   * @param s the members to use in this set in string form. If
+   * codenull/code an empty set is created.
+   *
+   * @exception IllegalArgumentException if any element is invalid
+   */
   protected SetOfIntegerSyntax(String s)
   {
-ArrayList vals = new ArrayList();
-
-StringCharacterIterator it = new StringCharacterIterator(s);
-
-while (true)
-  {
-// Skip whitespace.
-if (skipWhitespace(it))
-  break

[cp-patches] FYI: TextSyntax API docs additions and minor fixlet

2005-11-19 Thread Wolfgang Baer

Hi,

I added and enhanced api docs for SetOfIntegerSyntax

There is also one fix included. If the given locale to the constructor
is null the default locale as given by Locale.getDefault is to be used.

This change is backed by the mauve tests checked in earlier.

2005-11-19  Wolfgang Baer  [EMAIL PROTECTED]

* javax/print/attribute/TextSyntax.java:
Added and enhanced api docs for this class.
(TextSyntax): If locale is null use the default locale.

Regards,
Wolfgang





Index: javax/print/attribute/TextSyntax.java
===
RCS file: /cvsroot/classpath/classpath/javax/print/attribute/TextSyntax.java,v
retrieving revision 1.4
diff -u -r1.4 TextSyntax.java
--- javax/print/attribute/TextSyntax.java	2 Jul 2005 20:32:46 -	1.4
+++ javax/print/attribute/TextSyntax.java	19 Nov 2005 13:00:01 -
@@ -1,5 +1,5 @@
 /* TextSyntax.java -- 
-   Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -41,7 +41,14 @@
 import java.util.Locale;
 
 /**
- * @author Michael Koch
+ * codeTextSyntax/code is the abstract base class of all attribute 
+ * classes which provide a string as value (e.g. the location of the printer).
+ * p
+ * A codeTextSyntax/code instance consists of a string value and a
+ * locale which indicates the language of the locale of the string.
+ * /p
+ *
+ * @author Michael Koch ([EMAIL PROTECTED])
  */
 public abstract class TextSyntax implements Cloneable, Serializable
 {
@@ -55,23 +62,24 @@
* and locale.
*
* @param value the value for this syntax
-   * @param locale the locale to use
+   * @param locale the locale to use, if codenull/code the default
+   * locale is used.
*
-   * @exception NullPointerException if value and/or locale is null
+   * @exception NullPointerException if value is null
*/
   protected TextSyntax(String value, Locale locale)
   {
-if (value == null || locale == null)
-  throw new NullPointerException(value and/or locale may not be null);
-
+if (value == null)
+  throw new NullPointerException(value may not be null);
+
 this.value = value;
-this.locale = locale;
+this.locale = (locale == null ? Locale.getDefault() : locale);
   }
 
   /**
* Returns the value of this syntax object.
*
-   * @return the value
+   * @return The value.
*/
   public String getValue()
   {
@@ -81,7 +89,7 @@
   /**
* Returns the locale of this syntax object.
*
-   * @return the locale
+   * @return The locale.
*/
   public Locale getLocale()
   {
@@ -91,7 +99,7 @@
   /**
* Returns the hashcode for this object.
*
-   * @return the hashcode
+   * @return The hashcode.
*/
   public int hashCode()
   {
@@ -99,7 +107,7 @@
   }
 
   /**
-   * Tests of obj is equal to this object.
+   * Tests if the given object is equal to this object.
*
* @param obj the object to test
*
@@ -117,7 +125,10 @@
   }
 
   /**
-   * Returns a string representing the object.
+   * Returns a string representing the object. The returned
+   * string is the underlying text value of this object.
+   * 
+   * @return The string representation.
*/
   public String toString()
   {
___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


[cp-patches] FYI: ResolutionSyntax.toString fixlet

2005-11-19 Thread Wolfgang Baer

Hi,

a small fixlet for ResolutionSyntax.toString. This is backed by a
mauve test addition checked in earlier.

2005-11-19  Wolfgang Baer  [EMAIL PROTECTED]

* javax/print/attribute/ResolutionSyntax.java (toString):
Changed to not append the unitsName if null. Clarified api docs.

Regards,
Wolfgang

Index: javax/print/attribute/ResolutionSyntax.java
===
RCS file: /cvsroot/classpath/classpath/javax/print/attribute/ResolutionSyntax.java,v
retrieving revision 1.5
diff -u -r1.5 ResolutionSyntax.java
--- javax/print/attribute/ResolutionSyntax.java	19 Nov 2005 11:03:37 -	1.5
+++ javax/print/attribute/ResolutionSyntax.java	19 Nov 2005 15:53:53 -
@@ -254,12 +254,16 @@
* /p
* 
* @param units the units to use
-   * @param unitsName the name of the units
+   * @param unitsName the name of the units. If codenull/code
+   * it is ommitted from the string representation.
*
* @return The string representation.
*/
   public String toString(int units, String unitsName)
   {
+if (unitsName == null)
+  return getCrossFeedResolution(units) + x + getFeedResolution(units);
+
 return ( + getCrossFeedResolution(units)
 + x + getFeedResolution(units)
 +   + unitsName);
___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


[cp-patches] FYI: Size2DSyntax API docs additions and fixlet

2005-11-19 Thread Wolfgang Baer

Hi,

I added and enhanced api docs of Size2DSyntax.

This patch also fixes the two toString methods. The default toString() method
has to return the values as ints and not as floats so we cannot use the other
toString method for implementation. The other toString(int,String) method
should not append the unitsName if null.

The changes are backed by the mauve tests checked in earlier today
and makes them pass.

With this commit the javax.print.attribute package is finished (api docs,
mauve tests, fixlets) and I will start with java.print.attribute.standard.

2005-11-19  Wolfgang Baer  [EMAIL PROTECTED]

* javax/print/attribute/Size2DSyntax.java:
Added and enhanced api docs for this class.
(toString()): Changed to return values as ints.
(toString(int,String)): Changed to not append the unitsName if null.

Regards,
Wolfgang


Index: javax/print/attribute/Size2DSyntax.java
===
RCS file: /cvsroot/classpath/classpath/javax/print/attribute/Size2DSyntax.java,v
retrieving revision 1.2
diff -u -r1.2 Size2DSyntax.java
--- javax/print/attribute/Size2DSyntax.java	2 Jul 2005 20:32:46 -	1.2
+++ javax/print/attribute/Size2DSyntax.java	19 Nov 2005 17:39:58 -
@@ -1,5 +1,5 @@
 /* Size2DSyntax.java -- 
-   Copyright (C) 2003 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2005 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -40,21 +40,62 @@
 import java.io.Serializable;
 
 /**
- * @author Michael Koch
+ * codeSize2DSyntax/code is the abstract base class of all attribute 
+ * classes which provide a two dimensional size as value (e.g. the size of
+ * a media like Letter or A4).
+ * p
+ * A codeSize2DSyntax/code instance consists of two integer values
+ * describing the size in the x and y dimension. The units of 
+ * the given values is determined by two defined constants:
+ * ul
+ * liINCH - defines an inch/li
+ * liMM - defines a millimeter/li
+ * /ul
+ * /p
+ * p
+ * A size 2D attribute is constructed by two values for the size of the x and
+ * y dimension and the actual units of the given values as defined by the 
+ * constants.
+ * /p
+ * p
+ * There are different methods provided to return the size values for the
+ * dimensions in either of the two predefined units or with a given client
+ * supplied units conversion factor.
+ * /p
+ * p
+ * bInternal storage:/bbr
+ * The size of the x,y dimensions are stored internally in micrometers. The 
+ * values of the provided constants for inch (value 25400) and millimeters
+ * (value 1000) are used as conversion factors to the internal storage units.
+ * To get the internal micrometers values a multiplication of a given
+ * size value with its units constant value is done. Retrieving the size value
+ * for specific units is done by dividing the internal stored value by the 
+ * units constant value. Clients are therefore able to provide their own 
+ * size units by supplying other conversion factors.
+ * Subclasses of codeSize2DSyntax/code have access to the internal
+ * size values through the protected methods 
+ * [EMAIL PROTECTED] #getXMicrometers()} and [EMAIL PROTECTED] #getYMicrometers()}.
+ * /p
+ *
+ * @author Michael Koch ([EMAIL PROTECTED])
  */
 public abstract class Size2DSyntax implements Cloneable, Serializable
 {
   /**
-   * Constant for units of dots per mircometer to describe an inch.
+   * Constant for the units of inches.
+   * The actual value is the conversion factor to micrometers.
*/
   public static final int INCH = 25400;
 
   /**
-   * Constant for units of dots per mircometer to describe a centimeter.
+   * Constant for the units of millimeters.
+   * The actual value is the conversion factor to micrometers.
*/
   public static final int MM = 1000;
 
+  /** x size in micrometers. */
   private int x;
+  /** y size in micrometers. */
   private int y;
 
   /**
@@ -64,7 +105,7 @@
* @param y the size in y direction
* @param units the units to use for the sizes
*
-   * @exception IllegalArgumentException if preconditions fail
+   * @exception IllegalArgumentException if x or y lt; 0 or units lt; 1
*/
   protected Size2DSyntax(float x, float y, int units)
   {
@@ -85,7 +126,7 @@
* @param y the size in y direction
* @param units the units to use for the sizes
*
-   * @exception IllegalArgumentException if preconditions fail
+   * @exception IllegalArgumentException if x or y lt; 0 or units lt; 1
*/
   protected Size2DSyntax(int x, int y, int units)
   {
@@ -100,11 +141,11 @@
   }
 
   /**
-   * Tests of obj is equal to this object.
+   * Tests if the given object is equal to this object.
*
* @param obj the object to test
*
-   * @returns true if both objects are equal, false otherwise.
+   * @return codetrue/code if both objects are equal, codefalse/code otherwise.
*/
   public boolean equals(Object obj)
   {
@@ -118,15 +159,15 @@
   }
 
   /**
-   * Return

[cp-patches] FYI: Api docs additions in javax.print.attribute

2005-11-15 Thread Wolfgang Baer

Hi,

subjects says all.

2005-11-15  Wolfgang Baer  [EMAIL PROTECTED]

* javax/print/attribute/DateTimeSyntax.java,
* javax/print/attribute/EnumSyntax.java,
* javax/print/attribute/IntegerSyntax.java,
* javax/print/attribute/URISyntax.java:
Added and enhances some api docs.

Regards,
Wolfgang

Index: javax/print/attribute/IntegerSyntax.java
===
RCS file: /cvsroot/classpath/classpath/javax/print/attribute/IntegerSyntax.java,v
retrieving revision 1.3
diff -u -r1.3 IntegerSyntax.java
--- javax/print/attribute/IntegerSyntax.java	2 Jul 2005 20:32:46 -	1.3
+++ javax/print/attribute/IntegerSyntax.java	15 Nov 2005 16:15:38 -
@@ -1,5 +1,5 @@
 /* IntegerSyntax.java -- 
-   Copyright (C) 2003, 2004  Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -40,7 +40,10 @@
 import java.io.Serializable;
 
 /**
- * @author Michael Koch
+ * codeIntegerSyntax/code is the abstract base class of all attribute 
+ * classes having an integer as value.
+ * 
+ * @author Michael Koch ([EMAIL PROTECTED])
  */
 public abstract class IntegerSyntax implements Cloneable, Serializable
 {
@@ -49,7 +52,7 @@
   /**
* Creates a codeIntegerSyntax/code with the given value.
*
-   * @param value the value to set
+   * @param value the integer to set
*/
   protected IntegerSyntax(int value)
   {
@@ -57,9 +60,10 @@
   }
 
   /**
-   * Creates a codeIntegerSyntax/code with the given arguments.
+   * Creates a codeIntegerSyntax/code with the given integer value
+   * and checks if the value lies inside the given bounds..
*
-   * @param value the value to set
+   * @param value the integer to set
* @param lowerBound the lower bound for the value
* @param upperBound the upper bound for the value
*
@@ -78,7 +82,7 @@
   /**
* Returns the value of this object.
*
-   * @return the value
+   * @return The integer value.
*/
   public int getValue()
   {
@@ -86,11 +90,12 @@
   }
 
   /**
-   * Tests of obj is equal to this object.
+   * Tests if the given object is equal to this object.
*
* @param obj the object to test
*
-   * @return true if both objects are equal, false otherwise.
+   * @return codetrue/code if both objects are equal, 
+   * codefalse/code otherwise.
*/
   public boolean equals(Object obj)
   {
@@ -103,7 +108,7 @@
   /**
* Returns the hashcode for this object.
*
-   * @return the hashcode
+   * @return The hashcode.
*/
   public int hashCode()
   {
@@ -113,7 +118,7 @@
   /**
* Returns the string representation for this object.
*
-   * @return the string representation
+   * @return The string representation.
*/
   public String toString()
   {
Index: javax/print/attribute/EnumSyntax.java
===
RCS file: /cvsroot/classpath/classpath/javax/print/attribute/EnumSyntax.java,v
retrieving revision 1.5
diff -u -r1.5 EnumSyntax.java
--- javax/print/attribute/EnumSyntax.java	13 Nov 2005 10:34:18 -	1.5
+++ javax/print/attribute/EnumSyntax.java	15 Nov 2005 16:15:38 -
@@ -42,8 +42,8 @@
 import java.io.Serializable;
 
 /**
- * EnumSyntax is the abstract base class of all enumeration classes in 
- * the Java Print Service API. 
+ * codeEnumSyntax/code is the abstract base class of all enumeration
+ * classes in the Java Print Service API. 
  * p
  * Every enumeration class which extends from EnumSyntax provides several 
  * enumeration objects as singletons of its class.
Index: javax/print/attribute/URISyntax.java
===
RCS file: /cvsroot/classpath/classpath/javax/print/attribute/URISyntax.java,v
retrieving revision 1.2
diff -u -r1.2 URISyntax.java
--- javax/print/attribute/URISyntax.java	2 Jul 2005 20:32:46 -	1.2
+++ javax/print/attribute/URISyntax.java	15 Nov 2005 16:15:38 -
@@ -1,5 +1,5 @@
 /* URISyntax.java -- 
-   Copyright (C) 2003 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2005 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -41,7 +41,10 @@
 import java.net.URI;
 
 /**
- * @author Michael Koch
+ * codeURISyntax/code is the abstract base class of all attribute 
+ * classes having an Uniform Resource Identifier URI as value.
+ * 
+ * @author Michael Koch ([EMAIL PROTECTED])
  */
 public abstract class URISyntax
   implements Cloneable, Serializable
@@ -66,11 +69,12 @@
   }
 
   /**
-   * Tests of obj is equal to this object.
+   * Tests if the given object is equal to this object.
*
* @param obj the object to test
*
-   * @returns true if both objects are equal, false otherwise.
+   * @return codetrue/code if both objects are equal, 
+   * codefalse/code otherwise.
*/
   public boolean equals(Object obj)
   {
@@ -83,7 +87,7 @@
   /**
* Returns the URI value of this syntax

Re: [cp-patches] Patch: javax.print.attribute.HashAttributeSet fixlets

2005-11-14 Thread Wolfgang Baer

Hi Mark,

Mark Wielaard wrote:

Hi Wolfgang,

On Sun, 2005-11-13 at 20:58 +0100, Wolfgang Baer wrote:


2005-11-13  Wolfgang Baer  [EMAIL PROTECTED]

   * javax/print/attribute/HashAttributeSet.java:
   Added api docs to class and clarified method documentation.
   (toArray): Use iterator from values instead of entries.
   (hashCode): Compute hashcode according to specification.
   (get): Throw NullPointerException if category is null.
   (HashAttributeSet(Attribute[], Class)): Changed to allow
   Attribute[] to be null.



Should a HashAttributeSet be thread-safe? In that case you will have to
synchronize on the attributeMap while manipulating it or iterating over
it.


There is nothing about it in the api docs and thats despite a user guide
the only available documentation of the Java Print Service API.

However I assume that it has not to be thread safe itself, as there exists
a AttributeSetUtilities class which provides static methods to create a
synchronizedView on the different AttributeSet classes.


  /**
-   * Returns the hashcode for this object.
-   *
-   * @return the hashcode
+   * Returns the hashcode value. The hashcode value is the sum of all hashcodes
+   * of the attributes contained in this set.
+   * 
+   * @return The hashcode for this attribute set.

   */
  public int hashCode()
  {
-return attributeMap.hashCode() + interfaceName.hashCode();
+int hashcode = 0;
+Iterator it = attributeMap.values().iterator();
+while (it.hasNext())
+  hashcode = hashcode + it.next().hashCode();
+  
+return hashcode;

  }



It would be better to xor (^) the hashCode() values unless this
computation of the hashcode has been specified to use addition of
course. 


Thats what is done in the normal HashMap implementation. The hashcode
is the sum over all entries hashcode and this is key.hashcode ^ value.hashcode.

The api doc specifies for HashAttributeSet that the hashcode should be the
sum over all entries hashcodes. So just returning attributeMap.hashCode()
would give us the above default behaviour. However the mauve tests show that at
least the reference implementation does only sum up the hashcodes of the
values and ignores the entries hashcode values.

In both case the hashcode contract is fullfiled. So the question is should
we follow the reference implementation or not ?

Wolfgang


___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


Re: [cp-patches] Patch: javax.print.attribute.HashAttributeSet fixlets

2005-11-14 Thread Wolfgang Baer

Hi,

Mark Wielaard wrote:

Hi Wolfgang,

On Mon, 2005-11-14 at 09:33 +0100, Wolfgang Baer wrote:


However I assume that it has not to be thread safe itself, as there exists
a AttributeSetUtilities class which provides static methods to create a
synchronizedView on the different AttributeSet classes.



OK that makes sense.



In both case the hashcode contract is fullfiled. So the question is should
we follow the reference implementation or not ?



Yes, if there is documentation explaining and describing this behavior
then we should do similar.


Yes, its described in the Javadocs. Committed.

Thanks,
Wolfgang



___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


[cp-patches] FYI: Doc update and minor fixlet for javax.print.attribute.AttributeSetUtilities

2005-11-14 Thread Wolfgang Baer

Hi,

i committed api docs update and an obvious typo fixlet to
javax.print.attribute.AttributeSetUtilities.

2005-11-14  Wolfgang Baer  [EMAIL PROTECTED]

* javax/print/attribute/AttributeSetUtilities.java:
Added api docs and enhanced api docs all over the place.
(verifyCategoryForValue): Throw exception when arguments
are _not_ equal, Throw NPE also if attribute is null.

Regards,
Wolfgang
Index: javax/print/attribute/AttributeSetUtilities.java
===
RCS file: /cvsroot/classpath/classpath/javax/print/attribute/AttributeSetUtilities.java,v
retrieving revision 1.4
diff -u -r1.4 AttributeSetUtilities.java
--- javax/print/attribute/AttributeSetUtilities.java	2 Jul 2005 20:32:46 -	1.4
+++ javax/print/attribute/AttributeSetUtilities.java	14 Nov 2005 22:09:54 -
@@ -39,12 +39,41 @@
 
 import java.io.Serializable;
 
+/**
+ * codeAttributeSetUtilities/code provides static methods for working
+ * with codeAttributeSet/codes.
+ * p
+ * For every type of an attribute set available in the Java Print Service API
+ * are methods provided to get an unmodifiable view of an attribute set.
+ * This unmodifiable view provides a read-only version of the attribute
+ * set which throws [EMAIL PROTECTED] javax.print.attribute.UnmodifiableSetException}s
+ * if state changing methods are invoked.
+ * /p
+ * p
+ * Methods for getting a synchronized view of an attribute set are also 
+ * available. This view provides synchronized (thread safe) access to the
+ * underlying wrapped attribute set.
+ * /P
+ * p
+ * Three static methods for the implementation of own AttributeSets
+ * are provided, which verify that:
+ * ul
+ * lithe given object is an attribute of the given interface./li
+ * lithe category of given attribute is equals to a given category./li
+ * lithe given object is a codeClass/code that implements the given 
+ * interface name./li
+ * /ul
+ * 
+ */
 public final class AttributeSetUtilities
 {
   /**
* This class isn't intended to be instantiated.
*/
-  private AttributeSetUtilities() {}
+  private AttributeSetUtilities() 
+  {
+// only static methods
+  }
 
   private static class UnmodifiableAttributeSet
 implements AttributeSet, Serializable
@@ -287,7 +316,8 @@
   /**
* Returns a synchronized view of the given attribute set.
*
-   * @return the sychronized attribute set
+   * @param attributeSet the set to synchronize.
+   * @return The sychronized attribute set.
*/
   public static AttributeSet synchronizedView(AttributeSet attributeSet)
   {
@@ -297,7 +327,8 @@
   /**
* Returns a synchronized view of the given attribute set.
*
-   * @return the sychronized attribute set
+   * @param attributeSet the set to synchronize.
+   * @return The sychronized attribute set.
*/
   public static DocAttributeSet synchronizedView(DocAttributeSet attributeSet)
   {
@@ -307,7 +338,8 @@
   /**
* Returns a synchronized view of the given attribute set.
*
-   * @return the sychronized attribute set
+   * @param attributeSet the set to synchronize.
+   * @return The sychronized attribute set.
*/
   public static PrintJobAttributeSet synchronizedView(PrintJobAttributeSet attributeSet)
   {
@@ -317,7 +349,8 @@
   /**
* Returns a synchronized view of the given attribute set.
*
-   * @return the sychronized attribute set
+   * @param attributeSet the set to synchronize.
+   * @return The sychronized attribute set.
*/
   public static PrintRequestAttributeSet synchronizedView(PrintRequestAttributeSet attributeSet)
   {
@@ -327,7 +360,8 @@
   /**
* Returns a synchronized view of the given attribute set.
*
-   * @return the sychronized attribute set
+   * @param attributeSet the set to synchronize.
+   * @return The sychronized attribute set.
*/
   public static PrintServiceAttributeSet synchronizedView(PrintServiceAttributeSet attributeSet)
   {
@@ -337,7 +371,8 @@
   /**
* Returns an unmodifiable view of the given attribute set.
*
-   * @return the sychronized attribute set
+   * @param attributeSet the set to make unmodifiable.
+   * @return The unmodifiable attribute set.
*/
   public static AttributeSet unmodifiableView(AttributeSet attributeSet)
   {
@@ -347,7 +382,8 @@
   /**
* Returns an unmodifiable view of the given attribute set.
*
-   * @return the sychronized attribute set
+   * @param attributeSet the set to make unmodifiable.
+   * @return The unmodifiable attribute set.
*/
   public static DocAttributeSet unmodifiableView(DocAttributeSet attributeSet)
   {
@@ -357,7 +393,8 @@
   /**
* Returns an unmodifiable view of the given attribute set.
*
-   * @return the sychronized attribute set
+   * @param attributeSet the set to make unmodifiable.
+   * @return The unmodifiable attribute set.
*/
   public static PrintJobAttributeSet unmodifiableView(PrintJobAttributeSet attributeSet)
   {
@@ -367,7 +404,8

Re: [cp-patches] Patch: API docs for javax/print/attribute Interfaces and Exception

2005-11-13 Thread Wolfgang Baer

Mark Wielaard wrote:

Hi Wolfgang,

On Sat, 2005-11-12 at 20:39 +0100, Wolfgang Baer wrote:


this adds documentation to the interfaces and one exception
in javax.print.attribute.

2005-11-12  Wolfgang Baer  [EMAIL PROTECTED]

* javax/print/attribute/Attribute.java,
javax/print/attribute/AttributeSet.java,
javax/print/attribute/DocAttribute.java,
javax/print/attribute/DocAttributeSet.java,
javax/print/attribute/PrintJobAttribute.java,
javax/print/attribute/PrintJobAttributeSet.java,
javax/print/attribute/PrintRequestAttribute.java,
javax/print/attribute/PrintRequestAttributeSet.java,
javax/print/attribute/PrintServiceAttribute.java,
javax/print/attribute/PrintServiceAttributeSet.java,
javax/print/attribute/SupportedValuesAttribute.java,
javax/print/attribute/UnmodifiableSetException.java:
Added api documentation to class and method definitions.
* javax/print/attribute/package.html: Included a package
description.

OK to commit ?



Yes, very nice.


Commited.


Please feel free to commit further documentation additions without
needing to ask for permission.


OK

Wolfgang


___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


Re: [cp-patches] Patch: javax.print.attribute.EnumSyntax

2005-11-13 Thread Wolfgang Baer

Mark Wielaard wrote:

Hi,

On Sat, 2005-11-12 at 21:06 +0100, Wolfgang Baer wrote:


2005-11-12  Wolfgang Baer  [EMAIL PROTECTED]

   * javax/print/attribute/EnumSyntax.java:
   API docs added and enhanced for class and methods.
   (readResolve): New method.

OK to commit ?



Yes please.


Committed.

Wolfgang


___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


[cp-patches] FYI: API docs update javax.print.attribute

2005-11-13 Thread Wolfgang Baer

Hi,

this adds and enhances some api docs for some classes
in javax.print.attribute.

2005-11-13  Wolfgang Baer  [EMAIL PROTECTED]

* javax/print/attribute/HashDocAttributeSet.java,
* javax/print/attribute/HashPrintJobAttributeSet.java,
* javax/print/attribute/HashPrintRequestAttributeSet.java,
* javax/print/attribute/HashPrintServiceAttributeSet.java,
Added class api docs and enhanced method api docs.

Regards,
Wolfgang


Index: ChangeLog
===
RCS file: /cvsroot/classpath/classpath/ChangeLog,v
retrieving revision 1.5565
diff -u -r1.5565 ChangeLog
--- ChangeLog	13 Nov 2005 17:36:10 -	1.5565
+++ ChangeLog	13 Nov 2005 18:56:12 -
@@ -1,3 +1,11 @@
+2005-11-13  Wolfgang Baer  [EMAIL PROTECTED]
+
+	* javax/print/attribute/HashDocAttributeSet.java,
+	* javax/print/attribute/HashPrintJobAttributeSet.java,
+	* javax/print/attribute/HashPrintRequestAttributeSet.java,
+	* javax/print/attribute/HashPrintServiceAttributeSet.java,
+	Added class api docs and enhanced method api docs.
+
 2005-11-13  Tom Tromey  [EMAIL PROTECTED]
 
 	* native/jni/midi-dssi/.cvsignore: Updated.
Index: javax/print/attribute/HashDocAttributeSet.java
===
RCS file: /cvsroot/classpath/classpath/javax/print/attribute/HashDocAttributeSet.java,v
retrieving revision 1.2
diff -u -r1.2 HashDocAttributeSet.java
--- javax/print/attribute/HashDocAttributeSet.java	2 Jul 2005 20:32:46 -	1.2
+++ javax/print/attribute/HashDocAttributeSet.java	13 Nov 2005 18:56:12 -
@@ -1,5 +1,5 @@
 /* HashDocAttributeSet.java -- 
-   Copyright (C) 2003 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2005 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -39,6 +39,10 @@
 
 import java.io.Serializable;
 
+/**
+ * codeHashDocAttributeSet/code provides an implementation of
+ * [EMAIL PROTECTED] javax.print.attribute.DocAttributeSet}.
+ */
 public class HashDocAttributeSet extends HashAttributeSet
   implements DocAttributeSet, Serializable
 {
@@ -56,7 +60,7 @@
* Creates a codeHashDocAttributeSet/code object with the given
* attribute in it.
*
-   * @param attribute the attriute tu put into the attribute set
+   * @param attribute the attribute to put into the attribute set
*
* @exception NullPointerException if attribute is null
*/
@@ -69,9 +73,11 @@
* Creates a codeHashDocAttributeSet/code object with the given
* attributes in it.
*
-   * @param attributes the attributes to put into the attribute set
+   * @param attributes the array of attributes to put into the set. If
+   * codenull/code an empty set is created.
*
-   * @exception NullPointerException if attributes is null
+   * @exception NullPointerException if one of the attributes of the given
+   * array is null.
*/
   public HashDocAttributeSet(DocAttribute[] attributes)
   {
@@ -79,11 +85,11 @@
   }
 
   /**
-   * Creates a codeHashDocAttributeSet/code object with the given
-   * attributes in it.
-   *
-   * @param attributes the attributes to put into the attribute set
+   * Creates a codeHashDocAttributeSet/code object with the attributes
+   * of the given attributes set in it.
*
+   * @param attributes the attributes set to put into the set. If 
+   * codenull/code an empty set is created.
* @exception ClassCastException if any element of attributes is not
* an instance of codeDocAttribute/code
*/
Index: javax/print/attribute/HashPrintJobAttributeSet.java
===
RCS file: /cvsroot/classpath/classpath/javax/print/attribute/HashPrintJobAttributeSet.java,v
retrieving revision 1.2
diff -u -r1.2 HashPrintJobAttributeSet.java
--- javax/print/attribute/HashPrintJobAttributeSet.java	2 Jul 2005 20:32:46 -	1.2
+++ javax/print/attribute/HashPrintJobAttributeSet.java	13 Nov 2005 18:56:12 -
@@ -1,5 +1,5 @@
 /* HashPrintJobAttributeSet.java -- 
-   Copyright (C) 2003 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2005 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -39,6 +39,10 @@
 
 import java.io.Serializable;
 
+/**
+ * codeHashPrintJobAttributeSet/code provides an implementation of
+ * [EMAIL PROTECTED] javax.print.attribute.PrintJobAttributeSet}.
+ */
 public class HashPrintJobAttributeSet extends HashAttributeSet
   implements Serializable, PrintJobAttributeSet
 {
@@ -56,7 +60,7 @@
* Creates a codeHashPrintJobAttributeSet/code object with the given
* attribute in it.
*
-   * @param attribute the attriute tu put into the attribute set
+   * @param attribute the attribute to put into the attribute set
*
* @exception NullPointerException if attribute is null
*/
@@ -69,9 +73,11 @@
* Creates a codeHashPrintJobAttributeSet/code object with the given
* attributes in it.
*
-   * @param attributes the attributes

Re: [cp-patches] FYI: API docs update javax.print.attribute

2005-11-13 Thread Wolfgang Baer

Sorry the changlog slipped into the patch. Here the patch without
the changelog entry.

Wolfgang

2005-11-13  Wolfgang Baer  [EMAIL PROTECTED]

* javax/print/attribute/HashDocAttributeSet.java,
* javax/print/attribute/HashPrintJobAttributeSet.java,
* javax/print/attribute/HashPrintRequestAttributeSet.java,
* javax/print/attribute/HashPrintServiceAttributeSet.java,
Added class api docs and enhanced method api docs.


Index: javax/print/attribute/HashDocAttributeSet.java
===
RCS file: /cvsroot/classpath/classpath/javax/print/attribute/HashDocAttributeSet.java,v
retrieving revision 1.2
diff -u -r1.2 HashDocAttributeSet.java
--- javax/print/attribute/HashDocAttributeSet.java	2 Jul 2005 20:32:46 -	1.2
+++ javax/print/attribute/HashDocAttributeSet.java	13 Nov 2005 18:56:12 -
@@ -1,5 +1,5 @@
 /* HashDocAttributeSet.java -- 
-   Copyright (C) 2003 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2005 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -39,6 +39,10 @@
 
 import java.io.Serializable;
 
+/**
+ * codeHashDocAttributeSet/code provides an implementation of
+ * [EMAIL PROTECTED] javax.print.attribute.DocAttributeSet}.
+ */
 public class HashDocAttributeSet extends HashAttributeSet
   implements DocAttributeSet, Serializable
 {
@@ -56,7 +60,7 @@
* Creates a codeHashDocAttributeSet/code object with the given
* attribute in it.
*
-   * @param attribute the attriute tu put into the attribute set
+   * @param attribute the attribute to put into the attribute set
*
* @exception NullPointerException if attribute is null
*/
@@ -69,9 +73,11 @@
* Creates a codeHashDocAttributeSet/code object with the given
* attributes in it.
*
-   * @param attributes the attributes to put into the attribute set
+   * @param attributes the array of attributes to put into the set. If
+   * codenull/code an empty set is created.
*
-   * @exception NullPointerException if attributes is null
+   * @exception NullPointerException if one of the attributes of the given
+   * array is null.
*/
   public HashDocAttributeSet(DocAttribute[] attributes)
   {
@@ -79,11 +85,11 @@
   }
 
   /**
-   * Creates a codeHashDocAttributeSet/code object with the given
-   * attributes in it.
-   *
-   * @param attributes the attributes to put into the attribute set
+   * Creates a codeHashDocAttributeSet/code object with the attributes
+   * of the given attributes set in it.
*
+   * @param attributes the attributes set to put into the set. If 
+   * codenull/code an empty set is created.
* @exception ClassCastException if any element of attributes is not
* an instance of codeDocAttribute/code
*/
Index: javax/print/attribute/HashPrintJobAttributeSet.java
===
RCS file: /cvsroot/classpath/classpath/javax/print/attribute/HashPrintJobAttributeSet.java,v
retrieving revision 1.2
diff -u -r1.2 HashPrintJobAttributeSet.java
--- javax/print/attribute/HashPrintJobAttributeSet.java	2 Jul 2005 20:32:46 -	1.2
+++ javax/print/attribute/HashPrintJobAttributeSet.java	13 Nov 2005 18:56:12 -
@@ -1,5 +1,5 @@
 /* HashPrintJobAttributeSet.java -- 
-   Copyright (C) 2003 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2005 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -39,6 +39,10 @@
 
 import java.io.Serializable;
 
+/**
+ * codeHashPrintJobAttributeSet/code provides an implementation of
+ * [EMAIL PROTECTED] javax.print.attribute.PrintJobAttributeSet}.
+ */
 public class HashPrintJobAttributeSet extends HashAttributeSet
   implements Serializable, PrintJobAttributeSet
 {
@@ -56,7 +60,7 @@
* Creates a codeHashPrintJobAttributeSet/code object with the given
* attribute in it.
*
-   * @param attribute the attriute tu put into the attribute set
+   * @param attribute the attribute to put into the attribute set
*
* @exception NullPointerException if attribute is null
*/
@@ -69,9 +73,11 @@
* Creates a codeHashPrintJobAttributeSet/code object with the given
* attributes in it.
*
-   * @param attributes the attributes to put into the attribute set
+   * @param attributes the array of attributes to put into the set. If
+   * codenull/code an empty set is created.
*
-   * @exception NullPointerException if attributes is null
+   * @exception NullPointerException if one of the attributes of the given
+   * array is null.
*/
   public HashPrintJobAttributeSet(PrintJobAttribute[] attributes)
   {
@@ -79,11 +85,11 @@
   }
   
   /**
-   * Creates a codeHashPrintJobAttributeSet/code object with the given
-   * attributes in it.
-   *
-   * @param attributes the attributes to put into the attribute set
+   * Creates a codeHashPrintJobAttributeSet/code object with the attributes
+   * of the given attributes set

[cp-patches] Patch: javax.print.attribute.HashAttributeSet fixlets

2005-11-13 Thread Wolfgang Baer

Hi,

this patch adds and enhances api docs all over the class.
Futher it fixes some minor bugs found by the mauve tests for this class.

2005-11-13  Wolfgang Baer  [EMAIL PROTECTED]

* javax/print/attribute/HashAttributeSet.java:
Added api docs to class and clarified method documentation.
(toArray): Use iterator from values instead of entries.
(hashCode): Compute hashcode according to specification.
(get): Throw NullPointerException if category is null.
(HashAttributeSet(Attribute[], Class)): Changed to allow Attribute[]
to be null.

OK to commit ?

Regards,
Wolfgang
Index: javax/print/attribute/HashAttributeSet.java
===
RCS file: /cvsroot/classpath/classpath/javax/print/attribute/HashAttributeSet.java,v
retrieving revision 1.4
diff -u -r1.4 HashAttributeSet.java
--- javax/print/attribute/HashAttributeSet.java	2 Jul 2005 20:32:46 -	1.4
+++ javax/print/attribute/HashAttributeSet.java	13 Nov 2005 19:53:59 -
@@ -1,5 +1,5 @@
 /* HashAttributeSet.java -- 
-   Copyright (C) 2003, 2004  Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -41,6 +41,10 @@
 import java.util.HashMap;
 import java.util.Iterator;
 
+/**
+ * codeHashAttributeSet/code provides an implementation of
+ * [EMAIL PROTECTED] javax.print.attribute.AttributeSet}.
+ */
 public class HashAttributeSet implements AttributeSet, Serializable
 {
   private static final long serialVersionUID = 5311560590283707917L;
@@ -73,9 +77,11 @@
* Creates a codeHashAttributeSet/code object with the given
* attributes in it.
*
-   * @param attributes the attributes to put into the set
+   * @param attributes the array of attributes to put into the set. If
+   * codenull/code an empty set is created.
*
-   * @exception NullPointerException If attributes is null
+   * @exception NullPointerException if one of the attributes of the given
+   * array is null.
*/
   public HashAttributeSet(Attribute[] attributes)
   {
@@ -83,12 +89,11 @@
   }
 
   /**
-   * Creates a codeHashAttributeSet/code object with the given
-   * attributes in it.
-   *
-   * @param attributes the attributes to put into the set
+   * Creates a codeHashAttributeSet/code object with attributes
+   * of the given attributes set in it.
*
-   * @exception NullPointerException If attributes is null
+   * @param attributes the attributes set to put into the set. If 
+   * codenull/code an empty set is created.
*/
   public HashAttributeSet(AttributeSet attributes)
   {
@@ -111,7 +116,11 @@
   }
   
   /**
-   * Creates an empty codeHashAttributeSet/code object.
+   * Creates a codeHashAttributeSet/code object with the given
+   * attribute in it.
+   * 
+   * @param attribute the attribute to put into the set.
+   * @param interfaceName the interface that all members must implement.
*
* @exception ClassCastException if attribute is not an interface of
* interfaceName
@@ -128,7 +137,12 @@
   }
 
   /**
-   * Creates an empty codeHashAttributeSet/code object.
+   * Creates a codeHashAttributeSet/code object with the given
+   * attributes in it.
+   *
+   * @param attributes the array of attributes to put into the set. If
+   * codenull/code an empty set is created.
+   * @param interfaceName the interface that all members must implement.
*
* @exception ClassCastException if any element of attributes is not an
* interface of interfaceName
@@ -138,15 +152,20 @@
   {
 this(interfaceName);
 
-if (attributes == null)
-  throw new NullPointerException();
-
-for (int index = 0; index  attributes.length; index++)
-  addInternal(attributes[index], interfaceName);
+if (attributes != null)
+  {
+for (int index = 0; index  attributes.length; index++)
+  addInternal(attributes[index], interfaceName);
+  }
   }
 
   /**
-   * Creates an empty codeHashAttributeSet/code object.
+   * Creates a codeHashAttributeSet/code object with attributes
+   * of the given attributes set in it.
+   *
+   * @param attributes the attributes set to put into the set. If 
+   * codenull/code an empty set is created.
+   * @param interfaceName the interface that all members must implement.
*
* @exception ClassCastException if any element of attributes is not an
* interface of interfaceName
@@ -160,15 +179,16 @@
   }
 
   /**
-   * Adds the given attribute to the set.
-   *
-   * @param attribute the attribute to add
-   *
-   * @return true if the attribute set has changed, false otherwise
-   *
-   * @exception NullPointerException if attribute is null
-   * @exception UnmodifiableSetException if this attribute set does not
-   * support this action.
+   * Adds the specified attribute value to this attribute set 
+   * if it is not already present.
+   * 
+   * This operation removes any existing

Re: [cp-patches] RFC: ObjectInputStream fix for readResolve invocations

2005-11-12 Thread Wolfgang Baer

Hi,

Mark Wielaard wrote:

Multiple nitpicks here. The comment Can throw Errors and
RuntimeExceptions if caused by the readResolve() user code should not
be here, but a comment of public Object readObject() method. (The fact
that SUN also does this is not really that relevant imho.) The name
'ignore' is really a misnomer now. Maybe it isn't really confusing, but
it looks funny.

Feel free to commit this with or without these nitpicks fixed.


Committed as follows:

2005-11-12  Wolfgang Baer  [EMAIL PROTECTED]

* java/io/ObjectInputStream.java
(processResolution): Pass Error, RuntimeException and
ObjectStreamException through to the caller.
(readObject): Documentation update.

Regards,
Wolfgang

Index: java/io/ObjectInputStream.java
===
RCS file: /cvsroot/classpath/classpath/java/io/ObjectInputStream.java,v
retrieving revision 1.71
diff -u -r1.71 ObjectInputStream.java
--- java/io/ObjectInputStream.java	1 Nov 2005 23:32:21 -	1.71
+++ java/io/ObjectInputStream.java	12 Nov 2005 18:15:38 -
@@ -112,7 +112,10 @@
* codeprivate void readObject (ObjectInputStream)/code.
*
* If an exception is thrown from this method, the stream is left in
-   * an undefined state.
+   * an undefined state. This method can also throw Errors and 
+   * RuntimeExceptions if caused by existing readResolve() user code.
+   * 
+   * @return The object read from the underlying stream.
*
* @exception ClassNotFoundException The class that an object being
* read in belongs to cannot be found.
@@ -1565,8 +1568,15 @@
 	catch (IllegalAccessException ignore)
 	  {
 	  }
-	catch (InvocationTargetException ignore)
+	catch (InvocationTargetException exception)
 	  {
+	Throwable cause = exception.getCause();
+	if (cause instanceof ObjectStreamException)
+	  throw (ObjectStreamException) cause;
+	else if (cause instanceof RuntimeException)
+	  throw (RuntimeException) cause;
+	else if (cause instanceof Error)
+	  throw (Error) cause;
 	  }
   }
 
___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


[cp-patches] Patch: API docs for javax/print/attribute Interfaces and Exception

2005-11-12 Thread Wolfgang Baer

Hi,

this adds documentation to the interfaces and one exception
in javax.print.attribute.

2005-11-12  Wolfgang Baer  [EMAIL PROTECTED]

* javax/print/attribute/Attribute.java,
javax/print/attribute/AttributeSet.java,
javax/print/attribute/DocAttribute.java,
javax/print/attribute/DocAttributeSet.java,
javax/print/attribute/PrintJobAttribute.java,
javax/print/attribute/PrintJobAttributeSet.java,
javax/print/attribute/PrintRequestAttribute.java,
javax/print/attribute/PrintRequestAttributeSet.java,
javax/print/attribute/PrintServiceAttribute.java,
javax/print/attribute/PrintServiceAttributeSet.java,
javax/print/attribute/SupportedValuesAttribute.java,
javax/print/attribute/UnmodifiableSetException.java:
Added api documentation to class and method definitions.
* javax/print/attribute/package.html: Included a package description.

OK to commit ?

Regards,
Wolfgang



Index: javax/print/attribute/Attribute.java
===
RCS file: /cvsroot/classpath/classpath/javax/print/attribute/Attribute.java,v
retrieving revision 1.3
diff -u -r1.3 Attribute.java
--- javax/print/attribute/Attribute.java	2 Jul 2005 20:32:46 -	1.3
+++ javax/print/attribute/Attribute.java	12 Nov 2005 19:36:28 -
@@ -1,5 +1,5 @@
 /* Attribute.java -- 
-   Copyright (C) 2002 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2005 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -40,11 +40,27 @@
 import java.io.Serializable;
 
 /**
- * @author Michael Koch
+ * Base interface of every printing attribute of the Java Print Service API.
+ * 
+ * @author Michael Koch ([EMAIL PROTECTED])
  */
 public interface Attribute extends Serializable
 {
+  /**
+   * Returns the category of the printing attribute which is the specific
+   * attribute class implementing this interface.
+   * 
+   * @return The concrete [EMAIL PROTECTED] Class} instance of the attribute class.
+   */
   Class getCategory ();
 
+  /**
+   * Returns the descriptive name of the attribute category.
+   * 
+   * Implementations of the codeAttribute/code interfaces providing equal
+   * category values have to return equal name values.
+   * 
+   * @return The name of the attribute category.
+   */
   String getName ();
 }
Index: javax/print/attribute/AttributeSet.java
===
RCS file: /cvsroot/classpath/classpath/javax/print/attribute/AttributeSet.java,v
retrieving revision 1.3
diff -u -r1.3 AttributeSet.java
--- javax/print/attribute/AttributeSet.java	2 Jul 2005 20:32:46 -	1.3
+++ javax/print/attribute/AttributeSet.java	12 Nov 2005 19:36:28 -
@@ -1,5 +1,5 @@
 /* AttributeSet.java -- 
-   Copyright (C) 2002 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2005 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -38,40 +38,159 @@
 package javax.print.attribute;
 
 /**
- * @author Michael Koch
+ * codeAttributeSet/code is the top-level interface for sets of printing
+ * attributes in the Java Print Service API.
+ * p
+ * There are no duplicate values allowed in an attribute set and there is
+ * at most one attribute object contained per category type. Based on the
+ * [EMAIL PROTECTED] java.util.Map} interface the values of attribute sets are objects
+ * of type [EMAIL PROTECTED] javax.print.attribute.Attribute} and the entries are the
+ * categories as [EMAIL PROTECTED] java.lang.Class} instances.
+ * /p
+ * p
+ * The following specialized types of codeAttributeSet/code are available:
+ * ul
+ *  li[EMAIL PROTECTED] javax.print.attribute.DocAttributeSet}/li
+ *  li[EMAIL PROTECTED] javax.print.attribute.PrintRequestAttributeSet}/li
+ *  li[EMAIL PROTECTED] javax.print.attribute.PrintJobAttributeSet}/li
+ *  li[EMAIL PROTECTED] javax.print.attribute.PrintServiceAttributeSet}/li
+ * /ul
+ * /p
+ * p
+ * Attribute sets may be unmodifiable depending on the context of usage. If 
+ * used as read-only attribute set modifying operations throw an 
+ * [EMAIL PROTECTED] javax.print.attribute.UnmodifiableSetException}.
+ * /p
+ * p
+ * The Java Print Service API provides implementation classes for the existing
+ * attribute set interfaces but applications may use their own implementations.
+ * /p
+ * 
+ * @author Michael Koch ([EMAIL PROTECTED])
  */
 public interface AttributeSet
 {
   /**
-   * Adds the specified attribute value to this attribute set
+   * Adds the specified attribute value to this attribute set 
* if it is not already present.
+   * 
+   * This operation removes any existing attribute of the same category 
+   * before adding the given attribute to the set. 
+   * 
+   * @param attribute the attribute to add.
+   * @return codetrue/code if the set is changed, false otherwise.
+   * @throws NullPointerException if the attribute is codenull/code.
+   * @throws

[cp-patches] Patch: javax.print.attribute.EnumSyntax

2005-11-12 Thread Wolfgang Baer

Hi,

this patch finishes javax.print.attribute.EnumSyntax by adding
the missing method readResolve and api docs all over.


2005-11-12  Wolfgang Baer  [EMAIL PROTECTED]

* javax/print/attribute/EnumSyntax.java:
API docs added and enhanced for class and methods.
(readResolve): New method.


OK to commit ?

Regards,
Wolfgang
Index: javax/print/attribute/EnumSyntax.java
===
RCS file: /cvsroot/classpath/classpath/javax/print/attribute/EnumSyntax.java,v
retrieving revision 1.4
diff -u -r1.4 EnumSyntax.java
--- javax/print/attribute/EnumSyntax.java	2 Jul 2005 20:32:46 -	1.4
+++ javax/print/attribute/EnumSyntax.java	12 Nov 2005 20:03:33 -
@@ -1,5 +1,5 @@
 /* EnumSyntax.java -- 
-   Copyright (C) 2003 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2005 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -37,10 +37,69 @@
 
 package javax.print.attribute;
 
+import java.io.InvalidObjectException;
+import java.io.ObjectStreamException;
 import java.io.Serializable;
 
 /**
- * @author Michael Koch
+ * EnumSyntax is the abstract base class of all enumeration classes in 
+ * the Java Print Service API. 
+ * p
+ * Every enumeration class which extends from EnumSyntax provides several 
+ * enumeration objects as singletons of its class.
+ * /p
+ * p
+ * Notes for implementing subclasses:
+ * ul
+ *   li
+ * The values of all enumeration singelton instances have to be in a 
+ * sequence which may start at any value. See: [EMAIL PROTECTED] #getOffset()}
+ *   /li
+ *   li
+ * Subclasses have to override [EMAIL PROTECTED] #getEnumValueTable()} and should
+ * override [EMAIL PROTECTED] #getStringTable()} for correct serialization.
+ *   /li
+ * /ul
+ * /p
+ * Example: 
+ * pre 
+ * public class PrinterState extends EnumSyntax
+ * {
+ *   public static final PrinterState IDLE = new PrinterState(1);
+ *   public static final PrinterState PROCESSING = new PrinterState(2);
+ *   public static final PrinterState STOPPED = new PrinterState(3);
+ * 
+ *   protected PrinterState(int value)
+ *   {
+ * super(value);
+ *   }
+ * 
+ *   // Overridden because values start not at zero !
+ *   protected int getOffset()
+ *   {
+ * return 1;
+ *   }
+ * 
+ *   private static final String[] stringTable = { idle, processing, 
+ * stopped };
+ * 
+ *   protected String[] getStringTable()
+ *   {
+ * return stringTable;
+ *   }
+ * 
+ *   private static final PrinterState[] enumValueTable = { IDLE, 
+ * PROCESSING, STOPPED};
+ * 
+ *   protected EnumSyntax[] getEnumValueTable()
+ *   {
+ * return enumValueTable;
+ *   }
+ * }
+ * /pre
+ * 
+ * @author Michael Koch ([EMAIL PROTECTED])
+ * @author Wolfgang Baer ([EMAIL PROTECTED])
  */
 public abstract class EnumSyntax implements Cloneable, Serializable
 {
@@ -51,7 +110,7 @@
   /**
* Creates a codeEnumSyntax/code object.
*
-   * @param value the value to set
+   * @param value the value to set.
*/
   protected EnumSyntax(int value)
   {
@@ -59,9 +118,9 @@
   }
 
   /**
-   * Returns the value of this object.
+   * Returns the value of this enumeration object.
*
-   * @return the value
+   * @return The value.
*/
   public int getValue()
   {
@@ -71,7 +130,7 @@
   /**
* Clones this object.
*
-   * @return a clone of this object
+   * @return A clone of this object.
*/
   public Object clone()
   {
@@ -87,9 +146,10 @@
   }
 
   /**
-   * Returns the hashcode for this object.
+   * Returns the hashcode for this object. 
+   * The hashcode is the value of this enumeration object.
*
-   * @return the hashcode
+   * @return The hashcode.
*/
   public int hashCode()
   {
@@ -98,8 +158,11 @@
 
   /**
* Returns the string representation for this object.
+   * The string value from codegetStringTable()/code method is returned
+   * if subclasses override this method. Otherwise the value of this object
+   * as a string is returned.
*
-   * @return the string representation
+   * @return The string representation.
*/
   public String toString()
   {
@@ -118,9 +181,10 @@
* Returns a table with the enumeration values represented as strings
* for this object.
*
-   * The default implementation just returns null.
+   * The default implementation just returns null. Subclasses should
+   * override this method.
*
-   * @return the enumeration values as strings
+   * @return The enumeration values as strings.
*/
   protected String[] getStringTable()
   {
@@ -128,17 +192,49 @@
   }
 
   /**
+   * Needed for singelton semantics during deserialisation.
+   * 
+   * Subclasses must not override this class. Subclasses have to override
+   * codegetEnumValueTable()/code and should override 
+   * codegetStringTable()/code for correct serialization.
+   * 
+   * @return The Object at index codevalue

[cp-patches] RFC: ObjectInputStream fix for readResolve invocations

2005-11-08 Thread Wolfgang Baer

Hi all,

readResolve can throw ObjectStreamException's. In our implementation
currently all Errors and Exceptions are ignored. As a mauve test posted
to mauve-patches shows SUN passes Error, RuntimeException and 
ObjectStreamExceptions through to the caller.


The mauve test also shows (test number 1) that readResolve is actually
called by the ObjectInputStream implementation. Therefore I would say
that bug 22854 (readResolve isn't called) can be closed.

2005-11-08  Wolfgang Baer  [EMAIL PROTECTED]

* java/io/ObjectInputStream.java:
(processResolution) Pass Error, RuntimeException and
ObjectStreamException through to the caller.

Regards,
Wolfgang

Index: java/io/ObjectInputStream.java
===
RCS file: /cvsroot/classpath/classpath/java/io/ObjectInputStream.java,v
retrieving revision 1.71
diff -u -r1.71 ObjectInputStream.java
--- java/io/ObjectInputStream.java	1 Nov 2005 23:32:21 -	1.71
+++ java/io/ObjectInputStream.java	8 Nov 2005 20:43:56 -
@@ -1567,6 +1567,15 @@
 	  }
 	catch (InvocationTargetException ignore)
 	  {
+	// SUN passes Errors, RuntimeExceptions and
+	// ObjectStreamExceptions through to caller
+	Throwable cause = ignore.getCause();
+	if (cause instanceof ObjectStreamException)
+	  throw (ObjectStreamException) cause;
+	else if (cause instanceof RuntimeException)
+	  throw (RuntimeException) cause;
+	else if (cause instanceof Error)
+	  throw (Error) cause;
 	  }
   }
 
___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


Re: [cp-patches] Patch: File.getParent fixlet

2005-11-06 Thread Wolfgang Baer

Mark Wielaard wrote:

Hi Wolfgang,

On Fri, 2005-10-28 at 20:47 +0200, Wolfgang Baer wrote:


File.getParent fails with an Exception for a file with
a pathname of .

A corresponding mauve test is send to mauve-patches.

2005-10-28  Wolfgang Baer  [EMAIL PROTECTED]

* java/io/File.java
  (getParent): If pathname is  return null.



We talked a bit about the test on mauve-patches and you said that you
would supply another test that tested some more properties of the empty
File name. Could you post that and tell us if the above patch is still
valid?


These are the fixlets needed to make java.io.File pass the submitted
mauve tests for an empty file ( new File() ).

2005-11-06  Wolfgang Baer  [EMAIL PROTECTED]

* java/io/File.java
  (getParent): If pathname is  return null.
  (toURI): Also append separatorChar if path equals .
  (getAbsolutePath): If path equals  only return the value
   of the user.dir system property.

Regards,
Wolfgang

Index: java/io/File.java
===
RCS file: /cvsroot/classpath/classpath/java/io/File.java,v
retrieving revision 1.58
diff -u -r1.58 File.java
--- java/io/File.java	24 Oct 2005 06:44:19 -	1.58
+++ java/io/File.java	6 Nov 2005 17:49:46 -
@@ -457,6 +457,8 @@
 else
   return drvDir;
   }
+else if (path.equals())
+	return System.getProperty (user.dir);
 else
   return System.getProperty (user.dir) + separatorChar + path;
   }
@@ -543,6 +545,9 @@
   {
 String prefix = null;
 int nameSeqIndex = 0;
+
+if (path.equals())
+  return null;
 
 // The prefix, if present, is the leading / on UNIX and 
 // either the drive specifier (e.g. C:) or the leading \\
@@ -954,8 +959,8 @@
   public URI toURI()
   {
 String abspath = getAbsolutePath();
-
-if (isDirectory())
+   
+if (isDirectory() || path.equals())
   abspath = abspath + separatorChar;
 
 if (separatorChar == '\\')
___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


Re: [cp-patches] Patch: javax.print.event.* API docs

2005-11-06 Thread Wolfgang Baer

Mark Wielaard wrote:

Hi Wolfgang,

On Thu, 2005-11-03 at 20:40 +0100, Wolfgang Baer wrote:


this patch adds api docs to the javax.print.event package.

2005-11-03  Wolfgang Baer  [EMAIL PROTECTED]

* javax/print/event/*: Added API docs all over.



Thanks! This looks good.
Shall I commit it for you, or do you want to commit it yourself?
(In the last case, please register with savannah.gnu.org first and let
me know your user name.)


Comitted without changes.

Wolfgang


___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


[cp-patches] Patch: File.getParent fixlet

2005-10-28 Thread Wolfgang Baer

Hi,

File.getParent fails with an Exception for a file with
a pathname of .

A corresponding mauve test is send to mauve-patches.

2005-10-28  Wolfgang Baer  [EMAIL PROTECTED]

* java/io/File.java
  (getParent): If pathname is  return null.

Wolfgang
Index: java/io/File.java
===
RCS file: /cvsroot/classpath/classpath/java/io/File.java,v
retrieving revision 1.58
diff -u -r1.58 File.java
--- java/io/File.java	24 Oct 2005 06:44:19 -	1.58
+++ java/io/File.java	28 Oct 2005 18:42:26 -
@@ -543,6 +543,9 @@
   {
 String prefix = null;
 int nameSeqIndex = 0;
+
+if (path.equals())
+  return null;
 
 // The prefix, if present, is the leading / on UNIX and 
 // either the drive specifier (e.g. C:) or the leading \\
___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


Re: [cp-patches] Patch: FYI: fix SetOfIntegerSyntax

2005-10-07 Thread Wolfgang Baer

Tom Tromey wrote:

Wolfgang == Wolfgang Baer [EMAIL PROTECTED] writes:



Wolfgang So if you intend to work more on the javax.print package
Wolfgang please contact me so we do not duplicate work.

Nope, I'm not.  I only did this since I ran across it while looking at
japi.  I'm sorry if I stepped on your toes here; I didn't know anybody
was working in this area.


You didn't stepped on my toes. I hadn't done anything in this class yet.
But it showed me that its time to mention my intention to work on the
javax.print packages.


BTW, you can write mauve tests without assignment papers.  Hint, hint :-)


Yes, I know and I will do :-)

Wolfgang




___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


Re: [cp-patches] Patch: FYI: fix SetOfIntegerSyntax

2005-10-06 Thread Wolfgang Baer

Hi Tom,

Tom Tromey wrote:

I'm checking this in.

I happened to notice that SetOfIntegerSyntax was mostly stubs.
I implemented the class for real, and added the missing constructor.


I started already implementation of javax.print.attribute.standard and
some other stuff for javax.print.*

I am currently waiting for the FSF paperwork to be done.

So if you intend to work more on the javax.print package please contact
me so we do not duplicate work.

Wolfgang


___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


[cp-patches] Patch: Fix ClassCastException caused by javax.swing.text.GapContent

2005-07-30 Thread Wolfgang Baer

Hi,

the recent patch from Roman which uses the inner class
GapContentPosition for the positions in javax.swing.text.GapContent
breaks the swing demo.

The attached patch fixes that by using the new GapContentPosition
class for comparing in Collections.binarySearch instead of the former
Integer object.

Regards,

Wolfgang
Index: classpath/javax/swing/text/GapContent.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/text/GapContent.java,v
retrieving revision 1.15
diff -u -r1.15 GapContent.java
--- classpath/javax/swing/text/GapContent.java	29 Jul 2005 14:57:15 -	1.15
+++ classpath/javax/swing/text/GapContent.java	30 Jul 2005 11:35:01 -
@@ -398,7 +398,7 @@
 buffer = newBuf;
 
 // Update the marks after the gapEnd.
-int index = Collections.binarySearch(positions, new Integer(gapEnd));
+int index = Collections.binarySearch(positions, new GapContentPosition(gapEnd));
 if (index  0)
   {
 	index = -(index + 1);
@@ -422,8 +422,8 @@
 
 // Update the positions between newGapEnd and (old) gapEnd. The marks
 // must be shifted by (gapEnd - newGapEnd).
-int index1 = Collections.binarySearch(positions, new Integer(gapEnd));
-int index2 = Collections.binarySearch(positions, new Integer(newGapEnd));
+int index1 = Collections.binarySearch(positions, new GapContentPosition(gapEnd));
+int index2 = Collections.binarySearch(positions, new GapContentPosition(newGapEnd));
 int i1 = Math.min(index1, index2);
 int i2 = Math.max(index1, index2);
 for (ListIterator i = positions.listIterator(i1); i.hasNext();)
___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches