Re: [cp-patches] Patch: remove bogus ServerSocket security check

2006-01-03 Thread Gary Benson
Mark Wielaard wrote:
 On Mon, 2005-12-26 at 19:05 -0800, Anthony Green wrote:
  This patch removes a bogus security check from
  ServerSocket.accept(), and replaces it with a
  request to implement a proper check.  Once applied
  I will file a bug report for our records.
 
 Gary, do we have Mauve tests for this case already?

No.  FWIW if I had you could find it with something like
grep 'security: java.net.ServerSocket-accept'

Cheers,
Gary


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


Re: [cp-patches] java.security.Security

2006-01-03 Thread Raif S. Naffah
hello Mark,

On Tuesday 03 January 2006 07:42, Mark Wielaard wrote:
 Hi,

 On Tue, 2006-01-03 at 01:34 +1100, Raif S. Naffah wrote:
  2006-01-03  raif  [EMAIL PROTECTED]
 
  * java/security/Security.java (getProvider): Ensures provider's
  name is not null, not an empty string, and is trimmed before usage.

 This is fine, please commit.

done.


 BTW. Note that your ChangeLog entry name and email address are
 different from your normal one.

noted + corrected.  btw, the Eclipse ChangeLog plugin is a wonderful 
little gem!


cheers;
rsn


pgpSCAGiYGITd.pgp
Description: PGP signature
___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


[cp-patches] FYI: ElementBuffer.remove(Update) implemented

2006-01-03 Thread Roman Kennke
Hi,

I implemented the missing methods
javax.swing.text.DefaultStyledDocument.ElementBuffer.remove() and
removeUpdate().

2006-01-03  Roman Kennke  [EMAIL PROTECTED]

* javax/swing/text/DefaultStyledDocument.java
(ElementBuffer.remove): New method.
(ElementBuffer.removeUpdate): New method.
(removeUpdate): New method.

