[cp-patches] FYI: JList.setModel() argument check
I committed this small change to fix two failing Mauve tests: 2005-11-09 David Gilbert <[EMAIL PROTECTED]> * javax/swing/JList.java (setModel): throw IllegalArgumentException for null model. Regards, Dave Index: javax/swing/JList.java === RCS file: /cvsroot/classpath/classpath/javax/swing/JList.java,v retrieving revision 1.38 diff -u -r1.38 JList.java --- javax/swing/JList.java 26 Oct 2005 19:09:52 - 1.38 +++ javax/swing/JList.java 9 Nov 2005 10:45:35 - @@ -1620,10 +1620,15 @@ * #listListener} is unsubscribed from the existing model, if it exists, * and re-subscribed to the new model. * - * @param model The new property value + * @param model the new model (null not permitted). + * + * @throws IllegalArgumentException if model is + * null. */ public void setModel(ListModel model) { +if (model == null) + throw new IllegalArgumentException("Null 'model' argument."); if (this.model == model) return; ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] FYI: Was: gnu_java_awt_peer_gtk_GdkFontPeer.c (initStaticState): missing NewGlobalRef?
Hi! As discussed on classpath, this one is commited. Maybe more to come... TWISTI 2005-11-09 Christian Thalinger <[EMAIL PROTECTED]> * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c (initStaticState): Register global variable glyphVector_class as global reference. Index: native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c === RCS file: /cvsroot/classpath/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c,v retrieving revision 1.10 diff -u -3 -p -r1.10 gnu_java_awt_peer_gtk_GdkFontPeer.c --- native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c 19 Sep 2005 05:47:09 - 1.10 +++ native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c 9 Nov 2005 09:57:14 - @@ -65,6 +65,9 @@ Java_gnu_java_awt_peer_gtk_GdkFontPeer_i glyphVector_class = (*env)->FindClass (env, "gnu/java/awt/peer/gtk/GdkGlyphVector"); + glyphVector_class = (*env)->NewGlobalRef +(env, glyphVector_class); + glyphVector_ctor = (*env)->GetMethodID (env, glyphVector_class, "", "([D[ILjava/awt/Font;Ljava/awt/font/FontRenderContext;)V"); ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] FYI: BasicTextUI fixlet
I committed this little fixlet for the BasicTextUI. This should solve the problem with textfields where the text is slightly off when displaying right-aligned. 2005-11-09 Roman Kennke <[EMAIL PROTECTED]> * javax/swing/plaf/basic/BasicTextUI.java (getVisibleEditorRect): Correctly calculate the inner rectangle. /Roman Index: javax/swing/plaf/basic/BasicTextUI.java === RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicTextUI.java,v retrieving revision 1.52 diff -u -r1.52 BasicTextUI.java --- javax/swing/plaf/basic/BasicTextUI.java 8 Nov 2005 15:03:11 - 1.52 +++ javax/swing/plaf/basic/BasicTextUI.java 9 Nov 2005 10:19:42 - @@ -831,10 +831,10 @@ { Caret caret = textComponent.getCaret(); Highlighter highlighter = textComponent.getHighlighter(); - + if (textComponent.isOpaque()) paintBackground(g); - + if (highlighter != null && textComponent.getSelectionStart() != textComponent.getSelectionEnd()) highlighter.paint(g); @@ -1064,8 +1064,8 @@ Insets insets = textComponent.getInsets(); return new Rectangle(insets.left, insets.top, - width - insets.left + insets.right, - height - insets.top + insets.bottom); + width - insets.left - insets.right, + height - insets.top - insets.bottom); } /** ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
Re: [cp-patches] FYI: BasicTextUI fixlet
Oddly, this seems to also have fixed a problem with the vertical alignment of text in editable JComboBoxes under the MetalLookAndFeel. I'm very happy about that... Regards, Dave Roman Kennke wrote: I committed this little fixlet for the BasicTextUI. This should solve the problem with textfields where the text is slightly off when displaying right-aligned. 2005-11-09 Roman Kennke <[EMAIL PROTECTED]> * javax/swing/plaf/basic/BasicTextUI.java (getVisibleEditorRect): Correctly calculate the inner rectangle. /Roman Index: javax/swing/plaf/basic/BasicTextUI.java === RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicTextUI.java,v retrieving revision 1.52 diff -u -r1.52 BasicTextUI.java --- javax/swing/plaf/basic/BasicTextUI.java 8 Nov 2005 15:03:11 - 1.52 +++ javax/swing/plaf/basic/BasicTextUI.java 9 Nov 2005 10:19:42 - @@ -831,10 +831,10 @@ { Caret caret = textComponent.getCaret(); Highlighter highlighter = textComponent.getHighlighter(); - + if (textComponent.isOpaque()) paintBackground(g); - + if (highlighter != null && textComponent.getSelectionStart() != textComponent.getSelectionEnd()) highlighter.paint(g); @@ -1064,8 +1064,8 @@ Insets insets = textComponent.getInsets(); return new Rectangle(insets.left, insets.top, -width - insets.left + insets.right, -height - insets.top + insets.bottom); +width - insets.left - insets.right, +height - insets.top - insets.bottom); } /** ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
Re: [cp-patches] FYI: BasicTextUI fixlet
I looked more closely at the patch, and it's not so odd that this problem is fixed. Thanks Roman! Regards, Dave David Gilbert wrote: Oddly, this seems to also have fixed a problem with the vertical alignment of text in editable JComboBoxes under the MetalLookAndFeel. I'm very happy about that... Regards, Dave Roman Kennke wrote: I committed this little fixlet for the BasicTextUI. This should solve the problem with textfields where the text is slightly off when displaying right-aligned. 2005-11-09 Roman Kennke <[EMAIL PROTECTED]> * javax/swing/plaf/basic/BasicTextUI.java (getVisibleEditorRect): Correctly calculate the inner rectangle. /Roman Index: javax/swing/plaf/basic/BasicTextUI.java === RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicTextUI.java,v retrieving revision 1.52 diff -u -r1.52 BasicTextUI.java --- javax/swing/plaf/basic/BasicTextUI.java8 Nov 2005 15:03:11 -1.52 +++ javax/swing/plaf/basic/BasicTextUI.java9 Nov 2005 10:19:42 - @@ -831,10 +831,10 @@ { Caret caret = textComponent.getCaret(); Highlighter highlighter = textComponent.getHighlighter(); -+ if (textComponent.isOpaque()) paintBackground(g); -+ if (highlighter != null && textComponent.getSelectionStart() != textComponent.getSelectionEnd()) highlighter.paint(g); @@ -1064,8 +1064,8 @@ Insets insets = textComponent.getInsets(); return new Rectangle(insets.left, insets.top, - width - insets.left + insets.right, - height - insets.top + insets.bottom); + width - insets.left - insets.right, + height - insets.top - insets.bottom); } /** ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] FYI: JComponent fixlet
I committed the attached fix that moves the getComponentGraphics() fetch from paintComponent() to paint(). Some simple tests show that this is the right thing and it also fixes a problem with an app I have here. 2005-11-09 Roman Kennke <[EMAIL PROTECTED]> * javax/swing/JComponent.java (paint): Fetch a new componentGraphics here instead of paintComponent. (paintComponent): Don't fetch the componentGraphics here. This must be done in paint. /Roman Index: javax/swing/JComponent.java === RCS file: /cvsroot/classpath/classpath/javax/swing/JComponent.java,v retrieving revision 1.77 diff -u -r1.77 JComponent.java --- javax/swing/JComponent.java 8 Nov 2005 13:53:59 - 1.77 +++ javax/swing/JComponent.java 9 Nov 2005 14:41:55 - @@ -1685,10 +1685,11 @@ { if (g.getClip() == null) g.setClip(0, 0, getWidth(), getHeight()); -paintComponent(g); -paintBorder(g); -paintChildren(g); -Rectangle clip = g.getClipBounds(); +Graphics g2 = getComponentGraphics(g); +paintComponent(g2); +paintBorder(g2); +paintChildren(g2); +Rectangle clip = g2.getClipBounds(); if (clip.x == 0 && clip.y == 0 && clip.width == getWidth() && clip.height == getHeight()) RepaintManager.currentManager(this).markCompletelyClean(this); @@ -1785,7 +1786,7 @@ Graphics g2 = g; if (!(g instanceof Graphics2D)) g2 = g.create(); -ui.update(getComponentGraphics(g2), this); +ui.update(g2, this); if (!(g instanceof Graphics2D)) g2.dispose(); } ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
Re: [cp-patches] Patch: implemented InvocationEvent.getThrowable
On Tue, 2005-11-08 at 18:30 -0700, Tom Tromey wrote: > > "Tony" == Anthony Balkissoon <[EMAIL PROTECTED]> writes: > > Tony> Thanks for the advice Mark, I fixed this up and committed it. > Tony> 2005-11-08 Anthony Balkissoon <[EMAIL PROTECTED]> > Tony> * java/awt/event/InvocationEvent.java: > Tony> (exception): Removed unnecessary field. > > Actually, this field is still required for serialization. > > Tom > Ack, okay I'll put it back. For future reference, how do I know when a field is or isn't required for serialization? --Tony ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] FYI: ObjectReferenceFactory API fix.
2005-11-09 Audrius Meskauskas <[EMAIL PROTECTED]> * org/omg/PortableInterceptor/ObjectReferenceFactory.java: Do not inherit from org.omg.CORBA.Object Index: org/omg/PortableInterceptor/ObjectReferenceFactory.java === RCS file: /cvsroot/classpath/classpath/org/omg/PortableInterceptor/ObjectReferenceFactory.java,v retrieving revision 1.1 diff -u -r1.1 ObjectReferenceFactory.java --- org/omg/PortableInterceptor/ObjectReferenceFactory.java 26 Oct 2005 20:57:54 - 1.1 +++ org/omg/PortableInterceptor/ObjectReferenceFactory.java 9 Nov 2005 15:37:12 - @@ -52,6 +52,6 @@ * @author Audrius Meskauskas, Lithuania ([EMAIL PROTECTED]) */ public interface ObjectReferenceFactory - extends ObjectReferenceFactoryOperations, IDLEntity, org.omg.CORBA.Object + extends ObjectReferenceFactoryOperations, IDLEntity { } ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
Re: [cp-patches] Patch: implemented InvocationEvent.getThrowable
> "Tony" == Anthony Balkissoon <[EMAIL PROTECTED]> writes: Tony> Ack, okay I'll put it back. For future reference, how do I know Tony> when a field is or isn't required for serialization? The simplest way is to look at the online javadoc. There is a "serialized form" link which shows how the object looks in a serialized stream. Tom ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
Re: [cp-patches] Patch: implemented InvocationEvent.getThrowable
Hi there, Am Mittwoch, den 09.11.2005, 10:40 -0500 schrieb Anthony Balkissoon: > On Tue, 2005-11-08 at 18:30 -0700, Tom Tromey wrote: > > > "Tony" == Anthony Balkissoon <[EMAIL PROTECTED]> writes: > > > > Tony> Thanks for the advice Mark, I fixed this up and committed it. > > Tony> 2005-11-08 Anthony Balkissoon <[EMAIL PROTECTED]> > > Tony> * java/awt/event/InvocationEvent.java: > > Tony> (exception): Removed unnecessary field. > > > > Actually, this field is still required for serialization. > > > > Tom > > > > Ack, okay I'll put it back. For future reference, how do I know when a > field is or isn't required for serialization? In the API docs there is (for some classes like this) a page 'Serialized form' that describes which fields are serialized. The link is below the class description in the See also: field. /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] FYI: FileChooserDemo
I added a demo for the JFileChooser component, and integrated this into the gnu.classpath.examples.swing.Demo class. I also made a change to the latter class so that the buttons at the bottom appear in two rows now, so that the demo frame isn't so wide: 2005-11-09 David Gilbert <[EMAIL PROTECTED]> * examples/gnu/classpath/examples/swing/Demo.java (mkMenuBar): added file chooser item, (mkButtonBar): split buttons into two rows, added 'FileChooser' button, * examples/gnu/classpath/examples/swing/FileChooserDemo.java: New file. Regards, Dave Index: examples/gnu/classpath/examples/swing/Demo.java === RCS file: /cvsroot/classpath/classpath/examples/gnu/classpath/examples/swing/Demo.java,v retrieving revision 1.27 diff -u -r1.27 Demo.java --- examples/gnu/classpath/examples/swing/Demo.java 4 Nov 2005 12:23:13 - 1.27 +++ examples/gnu/classpath/examples/swing/Demo.java 9 Nov 2005 16:20:36 - @@ -211,6 +211,10 @@ (new TextFieldDemo("TextField Demo")).createContent(), examples); +new PopUpAction("FileChooser", +(new FileChooserDemo("FileChooser Demo")).createContent(), +examples); + new PopUpAction("ColorChooser", mkColorChooser(), examples); @@ -1018,28 +1022,29 @@ private JPanel mkButtonBar() { -JPanel panel = new JPanel (); -panel.setLayout(new FlowLayout()); +JPanel panel = new JPanel (new GridLayout(2, 1)); +JPanel panelA = new JPanel(new FlowLayout()); +JPanel panelB = new JPanel(new FlowLayout()); new PopUpAction("Buttons", (new ButtonDemo("Button Demo")).createContent(), - panel); + panelA); new PopUpAction("Toggles", mkToggle("cool and refreshing"), - panel); + panelA); new PopUpAction("Checkbox", mkCheckbox("ice cold"), - panel); + panelA); new PopUpAction("Radio", mkRadio("delicious"), - panel); + panelA); new PopUpAction("Slider", (new SliderDemo("Slider Demo")).createContent(), - panel); + panelA); new PopUpAction("List", mkListPanel(new String[] { "hello", @@ -1050,56 +1055,60 @@ "that", "wraps", "over"}), - panel); + panelA); new PopUpAction("Scrollbar", (new ScrollBarDemo("ScrollBar Demo")).createContent(), - panel); + panelA); new PopUpAction("Viewport", mkViewportBox(mkBigButton("View Me!")), - panel); + panelA); new PopUpAction("ScrollPane", mkScrollPane(mkBigButton("Scroll Me!")), - panel); + panelA); new PopUpAction("TabPane", mkTabs(new String[] {"happy", "sad", "indifferent"}), - panel); + panelB); new PopUpAction("Spinner", mkSpinner(), - panel); + panelB); new PopUpAction("TextField", (new TextFieldDemo("TextField Demo")).createContent(), - panel); + panelB); + +new PopUpAction("FileChooser", +(new FileChooserDemo("FileChooser Demo")).createContent(), +panelB); new PopUpAction("ColorChooser", mkColorChooser(), - panel); + panelB); new PopUpAction("ComboBox", (new ComboBoxDemo("ComboBox Demo")).createContent(), - panel); + panelB); new PopUpAction("Editor", mkEditorPane(), -panel); +panelB); new PopUpAction("Tree", mkTree(), -panel); +panelB); new PopUpAction("Table", mkTable(), -panel); +panelB); JButton exitDisposer = mkDisposerButton(frame); -panel.add(exitDisposer); +panelB.add(exitDisposer); exitDisposer.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -1107,6 +1116,8 @@ System.exit(1); } }); +panel.add(panelA); +panel.add(panelB); return pane
[cp-patches] Patch: JTabbedPane fix
Made this fix because there were several problems when the layout mode was set to SCROLLING. There are still some problems I am working on. 2005-11-09 Lillian Angel <[EMAIL PROTECTED]> * javax/swing/JTabbedPane.java (setComponent): Added check to prevent infinite loops. * javax/swing/plaf/metal/MetalTabbedPaneUI.java (createLayoutManager): Should call super here, so the layout is set properly depending on the layout mode. Index: javax/swing/JTabbedPane.java === RCS file: /cvsroot/classpath/classpath/javax/swing/JTabbedPane.java,v retrieving revision 1.22 diff -u -r1.22 JTabbedPane.java --- javax/swing/JTabbedPane.java 19 Oct 2005 15:45:04 - 1.22 +++ javax/swing/JTabbedPane.java 9 Nov 2005 16:48:30 - @@ -337,9 +337,12 @@ */ public void setComponent(Component c) { + if (c != null) +{ remove(component); this.component = c; add(c); +} } /** Index: javax/swing/plaf/metal/MetalTabbedPaneUI.java === RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/metal/MetalTabbedPaneUI.java,v retrieving revision 1.9 diff -u -r1.9 MetalTabbedPaneUI.java --- javax/swing/plaf/metal/MetalTabbedPaneUI.java 27 Oct 2005 09:50:58 - 1.9 +++ javax/swing/plaf/metal/MetalTabbedPaneUI.java 9 Nov 2005 16:48:30 - @@ -127,7 +127,7 @@ */ protected LayoutManager createLayoutManager() { -return new TabbedPaneLayout(); +return super.createLayoutManager(); } /** ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] FYI: New 1.5 CORBA classes.
2005-11-09 Audrius Meskauskas <[EMAIL PROTECTED]> * org/omg/PortableInterceptor/ObjectReferenceTemplate.java, * org/omg/PortableInterceptor/ObjectReferenceTemplateHelper.java, * org/omg/PortableInterceptor/ObjectReferenceTemplateHolder.java: New files. ObjectReferenceTemplate.tar.gz Description: GNU Zip compressed data ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] FYI: Two more CORBA classes
2005-11-09 Audrius Meskauskas <[EMAIL PROTECTED]> * org/omg/PortableInterceptor/ObjectReferenceTemplateSeqHelper.java, * org/omg/PortableInterceptor/ObjectReferenceTemplateSeqHolder.java: New files. /* ObjectReferenceTemplateSeqHolder.java -- Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License cover the whole combination. As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. */ package org.omg.PortableInterceptor; import org.omg.CORBA.portable.Streamable; import org.omg.CORBA.portable.InputStream; import org.omg.CORBA.portable.OutputStream; /** * A holder for the array of [EMAIL PROTECTED] ObjectReferenceTemplate}s. * * @author Audrius Meskauskas, Lithuania ([EMAIL PROTECTED]) */ public class ObjectReferenceTemplateSeqHolder implements Streamable { /** * The stored ObjectReferenceTemplate value. */ public ObjectReferenceTemplate[] value; /** * Create the unitialised instance, leaving the value field with default * null value. */ public ObjectReferenceTemplateSeqHolder() { } /** * Create the initialised instance. * * @param initialValue the value that will be assigned to the * value field. */ public ObjectReferenceTemplateSeqHolder(ObjectReferenceTemplate[] initialValue) { value = initialValue; } /** * Fill in the [EMAIL PROTECTED] value} by data from the CDR stream. * * @param input the org.omg.CORBA.portable stream to read. */ public void _read(InputStream input) { value = ObjectReferenceTemplateSeqHelper.read(input); } /** * Write the stored value into the CDR stream. * * @param output the org.omg.CORBA.portable stream to write. */ public void _write(OutputStream output) { ObjectReferenceTemplateSeqHelper.write(output, value); } /** * Get the typecode of the ObjectReferenceTemplate. */ public org.omg.CORBA.TypeCode _type() { return ObjectReferenceTemplateSeqHelper.type(); } } /* ObjectReferenceTemplateSeqHelper.java -- Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License cover the whole combination. As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent mod
[cp-patches] Patch: ComponentInputMaps implemented
This patch fixes all the FIXME notes in ComponentInputMap and tidies a few places in JComponent relating to ComponentInputMap. The main method however, JComponent.udpateComponentInputMap is not fully implemented because I first have to write a KeyboardManager class, which I'll do now. 2005-11-09 Anthony Balkissoon <[EMAIL PROTECTED]> * javax/swing/ComponentInputMap.java: (put): Notify the component. (clear): Likewise. (remove): Likewise. (setParent): Notify the parent. Improved the exception messages. * javax/swing/JComponent.java: (inputMap_whenInFocusedWindow): Changed type from InputMap to ComponentInputMap. (setInputMap): If we're setting the WHEN_IN_FOCUSED_WINDOW map and the parameter is not a ComponentInputMap or is not associated with the same Component, throw an IllegalArgumentException. (getInputMap): Create a new ComponentInputMap instead of a new InputMap when the WHEN_IN_FOCUSED_WINDOW map doesn't yet exist. (udpateComponentInputMap): New method. This is the method that ComponentInputMap calls when it is updated. Not yet completely implemented. --Tony Index: javax/swing/ComponentInputMap.java === RCS file: /cvsroot/classpath/classpath/javax/swing/ComponentInputMap.java,v retrieving revision 1.8 diff -u -r1.8 ComponentInputMap.java --- javax/swing/ComponentInputMap.java 26 Jul 2005 15:30:54 - 1.8 +++ javax/swing/ComponentInputMap.java 9 Nov 2005 19:07:40 - @@ -78,7 +78,8 @@ public void put(KeyStroke keystroke, Object value) { super.put(keystroke, value); -// FIXME: Notify component. +if (component != null) + component.updateComponentInputMap(this); } /** @@ -87,7 +88,8 @@ public void clear() { super.clear(); -// FIXME: Notify component. +if (component != null) + component.updateComponentInputMap(this); } /** @@ -98,7 +100,8 @@ public void remove(KeyStroke keystroke) { super.remove(keystroke); -// FIXME: Notify component. +if (component != null) + component.updateComponentInputMap(this); } /** @@ -111,14 +114,19 @@ */ public void setParent(InputMap parentMap) { -if (! (parentMap instanceof ComponentInputMap)) - throw new IllegalArgumentException(); - -if (((ComponentInputMap) parentMap).getComponent() != component) - throw new IllegalArgumentException(); +if (parentMap != null && !(parentMap instanceof ComponentInputMap)) + throw new IllegalArgumentException("ComponentInputMaps can only have " + + "ComponentInputMaps for parents"); + +if (parentMap != null && +((ComponentInputMap) parentMap).getComponent() != component) + throw new +IllegalArgumentException("ComponentInputMaps' parents must " + + "be associated with the same JComponents"); super.setParent(parentMap); -// FIXME: Notify component. +if (component != null) + component.updateComponentInputMap(this); } /** Index: javax/swing/JComponent.java === RCS file: /cvsroot/classpath/classpath/javax/swing/JComponent.java,v retrieving revision 1.78 diff -u -r1.78 JComponent.java --- javax/swing/JComponent.java 9 Nov 2005 14:44:00 - 1.78 +++ javax/swing/JComponent.java 9 Nov 2005 19:07:41 - @@ -546,7 +546,7 @@ private InputMap inputMap_whenFocused; private InputMap inputMap_whenAncestorOfFocused; - private InputMap inputMap_whenInFocusedWindow; + private ComponentInputMap inputMap_whenInFocusedWindow; private ActionMap actionMap; /** @since 1.3 */ private boolean verifyInputWhenFocusTarget; @@ -2022,7 +2022,11 @@ break; case WHEN_IN_FOCUSED_WINDOW: -inputMap_whenInFocusedWindow = map; +if (map != null && !(map instanceof ComponentInputMap)) +throw new + IllegalArgumentException("WHEN_IN_FOCUSED_WINDOW " + + "InputMap must be a ComponentInputMap"); +inputMap_whenInFocusedWindow = (ComponentInputMap)map; break; case UNDEFINED_CONDITION: @@ -2048,7 +2052,7 @@ case WHEN_IN_FOCUSED_WINDOW: if (inputMap_whenInFocusedWindow == null) - inputMap_whenInFocusedWindow = new InputMap(); + inputMap_whenInFocusedWindow = new ComponentInputMap(this); return inputMap_whenInFocusedWindow; case UNDEFINED_CONDITION: @@ -3297,5 +3301,27 @@ found = p; } return found; + } + + /** + * This is the method that gets called when the WHEN_IN_FOCUSED_WINDOW map + * is changed. + * @param c the JComponent associated with the WHEN_IN_FOCUSED_WINDOW map + */ + void updateComponentInputMap(Componen
Re: [cp-patches] Patch: implemented InvocationEvent.getThrowable
On Tue, 2005-11-08 at 18:30 -0700, Tom Tromey wrote: > Actually, this field is still required for serialization. Fixed. 2005-11-09 Anthony Balkissoon <[EMAIL PROTECTED]> * java/awt/event/InvocationEvent.java: (exception): Replaced this field (removed yesterday) because it is needed for serialization. (dispatch): Save thrown exception. (getException): Directly return exception, no need to cast throwable. --Tony Index: java/awt/event/InvocationEvent.java === RCS file: /cvsroot/classpath/classpath/java/awt/event/InvocationEvent.java,v retrieving revision 1.11 diff -u -r1.11 InvocationEvent.java --- java/awt/event/InvocationEvent.java 8 Nov 2005 20:51:39 - 1.11 +++ java/awt/event/InvocationEvent.java 9 Nov 2005 19:21:58 - @@ -98,6 +98,15 @@ protected boolean catchExceptions; /** + * This is the caught exception thrown in the run() method. It + * is null if exceptions are ignored, the run method hasn't completed, or + * there were no exceptions. + * + * @serial the caught exception, if any + */ + private Exception exception; + + /** * This is the caught Throwable thrown in the run() method. * It is null if throwables are ignored, the run method hasn't completed, * or there were no throwables thrown. @@ -184,6 +193,8 @@ catch (Throwable t) { throwable = t; + if (t instanceof Exception) +exception = (Exception)t; } else runnable.run(); @@ -205,9 +216,7 @@ */ public Exception getException() { -if (throwable == null || !(throwable instanceof Exception)) - return null; -return (Exception) throwable; +return exception; } /** ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] Fix for Eclipse-related Ælfred2 bu g
This fixes a problem in the Ælfred2 SAX parser whereby a MalformedURLException was being thrown even though a custom URI resolver was set on the parser instance. Reported by Michael Koch. 2005-11-09 Chris Burdess <[EMAIL PROTECTED]> * gnu/xml/aelfred2/SAXDriver.java: Ensure that absolutize does not throw exception when custom entity resolver is set. -- 犬 Chris Burdess "They that can give up essential liberty to obtain a little safety deserve neither liberty nor safety." - Benjamin Franklin patch Description: Binary data ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] FYI: [doc] Add cp-tools gjdoc download link
Hi, It was pointed out that there was no dowload link for cp-tools gjdoc on the website. This fixes that. 2005-11-09 Mark Wielaard <[EMAIL PROTECTED]> * doc/www.gnu.org/cp-tools/cp-tools.wml: Add gjdoc download link. Committed, Mark diff -u -r1.2 cp-tools.wml --- doc/www.gnu.org/cp-tools/cp-tools.wml 2 Mar 2005 16:15:06 - 1.2 +++ doc/www.gnu.org/cp-tools/cp-tools.wml 9 Nov 2005 20:51:56 - @@ -35,6 +35,15 @@ +GNU Classpath::Tools::Downloads + +At the moment there are only official releases of gjdoc on +ftp://ftp.gnu.org/gnu/classpath/"; name="ftp.gnu.org"/>. +All other tools are available from CVS from the savannah project page below. + + + + GNU Classpath::Tools::Development GNU Classpath Tools is part of the GNU Classpath project which is hosted at 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] RFC: new VM interface for Socket impls
Hi, Ingo has abstracted out the native code from gnu.java.net.PlainSocketImpl and gnu.java.net.PlainDatagramSocketImpl into a new VM interface. This allows VM implementors to provide a different implementation for the native parts of these classes if they wish. Is this ok to commit as it is? Do you have any suggestions/improvements to the interface? We would like to have a stable VM interface for this area, so maybe it would be helpful to discuss this with other VM implementors... 2005-11-09 Roman Kennke <[EMAIL PROTECTED]> Reported by Ingo Proetel <[EMAIL PROTECTED]> * vm/reference/gnu/java/net/VMPlainSocketImpl.java: New VM class. * vm/reference/gnu/java/net/VMPlainDatagramSocketImpl.java: New VM class. * native/jni/java-net/gnu_java_net_VMPlainSocketImpl.c: New file. * native/jni/java-net/gnu_java_net_VMPlainDatagramSocketImpl.c: New file. * native/jni/java-net/gnu_java_net_PlainDatagramSocketImpl.c: Removed. * native/jni/java-net/gnu_java_net_PlainSocketImpl.c: Removed. * native/jni/java-net/Makefile.am: Adjusted for new source files. * gnu/java/net/PlainDatagramSocketImpl.java: Use new VM interface. * gnu/java/net/PlainSocketImpl.java: Use new VM interface. * include/gnu_java_net_PlainDatagramSocketImpl.h: Removed. * include/gnu_java_net_PlainSocketImpl.h: Removed. * include/gnu_java_net_VMPlainDatagramSocketImpl.h: New header file. * include/gnu_java_net_VMPlainSocketImpl.h: New header file. /Roman patch.diff.gz Description: GNU Zip compressed data ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
Re: [cp-patches] Patch: JTabbedPane fix
Another JTabbedPane fix. 2005-11-09 Lillian Angel <[EMAIL PROTECTED]> * javax/swing/JTabbedPane.java (setComponent): No need to remove and add tab. (remove): Fixed API documentation. (remove): Fixed API documentation. Re-implemented according to API. On Wed, 2005-11-09 at 11:53 -0500, Lillian Angel wrote: > Made this fix because there were several problems when the layout mode > was set to SCROLLING. There are still some problems I am working on. > > 2005-11-09 Lillian Angel <[EMAIL PROTECTED]> > > * javax/swing/JTabbedPane.java > (setComponent): Added check to prevent infinite loops. > * javax/swing/plaf/metal/MetalTabbedPaneUI.java > (createLayoutManager): Should call super here, so the layout > is set properly depending on the layout mode. > > ___ > Classpath-patches mailing list > Classpath-patches@gnu.org > http://lists.gnu.org/mailman/listinfo/classpath-patches Index: javax/swing/JTabbedPane.java === RCS file: /cvsroot/classpath/classpath/javax/swing/JTabbedPane.java,v retrieving revision 1.23 diff -u -r1.23 JTabbedPane.java --- javax/swing/JTabbedPane.java 9 Nov 2005 16:52:35 - 1.23 +++ javax/swing/JTabbedPane.java 9 Nov 2005 21:25:51 - @@ -337,12 +337,7 @@ */ public void setComponent(Component c) { - if (c != null) -{ - remove(component); - add(c); - this.component = c; -} + component = c; } /** @@ -1054,9 +1050,9 @@ } /** - * The tab and it's associated component are removed. After the component - * has been removed from the JTabbedPane, it's set visible to ensure that - * it can be seen. + * Removes the tab at index. After the component associated with + * index is removed, its visibility is reset to true to ensure it + * will be visible if added to other containers. * * @param index The index of the tab to remove. */ @@ -1070,24 +1066,17 @@ } /** - * This method removes the component from the JTabbedPane. After the - * component has been removed from the JTabbedPane, it's set visible to - * ensure that it can be seen. + * Removes the specified Component from the JTabbedPane. * * @param component The Component to remove. */ public void remove(Component component) { -// This simply removes the component. -int index = indexOfComponent(component); super.remove(component); -component.show(); -setComponentAt(index, null); } /** - * This method removes the tab and component from the JTabbedPane. It simply - * calls removeTabAt(int index). + * Removes the tab and component which corresponds to the specified index. * * @param index The index of the tab to remove. */ ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] removing duplicate --enable-xmlj from INSTALL
--enable-xmlj compile native libxml/xslt library default=no This line is twice in INSTALL. The attached patch removes the later one of these. Regards, Petteri Index: INSTALL === RCS file: /cvsroot/classpath/classpath/INSTALL,v retrieving revision 1.33 diff -u -b -B -r1.33 INSTALL --- INSTALL 7 Oct 2005 03:21:02 - 1.33 +++ INSTALL 9 Nov 2005 21:33:13 - @@ -127,7 +127,6 @@ --enable-Werror whether to compile C code with -Werror which turns any compiler warning into a compilation failure default=no - --enable-xmlj compile native libxml/xslt library default=no --with-gjdoc generate documentation using gjdoc default=no --with-jay Regenerate the parsers with jay must be given the path to the jay executable signature.asc Description: OpenPGP digital signature ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
Re: [cp-patches] Patch: JTabbedPane fix
I made a mistake in my last patch. In setComponent we do need to add and remove the tab, but it is done differently now. Before it was adding the tab with no title (therefore adding an empty tab), and removing it by calling the wrong remove function. This is now fixed. 2005-11-09 Lillian Angel <[EMAIL PROTECTED]> * javax/swing/JTabbedPane.java (setComponent): Tab should be inserted with a title, and removed from the vector once set. (removeTabAt): Tab should only be removed from vector. remove(Component) is called to remove the tab from the JTabbedPane. (remove): Added call to the component. This function should remove the component as well as the tab. On Wed, 2005-11-09 at 16:29 -0500, Lillian Angel wrote: > Another JTabbedPane fix. > > 2005-11-09 Lillian Angel <[EMAIL PROTECTED]> > > * javax/swing/JTabbedPane.java > (setComponent): No need to remove and add tab. > (remove): Fixed API documentation. > (remove): Fixed API documentation. Re-implemented according to > API. > > > On Wed, 2005-11-09 at 11:53 -0500, Lillian Angel wrote: > > Made this fix because there were several problems when the layout mode > > was set to SCROLLING. There are still some problems I am working on. > > > > 2005-11-09 Lillian Angel <[EMAIL PROTECTED]> > > > > * javax/swing/JTabbedPane.java > > (setComponent): Added check to prevent infinite loops. > > * javax/swing/plaf/metal/MetalTabbedPaneUI.java > > (createLayoutManager): Should call super here, so the layout > > is set properly depending on the layout mode. > > > > ___ > > Classpath-patches mailing list > > Classpath-patches@gnu.org > > http://lists.gnu.org/mailman/listinfo/classpath-patches > ___ > Classpath-patches mailing list > Classpath-patches@gnu.org > http://lists.gnu.org/mailman/listinfo/classpath-patches Index: javax/swing/JTabbedPane.java === RCS file: /cvsroot/classpath/classpath/javax/swing/JTabbedPane.java,v retrieving revision 1.24 diff -u -r1.24 JTabbedPane.java --- javax/swing/JTabbedPane.java 9 Nov 2005 21:30:10 - 1.24 +++ javax/swing/JTabbedPane.java 9 Nov 2005 22:02:16 - @@ -337,7 +337,10 @@ */ public void setComponent(Component c) { + int i = indexOfComponent(component); + insertTab(title, icon, c, tip, i); component = c; + removeTabAt(i); } /** @@ -1059,10 +1062,8 @@ public void removeTabAt(int index) { checkIndex(index, 0, tabs.size()); -Component c = getComponentAt(index); -super.remove(index); -c.show(); tabs.remove(index); +getComponentAt(index).show(); } /** @@ -1082,6 +1083,7 @@ */ public void remove(int index) { +remove(getComponentAt(index)); removeTabAt(index); } ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] Patch (Suggestions Needed): JComponent key bindings
This patch implements the package-private class javax.swing.KeyboardManager and makes some adjustments in JComponent to allow keybindings registered with the condition WHEN_IN_FOCUSED_WINDOW to work. This mechanism is not 100% correct yet. Attached is a test case that works. Click on the JButton to give it focus. Then pressing 'a' prints "I'm Focused" to the screen. Clicking on the JCheckBox gives it focus (so the JButton is not focused) and then pressing 'a' prints "I'm In Focused Window" to the screen ==> this is new functionality, the JButton can register key bindings that work even when it is not focused or an ancestor of the focused component, it's just in the focused window. However, if, in the testcase, the keybinding is registered before the JButton is added to the JFrame (its top-level ancestor), our implementation fails. This is because when the key action is bound the JButton had no top-level ancestor, and when the JButton was added to the JFrame it doesn't re-hash its bindings. So, I have to find a way to re-hash WHEN_IN_FOCUSED_WINDOW bindings when components are added to containers. Unfortunately, adding occurs in Containers in AWT and much of the needed code is in package-private methods or classes in Swing. For instance, to re-hash bindings I need to use the KeyboardManager class, or at least the method JComponent.updateComponentInputMap. Anyone have any suggestions? 2005-11-09 Anthony Balkissoon <[EMAIL PROTECTED]> * javax/swing/JComponent.java: (processKeyEvent): Use local variables for boolean pressed and for the KeyStroke. Implemented the code for WHEN_IN_FOCUSED_WINDOW bindings. (updateComponentInputMap): Implemented and fixed typo in docs. * javax/swing/KeyboardManager.java: New class. Index: javax/swing/JComponent.java === RCS file: /cvsroot/classpath/classpath/javax/swing/JComponent.java,v retrieving revision 1.79 diff -u -r1.79 JComponent.java --- javax/swing/JComponent.java 9 Nov 2005 19:15:03 - 1.79 +++ javax/swing/JComponent.java 9 Nov 2005 21:54:20 - @@ -2167,13 +2167,14 @@ // 4. The WHEN_IN_FOCUSED_WINDOW maps of all the enabled components in //the focused window are searched. -if (processKeyBinding(KeyStroke.getKeyStrokeForEvent(e), - e, WHEN_FOCUSED, e.getID() == KeyEvent.KEY_PRESSED)) +KeyStroke keyStroke = KeyStroke.getKeyStrokeForEvent(e); +boolean pressed = e.getID() == KeyEvent.KEY_PRESSED; + +if (processKeyBinding(keyStroke, e, WHEN_FOCUSED, pressed)) // This is step 1 from above comment. e.consume(); -else if (processKeyBinding(KeyStroke.getKeyStrokeForEvent(e), - e, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, - e.getID() == KeyEvent.KEY_PRESSED)) +else if (processKeyBinding + (keyStroke, e, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, pressed)) // This is step 2 from above comment. e.consume(); else @@ -2183,9 +2184,8 @@ while ((current = current.getParent()) instanceof JComponent) { if (((JComponent)current).processKeyBinding -(KeyStroke.getKeyStrokeForEvent(e), e, - WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, - e.getID() == KeyEvent.KEY_PRESSED)) +(keyStroke, e,WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, + pressed)) { e.consume(); break; @@ -2196,10 +2196,10 @@ } if (e.isConsumed()) return; - + // This is step 4 from above comment. -// FIXME: Implement. Note, should use ComponentInputMaps rather -// than walking the entire containment hierarchy. +if (KeyboardManager.getManager().processKeyStroke(this, keyStroke, e)) + e.consume(); } } @@ -3306,7 +3306,7 @@ /** * This is the method that gets called when the WHEN_IN_FOCUSED_WINDOW map * is changed. - * @param c the JComponent associated with the WHEN_IN_FOCUSED_WINDOW map + * @param changed the JComponent associated with the WHEN_IN_FOCUSED_WINDOW map */ void updateComponentInputMap(ComponentInputMap changed) { @@ -3322,6 +3322,12 @@ return; // Now we have to update the keyboard manager's hashtable -// FIXME: not yet implemented +KeyboardManager km = KeyboardManager.getManager(); + +// This is a poor strategy, should be improved. We currently +// delete all the old bindings for the component and then register +// the current bindings. +km.clearBindingsForComp(changed.getComponent()); +km.registerEntireMap((ComponentInputMap) getInputMap(WHEN_IN_FOCUSED_WINDOW)); } } Index: javax/swing/KeyboardManager.java === RCS file: ja
Re: [cp-patches] removing duplicate --enable-xmlj from INSTALL
Hi Petteri, On Wed, 2005-11-09 at 23:37 +0200, Petteri Räty wrote: > --enable-xmlj compile native libxml/xslt library default=no > > This line is twice in INSTALL. The attached patch removes the later one > of these. Thanks. Committed as follows: 2005-11-09 Mark Wielaard <[EMAIL PROTECTED]> Reported by Petteri Räty <[EMAIL PROTECTED]> * INSTALL: Remove double --enable-xmlj entry. 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
[cp-patches] FYI: InputStreamReader fixlet
Hi, The jIRCii app passes a CharseetDecoder to InputStreamReader that returns null for charset() (its named NoConversion). This must be catched in the InputStreamReader constructor. 2005-11-09 Roman Kennke <[EMAIL PROTECTED]> * java/io/InputStreamReader.java (InputStreamReader(InputStream, CharsetDecoder)): Catch the case when the CharsetDecoder returns a null charset and handle it like US-ASCII. /Roman Index: java/io/InputStreamReader.java === RCS file: /cvsroot/classpath/classpath/java/io/InputStreamReader.java,v retrieving revision 1.26 diff -u -r1.26 InputStreamReader.java --- java/io/InputStreamReader.java 13 Sep 2005 21:25:09 - 1.26 +++ java/io/InputStreamReader.java 9 Nov 2005 22:35:38 - @@ -249,8 +249,12 @@ this.in = in; this.decoder = decoder; +Charset charset = decoder.charset(); try { - maxBytesPerChar = decoder.charset().newEncoder().maxBytesPerChar(); + if (charset == null) +maxBytesPerChar = 1f; + else +maxBytesPerChar = charset.newEncoder().maxBytesPerChar(); } catch(UnsupportedOperationException _){ maxBytesPerChar = 1f; } @@ -258,7 +262,10 @@ decoder.onMalformedInput(CodingErrorAction.REPLACE); decoder.onUnmappableCharacter(CodingErrorAction.REPLACE); decoder.reset(); -encoding = EncodingHelper.getOldCanonical(decoder.charset().name()); +if (charset == null) + encoding = "US-ASCII"; +else + encoding = EncodingHelper.getOldCanonical(decoder.charset().name()); } /** ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
RE: [cp-patches] RFC: Remove lowercasing of Windows paths
Am Mittwoch, den 26.10.2005, 15:26 +0200 schrieb Jeroen Frijters: > Roman Kennke wrote: > > Ingo found a bug in the Windows path handling. In the PlatformHelper > > class we lowercase all Windows paths. This is kind of naive and > > shortsighted, because paths are not only file system paths, > > but can also be paths inside JAR files etc, which actually ARE > > case-sensitive. > > When I last looked at PlatformHelper, it was very broken (on Windows) > and I recommend not using it at all. IMHO it should be removed from cvs > and VMFile should be rewritten to delegate these operations to native > code. > > IKVM replaces VMFile, so for me it's not really important, but it would > be good for other VMs to have better Windows support. Ok, I'll commit this now. 2005-11-09 Roman Kennke <[EMAIL PROTECTED]> Reported by Ingo Proetel <[EMAIL PROTECTED]> * gnu/java/io/PlatformHelper.java (toCanonicalForm): Remove lowercasing of paths in Windows. This breaks working with URLs, like when accessing files withing JAR files. /Roman Index: gnu/java/io/PlatformHelper.java === RCS file: /cvsroot/classpath/classpath/gnu/java/io/PlatformHelper.java,v retrieving revision 1.5 diff -u -r1.5 PlatformHelper.java --- gnu/java/io/PlatformHelper.java 2 Jul 2005 20:32:12 - 1.5 +++ gnu/java/io/PlatformHelper.java 9 Nov 2005 22:45:47 - @@ -109,11 +109,6 @@ String tmppath = path.replace('/', separatorChar); StringBuffer canonpath; -// We found it'll be more efficient and easy to handle to -// return a lowercased canonical path -if(isWindows) - tmppath = tmppath.toLowerCase(); - int i; if ((i = beginWithRootPathPrefix(tmppath)) == 0 ) 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] RFC: small PrintWriter improvement
Am Mittwoch, den 26.10.2005, 10:39 +0200 schrieb Roman Kennke: > Hi, > > here comes another fix from Friedjof Siebert that ensures that the field > line_separator is not null (in the unlikely but not impossible case that > the system property is not set). > > 2005-10-26 Roman Kennke <[EMAIL PROTECTED]> > > Reported by Friedjof Siebert <[EMAIL PROTECTED]> > * java/io/PrintWriter.java > (line_separator): Added default value for property to ensure > absence of null pointer exception even if property is not set. I also commit this now. 2005-11-09 Roman Kennke <[EMAIL PROTECTED]> Reported by Friedjof Siebert <[EMAIL PROTECTED]> * java/io/PrintWriter.java (line_separator): Added default value for property to ensure absence of null pointer exception even if property is not set. /Roman Index: java/io/PrintWriter.java === RCS file: /cvsroot/classpath/classpath/java/io/PrintWriter.java,v retrieving revision 1.19 diff -u -r1.19 PrintWriter.java --- java/io/PrintWriter.java 16 Sep 2005 19:49:04 - 1.19 +++ java/io/PrintWriter.java 9 Nov 2005 22:47:18 - @@ -379,7 +379,7 @@ * This is the system dependent line separator */ private static final char[] line_separator -= System.getProperty("line.separator").toCharArray(); += System.getProperty("line.separator", "\n").toCharArray(); /** * This method prints a line separator sequence to the stream. The value 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] RFC: WeakHashMap improvement
Hi, Am Mittwoch, den 26.10.2005, 10:37 +0200 schrieb Roman Kennke: > Hi, > > Friedjof Siebert did some improvements on java.util.WeakHashMap that I'd > like to check in. They are meant to improve reliability of this class by > enabling the prove of a cast and the absence of a null-pointer. > > 2005-10-26 Roman Kennke <[EMAIL PROTECTED]> > > Reported by Friedjof Siebert <[EMAIL PROTECTED]> > * java/util/WeakHashMap.java > (WeakEntrySet.Iterator.checkMod): Improved exception message. > (cleanQueue): Replaced null check with instanceof check to > prove correctness of cast at the same time. > (internalRemove): Removed redundant reads of buckets[slot] and > prev.next and added checks to ensure that no null pointer > exception may occur and that this can be proved automatically. I committed the attached modified patch that does not replace the null-check with an instanceof check. 2005-10-26 Roman Kennke <[EMAIL PROTECTED]> Reported by Friedjof Siebert <[EMAIL PROTECTED]> * java/util/WeakHashMap.java (WeakEntrySet.Iterator.checkMod): Improved exception message. (internalRemove): Removed redundant reads of buckets[slot] and prev.next and added checks to ensure that no null pointer exception may occur and that this can be proved automatically. /Roman Index: java/util/WeakHashMap.java === RCS file: /cvsroot/classpath/classpath/java/util/WeakHashMap.java,v retrieving revision 1.19 diff -u -r1.19 WeakHashMap.java --- java/util/WeakHashMap.java 2 Jul 2005 20:32:42 - 1.19 +++ java/util/WeakHashMap.java 9 Nov 2005 22:50:44 - @@ -241,7 +241,8 @@ // This method will get inlined. cleanQueue(); if (knownMod != modCount) -throw new ConcurrentModificationException(); +throw new ConcurrentModificationException(knownMod + " != " + + modCount); } /** @@ -698,21 +699,20 @@ // bucket may be enqueued later by the garbage collection, and // internalRemove will be called a second time. bucket.slot = -1; -if (buckets[slot] == bucket) - buckets[slot] = bucket.next; -else - { -WeakBucket prev = buckets[slot]; -/* This may throw a NullPointerException. It shouldn't but if - * a race condition occurred (two threads removing the same - * bucket at the same time) it may happen. - * But with race condition many much worse things may happen - * anyway. - */ -while (prev.next != bucket) - prev = prev.next; -prev.next = bucket.next; + +WeakBucket prev = null; +WeakBucket next = buckets[slot]; +while (next != bucket) + { + if (next == null) throw new InternalError("WeakHashMap in incosistent state"); + prev = next; + next = prev.next; } +if (prev == null) + buckets[slot] = bucket.next; +else + prev.next = bucket.next; + size--; } 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] RFC: WeakHashMap improvement
Hi Roman, On Wed, 2005-11-09 at 23:52 +0100, Roman Kennke wrote: > + if (next == null) throw new InternalError("WeakHashMap in incosistent > state"); As Tom pointed out in the first review inconsistent is not spelled correctly here. 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: WeakHashMap improvement
> "Roman" == Roman Kennke <[EMAIL PROTECTED]> writes: Two nits... Roman> + if (next == null) throw new InternalError("WeakHashMap in incosistent state"); This should not all be on one line. Also, 'inconsistent' is misspelled here. Tom ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] Patch: WHEN_IN_FOCUSED_WINDOW bindings implemented
Thanks to rabbit78 and fitzsim I figured out the problems discussed earlier on the list. This patch re-registers WHEN_IN_FOCUSED_WINDOW bindings when a JComponent is added to a Container because its top level container may have changed. The testcase from my last email now works even when the button is added to the frame after having it's bindings registered, and the modified test case is attached to this email. Note there is still some inefficiency that I can work on. In both places that we update (addNotify and updateComponentInputMap) right now we just remove all bindings and then add them back (and in fact there may be some strange cases where this is incorrect ... I will have to do more in depth tests tomorrow), so there is work to be done here still. 2005-11-09 Anthony Balkissoon <[EMAIL PROTECTED]> * javax/swing/JComponent.java: (addNotify): Unregister all WHEN_IN_FOCUSED_WINDOW bindings for this JComponent and then register them with its (potentially) new top level ancestor. Removed unncessary code that copied regular (WHEN_FOCUSED) key bindings up the parent hierarchy. --Tony Index: javax/swing/JComponent.java === RCS file: /cvsroot/classpath/classpath/javax/swing/JComponent.java,v retrieving revision 1.80 diff -u -r1.80 JComponent.java --- javax/swing/JComponent.java 9 Nov 2005 21:59:40 - 1.80 +++ javax/swing/JComponent.java 9 Nov 2005 23:11:23 - @@ -2828,41 +2828,22 @@ */ public void addNotify() { +// Register the WHEN_IN_FOCUSED_WINDOW keyboard bindings +// Note that here we unregister all bindings associated with +// this component and then re-register them. This may be more than +// necessary if the top-level ancestor hasn't changed. Should +// maybe improve this. +KeyboardManager km = KeyboardManager.getManager(); +km.clearBindingsForComp(this); +km.registerEntireMap((ComponentInputMap) + this.getInputMap(WHEN_IN_FOCUSED_WINDOW)); super.addNotify(); -// let parents inherit the keybord mapping -InputMap input = getInputMap(); -ActionMap actions = getActionMap(); - -Container parent = getParent(); -while ((parent != null) && (parent instanceof JComponent)) - { -JComponent jParent = (JComponent) parent; -InputMap parentInput = jParent.getInputMap(); -ActionMap parentAction = jParent.getActionMap(); - -KeyStroke[] ikeys = input.keys(); -for (int i = 0; i < ikeys.length; i++) - { -Object o = input.get(ikeys[i]); -parentInput.put(ikeys[i], o); - } - -Object[] akeys = actions.keys(); -for (int i = 0; i < akeys.length; i++) - { -Action a = actions.get(akeys[i]); -parentAction.put(akeys[i], a); - } - -parent = jParent.getParent(); - } - // Notify AncestorListeners. fireAncestorEvent(this, AncestorEvent.ANCESTOR_ADDED); // fire property change event for 'ancestor' -firePropertyChange("ancestor", null, parent); +firePropertyChange("ancestor", null, getParent()); } /** import java.awt.*; import java.awt.event.*; import javax.swing.*; class Test { public static void main(String args[]) { // Set up the JFrame JFrame jf = new JFrame(); jf.setSize(200,200); jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // A label and a button JCheckBox cb = new JCheckBox("dummy"); JButton b = new JButton(); // Actions for the button to perform Action focused = new AbstractAction(){ public void actionPerformed (ActionEvent e) { System.out.println ("I'm Focused"); } }; Action inWindow = new AbstractAction(){ public void actionPerformed (ActionEvent e) { System.out.println ("I'm In Focused Window"); } }; // Register the actions with the key 'a' KeyStroke k = KeyStroke.getKeyStroke('a'); b.registerKeyboardAction(focused, "focused", k, JComponent.WHEN_FOCUSED); b.registerKeyboardAction(inWindow, "window", k, JComponent.WHEN_IN_FOCUSED_WINDOW); // Add the components to the JFrame and show it jf.add(cb, BorderLayout.NORTH); jf.add(b, BorderLayout.SOUTH); jf.show(); } } ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
Re: [cp-patches] FYI: InputStreamReader fixlet
> "Roman" == Roman Kennke <[EMAIL PROTECTED]> writes: Roman> * java/io/InputStreamReader.java Roman> (InputStreamReader(InputStream, CharsetDecoder)): Catch the case Roman> when the CharsetDecoder returns a null charset and handle it like Roman> US-ASCII. Do we really want this to default to US-ASCII and not, say, file.encoding? Tom ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches