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

Re: [cp-patches] FYI: RepaintManager fix

2005-11-19 Thread Mark Wielaard
Hi Roman,

On Mon, 2005-11-14 at 12:52 +, Roman Kennke wrote:
 +  /**
 +   * The current repaint managers, indexed by their ThreadGroups.
 +   */
 +  static HashMap currentRepaintManagers;

Isn't this a potential memory leak? Maybe there are not many
ThreadGroups in an application ever. But it might be wise to use a
WeakHashMap here so that the entry disappears when the ThreadGroup is
garbage collected.

Cheers,

Mark


signature.asc
Description: This is a digitally signed message part
___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


Re: [cp-patches] FYI: JViewport system property

2005-11-19 Thread Mark Wielaard
On Tue, 2005-11-15 at 21:23 +0100, Mark Wielaard wrote:
 On Tue, 2005-11-15 at 14:16 +, Roman Kennke wrote:
  2005-11-15  Roman Kennke  [EMAIL PROTECTED]
  
  * javax/swing/JViewport.java
  (JViewport): Recognize setting of a system property
  gnu.javax.swing.JViewport for the scrollMode.
  
  --- javax/swing/JViewport.java  27 Oct 2005 17:20:22 -  1.34
  +++ javax/swing/JViewport.java  15 Nov 2005 14:12:41 -
  @@ -246,7 +246,18 @@
 public JViewport()
 {
   setOpaque(true);
  -setScrollMode(BLIT_SCROLL_MODE);
  +String scrollModeProp =
  +  System.getProperty(gnu.javax.swing.JViewport.scrollMode,
  + BLIT);
 
 You want to use gnu.classpath.SystemProperties.getProperty() here for
 the (admittedly unlikely) case a JViewport is instantiated through code
 that doesn't have enough permissions for reading that system property.
 
 It might also be an idea to make scrollModeProp static and only
 instantiate it once for efficiency. Although that might be an
 optimization that isn't really worth it since I guess instantiating
 JViewPorts isn't don't that often. And it would prevent changing this
 programmaticaly per instance of course. If that is desirable.

Ping. Any comments?


signature.asc
Description: This is a digitally signed message part
___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


Re: [cp-patches] FYI: JViewport system property

2005-11-19 Thread Roman Kennke
Hi there,

Am Samstag, den 19.11.2005, 20:04 +0100 schrieb Mark Wielaard:
 On Tue, 2005-11-15 at 21:23 +0100, Mark Wielaard wrote:
  On Tue, 2005-11-15 at 14:16 +, Roman Kennke wrote:
   2005-11-15  Roman Kennke  [EMAIL PROTECTED]
   
   * javax/swing/JViewport.java
   (JViewport): Recognize setting of a system property
   gnu.javax.swing.JViewport for the scrollMode.
   
   --- javax/swing/JViewport.java  27 Oct 2005 17:20:22 -  1.34
   +++ javax/swing/JViewport.java  15 Nov 2005 14:12:41 -
   @@ -246,7 +246,18 @@
  public JViewport()
  {
setOpaque(true);
   -setScrollMode(BLIT_SCROLL_MODE);
   +String scrollModeProp =
   +  System.getProperty(gnu.javax.swing.JViewport.scrollMode,
   + BLIT);
  
  You want to use gnu.classpath.SystemProperties.getProperty() here for
  the (admittedly unlikely) case a JViewport is instantiated through code
  that doesn't have enough permissions for reading that system property.
  
  It might also be an idea to make scrollModeProp static and only
  instantiate it once for efficiency. Although that might be an
  optimization that isn't really worth it since I guess instantiating
  JViewPorts isn't don't that often. And it would prevent changing this
  programmaticaly per instance of course. If that is desirable.
 
 Ping. Any comments?

Yeah, this is absolutely right. I'll fix that ASAP. Somehow this mail
got lost and I haven't seen it until now.

/Roman



signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil
___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


Re: [cp-patches] FYI: RepaintManager fix

2005-11-19 Thread Roman Kennke
Am Samstag, den 19.11.2005, 19:09 +0100 schrieb Mark Wielaard:
 Hi Roman,
 
 On Mon, 2005-11-14 at 12:52 +, Roman Kennke wrote:
  +  /**
  +   * The current repaint managers, indexed by their ThreadGroups.
  +   */
  +  static HashMap currentRepaintManagers;
 
 Isn't this a potential memory leak? Maybe there are not many
 ThreadGroups in an application ever. But it might be wise to use a
 WeakHashMap here so that the entry disappears when the ThreadGroup is
 garbage collected.

Yeah that is also correct. I'll fix this.

/Roman



signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil
___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


Re: [cp-patches] FYI: Getting the system clipboard in javax/swing/TransferHandler

2005-11-19 Thread Mark Wielaard
Hi,

On Sun, 2005-11-13 at 21:06 +0100, Meskauskas Audrius wrote:
 The private method getClipboard in TransferHandler was always returning 
 the VM local clipboard and not the system clipboard in the case when the 
 security manager is not installed (typical case).
 
 With this patch, I am able to paste the external data from the system 
 clipboard into the text field if manually calling the .paste() method 

This seems to work. But I don't understand why we are not just
completely ignoring the clipboard if we get a SecurityException. I would
propose the following patch that just makes the call to the Toolkit, the
Toolkit then does the security check, and if we get that we just ignore
the whole thing to prevent clipboard access by untrusted code.

2005-11-19  Mark Wielaard  [EMAIL PROTECTED]

* javax/swing/TransferHandler
(TransferAction.actionPerformed): Beep and return when clipboard
is null.
(getClipboard): Return null when access denied.
(clipboard): Removed static field.

What do you think?
Also CCed to Gary since he was investigating security issues in general.

Cheers,

Mark
Index: javax/swing/TransferHandler.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/TransferHandler.java,v
retrieving revision 1.11
diff -u -r1.11 TransferHandler.java
--- javax/swing/TransferHandler.java	13 Nov 2005 20:18:42 -	1.11
+++ javax/swing/TransferHandler.java	19 Nov 2005 21:25:06 -
@@ -1,5 +1,5 @@
 /* TransferHandler.java --
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -43,6 +43,7 @@
 import java.awt.datatransfer.Transferable;
 import java.awt.event.ActionEvent;
 import java.awt.event.InputEvent;
+import java.awt.Toolkit;
 import java.io.Serializable;
 
 public class TransferHandler implements Serializable
@@ -62,6 +63,13 @@
   TransferHandler transferHandler = component.getTransferHandler();
   Clipboard clipboard = getClipboard(component);
 
+  if (clipboard == null)
+	{
+	  // Access denied!
+	  Toolkit.getDefaultToolkit().beep();
+	  return;
+	}
+
   if (command.equals(COMMAND_COPY))
 	transferHandler.exportToClipboard(component, clipboard, COPY);
   else if (command.equals(COMMAND_CUT))
@@ -76,37 +84,22 @@
 }
   
 /**
- * Get the system cliboard. If not available, create and return the VM-local
- * clipboard.
+ * Get the system cliboard or null if the caller isn't allowed to
+ * access the system clipboard.
  * 
  * @param component a component, used to get the toolkit.
  * @return the clipboard
  */
 private static Clipboard getClipboard(JComponent component)
 {
-  // Avoid throwing exception if the system clipboard access failed
-  // in the past.
-  if (clipboard != null)
-return clipboard;
-  else
-{
-  try
-{
-  SecurityManager sm = System.getSecurityManager();
-  if (sm != null)
-sm.checkSystemClipboardAccess();
-
-  // We may access system clipboard.
-  return component.getToolkit().getSystemClipboard();
-}
-  catch (Exception e)
-{
-  // We may not access system clipboard.
-  // Create VM-local clipboard if none exists yet.
-  clipboard = new Clipboard(Clipboard);
-  return clipboard;
-}
-}
+  try
+	{
+	  return component.getToolkit().getSystemClipboard();
+	}
+  catch (SecurityException se)
+	{
+	  return null;
+	}
 }
   }
   
@@ -124,12 +117,6 @@
   private static Action copyAction = new TransferAction(COMMAND_COPY);
   private static Action cutAction = new TransferAction(COMMAND_CUT);
   private static Action pasteAction = new TransferAction(COMMAND_PASTE);
-  
-  /**
-   * Clipboard if system clipboard may not be used.
-   * Package-private to avoid an accessor method.
-   */
-  static Clipboard clipboard;
   
   private int sourceActions;
   private Icon visualRepresentation;


signature.asc
Description: This is a digitally signed message part
___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


Re: [cp-patches] FYI: Getting the system clipboard in javax/swing/TransferHandler

2005-11-19 Thread Meskauskas Audrius
The idea probably is that if we cannot get access to the system 
clipboard, we may still want to cut/copy/paste inside the same 
application  (for instance, to move the text fragment in the text area 
being currently edited). With the local clipboard, the application can 
only read the clipboard data that it have placed there itself. With the 
system clipboard, the application may have access on some data that are 
just accidently remaining there;  it is probably possible to steal a 
valuable  information this way.


Audrius.

Mark Wielaard wrote:


Hi,

On Sun, 2005-11-13 at 21:06 +0100, Meskauskas Audrius wrote:
 

The private method getClipboard in TransferHandler was always returning 
the VM local clipboard and not the system clipboard in the case when the 
security manager is not installed (typical case).


With this patch, I am able to paste the external data from the system 
clipboard into the text field if manually calling the .paste() method 
   



This seems to work. But I don't understand why we are not just
completely ignoring the clipboard if we get a SecurityException. I would
propose the following patch that just makes the call to the Toolkit, the
Toolkit then does the security check, and if we get that we just ignore
the whole thing to prevent clipboard access by untrusted code.

2005-11-19  Mark Wielaard  [EMAIL PROTECTED]

   * javax/swing/TransferHandler
   (TransferAction.actionPerformed): Beep and return when clipboard
   is null.
   (getClipboard): Return null when access denied.
   (clipboard): Removed static field.

What do you think?
Also CCed to Gary since he was investigating security issues in general.

Cheers,

Mark
 




Index: javax/swing/TransferHandler.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/TransferHandler.java,v
retrieving revision 1.11
diff -u -r1.11 TransferHandler.java
--- javax/swing/TransferHandler.java13 Nov 2005 20:18:42 -  1.11
+++ javax/swing/TransferHandler.java19 Nov 2005 21:25:06 -
@@ -1,5 +1,5 @@
/* TransferHandler.java --
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005 Free Software Foundation, Inc.

This file is part of GNU Classpath.

@@ -43,6 +43,7 @@
import java.awt.datatransfer.Transferable;
import java.awt.event.ActionEvent;
import java.awt.event.InputEvent;
+import java.awt.Toolkit;
import java.io.Serializable;

public class TransferHandler implements Serializable
@@ -62,6 +63,13 @@
  TransferHandler transferHandler = component.getTransferHandler();
  Clipboard clipboard = getClipboard(component);

+  if (clipboard == null)
+   {
+ // Access denied!
+ Toolkit.getDefaultToolkit().beep();
+ return;
+   }
+
  if (command.equals(COMMAND_COPY))
transferHandler.exportToClipboard(component, clipboard, COPY);
  else if (command.equals(COMMAND_CUT))
@@ -76,37 +84,22 @@
}
  
/**

- * Get the system cliboard. If not available, create and return the 
VM-local
- * clipboard.
+ * Get the system cliboard or null if the caller isn't allowed to
+ * access the system clipboard.
 * 
 * @param component a component, used to get the toolkit.

 * @return the clipboard
 */
private static Clipboard getClipboard(JComponent component)
{
-  // Avoid throwing exception if the system clipboard access failed
-  // in the past.
-  if (clipboard != null)
-return clipboard;
-  else
-{
-  try
-{
-  SecurityManager sm = System.getSecurityManager();
-  if (sm != null)
-sm.checkSystemClipboardAccess();
-
-  // We may access system clipboard.
-  return component.getToolkit().getSystemClipboard();
-}
-  catch (Exception e)
-{
-  // We may not access system clipboard.
-  // Create VM-local clipboard if none exists yet.
-  clipboard = new Clipboard(Clipboard);
-  return clipboard;
-}
-}
+  try
+   {
+ return component.getToolkit().getSystemClipboard();
+   }
+  catch (SecurityException se)
+   {
+ return null;
+   }
}
  }
  