/Roman
Index: javax/swing/text/DefaultStyledDocument.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/text/DefaultStyledDocument.java,v
retrieving revision 1.24
diff -u -r1.24 DefaultStyledDocument.java
--- javax/swing/text/DefaultStyledDocument.java	22 Dec 2005 20:02:59 -	1.24
+++ javax/swing/text/DefaultStyledDocument.java	3 Jan 2006 13:37:49 -
@@ -489,6 +489,85 @@
 }
 
 /**
+ * Updates the element structure of the document in response to removal of
+ * content. It removes the affected [EMAIL PROTECTED] Element}s from the document
+ * structure.
+ *
+ * This method sets some internal parameters and delegates the work
+ * to [EMAIL PROTECTED] #removeUpdate}.
+ *
+ * @param offs the offset from which content is remove
+ * @param len the length of the removed content
+ * @param ev the document event that records the changes
+ */
+public void remove(int offs, int len, DefaultDocumentEvent ev)
+{
+  offset = offs;
+  length = len;
+  documentEvent = ev;
+  removeUpdate();
+}
+
+/**
+ * Updates the element structure of the document in response to removal of
+ * content. It removes the affected [EMAIL PROTECTED] Element}s from the document
+ * structure.
+ */
+protected void removeUpdate()
+{
+  int startParagraph = root.getElementIndex(offset);
+  int endParagraph = root.getElementIndex(offset + length);
+  Element[] empty = new Element[0];
+  int removeStart = -1;
+  int removeEnd = -1;
+  for (int i = startParagraph;  i  endParagraph; i++)
+{
+  Element paragraph = root.getElement(i);
+  int contentStart = paragraph.getElementIndex(offset);
+  int contentEnd = paragraph.getElementIndex(offset + length);
+  if (contentStart == paragraph.getStartOffset()
+   contentEnd == paragraph.getEndOffset())
+{
+  // In this case we only need to remove the whole paragraph. We
+  // do this in one go after this loop and only record the indices
+  // here.
+  if (removeStart == -1)
+{
+  removeStart = i;
+  removeEnd = i;
+}
+  else
+removeEnd = i;
+}
+  else
+{
+  // In this case we remove a couple of child elements from this
+  // paragraph.
+  int removeLen = contentEnd - contentStart;
+  Element[] removed = new Element[removeLen];
+  for (int j = contentStart; j  contentEnd; j++)
+removed[j] = paragraph.getElement(j);
+  ((BranchElement) paragraph).replace(contentStart, removeLen,
+  empty);
+  documentEvent.addEdit(new ElementEdit(paragraph, contentStart,
+removed, empty));
+}
+}
+  // Now we remove paragraphs from the root that have been tagged for
+  // removal.
+  if (removeStart != -1)
+{
+  int removeLen = removeEnd - removeStart;
+  Element[] removed = new Element[removeLen];
+  for (int i = removeStart; i  removeEnd; i++)
+removed[i] = root.getElement(i);
+  ((BranchElement) root).replace(removeStart, removeLen, empty);
+  documentEvent.addEdit(new ElementEdit(root, removeStart, removed,
+empty));
+}
+}
+
+/**
  * Modifies the element structure so that the specified interval starts
  * and ends at an element boundary. Content and paragraph elements
  * are split and created as necessary.
@@ -1549,6 +1628,20 @@
   }
 
   /**
+   * Updates the document structure in response to text removal. This is
+   * forwarded to the [EMAIL PROTECTED] ElementBuffer} of this document. Any changes to
+   * the document structure are added to the specified document event and
+   * sent to registered listeners.
+   *
+   * @param ev the document event that records the changes to the document
+   */
+  protected void removeUpdate(DefaultDocumentEvent ev)
+  {
+super.removeUpdate(ev);
+buffer.remove(ev.getOffset(), ev.getLength(), ev);
+  }
+
+  /**
* Returns an enumeration of all style names.
*
* @return an enumeration of all style names
___
Classpath-patches mailing list
Classpath-patches@gnu.org

[cp-patches] FYI: BasicListUI fix

2006-01-03 Thread Roman Kennke
This patch fixes JList rendering and size calculations for wrapping
JLists.

2006-01-03  Roman Kennke  [EMAIL PROTECTED]

* javax/swing/plaf/basic/BasicListUI.java
(locationToIndex): Special case for when variable cell heights
are possible. (cellHeights is used instead of cellHeight).
(indexToLocation): Special case for when variable cell heights
are possible. (cellHeights is used instead of cellHeight).

/Roman
Index: javax/swing/plaf/basic/BasicListUI.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicListUI.java,v
retrieving revision 1.42
diff -u -r1.42 BasicListUI.java
--- javax/swing/plaf/basic/BasicListUI.java	25 Nov 2005 16:33:24 -	1.42
+++ javax/swing/plaf/basic/BasicListUI.java	3 Jan 2006 15:11:46 -
@@ -1158,7 +1158,6 @@
 int startIndex = list.locationToIndex(new Point(clip.x, clip.y));
 int endIndex = list.locationToIndex(new Point(clip.x + clip.width,
   clip.y + clip.height));
-
 for (int row = startIndex; row = endIndex; ++row)
   {
 Rectangle bounds = getCellBounds(list, row, row);
@@ -1212,7 +1211,18 @@
 // determine index for the given location
 int cellsPerColumn = numberOfItems / cellsPerRow + 1;
 int gridX = Math.min(location.x / cellWidth, cellsPerRow - 1);
-int gridY = Math.min(location.y / cellHeight, cellsPerColumn);
+int gridY;
+if (cellHeight  0)
+  gridY = Math.min(location.y / cellHeight, cellsPerColumn);
+else
+  {
+int posY = 0;
+for (gridY = 0; posY + cellHeights[gridY]  location.y;)
+  {
+posY += cellHeights[gridY];
+gridY++;
+  }
+  }
 index = gridX + gridY * cellsPerRow;
 break;
   case JList.VERTICAL_WRAP:
@@ -1227,7 +1237,18 @@
 int cellsPerRow2 = numberOfItems2 / visibleRows2 + 1;
 
 int gridX2 = Math.min(location.x / cellWidth, cellsPerRow2 - 1);
-int gridY2 = Math.min(location.y / cellHeight, visibleRows2);
+int gridY2;
+if (cellHeight  0)
+  gridY2 = Math.min(location.y / cellHeight, visibleRows2);
+else
+  {
+int posY = 0;
+for (gridY2 = 0; posY + cellHeights[gridY2]  location.y;)
+  {
+posY += cellHeights[gridY2];
+gridY2++;
+  }
+  }
 index = gridY2 + gridX2 * visibleRows2;
 break;
   }
@@ -1261,7 +1282,15 @@
 int gridX = index % numberOfCellsPerRow;
 int gridY = index / numberOfCellsPerRow;
 int locX = gridX * cellWidth;
-int locY = gridY * cellHeight;
+int locY;
+if (cellHeight  0)
+  locY = gridY * cellHeight;
+else
+  {
+locY = 0;
+for (int y = 0; y  gridY; y++)
+  locY += cellHeights[gridY];
+  }
 loc = new Point(locX, locY);
 break;
   case JList.VERTICAL_WRAP:
@@ -1278,7 +1307,15 @@
 int gridY2 = index % visibleRows2;
 int gridX2 = index / visibleRows2;
 int locX2 = gridX2 * cellWidth;
-int locY2 = gridY2 * cellHeight;
+int locY2;
+if (cellHeight  0)
+  locY2 = gridY2 * cellHeight;
+else
+  {
+locY2 = 0;
+for (int y = 0; y  gridY2; y++)
+  locY2 += cellHeights[gridY2];
+  }
 loc = new Point(locX2, locY2);
   }
 else
___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


[cp-patches] FYI: Avoid ArrayIndexOutOfBoundsException in BasicListUI

2006-01-03 Thread Roman Kennke
The attached patch helps avoiding an ArrayIndexOutOfBoundsException in
the BasicListUI.

2006-01-03  Roman Kennke  [EMAIL PROTECTED]

* javax/swing/plaf/basic/BasicListUI.java
(locationToIndex): Added check to avoid ArrayOutOfBoundsException.

/Roman
Index: javax/swing/plaf/basic/BasicListUI.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicListUI.java,v
retrieving revision 1.43
diff -u -r1.43 BasicListUI.java
--- javax/swing/plaf/basic/BasicListUI.java	3 Jan 2006 15:12:15 -	1.43
+++ javax/swing/plaf/basic/BasicListUI.java	3 Jan 2006 15:50:52 -
@@ -1243,7 +1243,8 @@
 else
   {
 int posY = 0;
-for (gridY2 = 0; posY + cellHeights[gridY2]  location.y;)
+for (gridY2 = 0; gridY2 = visibleRows2
+  posY + cellHeights[gridY2]  location.y;)
   {
 posY += cellHeights[gridY2];
 gridY2++;
___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


[cp-patches] Patch: FileChooser - small fixes

2006-01-03 Thread Lillian Angel
I made a small fix to match the JDK and I took out some inefficent code.

2006-01-03  Lillian Angel  [EMAIL PROTECTED]

* javax/swing/JList.java
(init): visibleRowCount should be 7, like the JDK.
* javax/swing/plaf/metal/MetalFileChooserUI.java
(installComponents): No need to add the fileFilterCombo
to a panel. It can be added to the row directly.

Index: javax/swing/JList.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/JList.java,v
retrieving revision 1.42
diff -u -r1.42 JList.java
--- javax/swing/JList.java	28 Nov 2005 18:33:39 -	1.42
+++ javax/swing/JList.java	3 Jan 2006 16:11:11 -
@@ -1070,7 +1070,7 @@
 layoutOrientation = VERTICAL;
 opaque = true;
 valueIsAdjusting = false;
-visibleRowCount = 8;
+visibleRowCount = 7;
 
 cellRenderer = new DefaultListCellRenderer();
 listListener = new ListListener();
Index: javax/swing/plaf/metal/MetalFileChooserUI.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/metal/MetalFileChooserUI.java,v
retrieving revision 1.14
diff -u -r1.14 MetalFileChooserUI.java
--- javax/swing/plaf/metal/MetalFileChooserUI.java	3 Jan 2006 15:29:52 -	1.14
+++ javax/swing/plaf/metal/MetalFileChooserUI.java	3 Jan 2006 16:11:12 -
@@ -1330,11 +1330,9 @@
 row1.add(fileNamePanel);
 bottomPanel.add(row1);
 
-JPanel filterPanel = new JPanel(new VerticalMidLayout());
-filterPanel.add(fileFilterCombo);
 JPanel row2 = new JPanel(new BorderLayout());
 row2.add(new JLabel(this.filterLabel), BorderLayout.WEST);
-row2.add(filterPanel);
+row2.add(fileFilterCombo);
 bottomPanel.add(row2);
 JPanel buttonPanel = new JPanel(new ButtonLayout());
 buttonPanel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 0));
___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


[cp-patches] Patch: JFileChooser width

2006-01-03 Thread Lillian Angel
Fixed the width of the JFileChooser.

2006-01-03  Lillian Angel  [EMAIL PROTECTED]

* javax/swing/plaf/basic/BasicListUI.java
(getPreferredSize): The JDK adds some extra space to
the list, so we should as well.
* javax/swing/plaf/metal/MetalFileChooserUI.java
(getPreferredSize): Should only take the fileListPanel's
width into account when getting the size. Also, the 
buttonPanel's size should not be checked, since it is in the 
bottomPanel already. (getMinimumSize): Likewise.

Index: javax/swing/plaf/basic/BasicListUI.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicListUI.java,v
retrieving revision 1.44
diff -u -r1.44 BasicListUI.java
--- javax/swing/plaf/basic/BasicListUI.java	3 Jan 2006 15:53:54 -	1.44
+++ javax/swing/plaf/basic/BasicListUI.java	3 Jan 2006 16:42:33 -
@@ -1087,6 +1087,7 @@
 int layoutOrientation = list.getLayoutOrientation();
 Rectangle bounds = getCellBounds(list, 0, list.getModel().getSize() - 1);
 Dimension retVal = bounds.getSize();
+retVal.width += cellWidth;
 Component parent = list.getParent();
 if ((visibleRows == -1)  (parent instanceof JViewport))
   {
Index: javax/swing/plaf/metal/MetalFileChooserUI.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/metal/MetalFileChooserUI.java,v
retrieving revision 1.15
diff -u -r1.15 MetalFileChooserUI.java
--- javax/swing/plaf/metal/MetalFileChooserUI.java	3 Jan 2006 16:13:48 -	1.15
+++ javax/swing/plaf/metal/MetalFileChooserUI.java	3 Jan 2006 16:42:34 -
@@ -1653,14 +1653,10 @@
   {
 Dimension tp = topPanel.getPreferredSize();
 Dimension bp = bottomPanel.getPreferredSize();
-Dimension bup = buttonPanel.getPreferredSize();
 Dimension fl = fileListPanel.getPreferredSize();
-return new Dimension((tp.width +
-bp.width + bup.width + fl.width), 
-(tp.height + bp.height +
- bup.height + fl.height));
+return new Dimension(fl.width, tp.height + bp.height + fl.height);
   }
-  
+
   /**
* Returns the minimum size for the file chooser component.
* 
@@ -1670,12 +1666,8 @@
   {
 Dimension tp = topPanel.getMinimumSize();
 Dimension bp = bottomPanel.getMinimumSize();
-Dimension bup = buttonPanel.getMinimumSize();
 Dimension fl = fileListPanel.getMinimumSize();
-return new Dimension((tp.width +
-bp.width + bup.width + fl.width), 
-(tp.height + bp.height +
- bup.height + fl.height));   
+return new Dimension(fl.width, tp.height + bp.height + fl.height);
   }
   
   /**
___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


Re: [cp-patches] FYI: Avoid ArrayIndexOutOfBoundsException in BasicListUI

2006-01-03 Thread Chris Lansdown
I tested it out, and it's not so much the row of what you click on, but the
size of the directory which you enter.

This patch isn't enough, because the problem is also that the visible row
count never gets set. When you go into a directory with fewer than 8
elements, this array tries to iterate over all 8 visible rows, except that
with (e.g. 2 elements) there are only 2 visible rows.

It seems that what we need is something that sets the visible row count
correctly.

Alternatively, change the oob check to

gridY2  Math.min(visibleRowCount, list.getModel().getSize())

Also, indexToLocation needs to be modified similarly, since it makes the
same mistake as locationToIndex.

And actually, now that I look at it, I think that list.getModel().getSize()
is more correct. Well, now that I say that, it would be more correct still
to use cellHeights.length (faster). Actually, Math.min(visibleRowCounts2,
cellHeights.length) would probably be both most optimal and most correct.

Thanks,
-Chris

On 01/03, Roman Kennke wrote:
 The attached patch helps avoiding an ArrayIndexOutOfBoundsException in
 the BasicListUI.
 
 2006-01-03  Roman Kennke  [EMAIL PROTECTED]
 
 * javax/swing/plaf/basic/BasicListUI.java
 (locationToIndex): Added check to avoid ArrayOutOfBoundsException.
 
 /Roman


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


-- 
Let us endeavor so to live that when we come to die even the undertaker 
will be sorry.  -- Mark Twain, Pudd'nhead Wilson's Calendar
== Evil Overlord Quote of the Day (www.eviloverlord.com) =
172. I will allow guards to operate under a flexible work schedule. That way
if one is feeling sleepy, he can call for a replacement, punch out,
take a nap, and come back refreshed and alert to finish out his shift. 


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


[cp-patches] Patch: Constructor fixes

2006-01-03 Thread Lillian Angel
I fixed some constructor problems in several swing classes. These were
pointed out by several mauve tests.

2006-01-03  Lillian Angel  [EMAIL PROTECTED]

* javax/swing/AbstractAction.java
(AbstractAction): Fixed to pass in null. Should not be
an empty string. Removed TODO comment.
(AbstractAction): Removed TODO comment.
* javax/swing/JList.java
(init): Default selection mode should be 
MULTIPLE_INTERVAL_SELECTION.
* javax/swing/JMenuItem.java
(JMenuItem): Set all defaults if the action passed in is not 
null.
* javax/swing/JProgressBar.java
(JProgressBar): Added check to prevent NPE.

Index: javax/swing/AbstractAction.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/AbstractAction.java,v
retrieving revision 1.17
diff -u -r1.17 AbstractAction.java
--- javax/swing/AbstractAction.java	13 Dec 2005 22:15:16 -	1.17
+++ javax/swing/AbstractAction.java	3 Jan 2006 18:37:46 -
@@ -79,7 +79,7 @@
*/
   public AbstractAction()
   {
-this(); // TODO: default name
+this(null);
   }
 
   /**
@@ -90,7 +90,7 @@
*/
   public AbstractAction(String name)
   {
-this(name, null); // TODO: default icon??
+this(name, null);
   }
 
   /**
Index: javax/swing/JList.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/JList.java,v
retrieving revision 1.43
diff -u -r1.43 JList.java
--- javax/swing/JList.java	3 Jan 2006 16:13:48 -	1.43
+++ javax/swing/JList.java	3 Jan 2006 18:37:47 -
@@ -1077,7 +1077,7 @@
 
 setModel(new DefaultListModel());
 setSelectionModel(createSelectionModel());
-setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
 setLayout(null);
 
 updateUI();
Index: javax/swing/JMenuItem.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/JMenuItem.java,v
retrieving revision 1.23
diff -u -r1.23 JMenuItem.java
--- javax/swing/JMenuItem.java	14 Nov 2005 20:23:56 -	1.23
+++ javax/swing/JMenuItem.java	3 Jan 2006 18:37:47 -
@@ -117,6 +117,13 @@
 super();
 super.setAction(action);
 init(null, null);
+if (action != null)
+  {
+setName((String) action.getValue(Action.NAME));
+setAccelerator((KeyStroke) action.getValue(Action.ACCELERATOR_KEY));
+setMnemonic(((Integer) action.getValue(Action.MNEMONIC_KEY)).intValue());
+setActionCommand((String) action.getValue(Action.ACTION_COMMAND_KEY));
+  }
   }
 
   /**
Index: javax/swing/JProgressBar.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/JProgressBar.java,v
retrieving revision 1.14
diff -u -r1.14 JProgressBar.java
--- javax/swing/JProgressBar.java	19 Oct 2005 15:45:04 -	1.14
+++ javax/swing/JProgressBar.java	3 Jan 2006 18:37:47 -
@@ -262,7 +262,8 @@
   {
 this.model = model;
 changeListener = createChangeListener();
-model.addChangeListener(changeListener);
+if (model != null)
+  model.addChangeListener(changeListener);
 updateUI();
   }
___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


[cp-patches] Patch: Tree selection default

2006-01-03 Thread Lillian Angel
Fixed tree selection default.

2006-01-03  Lillian Angel  [EMAIL PROTECTED]

* javax/swing/tree/DefaultTreeSelectionModel.java
(DefaultTreeSelectionModel): Default should be 
DISCONTIGUOUS_TREE_SELECTION.

Index: javax/swing/tree/DefaultTreeSelectionModel.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/tree/DefaultTreeSelectionModel.java,v
retrieving revision 1.20
diff -u -r1.20 DefaultTreeSelectionModel.java
--- javax/swing/tree/DefaultTreeSelectionModel.java	18 Aug 2005 20:50:39 -	1.20
+++ javax/swing/tree/DefaultTreeSelectionModel.java	3 Jan 2006 18:59:22 -
@@ -116,7 +116,7 @@
 	 */
 	public DefaultTreeSelectionModel()
 	{
-		setSelectionMode(SINGLE_TREE_SELECTION);
+		setSelectionMode(DISCONTIGUOUS_TREE_SELECTION);
 		listenerList = new EventListenerList();
 	}
 
