[cp-patches] Re: FYI: Fixed a bug in file connection unicode character decoding

2006-03-05 Thread Dalibor Topic
On Mon, 2006-03-06 at 04:44 +0100, Dalibor Topic wrote:
> Hi all,
> 
> I've added a small path to fix a bug with file connection's handling of
> unquoting unicode characters outside of basic plane. I forgot to update
> the position in the buffer in my first patch, so the attached patch
> fixes that.
> 
> cheers,
> dalibor topic
> 
> 2006-03-06  Dalibor Topic  <[EMAIL PROTECTED]>
> 
> * gnu/java/net/protocol/file/Connection.java (unquote):
> Update position in buffer after decoding a unicode character
> outside of the basic plane.
> 
> 
Index: gnu/java/net/protocol/file/Connection.java
===
RCS file: /sources/classpath/classpath/gnu/java/net/protocol/file/Connection.java,v
retrieving revision 1.19
diff -u -r1.19 Connection.java
--- gnu/java/net/protocol/file/Connection.java	12 Feb 2006 19:25:46 -	1.19
+++ gnu/java/net/protocol/file/Connection.java	6 Mar 2006 02:14:08 -
@@ -160,7 +160,9 @@
  	else if (c > 127) {
 	try {
 		byte [] c_as_bytes = Character.toString(c).getBytes("utf-8");
-		System.arraycopy(c_as_bytes, 0, buf, pos, c_as_bytes.length);
+		final int c_length = c_as_bytes.length;
+		System.arraycopy(c_as_bytes, 0, buf, pos, c_length);
+		pos += c_length;
 	}
 	catch (java.io.UnsupportedEncodingException x2) {
 		throw (Error) new InternalError().initCause(x2);


[cp-patches] FYI: Fixed a bug in file connection unicode character decoding

2006-03-05 Thread Dalibor Topic
Hi all,

I've added a small path to fix a bug with file connection's handling of
unquoting unicode characters outside of basic plane. I forgot to update
the position in the buffer in my first patch, so the attached patch
fixes that.

cheers,
dalibor topic

2006-03-06  Dalibor Topic  <[EMAIL PROTECTED]>

* gnu/java/net/protocol/file/Connection.java (unquote):
Update position in buffer after decoding a unicode character
outside of the basic plane.






[cp-patches] FYI: BasicTextUI.damageRange fix

2006-03-05 Thread Robert Schuster
Hi,
while working on the new paint algorithm for the
DefaultHighlighter.DefaultHighlighterPainter (which is mostly copy and pasted
code from BasicTextUI.damageRange) I saw some thinkos in my first 
implementation.

This fixes that.

2006-03-06  Robert Schuster  <[EMAIL PROTECTED]>

* javax/swing/plaf/basic/BasicTextUI.java:
(damageRange): Rewritten if-expressions to correctly identify the
break condition.

cya
Robert
Index: javax/swing/plaf/basic/BasicTextUI.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicTextUI.java,v
retrieving revision 1.72
diff -u -r1.72 BasicTextUI.java
--- javax/swing/plaf/basic/BasicTextUI.java	3 Mar 2006 11:06:11 -	1.72
+++ javax/swing/plaf/basic/BasicTextUI.java	6 Mar 2006 02:25:37 -
@@ -1023,7 +1023,11 @@
 // we should stop searching for one.
 
 int posBelow = Utilities.getPositionBelow(t, p0, l1.x);
-if (posBelow < p1 && posBelow != -1 && posBelow != p0)
+int p1RowStart = Utilities.getRowStart(t, p1);
+
+if (posBelow != -1
+&& posBelow != p0
+&& Utilities.getRowStart(t, posBelow) != p1RowStart)
   {
 // Take the rectangle of the offset we just found and grow it
 // to the maximum width. Retain y because this is our start
@@ -1034,10 +1038,15 @@
 
 // Find further lines which have to be damaged completely.
 int nextPosBelow = posBelow;
-while (nextPosBelow < p1 && nextPosBelow != -1 && posBelow != nextPosBelow)
+while (nextPosBelow != -1
+   && posBelow != nextPosBelow
+   && Utilities.getRowStart(t, nextPosBelow) != p1RowStart)
   {
 posBelow = nextPosBelow;
 nextPosBelow = Utilities.getPositionBelow(t, posBelow, l1.x);
+
+if (posBelow == nextPosBelow)
+  break;
   }
 // Now posBelow is an offset on the last line which has to be damaged
 // completely. (newPosBelow is on the same line as p1)


signature.asc
Description: OpenPGP digital signature


[cp-patches] RFC: DefaultHighlighter.DefaultHighlighterPainter.paint rewritten

2006-03-05 Thread Robert Schuster
Hi,
this is the patch which should make the
DefaultHighlighter.DefaultHighlighterPainter able to paint lines with different
font sizes. However I cannot really test this because JTextPane cannot display
such documents correctly atm and I do not know whether my approach works for
these documents.

Ideas, comments?

2006-03-02  Robert Schuster  <[EMAIL PROTECTED]>

* javax/swing/text/DefaultHighlighter.java:
(DefaultHighlighter.DefaultHighlightPainter.paint): Rewritten.

cya
Robert
Index: javax/swing/text/DefaultHighlighter.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/text/DefaultHighlighter.java,v
retrieving revision 1.8
diff -u -r1.8 DefaultHighlighter.java
--- javax/swing/text/DefaultHighlighter.java	22 Feb 2006 13:33:27 -	1.8
+++ javax/swing/text/DefaultHighlighter.java	6 Mar 2006 02:19:13 -
@@ -71,60 +71,89 @@
 }
 
 public void paint(Graphics g, int p0, int p1, Shape bounds,
-		  JTextComponent c)
+		  JTextComponent t)
 {
-  Rectangle r0 = null;
-  Rectangle r1 = null;
-  Rectangle rect = bounds.getBounds();
-  
-  try
-	{
-	  r0 = c.modelToView(p0);
-	  r1 = c.modelToView(p1);
-	}
-  catch (BadLocationException e)
-{
-	  // This should never occur.
-  return;
-	}
+  if (p0 == p1)
+return;
   
-  if (r0 == null || r1 == null)
-	return;
+  Rectangle rect = bounds.getBounds();
 
   if (color == null)
-	g.setColor(c.getSelectionColor());
+g.setColor(t.getSelectionColor());
   else
-	g.setColor(color);
+g.setColor(color);
 
-  // Check if only one line to highlight.
-  if (r0.y == r1.y)
-	{
-	  r0.width = r1.x - r0.x;
-	  paintHighlight(g, r0);
-	  return;
-	}
+  TextUI ui = t.getUI();
   
-  // First line, from p0 to end-of-line.
-  r0.width = rect.x + rect.width - r0.x;
-  paintHighlight(g, r0);
-  
-  // FIXME: All the full lines in between, if any (assumes that all lines
-  // have the same height -- not a good assumption with JEditorPane/JTextPane).
-  r0.y += r0.height;
-  r0.x = rect.x;
-  r0.width = rect.width;
-  
-  while (r0.y < r1.y)
-	{
-	  paintHighlight(g, r0);
-	  r0.y += r0.height;
-	}
-
-  // Last line, from beginning-of-line to p1.
-  // The "-1" is neccessary else we would paint one pixel column more
-  // than in the case where the selection is only on one line. 
-  r0.width = r1.x + r1.width - 1;
-  paintHighlight(g, r0);
+  try
+  {
+
+Rectangle l0 = ui.modelToView(t, p0, null);
+Rectangle l1 = ui.modelToView(t, p1, null);
+
+if (l0.y == l1.y)
+  paintHighlight(g, l0.union(l1));
+else
+  {
+// 1. The line of p0 is painted from the position of p0
+// to the right border.
+// 2. All lines between the ones where p0 and p1 lie on
+// are completely highlighted. The allocation area is used to find
+// out the bounds.
+// 3. The final line is damaged from the left bound to the
+// position of p1.
+
+// Highlight first line until the end.
+l0.width = rect.width - l0.x;
+paintHighlight(g, l0);
+
+int posBelow = Utilities.getPositionBelow(t, p0, l0.x);
+int p1RowStart = Utilities.getRowStart(t, p1);
+if (posBelow != -1
+&& posBelow != p0
+&& Utilities.getRowStart(t, posBelow)
+   != p1RowStart)
+  {
+Rectangle grow = ui.modelToView(t, posBelow);
+grow.x = rect.x;
+grow.width = rect.width;
+
+// Find further lines which have to be highlighted completely.
+int nextPosBelow = posBelow;
+while (nextPosBelow != -1
+   && Utilities.getRowStart(t, nextPosBelow) != p1RowStart)
+  {
+posBelow = nextPosBelow;
+nextPosBelow = Utilities.getPositionBelow(t, posBelow, l0.x);
+
+if (nextPosBelow == posBelow)
+  break;
+  }
+// Now posBelow is an offset on the last line which has to be damaged
+// completely. (newPosBelow is on the same line as p1)
+ 
+// Retrieve the rectangle of posBelow and use its y and height
+// value to calculate the final height of the multiple line
+// spanning rectangle.
+Rectangle end = ui.modelToView(t, posBelow);
+grow.height = end.y + end.height - grow.y;
+
+// Mark that area as damage.
+paintHighlight(g, grow);
+  }
+
+   

[cp-patches] FYI: DefaultCaret - selection with shift + double & triple-click behavior

2006-03-05 Thread Robert Schuster
Hi,
this patch fixes the missing shift-click behavior of the caret (PR 26416).

And while I was at this class I saw that we are missing word (double-click) and
line (triple-click) behavior and implemented that. In case of the double click
the RI will select the gap between two if you click on it. We do that too, of
course. :)

@Mark: I really would like to have this in the release branch. :)

2006-03-06  Robert Schuster  <[EMAIL PROTECTED]>

* javax/swing/text/DefaultCaret.java:
(mouseDragged): Do selection when shift is pressed.
(mouseClicked): Implemented.


cya
Robert
Index: javax/swing/text/DefaultCaret.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/text/DefaultCaret.java,v
retrieving revision 1.32
diff -u -r1.32 DefaultCaret.java
--- javax/swing/text/DefaultCaret.java	1 Mar 2006 20:39:49 -	1.32
+++ javax/swing/text/DefaultCaret.java	6 Mar 2006 02:02:08 -
@@ -366,7 +366,8 @@
* 
* If we receive a double click, the caret position (dot) is set
*   to the position associated to the mouse click and the word at
-   *   this location is selected.
+   *   this location is selected. If there is no word at the pointer
+   *   the gap is selected instead.
* If we receive a triple click, the caret position (dot) is set
*   to the position associated to the mouse click and the line at
*   this location is selected.
@@ -376,7 +377,50 @@
*/
   public void mouseClicked(MouseEvent event)
   {
-// TODO: Implement double- and triple-click behaviour here.
+int count = event.getClickCount();
+
+if (count >= 2)
+  {
+int newDot = getComponent().viewToModel(event.getPoint());
+JTextComponent t = getComponent();
+
+try
+  {
+if (count == 3)
+  t.select(Utilities.getRowStart(t, newDot), Utilities.getRowEnd(t, newDot));
+else
+  {
+int nextWord = Utilities.getNextWord(t, newDot);
+
+// When the mouse points at the offset of the first character
+// in a word Utilities().getPreviousWord will not return that
+// word but we want to select that. We have to use
+// Utilities.nextWord() to get it.
+if (newDot == nextWord)
+  t.select(nextWord, Utilities.getNextWord(t, nextWord));
+else
+  {
+int previousWord = Utilities.getPreviousWord(t, newDot);
+int previousWordEnd = Utilities.getWordEnd(t, previousWord);
+
+// If the user clicked in the space between two words,
+// then select the space.
+if (newDot >= previousWordEnd && newDot <= nextWord)
+  t.select(previousWordEnd, nextWord);
+// Otherwise select the word under the mouse pointer.
+else
+  t.select(previousWord, previousWordEnd);
+  }
+  }
+  }
+catch(BadLocationException ble)
+  {
+// TODO: Swallowing ok here?
+  }
+
+dot = newDot;
+  }
+
   }
 
   /**
@@ -411,7 +455,10 @@
*/
   public void mousePressed(MouseEvent event)
   {
-positionCaret(event);
+if (event.isShiftDown())
+  moveCaret(event);
+else
+  positionCaret(event);
   }
 
   /**


signature.asc
Description: OpenPGP digital signature


[cp-patches] FYI: Fixed URI quoting of unicode characters outside the basic plane

2006-03-05 Thread Dalibor Topic
Hi all,

I've checked in the following fix to URI unicode quoting issues. See
gnu/testlet/java/net/URI/UnicodeURI.java in mauve for an example.

cheers,
dalibor topic

2006-03-06  Dalibor Topic  <[EMAIL PROTECTED]>

* libraries/javalib/external/classpath/java/net/URI.java(quote):
Pass Unicode characters outside the basic plane through.


Index: java/net/URI.java
===
RCS file: /sources/classpath/classpath/java/net/URI.java,v
retrieving revision 1.17
diff -u -r1.17 URI.java
--- java/net/URI.java	31 Jan 2006 21:59:15 -	1.17
+++ java/net/URI.java	6 Mar 2006 01:22:17 -
@@ -487,16 +487,14 @@
 for (int i = 0; i < str.length(); i++)
   {
 	char c = str.charAt(i);
-	if (legalCharacters.indexOf(c) == -1)
+	if ((legalCharacters.indexOf(c) == -1)
+	&& (c <= 127))
 	  {
-	if (c <= 127)
-	  {
-		sb.append('%');
-		sb.append(HEX.charAt(c / 16));
-		sb.append(HEX.charAt(c % 16));
-	  }
+	sb.append('%');
+	sb.append(HEX.charAt(c / 16));
+	sb.append(HEX.charAt(c % 16));
 	  }
-	else
+  	else
 	  sb.append(c);
   }
 return sb.toString();


[cp-patches] FYI: PlainDocument.insertUpdate

2006-03-05 Thread Robert Schuster
Hi,
this patch fixes PR 26194 which made it impossible to enter newlines into
JTextAreas.

There is a new mauve test which backs this work up. Along with my other small
fix to GapContent we now pass every PlainDocument.insertString test.

@Mark: Please add this patch to the release branch.

2006-03-06  Robert Schuster  <[EMAIL PROTECTED]>

* javax/swing/text/PlainDocument.java:
(insertUpdate): Extended if-expression, added
code to generate another Element when newly inserted characters
and old ones will be on the same line.

cya
Robert
Index: javax/swing/text/PlainDocument.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/text/PlainDocument.java,v
retrieving revision 1.19
diff -u -r1.19 PlainDocument.java
--- javax/swing/text/PlainDocument.java	9 Jan 2006 21:55:39 -	1.19
+++ javax/swing/text/PlainDocument.java	6 Mar 2006 01:12:22 -
@@ -110,17 +110,19 @@
   {
 int offset = event.getOffset();
 int end = offset + event.getLength();
-int elementIndex = rootElement.getElementIndex(offset);
+int oldElementIndex, elementIndex = rootElement.getElementIndex(offset);
 Element firstElement = rootElement.getElement(elementIndex);
-
+oldElementIndex = elementIndex;
+
 // If we're inserting immediately after a newline we have to fix the 
-// Element structure.
-if (offset > 0)
+// Element structure (but only if we are dealing with a line which
+// has not existed as Element before).
+if (offset > 0 && firstElement.getStartOffset() != offset)
   {
 try
 {
   String s = getText(offset - 1, 1);
-  if (s.equals("\n"))
+  if (s.equals("\n") )
 {
   int newEl2EndOffset = end;
   boolean replaceNext = false;
@@ -166,26 +168,35 @@
 // characters within the newly inserted text
 int j = firstElement.getStartOffset();
 int i = str.indexOf('\n', offset);
+  
 while (i != -1 && i <= end)
   {
 // For each new line, create a new element
 elts.add(createLeafElement(rootElement, SimpleAttributeSet.EMPTY,
j, i + 1));
+  
 j = i + 1;
 if (j >= str.length())
-  break;
+break;
 i = str.indexOf('\n', j);
   }
+
 // If there were new lines added we have to add an ElementEdit to 
 // the DocumentEvent and we have to call rootElement.replace to 
 // insert the new lines
 if (elts.size() != 0)
   {
+// If we have created new lines test whether there are remaining
+// characters in firstElement after the inserted text and if so
+// create a new element for them.
+if (j < firstElement.getEndOffset())
+  elts.add(createLeafElement(rootElement, SimpleAttributeSet.EMPTY, j, firstElement.getEndOffset()));
+
 // Set up the ElementEdit by filling the added and removed 
 // arrays with the proper Elements
 added = new Element[elts.size()];
-for (int k = 0; k < elts.size(); ++k)
-  added[k] = (Element) elts.get(k);
+elts.toArray(added);
+
 removed[0] = firstElement;
 
 // Now create and add the ElementEdit
@@ -204,6 +215,7 @@
 ae.initCause(e);
 throw ae;
   }
+
 super.insertUpdate(event, attributes);
   }
 


signature.asc
Description: OpenPGP digital signature


[cp-patches] FYI: GapContent.insertString fix

2006-03-05 Thread Robert Schuster
Hi,
Sun's GapContent.insertString does not like it when the where argument is below
zero and throws a BadLocationException. That exception should be visible when an
instance of that class is used by PlainDocument. There is already a mauve test
which relies on that.

This small patch fixes that and makes the test pass.

@Mark: Please let this go into the release branch.

2006-03-05  Robert Schuster  <[EMAIL PROTECTED]>

* javax/swing/text/GapContent.java:
(insertString): Throw exception when argument is below
zero.


cya
Robert
Index: javax/swing/text/GapContent.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/text/GapContent.java,v
retrieving revision 1.41
diff -u -r1.41 GapContent.java
--- javax/swing/text/GapContent.java	4 Mar 2006 06:25:02 -	1.41
+++ javax/swing/text/GapContent.java	5 Mar 2006 22:44:05 -
@@ -347,8 +347,12 @@
 int length = length();
 int strLen = str.length();
 
+if (where < 0)
+  throw new BadLocationException("The where argument cannot be smaller"
+ + " than the zero", where);
+
 if (where >= length)
-  throw new BadLocationException("the where argument cannot be greater"
+  throw new BadLocationException("The where argument cannot be greater"
   + " than the content length", where);
 
 replace(where, 0, str.toCharArray(), strLen);


signature.asc
Description: OpenPGP digital signature


[cp-patches] FYI: javax.swing.plaf.metal.* - API doc tag fixes

2006-03-05 Thread David Gilbert

This patch (committed) fixes a couple of API doc warnings in 
javax.swing.plaf.metal.*:

2006-03-05  David Gilbert  <[EMAIL PROTECTED]>

* javax/swing/plaf/metal/MetalComboBoxButton.java
(MetalComboBoxButton(JComboBox, Icon, boolean, CellRendererPane,
JList)): Fixed API doc tag,
* javax/swing/plaf/metal/MetalInternalFrameTitlePane
(createLayout): Fixed API doc warning.

Regards,

Dave
Index: javax/swing/plaf/metal/MetalComboBoxButton.java
===
RCS file: 
/sources/classpath/classpath/javax/swing/plaf/metal/MetalComboBoxButton.java,v
retrieving revision 1.6
diff -u -r1.6 MetalComboBoxButton.java
--- javax/swing/plaf/metal/MetalComboBoxButton.java 19 Oct 2005 14:54:55 
-  1.6
+++ javax/swing/plaf/metal/MetalComboBoxButton.java 5 Mar 2006 21:57:18 
-
@@ -91,7 +91,7 @@
* @param cb  the combo that the button is used for (null not 
*permitted).
* @param i  the icon displayed on the button.
-   * @parma onlyIcon  a flag that specifies whether the button displays only an
+   * @param onlyIcon  a flag that specifies whether the button displays only an
*  icon, or text as well.
* @param pane  the rendering pane.
* @param list  the list.
Index: javax/swing/plaf/metal/MetalInternalFrameTitlePane.java
===
RCS file: 
/sources/classpath/classpath/javax/swing/plaf/metal/MetalInternalFrameTitlePane.java,v
retrieving revision 1.7
diff -u -r1.7 MetalInternalFrameTitlePane.java
--- javax/swing/plaf/metal/MetalInternalFrameTitlePane.java 16 Nov 2005 
16:41:41 -  1.7
+++ javax/swing/plaf/metal/MetalInternalFrameTitlePane.java 5 Mar 2006 
21:57:19 -
@@ -329,9 +329,10 @@
   }
 
   /**
-   * Creates a new instance of [EMAIL PROTECTED] MetalTitlePaneLayout}.
+   * Creates a new instance of MetalTitlePaneLayout (not part of
+   * the public API).
* 
-   * @return A new instance of [EMAIL PROTECTED] MetalTitlePaneLayout}.
+   * @return A new instance of MetalTitlePaneLayout.
*/
   protected LayoutManager createLayout()
   {


[cp-patches] FYI: FocusManager/DefaultFocusManager.java - API tag fixes

2006-03-05 Thread David Gilbert

This patch (committed) fixes some bad API doc tags:

2006-03-05  David Gilbert  <[EMAIL PROTECTED]>

* javax/swing/DefaultFocusManager.java: Fixed bad API doc tags,
* javax/swing/FocusManager.java: Likewise.

Regards,

Dave
Index: javax/swing/DefaultFocusManager.java
===
RCS file: /sources/classpath/classpath/javax/swing/DefaultFocusManager.java,v
retrieving revision 1.5
diff -u -r1.5 DefaultFocusManager.java
--- javax/swing/DefaultFocusManager.java27 Jul 2005 12:41:33 -  
1.5
+++ javax/swing/DefaultFocusManager.java5 Mar 2006 21:41:08 -
@@ -1,5 +1,5 @@
 /* DefaultFocusManager.java --
-   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2006, Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -49,9 +49,10 @@
  *
  * @author Andrew Selkirk
  */
-public class DefaultFocusManager extends FocusManager {
+public class DefaultFocusManager extends FocusManager 
+{
 
-   /**
+  /**
* historyStack
*/
   private Stack historyStack;
@@ -77,7 +78,7 @@
 // TODO
   } // processKeyEvent()
 
-   /**
+  /**
* focusNextComponent
* 
* @param component
@@ -88,7 +89,7 @@
 // TODO
   } // focusNextComponent()
 
-   /**
+  /**
* focusPreviousComponent
* 
* @param component
@@ -99,66 +100,66 @@
 // TODO
   } // focusPreviousComponent()
 
-   /**
+  /**
* getFirstComponent
* 
* @param container
*  TODO
-   * @returns Component
+   * @return Component
*/
   public Component getFirstComponent(Container container)
   {
 return null; // TODO
   } // getFirstComponent()
 
-   /**
+  /**
* getLastComponent
* 
* @param container
*  TODO
-   * @returns Component
+   * @return Component
*/
   public Component getLastComponent(Container container)
   {
 return null; // TODO
   } // getLastComponent()
 
-   /**
+  /**
* getComponentBefore
* 
* @param container
*  TODO
* @param component
*  TODO
-   * @returns Component
+   * @return Component
*/
   public Component getComponentBefore(Container container, Component component)
   {
 return null; // TODO
   } // getComponentBefore()
 
-   /**
+  /**
* getComponentAfter
* 
* @param container
*  TODO
* @param component
*  TODO
-   * @returns Component
+   * @return Component
*/
   public Component getComponentAfter(Container container, Component component)
   {
 return null; // TODO
   } // getComponentAfter()
 
-   /**
+  /**
* compareTabOrder
* 
* @param component1
*  TODO
* @param component2
*  TODO
-   * @returns boolean
+   * @return boolean
*/
   public boolean compareTabOrder(Component component1, Component component2)
   {
Index: javax/swing/FocusManager.java
===
RCS file: /sources/classpath/classpath/javax/swing/FocusManager.java,v
retrieving revision 1.10
diff -u -r1.10 FocusManager.java
--- javax/swing/FocusManager.java   28 Oct 2005 16:41:16 -  1.10
+++ javax/swing/FocusManager.java   5 Mar 2006 21:41:09 -
@@ -485,7 +485,7 @@
 
   /**
* getCurrentManager
-   * @returns FocusManager
+   * @return FocusManager
*/
   public static FocusManager getCurrentManager()
   {


[cp-patches] FYI: javax.swing.undo.* API doc fixes

2006-03-05 Thread David Gilbert
This patch (committed) adds some API docs and fixes a few minor issues in 
javax.swing.undo.*:


2006-03-05  David Gilbert  <[EMAIL PROTECTED]>

* javax/swing/undo/StateEditable.java
(restoreState): Fixed bad API doc tag,
* javax/swing/undo/UndoableEdit.java: Copied API doc comments from
AbstractUndoableEdit.java,
* javax/swing/undo/UndoableEditSupport.java
(createCompoundEdit): Fixed bad API doc tag,
* javax/swing/undo/UndoManager.java
(editToBeUndone): Fixed bad API doc tag,
(editToBeRedone): Likewise.

Regards,

Dave
Index: javax/swing/undo/StateEditable.java
===
RCS file: /sources/classpath/classpath/javax/swing/undo/StateEditable.java,v
retrieving revision 1.8
diff -u -r1.8 StateEditable.java
--- javax/swing/undo/StateEditable.java 14 Feb 2006 10:14:25 -  1.8
+++ javax/swing/undo/StateEditable.java 5 Mar 2006 20:59:54 -
@@ -1,5 +1,5 @@
 /* StateEditable.java -- Interface for collaborating with StateEdit.
-   Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2003, 2006, Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -90,9 +90,9 @@
* from the specified hash table.
*
* Note to implementors of this interface: To increase
-   * efficiency, the StateEdit class [EMAIL PROTECTED]
-   * StateEdit#removeRedundantState() removes redundant state
-   * information}. Therefore, implementations of this interface must be
+   * efficiency, the StateEdit class [EMAIL PROTECTED]
+   * StateEdit#removeRedundantState()} removes redundant state
+   * information. Therefore, implementations of this interface must be
* prepared for the case where certain keys were stored into the
* table by [EMAIL PROTECTED] #storeState}, but are not present anymore
* when the restoreState method gets called.
Index: javax/swing/undo/UndoManager.java
===
RCS file: /sources/classpath/classpath/javax/swing/undo/UndoManager.java,v
retrieving revision 1.6
diff -u -r1.6 UndoManager.java
--- javax/swing/undo/UndoManager.java   2 Jul 2005 20:32:52 -   1.6
+++ javax/swing/undo/UndoManager.java   5 Mar 2006 20:59:54 -
@@ -1,5 +1,5 @@
-/* AbstractTableModel.java --
-   Copyright (C) 2002, 2004, 2005  Free Software Foundation, Inc.
+/* UndoManager.java --
+   Copyright (C) 2002, 2004, 2005, 2006,  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -265,7 +265,7 @@
* Determines which significant edit would be undone if [EMAIL PROTECTED]
* #undo()} was called.
*
-   * @returns the significant edit that would be undone, or
+   * @return the significant edit that would be undone, or
* null if no significant edit would be affected by
* calling [EMAIL PROTECTED] #undo()}.
*/
@@ -288,7 +288,7 @@
* Determines which significant edit would be redone if [EMAIL PROTECTED]
* #redo()} was called.
*
-   * @returns the significant edit that would be redone, or
+   * @return the significant edit that would be redone, or
* null if no significant edit would be affected by
* calling [EMAIL PROTECTED] #redo()}.
*/
Index: javax/swing/undo/UndoableEdit.java
===
RCS file: /sources/classpath/classpath/javax/swing/undo/UndoableEdit.java,v
retrieving revision 1.4
diff -u -r1.4 UndoableEdit.java
--- javax/swing/undo/UndoableEdit.java  2 Jul 2005 20:32:52 -   1.4
+++ javax/swing/undo/UndoableEdit.java  5 Mar 2006 20:59:54 -
@@ -1,5 +1,5 @@
-/* AbstractTableModel.java --
-   Copyright (C) 2002 Free Software Foundation, Inc.
+/* UndoableEdit.java --
+   Copyright (C) 2002, 2006, Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -38,77 +38,120 @@
 package javax.swing.undo;
 
 /**
- * UndoableEdit public interface
+ * An editing operation that supports undo/redoability.
+ * 
  * @author Andrew Selkirk
  */
-public interface UndoableEdit {
+public interface UndoableEdit 
+{
 
-   /**
-* anEdit
-* @param anEdit TODO
-* @returns TODO
-*/
-   boolean addEdit(UndoableEdit anEdit);
-
-   /**
-* canRedo
-* @returns TODO
-*/
-   boolean canRedo();
-
-   /**
-* canRedo
-* @returns TODO
-*/
-   boolean canUndo();
-
-   /**
-* die
-*/
-   void die();
-
-   /**
-* getPresentationName
-* @returns TODO
-*/
-   String getPresentationName();
-
-   /**
-* getRedoPresentationName
-* @returns TODO
-*/
-   String getRedoPresentationName();
-
-   /**
-* getUndoPresentationName
-* @returns TODO
-*/
-   String getUndoPresentationName();
-
-   /**
-* isSignificant
-* @returns TODO
-*/
-  

[cp-patches] FYI: ComboBoxUI.java - API doc fixes

2006-03-05 Thread David Gilbert

This patch (committed) fixes a couple of minor API doc issues in the ComboBoxUI 
class:

2006-03-05  David Gilbert  <[EMAIL PROTECTED]>

* javax/swing/plaf/ComboBoxUI.java: Fixed typo in class description,
and corrected a bad API doc tag.

Regards,

Dave
Index: javax/swing/plaf/ComboBoxUI.java
===
RCS file: /sources/classpath/classpath/javax/swing/plaf/ComboBoxUI.java,v
retrieving revision 1.5
diff -u -r1.5 ComboBoxUI.java
--- javax/swing/plaf/ComboBoxUI.java19 Oct 2005 14:20:10 -  1.5
+++ javax/swing/plaf/ComboBoxUI.java5 Mar 2006 20:21:07 -
@@ -1,5 +1,5 @@
 /* ComboBoxUI.java --
-   Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2003, 2006, Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -41,9 +41,7 @@
 
 /**
  * An abstract base class for delegates that implement the pluggable
- * look and feel for a JButton.
- *
- * @see javax.swing.JComboBox
+ * look and feel for a [EMAIL PROTECTED] JComboBox}.
  *
  * @author Andrew Selkirk
  * @author Sascha Brawer ([EMAIL PROTECTED])
@@ -57,8 +55,7 @@
   {
 // Nothing to do here.
   }
-  
-  
+
   /**
* Sets the visibility of the popup button.
*
@@ -70,7 +67,6 @@
*/
   public abstract void setPopupVisible(JComboBox c, boolean visible);
 
-
   /**
* Determines whether the popup button is currently visible.
*
@@ -82,15 +78,15 @@
*/
   public abstract boolean isPopupVisible(JComboBox c);
   
-  
   /**
* Determines whether the combo box can receive input focus.
*
* @param c JComboBox whose focus traversability
*is to be retrieved.
*
-   * @returns true if c can receive
+   * @return true if c can receive
*  input focus, false otherwise.
*/
   public abstract boolean isFocusTraversable(JComboBox c);
+  
 }


[cp-patches] FYI: ColorSelectionModel.java - added API docs

2006-03-05 Thread David Gilbert

This patch (committed) adds API doc comments to the ColorSelectionModel 
interface:

2006-03-05  David Gilbert  <[EMAIL PROTECTED]>

* javax/swing/colorchooser/ColorSelectionModel.java: Reformatted and
added API docs all over.

Regards,

Dave
Index: javax/swing/colorchooser/ColorSelectionModel.java
===
RCS file: 
/sources/classpath/classpath/javax/swing/colorchooser/ColorSelectionModel.java,v
retrieving revision 1.5
diff -u -r1.5 ColorSelectionModel.java
--- javax/swing/colorchooser/ColorSelectionModel.java   2 Jul 2005 20:32:49 
-   1.5
+++ javax/swing/colorchooser/ColorSelectionModel.java   5 Mar 2006 20:10:46 
-
@@ -1,5 +1,5 @@
 /* ColorSelectionModel.java --
-   Copyright (C) 2002, 2004  Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2006,  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -40,42 +40,47 @@
 
 import java.awt.Color;
 
+import javax.swing.JColorChooser;
+import javax.swing.event.ChangeEvent;
 import javax.swing.event.ChangeListener;
 
 /**
- * ColorSelectionModel
+ * A model that is used by the [EMAIL PROTECTED] JColorChooser} component to 
represent the
+ * selected color.
+ * 
  * @author Andrew Selkirk
- * @version1.0
  */
-public interface ColorSelectionModel {
+public interface ColorSelectionModel 
+{
 
-   //-
-   // Methods 
-   //-
-
-   /**
-* getSelectedColor
-* @returns Color
-*/
-   Color getSelectedColor();
-
-   /**
-* setSelectedColor
-* @param color TODO
-*/
-   void setSelectedColor(Color color);
-
-   /**
-* addChangeListener
-* @param listener TODO
-*/
-   void addChangeListener(ChangeListener listener);
-
-   /**
-* removeChangeListener
-* @param listener TODO
-*/
-   void removeChangeListener(ChangeListener listener);
+  /**
+   * Returns the selected color.
+   * 
+   * @return The selected color.
+   */
+  Color getSelectedColor();
+
+  /**
+   * Sets the selected color.
+   * 
+   * @param color  the selected color.
+   */
+  void setSelectedColor(Color color);
+
+  /**
+   * Registers a listener to receive [EMAIL PROTECTED] ChangeEvent} 
notifications
+   * from this model.
+   * 
+   * @param listener  the listener.
+   */
+  void addChangeListener(ChangeListener listener);
+
+  /**
+   * Deregisters a listener so that it no longer receives [EMAIL PROTECTED] 
ChangeEvent} 
+   * notifications from this action.
+   *
+   * @param listener  the listener.
+   */
+  void removeChangeListener(ChangeListener listener);
 
-
-} // ColorSelectionModel
+}


[cp-patches] FYI: javax.swing.filechooser.* API doc tag fixes

2006-03-05 Thread David Gilbert

This patch (committed) fixes a couple of bad API doc tags in 
javax.swing.filechooser.*:

2006-03-05  David Gilbert  <[EMAIL PROTECTED]>

* javax/swing/filechooser/FileFilter.java:
(accept): Fixed API doc tag,
(getDescription): Likewise,
* javax/swing/filechooser/FileView.java:
(isTraversable): Fixed API doc tag.

Regards,

Dave
Index: javax/swing/filechooser/FileFilter.java
===
RCS file: /sources/classpath/classpath/javax/swing/filechooser/FileFilter.java,v
retrieving revision 1.5
diff -u -r1.5 FileFilter.java
--- javax/swing/filechooser/FileFilter.java 18 Oct 2005 20:42:03 -  
1.5
+++ javax/swing/filechooser/FileFilter.java 5 Mar 2006 19:32:53 -
@@ -1,5 +1,5 @@
 /* FileFilter.java --
-   Copyright (C) 2002, 2005 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2005, 2006, Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -67,7 +67,7 @@
* 
* @param file  the file.
* 
-   * @returns A boolean.
+   * @return A boolean.
*/
   public abstract boolean accept(File file);
 
@@ -78,7 +78,7 @@
* is used to select the appropriate filter (in cases where more than one
* filter is available).
* 
-   * @returns A description of the filter.
+   * @return A description of the filter.
*/
   public abstract String getDescription();
 
Index: javax/swing/filechooser/FileView.java
===
RCS file: /sources/classpath/classpath/javax/swing/filechooser/FileView.java,v
retrieving revision 1.6
diff -u -r1.6 FileView.java
--- javax/swing/filechooser/FileView.java   18 Oct 2005 20:42:03 -  
1.6
+++ javax/swing/filechooser/FileView.java   5 Mar 2006 19:32:53 -
@@ -1,5 +1,5 @@
 /* FileView.java --
-   Copyright (C) 2002, 2004, 2005  Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2005, 2006,  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -118,7 +118,7 @@
* 
* @param directory  the directory.
* 
-   * @returns Always null.
+   * @return Always null.
*/
   public Boolean isTraversable(File directory) 
   {


[cp-patches] Patch: FYI: fix Constructor.toString and Field.toString

2006-03-05 Thread Tom Tromey
I'm checking this in.

This fixes a bug I noticed in Constructor.toString and Field.toString.
I added a Mauve test for this and tested it by pulling the modified
code into the jamvm in my workspace.

VM implementors will probably have to copy this code into their VM,
as generally Constructor and Field are in the VM layer.

Tom

2006-03-05  Tom Tromey  <[EMAIL PROTECTED]>

* vm/reference/java/lang/reflect/Constructor.java (toString): Use
ClassHelper.getUserName.
* vm/reference/java/lang/reflect/Method.java (toString): Use
ClassHelper.getUserName.
(getUserTypeName): Removed.
* gnu/java/lang/ClassHelper.java (getUserName): New method.
* vm/reference/java/lang/reflect/Field.java (toString): Use
ClassHelper.getUserName.

Index: gnu/java/lang/ClassHelper.java
===
RCS file: /cvsroot/classpath/classpath/gnu/java/lang/ClassHelper.java,v
retrieving revision 1.13
diff -u -r1.13 ClassHelper.java
--- gnu/java/lang/ClassHelper.java  2 Jul 2005 20:32:12 -   1.13
+++ gnu/java/lang/ClassHelper.java  5 Mar 2006 18:15:48 -
@@ -81,6 +81,34 @@
 return name.substring(lastInd + 1);
   }
 
+  /**
+   * Return the name of the class as written by the user.
+   * This is used by the various reflection toString methods.
+   * It differs from [EMAIL PROTECTED] Class#getName()} in that it prints
+   * arrays with trailing "[]"s.  Note that it does not treat
+   * member classes specially, so a dollar sign may still appear
+   * in the result.  This is intentional.
+   * @param klass the class
+   * @return a pretty form of the class' name
+   */
+  public static String getUserName(Class klass)
+  {
+int arrayCount = 0;
+while (klass.isArray())
+  {
+++arrayCount;
+klass = klass.getComponentType();
+  }
+String name = klass.getName();
+if (arrayCount == 0)
+  return name;
+StringBuilder b = new StringBuilder(name.length() + 2 * arrayCount);
+b.append(name);
+for (int i = 0; i < arrayCount; ++i)
+  b.append("[]");
+return b.toString();
+  }
+
   /** Cache of methods found in getAllMethods(). */
   private static Map allMethods = new HashMap();
 
Index: vm/reference/java/lang/reflect/Constructor.java
===
RCS file: 
/cvsroot/classpath/classpath/vm/reference/java/lang/reflect/Constructor.java,v
retrieving revision 1.14
diff -u -r1.14 Constructor.java
--- vm/reference/java/lang/reflect/Constructor.java 13 Feb 2006 23:27:52 
-  1.14
+++ vm/reference/java/lang/reflect/Constructor.java 5 Mar 2006 18:15:50 
-
@@ -38,6 +38,8 @@
 
 package java.lang.reflect;
 
+import gnu.java.lang.ClassHelper;
+
 import java.util.Arrays;
 
 /**
@@ -190,9 +192,9 @@
 Class[] c = getParameterTypes();
 if (c.length > 0)
   {
-sb.append(c[0].getName());
+sb.append(ClassHelper.getUserName(c[0]));
 for (int i = 1; i < c.length; i++)
-  sb.append(',').append(c[i].getName());
+  sb.append(',').append(ClassHelper.getUserName(c[i]));
   }
 sb.append(')');
 c = getExceptionTypes();
Index: vm/reference/java/lang/reflect/Field.java
===
RCS file: 
/cvsroot/classpath/classpath/vm/reference/java/lang/reflect/Field.java,v
retrieving revision 1.10
diff -u -r1.10 Field.java
--- vm/reference/java/lang/reflect/Field.java   2 Jul 2005 20:33:08 -   
1.10
+++ vm/reference/java/lang/reflect/Field.java   5 Mar 2006 18:15:50 -
@@ -38,6 +38,8 @@
 
 package java.lang.reflect;
 
+import gnu.java.lang.ClassHelper;
+
 /**
  * The Field class represents a member variable of a class. It also allows
  * dynamic access to a member, via reflection. This works for both
@@ -171,7 +173,7 @@
 // 64 is a reasonable buffer initial size for field
 StringBuffer sb = new StringBuffer(64);
 Modifier.toString(getModifiers(), sb).append(' ');
-sb.append(getType().getName()).append(' ');
+sb.append(ClassHelper.getUserName(getType())).append(' ');
 sb.append(getDeclaringClass().getName()).append('.');
 sb.append(getName());
 return sb.toString();
Index: vm/reference/java/lang/reflect/Method.java
===
RCS file: 
/cvsroot/classpath/classpath/vm/reference/java/lang/reflect/Method.java,v
retrieving revision 1.15
diff -u -r1.15 Method.java
--- vm/reference/java/lang/reflect/Method.java  13 Feb 2006 23:27:52 -  
1.15
+++ vm/reference/java/lang/reflect/Method.java  5 Mar 2006 18:15:50 -
@@ -38,6 +38,8 @@
 
 package java.lang.reflect;
 
+import gnu.java.lang.ClassHelper;
+
 import java.util.Arrays;
 
 /**
@@ -212,15 +214,15 @@
 // 128 is a reasonable buffer initial size for constructor
 StringBuffer sb = new StringBuffer(128);
 Modifier.toString(getModifiers(), sb).append('

[Fwd: Re: [cp-patches] RFC: file resources can be directory too]

2006-03-05 Thread Olivier Jolly
Hi,
  since no one objected on the fact that we should consider directories
as valid resources, I committed the attached trivial patch with this
changelog

2006-03-05  Olivier Jolly  <[EMAIL PROTECTED]>

Fixes PR 22813
* java/net/URLClassLoader.java (FileURLLoader.getResource):   
Allows directories as valid resources.

Cheers

Olivier

 Message original 
Sujet:  Re: [cp-patches] RFC: file resources can be directory too
Date:   Wed, 01 Mar 2006 12:27:42 +0100
De: Olivier Jolly <[EMAIL PROTECTED]>
Pour:   Mark Wielaard <[EMAIL PROTECTED]>
Copie:  Robin Green <[EMAIL PROTECTED]>, classpath-patches

Références: <[EMAIL PROTECTED]>
<[EMAIL PROTECTED]>
<[EMAIL PROTECTED]>



Mark Wielaard wrote:
> On Tue, 2006-02-28 at 16:53 -0600, Archie Cobbs wrote:
>   
>> Olivier Jolly wrote:
>> 
>>>   following the mauve testlet commit, here is the fix proposition in
>>> classpath.
>>>   Basically, we were explicitly preventing directories to be retrieved
>>> as file resources, while I don't see any reason to do so (nor sun
>>> implementors afaik).
>>>   So, I propose this very trivial patch to deal with it.
>>>   
>> Looks like I was the one who disabled this behavior in rev 1.32.
>> Right now I can't remember why. But I think there was some bug in
>> the previous code. Note rev 1.32 removed code in getInputStream()
>> too, which is where ISTR the bug was.
>>
>> I can't access the archives right now (web site too slow) but it
>> might be worth checking them for the original reasoning for the change.
>> Had something to do with something working with file:// URLs but not
>> http:// URLs, or the other way around, or...
>> 
>
> Archived discussion is here:
> http://lists.gnu.org/archive/html/classpath/2005-07/msg00071.html
>
> Which also points to the following (open) bug:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22813
>
> And I found this mauve suggestion from Robin Green (CCed):
> http://sourceware.org/ml/mauve-patches/2004/msg00118.html
> (Which embarrassingly enough never got checked in. Sorry Robin!)
>
>   
Thanks Mark for finding those references.

As far as I understand, the directories were treated in a special way in 
URLClassLoader for getLength and getInputStream but were valid Resource 
from the FileUrlClassLoader point of view. With the removing of the 
special treatment in getLength and getInputStream for directories, it 
had been choosen to prevent directories from being considered as 
Resource to avoid the blurry case of trying to get the length or the 
inputStream off a directory.
The problem was moved from the getLength and getInputStream toward 
FileUrlClassLoader.getResource.

However, on a Resource, we can do other stuff than getLength and 
getInputStream which are also valid for directories, and I think we 
agree that getResource on a directory which actually exists in the list 
of urls the FileUrlClassLoader is looking for should return a valid File 
instance refering to this directory.
So, I think we're moving the problem in another direction, and it's up 
to the FileInputStream and File to know how to behave with directories, 
which is, imho, the right place to wonder how to handle this. 
FileUrlClassLoader should blindly rely on the File & cie implementations.

Yesterday Tom pointed at this bug and I didn't think it was exactly the 
same since the initial bug report and the reply were not talking exactly 
the same thing. The initial bug report is the problem we're dealing this 
right now while the answer seems to deal with the multiplicity of result 
of getResources. I'm been tricked by the answer.

Finally, I think that Robin was right about his assumption and that his 
patch proposition which should be commited (I did a similar modification 
locally to have both sun and patched classpath implementation happy with 
all those tests).
> Cheers,
>
>   
Thanks in advance for feedback
> Mark
>   
Olivier


Index: URLClassLoader.java
===
RCS file: /sources/classpath/classpath/java/net/URLClassLoader.java,v
retrieving revision 1.44
diff -u -r1.44 URLClassLoader.java
--- URLClassLoader.java	18 Jan 2006 00:19:13 -	1.44
+++ URLClassLoader.java	28 Feb 2006 21:26:35 -
@@ -539,7 +539,7 @@
   try 
  	{
  	  File file = new File(dir, name).getCanonicalFile();
- 	  if (file.exists() && !file.isDirectory())
+ 	  if (file.exists())
  	return new FileResource(this, file);
  	}
   catch (IOException e)


Re: [cp-patches] NIO Scatter/Gather patch

2006-03-05 Thread Michael Barker
I have addressed the issues raised by Roman and Jeoren and attached an updated patch.Cheers,Mike.
Index: gnu/java/nio/PipeImpl.java
===
RCS file: /cvsroot/classpath/classpath/gnu/java/nio/PipeImpl.java,v
retrieving revision 1.11
diff -u -r1.11 PipeImpl.java
--- gnu/java/nio/PipeImpl.java	2 Jul 2005 20:32:13 -	1.11
+++ gnu/java/nio/PipeImpl.java	2 Mar 2006 19:34:22 -
@@ -37,6 +37,7 @@
 
 package gnu.java.nio;
 
+
 import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.nio.channels.Pipe;
@@ -47,12 +48,14 @@
   public static final class SourceChannelImpl extends Pipe.SourceChannel
   {
 private int native_fd;
+private VMChannel vmch;
 
 public SourceChannelImpl (SelectorProvider selectorProvider,
   int native_fd)
 {
   super (selectorProvider);
   this.native_fd = native_fd;
+  vmch = VMChannel.getVMChannel(this);
 }
 
 protected final void implCloseSelectableChannel()
@@ -64,19 +67,19 @@
 protected void implConfigureBlocking (boolean blocking)
   throws IOException
 {
-  throw new Error ("Not implemented");
+  vmch.setBlocking(blocking);
 }
 
 public final int read (ByteBuffer src)
   throws IOException
 {
-  throw new Error ("Not implemented");
+  return vmch.read(src);
 }
 
 public final long read (ByteBuffer[] srcs)
   throws IOException
 {
-  return read (srcs, 0, srcs.length);
+  return vmch.readScattering(srcs, 0, srcs.length);
 }
 
 public final synchronized long read (ByteBuffer[] srcs, int offset,
@@ -89,13 +92,7 @@
 	  || len > srcs.length - offset)
 	throw new IndexOutOfBoundsException();
 
-  long bytesRead = 0;
-  
-  for (int index = 0; index < len; index++)
-	bytesRead += read (srcs [offset + index]);
-
-  return bytesRead;
-
+  return vmch.readScattering(srcs, offset, len);
 }
 
 public final int getNativeFD()
@@ -107,12 +104,14 @@
   public static final class SinkChannelImpl extends Pipe.SinkChannel
   {
 private int native_fd;
+private VMChannel vmch;
 
 public SinkChannelImpl (SelectorProvider selectorProvider,
 int native_fd)
 {
   super (selectorProvider);
   this.native_fd = native_fd;
+  vmch = VMChannel.getVMChannel(this);
 }
 
 protected final void implCloseSelectableChannel()
@@ -124,19 +123,19 @@
 protected final void implConfigureBlocking (boolean blocking)
   throws IOException
 {
-  throw new Error ("Not implemented");
+  vmch.setBlocking(blocking);
 }
 
 public final int write (ByteBuffer dst)
   throws IOException
 {
-  throw new Error ("Not implemented");
+  return vmch.write(dst);
 }
 
 public final long write (ByteBuffer[] srcs)
   throws IOException
 {
-  return write (srcs, 0, srcs.length);
+  return vmch.writeGathering(srcs, 0, srcs.length);
 }
 
 public final synchronized long write (ByteBuffer[] srcs, int offset, int len)
@@ -147,13 +146,8 @@
 	  || len < 0
 	  || len > srcs.length - offset)
 	throw new IndexOutOfBoundsException();
-
-  long bytesWritten = 0;
   
-  for (int index = 0; index < len; index++)
-	bytesWritten += write (srcs [offset + index]);
-
-  return bytesWritten;
+  return vmch.writeGathering(srcs, offset, len);
 }
 
 public final int getNativeFD()
Index: gnu/java/nio/SelectorImpl.java
===
RCS file: /cvsroot/classpath/classpath/gnu/java/nio/SelectorImpl.java,v
retrieving revision 1.21
diff -u -r1.21 SelectorImpl.java
--- gnu/java/nio/SelectorImpl.java	27 Dec 2005 08:32:12 -	1.21
+++ gnu/java/nio/SelectorImpl.java	2 Mar 2006 19:34:22 -
@@ -379,6 +379,8 @@
   result = new DatagramChannelSelectionKey (ch, this);
 else if (ch instanceof ServerSocketChannelImpl)
   result = new ServerSocketChannelSelectionKey (ch, this);
+else if (ch instanceof gnu.java.nio.SocketChannelImpl)
+  result = new gnu.java.nio.SocketChannelSelectionKeyImpl((gnu.java.nio.SocketChannelImpl)ch, this);
 else
   throw new InternalError ("No known channel type");
 
Index: gnu/java/nio/SocketChannelImpl.java
===
RCS file: /cvsroot/classpath/classpath/gnu/java/nio/SocketChannelImpl.java,v
retrieving revision 1.29
diff -u -r1.29 SocketChannelImpl.java
--- gnu/java/nio/SocketChannelImpl.java	27 Dec 2005 02:27:01 -	1.29
+++ gnu/java/nio/SocketChannelImpl.java	2 Mar 2006 19:34:22 -
@@ -1,5 +1,5 @@
 /* SocketChannelImpl.java -- 
-   Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -39,10 +39,9 @@
 package gnu.java.nio;
 
 import gnu.java.net.PlainSocketImpl;
+import gnu.ja

Re: [cp-patches] RFC: fixlet for URLClassLoader.addURLImpl

2006-03-05 Thread Dalibor Topic
On Sun, 2006-02-12 at 21:52 +0100, Dalibor Topic wrote:
> Hi all,
> 
> the attached patch is part of the fallout of work on Kaffe's bug #16. It
> turns out that addURLImpl can occasionally get confused whether an URL
> points to a directory or not, based on the string check alone, for
> example when the directory ends in a Unicode character outside the basic
> plane.
> 
> Using File.isDiectory delegates that to the operating system, and makes
> the code a bit cleaner, in my opinion.
> 
> 2006-02-12  Dalibor Topic  <[EMAIL PROTECTED]>
> 
> * java/net/URLClassLoader.java
> (addURLImpl) Check if a file URL points to a directory before
> using a JarURLClassLoader.
> 

Since noone complained about it (save from a brief conversation with Tom
on IRC, that was inconclusive on benefits on not fixing the code,
afair), I'll be checking this in, in a few hours. Speak up, or live with
the ClassLoader change ;)

cheers,
dalibor topic