@@ -124,12 +117,6 @@

  private static Action copyAction = new TransferAction(COMMAND_COPY);
  private static Action cutAction = new TransferAction(COMMAND_CUT);
  private static Action pasteAction = new TransferAction(COMMAND_PASTE);
-  
-  /**

-   * Clipboard if system clipboard may not be used.
-   * Package-private to avoid an accessor method.
-   */
-  static Clipboard clipboard;
  
  private int sourceActions;

  private Icon visualRepresentation;
 





___
Classpath-patches mailing list
Classpath-patches@gnu.org

[cp-patches] FYI: Add some comment to java/io/StreamTokenizer.java

2005-11-19 Thread Ito Kazumitsu

2005-11-20  Ito Kazumitsu  [EMAIL PROTECTED]

Fixes bug #22691
* java/io/StreamTokenizer.java(parseNumbers): Added some comment.

Index: classpath/java/io/StreamTokenizer.java
===
RCS file: /cvsroot/classpath/classpath/java/io/StreamTokenizer.java,v
retrieving revision 1.19
diff -u -r1.19 StreamTokenizer.java
--- classpath/java/io/StreamTokenizer.java  2 Jul 2005 20:32:38 -   
1.19
+++ classpath/java/io/StreamTokenizer.java  20 Nov 2005 01:12:01 -
@@ -550,6 +550,12 @@
   /**
* This method sets the numeric attribute on the characters '0' - '9' and
* the characters '.' and '-'.
+   * When this method is used, the result of giving other attributes
+   * (whitespace, quote, or comment) to the numeric characters may
+   * vary depending on the implementation. For example, if
+   * parseNumbers() and then whitespaceChars('1', '1') are called,
+   * this implementation reads 121 as 2, while some other implementation
+   * will read it as 21.
*/
   public void parseNumbers()
   {
___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


Re: JamVM does not startup

2005-11-19 Thread Mark Wielaard
Hi Isabella,

On Fri, 2005-11-18 at 15:32 -0800, Isabella Thomm wrote:
 I am new to this, so sorry about this simple question and it probably
 does not fit in here, but I'd be glad to solve this problem: 
 I have installed classpath 0.19, as described, (configure, make, make
 install...), and then jamVM 1.3.3 (configure with the
 --with-classpath-install-dir option, make etc.) and I get the following
 error, while trying to execute a simple with java compiled program: 
 Error initialising VM (initialiseMainThread). 

I think this is your --prefix option to classpath configure not matching
the --with-classpath-install-dir configure option for jamvm. I saw that
Robert wanted to to help offline. But please do post the solution to the
list so others having the same problem might find the solution on the
list later.

 I am using Debian unstable.

Note that Debian unstable should come with the latest classpath and
jamvm releases prepackaged.

Cheers,

Mark
-- 
Escape the Java Trap with GNU Classpath!
http://www.gnu.org/philosophy/java-trap.html

Join the community at http://planet.classpath.org/


signature.asc
Description: This is a digitally signed message part
___
Classpath mailing list
Classpath@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath


Re: New GNU Classpath developer Gary Benson

2005-11-19 Thread Mark Wielaard
Hi Ito,

On Fri, 2005-11-18 at 14:59 -0800, David Daney wrote:
 Ito Kazumitsu wrote:
  From: Mark Wielaard [EMAIL PROTECTED]
 
 long as they have to. And the eighth and final rule, if this is
 your first night at GNU Classpath, you have to patch the AUTHORS
 file. (*)
  
  I, Ito Kazumitsu, did not obey this rule, but I do not think I
  have to be listed in AUTHORS because I have fixed and will fix
  only simple bugs.
  
  Should I list myself in THANKYOU?
  
 If you have CVS commit privileges, you owe it to your self to do this. 
 It will bring you worldwide renown.

David is right. Please add yourself. We didn't have this rule in the
past, but from now on we should do this. And your work, testing,
reporting, fixing, retesting and discussing solutions for the various
issues you found are really appreciated. What seem like simple bugs to
you are hairy incomprehensible multi-byte character encoding issues to
others.

Cheers,

Mark

-- 
Escape the Java Trap with GNU Classpath!
http://www.gnu.org/philosophy/java-trap.html

Join the community at http://planet.classpath.org/


signature.asc
Description: This is a digitally signed message part
___
Classpath mailing list
Classpath@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath


Kerberos

2005-11-19 Thread Jeff Bailey
Hi!  I sent in a patch to implement the KerberosPrincipal class.  Now
comes the fun part. =)