___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


Re: [cp-patches] FYI: BasicLookAndFeel defaults

2006-01-03 Thread Lillian Angel
On Tue, 2006-01-03 at 14:51 -0500, Lillian Angel wrote:
 Obviously, with these changes, other bugs may be exposed.

I fixed all the problems that were caused as a result of my last patch.

2006-01-03  Lillian Angel  [EMAIL PROTECTED]

* javax/swing/plaf/basic/BasicFileChooserUI.java
(installStrings): Fixed installation of defaults that
were changed in BasicLookAndFeel.
* javax/swing/plaf/basic/BasicTabbedPaneUI.java
(installDefaults): Fixed installation of defaults that
were changed in BasicLookAndFeel.

Index: javax/swing/plaf/basic/BasicFileChooserUI.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicFileChooserUI.java,v
retrieving revision 1.21
diff -u -r1.21 BasicFileChooserUI.java
--- javax/swing/plaf/basic/BasicFileChooserUI.java	30 Nov 2005 19:42:40 -	1.21
+++ javax/swing/plaf/basic/BasicFileChooserUI.java	3 Jan 2006 20:03:44 -
@@ -949,28 +949,28 @@
 acceptAllFileFilterText = defaults.getString(FileChooser.acceptAllFileFilterText);
 cancelButtonText = Cancel;
 cancelButtonToolTipText = Abort file chooser dialog;
-cancelButtonMnemonic = defaults.getInt(FileChooser.cancelButtonMnemonic);
+cancelButtonMnemonic = new Integer((String) UIManager.get(FileChooser.cancelButtonMnemonic)).intValue();
 
 directoryOpenButtonText = Open;
 directoryOpenButtonToolTipText = Open selected directory;
 directoryOpenButtonMnemonic 
-= defaults.getInt(FileChooser.directoryOpenButtonMnemonic);
+= new Integer((String) UIManager.get(FileChooser.directoryOpenButtonMnemonic)).intValue();
 
 helpButtonText = Help;
 helpButtonToolTipText = FileChooser help;
-helpButtonMnemonic = defaults.getInt(FileChooser.helpButtonMnemonic);
+helpButtonMnemonic = new Integer((String) UIManager.get(FileChooser.helpButtonMnemonic)).intValue();
 
 openButtonText = Open;
 openButtonToolTipText = Open selected file;
-openButtonMnemonic = defaults.getInt(FileChooser.openButtonMnemonic);
+openButtonMnemonic = new Integer((String) UIManager.get(FileChooser.openButtonMnemonic)).intValue();
 
 saveButtonText = Save;
 saveButtonToolTipText = Save selected file;
-saveButtonMnemonic = UIManager.getInt(FileChooser.saveButtonMnemonic);
+saveButtonMnemonic = new Integer((String) UIManager.get(FileChooser.saveButtonMnemonic)).intValue();
   
 updateButtonText = Update;
 updateButtonToolTipText = Update directory listing;