What I was thinking is that there should probably really be three
implementations of the Kerberos stuff.  The first two are glue code
around MIT Kerberos and Heimdal Kerberos.  That way if you have a user
who's already got a ticket, it continues to be useful in their Java
environment.  I think this is important for distribution integration.

The third is a native implementation so that people don't
need to install Kerberos in order to have classpath installed.  I don't
know if this is necessary or even desirable.  I'd imagine that if
someone has Kerberos on their network on in their distribution they'll
probably want to integrate getting a ticket with logging in and have
multiple Kerberized application.  It also means that our security issues
are limited to glue code, and are not based around my understanding of
asn.1 as an on-wire protocol. =)

I imagine for now, it just means another command line switch to
configure to enable it if possible, and select MIT vs. Heimdal.

Comments, flames, etc., appreciated.  In the absence of any, I'll just
start hacking and feeding patches to classpath-patches.

Tks,
Jeff Bailey


signature.asc
Description: This is a digitally signed message part
___
Classpath mailing list
Classpath@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath


[commit-cp] classpath ./ChangeLog javax/print/attribute/Res...

2005-11-19 Thread Wolfgang Baer
CVSROOT:/cvsroot/classpath
Module name:classpath
Branch: 
Changes by: Wolfgang Baer [EMAIL PROTECTED]   05/11/19 11:03:37

Modified files:
.  : ChangeLog 
javax/print/attribute: ResolutionSyntax.java 

Log message:
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.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/ChangeLog.diff?tr1=1.5671tr2=1.5672r1=textr2=text
http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/javax/print/attribute/ResolutionSyntax.java.diff?tr1=1.4tr2=1.5r1=textr2=text





[commit-cp] classpath ./ChangeLog javax/print/attribute/Set...

2005-11-19 Thread Wolfgang Baer
CVSROOT:/cvsroot/classpath
Module name:classpath
Branch: 
Changes by: Wolfgang Baer [EMAIL PROTECTED]   05/11/19 11:59:43

Modified files:
.  : ChangeLog 
javax/print/attribute: SetOfIntegerSyntax.java 

Log message:
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.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/ChangeLog.diff?tr1=1.5672tr2=1.5673r1=textr2=text
http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/javax/print/attribute/SetOfIntegerSyntax.java.diff?tr1=1.4tr2=1.5r1=textr2=text





[commit-cp] classpath ./ChangeLog javax/print/attribute/Tex...

2005-11-19 Thread Wolfgang Baer
CVSROOT:/cvsroot/classpath
Module name:classpath
Branch: 
Changes by: Wolfgang Baer [EMAIL PROTECTED]   05/11/19 13:10:18