-updateButtonMnemonic = defaults.getInt(FileChooser.updateButtonMnemonic);
+updateButtonMnemonic = new Integer((String) UIManager.get(FileChooser.updateButtonMnemonic)).intValue();
   }
 
   /**
Index: javax/swing/plaf/basic/BasicTabbedPaneUI.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicTabbedPaneUI.java,v
retrieving revision 1.31
diff -u -r1.31 BasicTabbedPaneUI.java
--- javax/swing/plaf/basic/BasicTabbedPaneUI.java	25 Nov 2005 14:00:04 -	1.31
+++ javax/swing/plaf/basic/BasicTabbedPaneUI.java	3 Jan 2006 20:03:45 -
@@ -1549,9 +1549,9 @@
 textIconGap = UIManager.getInt(TabbedPane.textIconGap);
 tabRunOverlay = UIManager.getInt(TabbedPane.tabRunOverlay);
 
-tabInsets = UIManager.getInsets(TabbedPane.tabbedPaneTabInsets);
+tabInsets = UIManager.getInsets(TabbedPane.tabInsets);
 selectedTabPadInsets = UIManager.getInsets(TabbedPane.tabbedPaneTabPadInsets);
-tabAreaInsets = UIManager.getInsets(TabbedPane.tabbedPaneTabAreaInsets);
+tabAreaInsets = UIManager.getInsets(TabbedPane.tabAreaInsets);
 contentBorderInsets = UIManager.getInsets(TabbedPane.tabbedPaneContentBorderInsets);
 
 calcRect = new Rectangle();
___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


Re: [cp-patches] RFC: JTextArea text == null in constructor patch

2006-01-03 Thread Roman Kennke
Hi Mark,

Am Dienstag, den 03.01.2006, 20:57 +0100 schrieb Mark Wielaard:
 Hi,
 
 While playing with JEdit I encountered an exception because JEdit has a
 JTextArea subclass that doesn't expect its overridden setText() method
 to be called from the constructor. This patch makes it so:
 
 2006-01-03  Mark Wielaard  [EMAIL PROTECTED]
 
 * javax/swing/JTextArea.java
 (JTextArea(Document,text,int,int)): Only call setText() when text is
 not null.
 
 I think this is OK since text is often null when any of the other
 constuctors is called that don't have a text argument (as in the JEdit
 case). Does it look sane?

Yes, please go ahead and commit it.

/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


[cp-patches] RFC: GdkGraphics2D.setBackground() set to white if null

2006-01-03 Thread Mark Wielaard
Hi,

I had some trouble using Graphics2D with JEdit and myPod. This patch
helps by making sure the background color is always set:

2006-01-03  Mark Wielaard  [EMAIL PROTECTED]

* gnu/java/awt/peer/gtk/GdkGraphics2D.java (setBackground): Set to
Color.WHITE if null.

This was inspired by setColor() which does the same (but defaults to
black). What do you think?

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] RFC: GdkGraphics2D.setBackground() set to white if null

2006-01-03 Thread Mark Wielaard
Hi,

On Tue, 2006-01-03 at 23:20 +0100, Mark Wielaard wrote:
 2006-01-03  Mark Wielaard  [EMAIL PROTECTED]
 
 * gnu/java/awt/peer/gtk/GdkGraphics2D.java (setBackground): Set to
 Color.WHITE if null.
 
 This was inspired by setColor() which does the same (but defaults to
 black). What do you think?

Thomas said (offlist) this was fine and said the actual patch was
missing. So here is the patch.

Committed,

Mark

diff -u -r1.52 GdkGraphics2D.java
--- gnu/java/awt/peer/gtk/GdkGraphics2D.java30 Oct 2005 13:48:44 - 
1.52
+++ gnu/java/awt/peer/gtk/GdkGraphics2D.java3 Jan 2006 22:42:31 -
@@ -1088,6 +1088,8 @@

   public void setBackground(Color c)
   {
+if (c == null)
+  c = Color.WHITE;
 bg = c;
   }




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


[cp-patches] FYI: Always call MetalLookAndFeel.createDefaultTheme()

2006-01-03 Thread Mark Wielaard
Hi,

The KunstoffLookAndFeel (as used by myPod) depends on
createDefaultTheme() always being called since it overrides it to set
the theme. So this patch makes it so.

2006-01-03  Mark Wielaard  [EMAIL PROTECTED]

   * javax/swing/plaf/metal/MetalLookAndFeel.java (MetalLookAndFeel):
   Always call createDefaultTheme().
   (createDefaultTheme): Check whether theme is still null.

Committed,

Mark
Index: javax/swing/plaf/metal/MetalLookAndFeel.java
===
RCS file: /sources/classpath/classpath/javax/swing/plaf/metal/MetalLookAndFeel.java,v
retrieving revision 1.74
diff -u -r1.74 MetalLookAndFeel.java
--- javax/swing/plaf/metal/MetalLookAndFeel.java	3 Jan 2006 21:07:46 -	1.74
+++ javax/swing/plaf/metal/MetalLookAndFeel.java	3 Jan 2006 22:46:54 -
@@ -81,8 +81,7 @@
*/
   public MetalLookAndFeel()
   {
-if (theme == null)
-  createDefaultTheme();
+createDefaultTheme();
   }
 
   /**
@@ -90,7 +89,8 @@
*/
   protected void createDefaultTheme()
   {
-setCurrentTheme(new DefaultMetalTheme());
+if (theme == null)
+  setCurrentTheme(new DefaultMetalTheme());
   }
 
   /**


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


[cp-patches] Re: compiling Classpath on cigwin/win

2006-01-03 Thread Mark Wielaard
Hi Paul,

On Tue, 2006-01-03 at 22:20 +, Paul Jenner wrote:
 On Tue, 2006-01-03 at 23:12 +0100, Mark Wielaard wrote:
  O, interesting. The class comment in that file contains some strange
  characters. Does removing them help?
 
 Just noticed that myself. Yep - remove the odd characters and build is
 merrily completing for me.

Great! Committed as follows:

2006-01-03  Mark Wielaard  [EMAIL PROTECTED]

* org/omg/CORBA/INVALID_ACTIVITY.java: Remove non-ascii characters.

Thanks,

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: BasicListUI fix

2006-01-03 Thread Chris Lansdown
Roman,

The loops loop like they will throw an OOB exception if the mouse click is
below the last item, if there are too few items. Am I missing something?

Thanks,
Chris Lansdown

On 01/03, Roman Kennke wrote:
 This patch fixes JList rendering and size calculations for wrapping
 JLists.
 
 2006-01-03  Roman Kennke  [EMAIL PROTECTED]
 
 * javax/swing/plaf/basic/BasicListUI.java
 (locationToIndex): Special case for when variable cell heights
 are possible. (cellHeights is used instead of cellHeight).
 (indexToLocation): Special case for when variable cell heights
 are possible. (cellHeights is used instead of cellHeight).
 
 /Roman


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


-- 
Let us endeavor so to live that when we come to die even the undertaker 
will be sorry.  -- Mark Twain, Pudd'nhead Wilson's Calendar
== Evil Overlord Quote of the Day (www.eviloverlord.com) =
172. I will allow guards to operate under a flexible work schedule. That way
if one is feeling sleepy, he can call for a replacement, punch out,
take a nap, and come back refreshed and alert to finish out his shift. 


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


[cp-patches] RFC: JMenuItem null accelerators

2006-01-03 Thread Mark Wielaard
Hi,

At various points we try to register a null KeyStroke with an InputMap.
This gives some problems later on when InputMaps are copied because null
entries aren't always expected. Does the following patch make sense?

2006-01-03  Mark Wielaard  [EMAIL PROTECTED]

* javax/swing/JMenuItem.java (configurePropertiesFromAction): Only
register keyboard action when accelerator is not null.
* javax/swing/plaf/basic/BasicMenuItemUI.java (propertyChange): Only
re-register accelerator if not null.
(installKeyboardActions): Only put accelerator in map when not null.

Cheers,

Mark
Index: javax/swing/JMenuItem.java
===
RCS file: /sources/classpath/classpath/javax/swing/JMenuItem.java,v
retrieving revision 1.24
diff -u -r1.24 JMenuItem.java
--- javax/swing/JMenuItem.java	3 Jan 2006 18:42:22 -	1.24
+++ javax/swing/JMenuItem.java	3 Jan 2006 23:01:29 -
@@ -280,8 +280,9 @@
 if (! (this instanceof JMenu)  action != null)
   {
 setAccelerator((KeyStroke) (action.getValue(Action.ACCELERATOR_KEY)));
-super.registerKeyboardAction(action, accelerator, 
- JComponent.WHEN_IN_FOCUSED_WINDOW);
+if (accelerator != null)
+  super.registerKeyboardAction(action, accelerator, 
+   JComponent.WHEN_IN_FOCUSED_WINDOW);
   }
   }
 
Index: javax/swing/plaf/basic/BasicMenuItemUI.java
===
RCS file: /sources/classpath/classpath/javax/swing/plaf/basic/BasicMenuItemUI.java,v
retrieving revision 1.41
diff -u -r1.41 BasicMenuItemUI.java
--- javax/swing/plaf/basic/BasicMenuItemUI.java	19 Dec 2005 15:05:04 -	1.41
+++ javax/swing/plaf/basic/BasicMenuItemUI.java	3 Jan 2006 23:01:30 -
@@ -206,7 +206,10 @@
 map.remove((KeyStroke)e.getOldValue());
   else
 map = new ComponentInputMapUIResource(menuItem);
-  map.put((KeyStroke)e.getNewValue(), doClick);
+
+  KeyStroke accelerator = (KeyStroke) e.getNewValue();
+  if (accelerator != null)
+map.put(accelerator, doClick);
 }
 }
   }
@@ -485,7 +488,9 @@
 InputMap focusedWindowMap = SwingUtilities.getUIInputMap(menuItem, JComponent.WHEN_IN_FOCUSED_WINDOW);
 if (focusedWindowMap == null)
   focusedWindowMap = new ComponentInputMapUIResource(menuItem);
-focusedWindowMap.put(menuItem.getAccelerator(), doClick);
+KeyStroke accelerator = menuItem.getAccelerator();
+if (accelerator != null)
+  focusedWindowMap.put(accelerator, doClick);
 SwingUtilities.replaceUIInputMap(menuItem, JComponent.WHEN_IN_FOCUSED_WINDOW, focusedWindowMap);
 
 ActionMap UIActionMap = SwingUtilities.getUIActionMap(menuItem);


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


[cp-patches] Patch: FYI: @since updates

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

I happened to notice that a few constructors were missing @since tags.

Tom

2006-01-03  Tom Tromey  [EMAIL PROTECTED]

* java/io/OutputStreamWriter.java (OutputStreamWriter): Added @since.
* java/io/InputStreamReader.java (InputStreamReader): Added @since.

Index: java/io/InputStreamReader.java
===
RCS file: /cvsroot/classpath/classpath/java/io/InputStreamReader.java,v
retrieving revision 1.27
diff -u -r1.27 InputStreamReader.java
--- java/io/InputStreamReader.java  9 Nov 2005 22:40:51 -   1.27
+++ java/io/InputStreamReader.java  4 Jan 2006 00:06:55 -
@@ -230,6 +230,8 @@
* Creates an InputStreamReader that uses a decoder of the given
* charset to decode the bytes in the InputStream into
* characters.
+   * 
+   * @since 1.5
*/
   public InputStreamReader(InputStream in, Charset charset) {
 this.in = in;
@@ -244,6 +246,8 @@
   /**
* Creates an InputStreamReader that uses the given charset decoder
* to decode the bytes in the InputStream into characters.
+   * 
+   * @since 1.5
*/
   public InputStreamReader(InputStream in, CharsetDecoder decoder) {
 this.in = in;
Index: java/io/OutputStreamWriter.java
===
RCS file: /cvsroot/classpath/classpath/java/io/OutputStreamWriter.java,v
retrieving revision 1.20
diff -u -r1.20 OutputStreamWriter.java
--- java/io/OutputStreamWriter.java 26 Sep 2005 18:44:39 -  1.20
+++ java/io/OutputStreamWriter.java 4 Jan 2006 00:06:55 -
@@ -213,6 +213,8 @@
*
* @param out The codeOutputStream/code to write to
* @param cs The codeCharset/code of the encoding to use
+   * 
+   * @since 1.5
*/
   public OutputStreamWriter(OutputStream out, Charset cs)
   {
@@ -230,6 +232,8 @@
*
* @param out The codeOutputStream/code to write to
* @param enc The codeCharsetEncoder/code to encode the output with
+   * 
+   * @since 1.5
*/
   public OutputStreamWriter(OutputStream out, CharsetEncoder enc)
   {


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


[cp-patches] RFC: AX_CREATE_STDINT.m4

2006-01-03 Thread Dalibor Topic

Hi all,

the attached patch adds a generated header for C99 fixed-size integer 
types that delegates to the underlying implementation (stdint.h, 
inttypes.h) and/or creates typedefs for the missing types.


The patch uses the ax_create_stdint.m4 macro from Guido Draheim, taken 
from ac-archive.sf.net, in the current CVS head version. It is licensed 
under GPLWithACException. I've used it to fix the GNU Classpath build on 
Cygwin, where fdlibm's mprec.h trying to redefine some C99 types lead to 
compilation breakage.


The patch passes make distcheck.

If the patch is accepted, I'll post a follow up patch, to clean up the 
jni_md.h to use the corresponding C99 types, like I did in Kaffe a while 
ago. Then the x86-linux specific jni_md.h file could go away.


cheers,
dalibor topic

2006-01-04  Dalibor Topic  [EMAIL PROTECTED]

* configure.ac: Added AX_CREATE_STDINT_H

* include/Makefile.am (DISTCLEANFILES): Remove config-int.h.

* m4/ax_create_stdint_h.m4: New file.

* native/fdlibm/mprec.h: Include config-int.h. Removed C99
typedefs. Removed stdint.h and inttypes.h includes.
Index: configure.ac
===
RCS file: /sources/classpath/classpath/configure.ac,v
retrieving revision 1.122
diff -u -r1.122 configure.ac
--- configure.ac1 Jan 2006 20:57:30 -   1.122
+++ configure.ac4 Jan 2006 02:42:36 -
@@ -556,6 +556,8 @@
   esac],
   [])
 
+AX_CREATE_STDINT_H([include/config-int.h])
+
 dnl ---
 dnl output files
 dnl ---
Index: include/Makefile.am
===
RCS file: /sources/classpath/classpath/include/Makefile.am,v
retrieving revision 1.51
diff -u -r1.51 Makefile.am
--- include/Makefile.am 22 Dec 2005 09:36:02 -  1.51
+++ include/Makefile.am 4 Jan 2006 02:42:36 -
@@ -1,6 +1,6 @@
 include_HEADERS = jni.h jni_md.h jawt.h jawt_md.h
 
-DISTCLEANFILES = jni_md.h
+DISTCLEANFILES = jni_md.h config-int.h
 
 ARG_JNI_JAVAH = -jni
 ARG_CLASSPATH_JAVAH = -bootclasspath
Index: m4/ax_create_stdint_h.m4
===
RCS file: m4/ax_create_stdint_h.m4
diff -N m4/ax_create_stdint_h.m4
--- /dev/null   1 Jan 1970 00:00:00 -
+++ m4/ax_create_stdint_h.m44 Jan 2006 02:42:39 -
@@ -0,0 +1,685 @@
+dnl @synopsis AX_CREATE_STDINT_H [( HEADER-TO-GENERATE [, HEDERS-TO-CHECK])]
+dnl
+dnl the ISO C9X: 7.18 Integer types stdint.h section requires the
+dnl existence of an include file stdint.h that defines a set of
+dnl typedefs, especially uint8_t,int32_t,uintptr_t. Many older
+dnl installations will not provide this file, but some will have the
+dnl very same definitions in inttypes.h. In other enviroments we can
+dnl use the inet-types in sys/types.h which would define the typedefs
+dnl int8_t and u_int8_t respectivly.
+dnl
+dnl This macros will create a local _stdint.h or the headerfile given
+dnl as an argument. In many cases that file will just #include
+dnl stdint.h or #include inttypes.h, while in other environments
+dnl it will provide the set of basic 'stdint's definitions/typedefs:
+dnl
+dnl   int8_t,uint8_t,int16_t,uint16_t,int32_t,uint32_t,intptr_t,uintptr_t
+dnl   int_least32_t.. int_fast32_t.. intmax_t
+dnl
+dnl which may or may not rely on the definitions of other files, or
+dnl using the AC_CHECK_SIZEOF macro to determine the actual sizeof each
+dnl type.
+dnl
+dnl if your header files require the stdint-types you will want to
+dnl create an installable file mylib-int.h that all your other
+dnl installable header may include. So if you have a library package
+dnl named mylib, just use
+dnl
+dnl  AX_CREATE_STDINT_H(mylib-int.h)
+dnl
+dnl in configure.ac and go to install that very header file in
+dnl Makefile.am along with the other headers (mylib.h) - and the
+dnl mylib-specific headers can simply use #include mylib-int.h to
+dnl obtain the stdint-types.
+dnl
+dnl Remember, if the system already had a valid stdint.h, the
+dnl generated file will include it directly. No need for fuzzy
+dnl HAVE_STDINT_H things...
+dnl
+dnl @category C
+dnl @author Guido Draheim [EMAIL PROTECTED]
+dnl @version 2003-12-07
+dnl @license GPLWithACException
+
+AC_DEFUN([AX_CHECK_DATA_MODEL],[
+   AC_CHECK_SIZEOF(char)
+   AC_CHECK_SIZEOF(short)
+   AC_CHECK_SIZEOF(int)
+   AC_CHECK_SIZEOF(long)
+   AC_CHECK_SIZEOF(void*)
+   ac_cv_char_data_model=
+   ac_cv_char_data_model=$ac_cv_char_data_model$ac_cv_sizeof_char
+   ac_cv_char_data_model=$ac_cv_char_data_model$ac_cv_sizeof_short
+   ac_cv_char_data_model=$ac_cv_char_data_model$ac_cv_sizeof_int
+   ac_cv_long_data_model=
+   ac_cv_long_data_model=$ac_cv_long_data_model$ac_cv_sizeof_int
+   ac_cv_long_data_model=$ac_cv_long_data_model$ac_cv_sizeof_long
+