Modified files:
.  : ChangeLog 
javax/print/attribute: TextSyntax.java 

Log message:
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.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/ChangeLog.diff?tr1=1.5673tr2=1.5674r1=textr2=text
http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/javax/print/attribute/TextSyntax.java.diff?tr1=1.4tr2=1.5r1=textr2=text





[commit-cp] classpath ./ChangeLog javax/print/attribute/Res...

2005-11-19 Thread Wolfgang Baer
CVSROOT:/cvsroot/classpath
Module name:classpath
Branch: 
Changes by: Wolfgang Baer [EMAIL PROTECTED]   05/11/19 15:56:51

Modified files:
.  : ChangeLog 
javax/print/attribute: ResolutionSyntax.java 

Log message:
2005-11-19  Wolfgang Baer  [EMAIL PROTECTED]

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

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/ChangeLog.diff?tr1=1.5674tr2=1.5675r1=textr2=text
http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/javax/print/attribute/ResolutionSyntax.java.diff?tr1=1.5tr2=1.6r1=textr2=text





[commit-cp] classpath ./ChangeLog javax/print/attribute/Siz...

2005-11-19 Thread Wolfgang Baer
CVSROOT:/cvsroot/classpath
Module name:classpath
Branch: 
Changes by: Wolfgang Baer [EMAIL PROTECTED]   05/11/19 17:50:15

Modified files:
.  : ChangeLog 
javax/print/attribute: Size2DSyntax.java 

Log message:
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.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/ChangeLog.diff?tr1=1.5675tr2=1.5676r1=textr2=text
http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/javax/print/attribute/Size2DSyntax.java.diff?tr1=1.2tr2=1.3r1=textr2=text





[commit-cp] classpath AUTHORS ChangeLog

2005-11-19 Thread Ito Kazumitsu
CVSROOT:/cvsroot/classpath
Module name:classpath
Branch: 
Changes by: Ito Kazumitsu [EMAIL PROTECTED]   05/11/19 23:17:15

Modified files:
.  : AUTHORS ChangeLog 

Log message:
2005-11-19  Ito Kazumitsu  [EMAIL PROTECTED]

* AUTHORS: Added myself.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/AUTHORS.diff?tr1=1.31tr2=1.32r1=textr2=text
http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/ChangeLog.diff?tr1=1.5676tr2=1.5677r1=textr2=text