[cp-patches] Patch: convert new Boolean(X) to Boolean.valueOf(X)
While messing around with FindBugs, I came up with the following useful patch. It converts all new Boolean(X) instances to Boolean.valueOf(X). Ok? AG h 2005-09-13 Anthony Green [EMAIL PROTECTED] * javax/swing/plaf/basic/BasicFileChooserUI.java, javax/swing/filechooser/FileSystemView.java, java/util/logging/LogManager.java, gnu/xml/libxmlj/dom/GnomeDocument.java, gnu/xml/aelfred2/JAXPFactory.java, gnu/java/security/x509/ext/Extension.java, gnu/java/security/x509/ext/BasicConstraints.java, gnu/java/rmi/server/RMIObjectInputStream.java, gnu/java/rmi/dgc/DGCImpl_Stub.java, gnu/java/beans/decoder/BooleanHandler.java: Use Boolean.valueOf() instead of new Boolean. Index: gnu/java/beans/decoder/BooleanHandler.java === RCS file: /cvsroot/classpath/classpath/gnu/java/beans/decoder/BooleanHandler.java,v retrieving revision 1.2 diff -u -p -r1.2 BooleanHandler.java --- gnu/java/beans/decoder/BooleanHandler.java 2 Jul 2005 20:32:12 - 1.2 +++ gnu/java/beans/decoder/BooleanHandler.java 14 Sep 2005 07:00:11 - @@ -57,10 +57,10 @@ class BooleanHandler extends SimpleHandl protected Object parse(String number) throws AssemblyException { if (number.equals(true)) - return new Boolean(true); + return Boolean.valueOf(true); if (number.equals(false)) - return new Boolean(false); + return Boolean.valueOf(false); throw new AssemblyException(new IllegalArgumentException(Element contained no valid boolean value.)); } Index: gnu/java/rmi/dgc/DGCImpl_Stub.java === RCS file: /cvsroot/classpath/classpath/gnu/java/rmi/dgc/DGCImpl_Stub.java,v retrieving revision 1.3 diff -u -p -r1.3 DGCImpl_Stub.java --- gnu/java/rmi/dgc/DGCImpl_Stub.java 2 Jul 2005 20:32:14 - 1.3 +++ gnu/java/rmi/dgc/DGCImpl_Stub.java 14 Sep 2005 07:00:12 - @@ -81,7 +81,7 @@ public final class DGCImpl_Stub public void clean(java.rmi.server.ObjID[] $param_0, long $param_1, java.rmi.dgc.VMID $param_2, boolean $param_3) throws java.rmi.RemoteException { try { if (useNewInvoke) { -ref.invoke(this, $method_clean_0, new java.lang.Object[] {$param_0, new java.lang.Long($param_1), $param_2, new java.lang.Boolean($param_3)}, -5803803475088455571L); +ref.invoke(this, $method_clean_0, new java.lang.Object[] {$param_0, new java.lang.Long($param_1), $param_2, Boolean.valueOf($param_3)}, -5803803475088455571L); } else { java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject)this, operations, 0, interfaceHash); Index: gnu/java/rmi/server/RMIObjectInputStream.java === RCS file: /cvsroot/classpath/classpath/gnu/java/rmi/server/RMIObjectInputStream.java,v retrieving revision 1.8 diff -u -p -r1.8 RMIObjectInputStream.java --- gnu/java/rmi/server/RMIObjectInputStream.java 2 Jul 2005 20:32:14 - 1.8 +++ gnu/java/rmi/server/RMIObjectInputStream.java 14 Sep 2005 07:00:12 - @@ -102,7 +102,7 @@ protected Class resolveProxyClass(String protected Object readValue(Class valueClass) throws IOException, ClassNotFoundException { if(valueClass.isPrimitive()){ if(valueClass == Boolean.TYPE) -return new Boolean(readBoolean()); +return Boolean.valueOf(readBoolean()); if(valueClass == Byte.TYPE) return new Byte(readByte()); if(valueClass == Character.TYPE) Index: gnu/java/security/x509/ext/BasicConstraints.java === RCS file: /cvsroot/classpath/classpath/gnu/java/security/x509/ext/BasicConstraints.java,v retrieving revision 1.3 diff -u -p -r1.3 BasicConstraints.java --- gnu/java/security/x509/ext/BasicConstraints.java 2 Jul 2005 20:32:14 - 1.3 +++ gnu/java/security/x509/ext/BasicConstraints.java 14 Sep 2005 07:00:13 - @@ -112,7 +112,7 @@ public class BasicConstraints extends Ex if (encoded == null) { List bc = new ArrayList (2); -bc.add (new DERValue (DER.BOOLEAN, new Boolean (ca))); +bc.add (new DERValue (DER.BOOLEAN, Boolean.valueOf (ca))); if (pathLenConstraint = 0) bc.add (new DERValue (DER.INTEGER, BigInteger.valueOf ((long) pathLenConstraint))); Index: gnu/java/security/x509/ext/Extension.java === RCS file: /cvsroot/classpath/classpath/gnu/java/security/x509/ext/Extension.java,v retrieving revision 1.3 diff -u -p -r1.3 Extension.java --- gnu/java/security/x509/ext/Extension.java 2 Jul 2005 20:32:14 - 1.3 +++ gnu/java/security/x509/ext/Extension.java 14 Sep 2005 07:00:13 - @@ -232,7 +232,7 @@ public class Extension { List ext = new ArrayList (3); ext.add (new DERValue (DER.OBJECT_IDENTIFIER,
[cp-patches] Patch: remove stray semicolon
FindBugs and I think we have a stray semicolon that needs removing. Ok? AG 2005-09-13 Anthony Green [EMAIL PROTECTED] * gnu/java/security/der/DERReader.java: Remove stray semicolon. Index: gnu/java/security/der/DERReader.java === RCS file: /cvsroot/classpath/classpath/gnu/java/security/der/DERReader.java,v retrieving revision 1.6 diff -u -p -r1.6 DERReader.java --- gnu/java/security/der/DERReader.java 2 Jul 2005 20:32:14 - 1.6 +++ gnu/java/security/der/DERReader.java 14 Sep 2005 06:45:24 - @@ -389,7 +389,7 @@ public class DERReader implements DER Integer.parseInt(str.substring( 4, 6)),// day Integer.parseInt(str.substring( 6, 8)),// hour Integer.parseInt(str.substring( 8, 10))); // minute -if (date.length() == 12); +if (date.length() == 12) calendar.set(Calendar.SECOND, Integer.parseInt(str.substring(10, 12))); } ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] Patch: add missing switch break?
From reading this code, I don't think we really want to fall-through on this switch case. OK? AG 2005-09-13 Anthony Green [EMAIL PROTECTED] * gnu/xml/aelfred2/XmlParser.java: Add missing break;. Index: gnu/xml/aelfred2/XmlParser.java === RCS file: /cvsroot/classpath/classpath/gnu/xml/aelfred2/XmlParser.java,v retrieving revision 1.7 diff -u -p -r1.7 XmlParser.java --- gnu/xml/aelfred2/XmlParser.java 2 Jul 2005 20:32:15 - 1.7 +++ gnu/xml/aelfred2/XmlParser.java 14 Sep 2005 06:45:48 - @@ -2185,6 +2185,7 @@ loop: { nest++; } + break; case ']': if (tryRead(])) { ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] FYI: MetalComboBoxIcon
I committed this small change to update the icon color depending on the component state: 2005-09-14 David Gilbert [EMAIL PROTECTED] * javax/swing/plaf/metal/MetalComboBoxIcon.java: fixed header, (paintIcon): change color to reflect component state. Regards, Dave Index: javax/swing/plaf/metal/MetalComboBoxIcon.java === RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/metal/MetalComboBoxIcon.java,v retrieving revision 1.1 diff -u -r1.1 MetalComboBoxIcon.java --- javax/swing/plaf/metal/MetalComboBoxIcon.java 15 Jul 2005 16:27:10 - 1.1 +++ javax/swing/plaf/metal/MetalComboBoxIcon.java 14 Sep 2005 07:16:15 - @@ -1,4 +1,4 @@ -/* MetalComboBoxButton.java +/* MetalComboBoxIcon.java Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -88,10 +88,11 @@ */ public void paintIcon(Component c, Graphics g, int x, int y) { -// TODO: work out whether/how the icon changes with different component -// states (and also different metal themes) Color savedColor = g.getColor(); -g.setColor(Color.black); +if (c.isEnabled()) + g.setColor(MetalLookAndFeel.getBlack()); +else + g.setColor(MetalLookAndFeel.getControlDisabled()); for (int i = 0; i 5; i++) g.drawLine(x + i, y + i, x + 9 - i, y + i); g.setColor(savedColor); ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] FYI: Basic look and feel - getPropertyPrefix() API docs
I committed this patch (just API doc additions): 2005-09-14 David Gilbert [EMAIL PROTECTED] * javax/swing/plaf/basic/BasicFormattedTextFieldUI.java: (getPropertyPrefix): added API docs, * javax/swing/plaf/basic/BasicPasswordFieldUI.java: (getPropertyPrefix): added API docs, * javax/swing/plaf/basic/BasicTextAreaUI.java: (getPropertyPrefix): added API docs, * javax/swing/plaf/basic/BasicTextFieldUI.java: (getPropertyPrefix): added API docs, * javax/swing/plaf/basic/BasicTextPaneUI.java: (getPropertyPrefix): added API docs. Regards, Dave Index: javax/swing/plaf/basic/BasicFormattedTextFieldUI.java === RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicFormattedTextFieldUI.java,v retrieving revision 1.2 diff -u -r1.2 BasicFormattedTextFieldUI.java --- javax/swing/plaf/basic/BasicFormattedTextFieldUI.java 2 Jul 2005 20:32:50 - 1.2 +++ javax/swing/plaf/basic/BasicFormattedTextFieldUI.java 14 Sep 2005 07:53:24 - @@ -1,5 +1,5 @@ /* BasicFormattedTextFieldUI.java - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -39,6 +39,7 @@ package javax.swing.plaf.basic; import javax.swing.JComponent; +import javax.swing.UIDefaults; import javax.swing.plaf.ComponentUI; /** @@ -55,6 +56,11 @@ return new BasicFormattedTextFieldUI(); } + /** + * Returns the prefix for entries in the [EMAIL PROTECTED] UIDefaults} table. + * + * @return FormattedTextField + */ protected String getPropertyPrefix() { return FormattedTextField; Index: javax/swing/plaf/basic/BasicPasswordFieldUI.java === RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicPasswordFieldUI.java,v retrieving revision 1.3 diff -u -r1.3 BasicPasswordFieldUI.java --- javax/swing/plaf/basic/BasicPasswordFieldUI.java2 Jul 2005 20:32:50 - 1.3 +++ javax/swing/plaf/basic/BasicPasswordFieldUI.java14 Sep 2005 07:53:24 - @@ -39,6 +39,7 @@ package javax.swing.plaf.basic; import javax.swing.JComponent; +import javax.swing.UIDefaults; import javax.swing.plaf.ComponentUI; import javax.swing.text.Element; import javax.swing.text.PasswordView; @@ -60,6 +61,11 @@ return new BasicPasswordFieldUI(); } + /** + * Returns the prefix for entries in the [EMAIL PROTECTED] UIDefaults} table. + * + * @return PasswordField + */ protected String getPropertyPrefix() { return PasswordField; Index: javax/swing/plaf/basic/BasicTextAreaUI.java === RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicTextAreaUI.java,v retrieving revision 1.3 diff -u -r1.3 BasicTextAreaUI.java --- javax/swing/plaf/basic/BasicTextAreaUI.java 2 Jul 2005 20:32:50 - 1.3 +++ javax/swing/plaf/basic/BasicTextAreaUI.java 14 Sep 2005 07:53:25 - @@ -40,6 +40,7 @@ import javax.swing.JComponent; +import javax.swing.UIDefaults; import javax.swing.plaf.ComponentUI; import javax.swing.text.Element; import javax.swing.text.PlainView; @@ -61,6 +62,11 @@ return new PlainView(elem); } + /** + * Returns the prefix for entries in the [EMAIL PROTECTED] UIDefaults} table. + * + * @return TextArea + */ protected String getPropertyPrefix() { return TextArea; Index: javax/swing/plaf/basic/BasicTextFieldUI.java === RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicTextFieldUI.java,v retrieving revision 1.3 diff -u -r1.3 BasicTextFieldUI.java --- javax/swing/plaf/basic/BasicTextFieldUI.java2 Jul 2005 20:32:50 - 1.3 +++ javax/swing/plaf/basic/BasicTextFieldUI.java14 Sep 2005 07:53:25 - @@ -41,6 +41,7 @@ import java.beans.PropertyChangeEvent; import javax.swing.JComponent; +import javax.swing.UIDefaults; import javax.swing.plaf.ComponentUI; import javax.swing.text.Element; import javax.swing.text.FieldView; @@ -63,6 +64,11 @@ return new BasicTextFieldUI(); } + /** + * Returns the prefix for entries in the [EMAIL PROTECTED] UIDefaults} table. + * + * @return TextField + */ protected String getPropertyPrefix() { return TextField; Index: javax/swing/plaf/basic/BasicTextPaneUI.java === RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicTextPaneUI.java,v retrieving revision 1.4 diff -u -r1.4 BasicTextPaneUI.java --- javax/swing/plaf/basic/BasicTextPaneUI.java 2 Jul 2005 20:32:50 - 1.4 +++ javax/swing/plaf/basic/BasicTextPaneUI.java 14 Sep 2005 07:53:25 - @@ -39,6 +39,7 @@ package javax.swing.plaf.basic;
[cp-patches] FYI: API doc fixes in org.omg.CORBA
I've had these (minor) API doc fixes sitting on my hard drive for a while and figured I might as well commit them: 2005-09-14 David Gilbert [EMAIL PROTECTED] * org/omg/CORBA/ORB.java: minor API doc fixes, * org/omg/CORBA/PERSIST_STORE.java: likewise, * org/omg/CORBA/PolicyError.java: likewise, * org/omg/CORBA/ValueBaseHolder.java: likewise, * org/omg/CORBA/VisibilityHelper.java: likewise. Regards, Dave Gilbert Index: org/omg/CORBA/ORB.java === RCS file: /cvsroot/classpath/classpath/org/omg/CORBA/ORB.java,v retrieving revision 1.15 diff -u -r1.15 ORB.java --- org/omg/CORBA/ORB.java 2 Sep 2005 15:53:05 - 1.15 +++ org/omg/CORBA/ORB.java 14 Sep 2005 07:36:30 - @@ -89,7 +89,7 @@ * /td/tr * trtdorg.omg.CORBA.ORBInitRef/tdtdSpecifies the * initial reference, accessible by name with the method - * [EMAIL PROTECTED] resolve_initial_references(String)}. + * [EMAIL PROTECTED] #resolve_initial_references(String)}. * /table * The command line accepts the same properties as a keys. When specifying * in the command line, the prefix org.omg.CORBA can be omitted, @@ -100,8 +100,8 @@ public abstract class ORB { /** - * By default, [EMAIL PROTECTED] init(String[], Properties)} and - * [EMAIL PROTECTED] init(Applet, Properties} return + * By default, [EMAIL PROTECTED] #init(String[], Properties)} and + * [EMAIL PROTECTED] #iinit(Applet, Properties)} return * the built-in fully functional ORB is returned. If the * codeprops/code contains the property org.omg.CORBA.ORBClass, * the value of this property is used as a class name to instantiate @@ -172,7 +172,7 @@ /** * Create an instance of the CORBA [EMAIL PROTECTED] Any} with the type, intialised - * to [EMAIL PROTECTED] TCKind#tc_null} + * to [EMAIL PROTECTED] TCKind#tk_null} */ public abstract Any create_any(); @@ -394,7 +394,7 @@ * * @return the named value. */ - public abstract NamedValue create_named_value(String s, Any any, int flags); + public abstract NamedValue create_named_value(String name, Any any, int flags); /** * Send multiple prepared requests one way, do not caring about the answer. @@ -466,7 +466,7 @@ * However this method is oficially documented as not implemented at least * till v1.4 inclusive. * - * @param peration_definition the operation definition, must be + * @param operation_definition the operation definition, must be * CORBA codeOperationDef/code. * * @return never @@ -482,7 +482,7 @@ * pCreates the new policy of the specified type, having the given value. * This method looks for the policy factory that was previously registered * during ORB initialization by - * [EMAIL PROTECTED] org.omg.PortableInterceptor.ORBInitialiser}. + * [EMAIL PROTECTED] org.omg.PortableInterceptor#ORBInitialiser}. * * If the suitable factory is found, this factory creates the requested policy, * otherwise the PolicyError is thrown. @@ -532,7 +532,7 @@ * * The TypeCode object is initialized with the given id, name, and members. * @param id the Id of this type. - * @param the name of this type. + * @param name the name of this type. * @param members the member list. * * @return the typecode. @@ -548,7 +548,7 @@ * and members. * * @param id the Id of this type. - * @param the name of this type. + * @param name the name of this type. * @param discriminator the union discriminator. * @param members the member list. * @@ -741,7 +741,7 @@ * @return the default context of this ORB. * * @throws NO_IMPLEMENT for the Singleton ORB, returned by - * the parameterless [EMAIL PROTECTED] init()}. + * the parameterless [EMAIL PROTECTED] #init()}. */ public Context get_default_context() { @@ -751,7 +751,7 @@ /** * Return thg typecode, representing the given primitive object type. * - * @param the kind of the primitive typecode. + * @param tcKind the kind of the primitive typecode. * * @return the typecode of the primitve typecode. */ @@ -817,7 +817,7 @@ * By default the built-in fully functional ORB is returned. The ORB class * is found as described in the header of this class. * - * @param the parameters, passed to the applications + * @param args the parameters, passed to the applications * codemain(String[] args)/code method, may be codenull/code. * The parameter -org.omg.CORBA.ORBClass class name * if present, defines the used ORB implementation class. If this @@ -856,7 +856,7 @@ * * @return a list of services. * - * @see resolve_initial_references(String) + * @see #resolve_initial_references(String) */ public abstract String[] list_initial_services(); @@ -919,9 +919,9 @@ * (key) inside the server, the communication protocol version, * supported charsets
[cp-patches] FYI: API doc fixes in gnu.CORBA.*
Just cleaning up some small fixes that were sitting in my workspace - the following is committed: 2005-09-14 David Gilbert [EMAIL PROTECTED] * gnu/CORBA/ExceptionCreator.java: minor API doc fixes, * gnu/CORBA/Version.java: likewise. Regards, Dave Gilbert Index: gnu/CORBA/ExceptionCreator.java === RCS file: /cvsroot/classpath/classpath/gnu/CORBA/ExceptionCreator.java,v retrieving revision 1.3 diff -u -r1.3 ExceptionCreator.java --- gnu/CORBA/ExceptionCreator.java 28 Aug 2005 11:23:36 - 1.3 +++ gnu/CORBA/ExceptionCreator.java 14 Sep 2005 08:06:40 - @@ -138,8 +138,8 @@ * @param idl the exception idl name. * @param input the stream to read from. * - * @return the loaded exception. - * @return null if the helper class cannot be found. + * @return the loaded exception, or codenull/code if the helper class + * cannot be found. */ public static UserException readUserException(String idl, InputStream input) { @@ -187,7 +187,7 @@ } /** - * Converts teh given IDL name to class name. + * Converts the given IDL name to class name. * * @param IDL the idl name. * Index: gnu/CORBA/Version.java === RCS file: /cvsroot/classpath/classpath/gnu/CORBA/Version.java,v retrieving revision 1.2 diff -u -r1.2 Version.java --- gnu/CORBA/Version.java 2 Jul 2005 20:32:09 - 1.2 +++ gnu/CORBA/Version.java 14 Sep 2005 08:06:40 - @@ -70,8 +70,8 @@ /** * Create the version with the given version numbers. * - * @param major major number (0..255) - * @param minor minor number (0..255) + * @param _major major number (0..255) + * @param _minor minor number (0..255) */ public Version(int _major, int _minor) { @@ -166,7 +166,7 @@ * Returs true if the given version is lower or equal to the * version, specified by the provided minor and major version * number. This means, the version, specified by these two numbers, - * should be supported by teh current version. + * should be supported by the current version. * * @param a_major a major version number. * @param a_minor a minor version number. ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
Re: [cp-patches] Patch: convert new Boolean(X) to Boolean.valueOf(X)
On Wed, 2005-09-14 at 00:14 -0700, Anthony Green wrote: While messing around with FindBugs, I came up with the following useful patch. It converts all new Boolean(X) instances to Boolean.valueOf(X). Ok? [...] - return new Boolean(true); + return Boolean.valueOf(true); OK, but if you know the actual value then using Boolean.TRUE and Boolean.FALSE seems more appropriate then valueOf(). Could you make that change? 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
[cp-patches] FYI: Added API comments to javax.swing.ButtonModel
2005-09-14 Roman Kennke [EMAIL PROTECTED] * javax/swing/ButtonModel.java: Added API docs all over. /Roman Index: javax/swing/ButtonModel.java === RCS file: /cvsroot/classpath/classpath/javax/swing/ButtonModel.java,v retrieving revision 1.7 diff -u -r1.7 ButtonModel.java --- javax/swing/ButtonModel.java 13 Jul 2005 21:22:44 - 1.7 +++ javax/swing/ButtonModel.java 14 Sep 2005 11:11:37 - @@ -49,37 +49,253 @@ */ public interface ButtonModel extends ItemSelectable { -boolean isArmed(); -void setArmed(boolean b); - -boolean isEnabled(); -void setEnabled(boolean b); - -void setPressed(boolean b); -boolean isPressed(); - - -void removeActionListener(ActionListener l); -void addActionListener(ActionListener l); - -void addItemListener(ItemListener l); -void removeItemListener(ItemListener l); - -void addChangeListener(ChangeListener l); -void removeChangeListener(ChangeListener l); - -void setRollover(boolean b); -boolean isRollover(); - -int getMnemonic(); -void setMnemonic(int key); - -void setActionCommand(String s); -String getActionCommand(); - -void setGroup(ButtonGroup group); - -void setSelected(boolean b); -boolean isSelected(); + /** + * Returns codetrue/code if the button is armed, codefalse/code + * otherwise. + * + * A button is armed, when the user has pressed the mouse over it, but has + * not yet released the mouse. + * + * @return codetrue/code if the button is armed, codefalse/code + * otherwise + * + * @see #setArmed(boolean) + */ + boolean isArmed(); + + /** + * Sets the armed flag of the button. + * + * A button is armed, when the user has pressed the mouse over it, but has + * not yet released the mouse. + * + * @param b codetrue/code if the button is armed, codefalse/code + *otherwise + * + * @see #isArmed() + */ + void setArmed(boolean b); + + /** + * Returns codetrue/code if the button is enabled, codefalse/code + * otherwise. + * + * When a button is disabled, it is usually grayed out and the user cannot + * change its state. + * + * @return codetrue/code if the button is enabled, codefalse/code + * otherwise + * + * @see #setEnabled(boolean) + */ + boolean isEnabled(); + + /** + * Sets the enabled flag of the button. + * + * When a button is disabled, it is usually grayed out and the user cannot + * change its state. + * + * @param b codetrue/code if the button is enabled, codefalse/code + *otherwise + * + * @see #isEnabled() + */ + void setEnabled(boolean b); + + /** + * Sets the pressed flag of the button. + * + * The button usually gets pressed when the user clicks on a button, it will + * be un-pressed when the user releases the mouse. + * + * @param b codetrue/code if the button is pressed, codefalse/code + *otherwise + * + * @see #isPressed() + */ + void setPressed(boolean b); + + /** + * Returns codetrue/code if the button is pressed, codefalse/code + * otherwise. + * + * The button usually gets pressed when the user clicks on a button, it will + * be un-pressed when the user releases the mouse. + * + * @return codetrue/code if the button is pressed, codefalse/code + * otherwise + * + * @see #setPressed(boolean) + */ + boolean isPressed(); + + /** + * Removes an [EMAIL PROTECTED] ActionListener} from the list of registered listeners. + * + * @param l the action listener to remove + * + * @see #addActionListener(ActionListener) + */ + void removeActionListener(ActionListener l); + + /** + * Adds an [EMAIL PROTECTED] ActionListener} to the list of registered listeners. + * + * An codeActionEvent/code is usually fired when the user clicks on a + * button. + * + * @param l the action listener to add + * + * @see #removeActionListener(ActionListener) + */ + void addActionListener(ActionListener l); + + /** + * Adds an [EMAIL PROTECTED] ItemListener} to the list of registered listeners. + * + * An codeItemEvent/code is usually fired when a button's selected + * state changes. This applies only to buttons that support the selected + * flag. + * + * @param l the item listener to add + * + * @see #removeItemListener(ItemListener) + */ + void addItemListener(ItemListener l); + + /** + * Adds an [EMAIL PROTECTED] ItemListener} to the list of registered listeners. + * + * @param l the item listener to add + * + * @see #removeItemListener(ItemListener) + */ + void removeItemListener(ItemListener l); + + /** + * Adds an [EMAIL PROTECTED] ChangeListener} to the list of registered listeners. + * + * A codeChangeEvent/code is fired when any one of the button's flags + * changes. + * + * @param l the change listener to add + * + * @see
[cp-patches] jcl.c 64-bit fix
Hi! Yesterday, after a long debugging session with fitzsim, i've found this bug. TWISTI 2005-09-14 Christian Thalinger [EMAIL PROTECTED] * native/jni/classpath/jcl.c: Replaced undefined POINTERS_ARE_64BIT with SIZEOF_VOID_P == 8. Index: native/jni/classpath/jcl.c === RCS file: /ahome/cacao/cacaocvs/cacao/src/classpath/native/jni/classpath/jcl.c,v retrieving revision 1.6 diff -u -3 -p -r1.6 jcl.c --- native/jni/classpath/jcl.c 10 Sep 2005 13:04:03 - 1.6 +++ native/jni/classpath/jcl.c 13 Sep 2005 22:54:30 - @@ -193,7 +193,7 @@ JCL_NewRawDataObject (JNIEnv * env, void { if (rawDataClass == NULL) { -#ifdef POINTERS_ARE_64BIT +#if SIZEOF_VOID_P == 8 rawDataClass = (*env)-FindClass (env, gnu/classpath/Pointer64); if (rawDataClass == NULL) { @@ -253,7 +253,7 @@ JCL_NewRawDataObject (JNIEnv * env, void } } -#ifdef POINTERS_ARE_64BIT +#if SIZEOF_VOID_P == 8 return (*env)-NewObject (env, rawDataClass, rawData_mid, (jlong) data); #else return (*env)-NewObject (env, rawDataClass, rawData_mid, (jint) data); @@ -263,7 +263,7 @@ JCL_NewRawDataObject (JNIEnv * env, void JNIEXPORT void * JNICALL JCL_GetRawData (JNIEnv * env, jobject rawdata) { -#ifdef POINTERS_ARE_64BIT +#if SIZEOF_VOID_P == 8 return (void *) (*env)-GetLongField (env, rawdata, rawData_fid); #else return (void *) (*env)-GetIntField (env, rawdata, rawData_fid); ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
Re: [cp-patches] Patch: remove stray semicolon
Anthony == Anthony Green [EMAIL PROTECTED] writes: Anthony 2005-09-13 Anthony Green [EMAIL PROTECTED] Anthony* gnu/java/security/der/DERReader.java: Remove stray semicolon. Yes, thanks. IMO this kind of thing doesn't require approval. Tom ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
Re: [cp-patches] jcl.c 64-bit fix
Twisti == Christian Thalinger [EMAIL PROTECTED] writes: Twisti 2005-09-14 Christian Thalinger [EMAIL PROTECTED] Twisti * native/jni/classpath/jcl.c: Replaced undefined Twisti POINTERS_ARE_64BIT with SIZEOF_VOID_P == 8. I'm checking this in. Tom ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] FYI: reformatted BasicTabbedPaneUI
2005-09-14 Roman Kennke [EMAIL PROTECTED] * javax/swing/plaf/basic/BasicTabbedPaneUI.java: Reformatted file. /Roman ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] Patch: FYI: Character javadoc fixes
I'm checking this in. This fixes a couple minor problems in the Character javadoc. Tom Index: ChangeLog from Tom Tromey [EMAIL PROTECTED] * java/lang/Character.java: Typo fixes in javadoc. Index: java/lang/Character.java === RCS file: /cvsroot/classpath/classpath/java/lang/Character.java,v retrieving revision 1.37 diff -u -r1.37 Character.java --- java/lang/Character.java 17 Aug 2005 14:12:27 - 1.37 +++ java/lang/Character.java 14 Sep 2005 15:09:16 - @@ -1,5 +1,5 @@ /* java.lang.Character -- Wrapper class for char, and Unicode subsets - Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -1480,28 +1480,28 @@ /** - * Minimum high surrrogate code in UTF-16 encoding. + * Minimum high surrogate code in UTF-16 encoding. * * @since 1.5 */ public static final char MIN_HIGH_SURROGATE = '\ud800'; /** - * Maximum high surrrogate code in UTF-16 encoding. + * Maximum high surrogate code in UTF-16 encoding. * * @since 1.5 */ public static final char MAX_HIGH_SURROGATE = '\udbff'; /** - * Minimum low surrrogate code in UTF-16 encoding. + * Minimum low surrogate code in UTF-16 encoding. * * @since 1.5 */ public static final char MIN_LOW_SURROGATE = '\udc00'; /** - * Maximum low surrrogate code in UTF-16 encoding. + * Maximum low surrogate code in UTF-16 encoding. * * @since 1.5 */ @@ -2370,7 +2370,7 @@ * Return number of 16-bit characters required to represent the given * code point. * - * @param codePoint a uncode code point + * @param codePoint a unicode code point * * @return 2 if codePoint = 0x1, 1 otherwise. * ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
Re: [cp-patches] Patch: fix logical operation in ValidationConsumer
Anthony == Anthony Green [EMAIL PROTECTED] writes: Anthony FindBugs pointed out this suspicious constant logical expression. My Anthony patch assumes this | should be . Ok? I'm not familiar with this code but I don't see how this could be anything else. Please check it in. Tom ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches]: Patch: MetalTreeUI implementation, BasicTreeUI implementation updated.
2005-09-14 Lillian Angel [EMAIL PROTECTED] Fixes Bug #23795 * javax/swing/plaf/basic/BasicTreeUI.java: Made private fields package private. (setCellRenderer): Took out code that updateRenderer takes care of. (getPathBounds): Fixed to use treeModel field. (getPathForRow): Likewise. (getRowCount): Likewise. (installComponents): Implemented. (createNodeDimensions): Implemented. (uninstallComponents): Implemented. (getVerticalLegBuffer): Implemented. (getHorizontalLegBuffer): Implemented. (updateLayoutCacheExpandedNodes): Implemented. (updateExpandedDescendants): Implemented. (updateDepthOffset): Implemented. (updateRenderer): Implemented. (updateSize): Implemented. (installDefaults): Added some more defaults. (installUI): Moved code to installComponents. (paint): Fixed to use treeModel field. (ensureRowsAreVisible): Implemented. (getMinimumSize): Implemented. (getMaximumSize): Implemented. (checkForClickInExpandControl): Implemented. (isLocationInExpandControl): Implemented. (handleExpandControlClick): Implemented. (toggleExpandState): Implemented. (isToggleSelectionEvent): Implemented. (isMultiSelectEvent): Implemented. (isToggleEvent): Implemented. (selectPathForEvent): Implemented. (actionPerformed): Changed to use toggleExpandState. (mousePressed): Fixed code to use helper methods. Made more efficent. (TreeCancelEditingAction): Fixed Constructor signature. (actionPerformed): Fixed to use treeModel field. (paintRecursive): Fixed to use line drawing helper methods. (paintControlIcons): Fixed to use control icons helper methods. (getCurrentControlIcon): New method. (findNode): Changed to use treeModel field. (getNextNode): Likewise. (getPreviousNode): Likewise. (getNextSibling): Likewise. (getPreviousSibling): Likewise. (getPathToRoot): Likewise. (drawDashedHorizontalLine): Implemented. (drawDashedVerticalLine): Implemented. (paintExpandControl): Implemented. (paintHorizontalPartOfLeg): New method. (paintVerticalPartOfLeg): New method. (paintRow): New method. (shouldPaintExpandControl): New Method. * javax/swing/plaf/metal/MetalTreeUI.java: Added private fields for listeners. (getHorizontalLegBuffer): Implemented. (installUI): Implemented. (uninstallUI): Implemented. (decodeLineStyle): New method. (isLocationInExpandControl): Implemented. (paint): Implemented. (paintHorizontalSeparators): New method. (paintVerticalPartOfLeg): Implemented. (paintHorizontalPartOfLeg): Implemented. Index: javax/swing/plaf/basic/BasicTreeUI.java === RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicTreeUI.java,v retrieving revision 1.76 diff -u -r1.76 BasicTreeUI.java --- javax/swing/plaf/basic/BasicTreeUI.java 9 Sep 2005 21:34:36 - 1.76 +++ javax/swing/plaf/basic/BasicTreeUI.java 14 Sep 2005 19:02:45 - @@ -44,6 +44,7 @@ import java.awt.Font; import java.awt.FontMetrics; import java.awt.Graphics; +import java.awt.Insets; import java.awt.Point; import java.awt.Rectangle; import java.awt.event.ActionEvent; @@ -62,6 +63,7 @@ import java.awt.event.MouseMotionListener; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; +import java.util.Enumeration; import java.util.Hashtable; import javax.swing.AbstractAction; @@ -96,7 +98,6 @@ import javax.swing.tree.AbstractLayoutCache; import javax.swing.tree.DefaultTreeCellEditor; import javax.swing.tree.DefaultTreeCellRenderer; -import javax.swing.tree.ExpandVetoException; import javax.swing.tree.FixedHeightLayoutCache; import javax.swing.tree.TreeCellEditor; import javax.swing.tree.TreeCellRenderer; @@ -174,6 +175,9 @@ /** Size needed to completely display all the nodes. */ protected Dimension preferredSize; + + /** Minimum size needed to completely display all the nodes. */ + protected Dimension preferredMinSize; /** Is the preferredSize valid? */ protected boolean validCachedPreferredSize; @@ -225,36 +229,30 @@ protected boolean editorHasDifferentSize; /** The action listener for the editor's Timer. */ - private Timer editorTimer = new EditorUpdateTimer(); + Timer editorTimer = new EditorUpdateTimer(); /** The new value of the node after editing. */ - private Object newVal; + Object newVal; /** The action bound to KeyStrokes. */ - private TreeAction action; + TreeAction action; /** Boolean to keep track of editing. */ - private boolean isEditing; + boolean isEditing; + + /** The bounds of the
[cp-patches] FYI: Hashcode for NameComponent.
This is a hashcode function for the NameComponent, computed using Adler by content rather than by identity (same as .equals works). 2005-09-14Audrius Meskauskas [EMAIL PROTECTED] * org/omg/CosNaming/NameComponent (hashCode): New method. Index: org/omg/CosNaming/NameComponent.java === RCS file: /cvsroot/classpath/classpath/org/omg/CosNaming/NameComponent.java,v retrieving revision 1.3 diff -u -r1.3 NameComponent.java --- org/omg/CosNaming/NameComponent.java2 Jul 2005 20:32:59 - 1.3 +++ org/omg/CosNaming/NameComponent.java14 Sep 2005 19:06:22 - @@ -40,6 +40,8 @@ import org.omg.CORBA.portable.IDLEntity; +import java.util.zip.Adler32; + /** * The name component, a node in the multi-comonent name. * @@ -115,4 +117,14 @@ { return id + . + kind; } -} \ No newline at end of file + + /** + * Return the hashCode of this NameComponent. + */ + public int hashCode() + { +Adler32 adler = new Adler32(); +adler.update(toString().getBytes()); +return (int) adler.getValue() Integer.MAX_VALUE; + } +} ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches]: Patch: JProgressBar Fix
2005-09-14 Lillian Angel [EMAIL PROTECTED] * javax/swing/JProgressBar.java (JProgressBar): Fixed to use setOrientation function. * javax/swing/plaf/metal/MetalProgressBarUI.java (createUI): Was using the same instance of the UI for each new JProgressBar. Fixed this. * javax/swing/plaf/basic/BasicTreeUI.java (installUI): Added call to prepareForUIInstall. (uninstallUI): Added call to prepareForUIUninstall. Index: javax/swing/JProgressBar.java === RCS file: /cvsroot/classpath/classpath/javax/swing/JProgressBar.java,v retrieving revision 1.12 diff -u -r1.12 JProgressBar.java --- javax/swing/JProgressBar.java 7 Jul 2005 11:37:45 - 1.12 +++ javax/swing/JProgressBar.java 14 Sep 2005 20:21:47 - @@ -243,7 +243,7 @@ model = new DefaultBoundedRangeModel(minimum, 0, minimum, maximum); if (orientation != HORIZONTAL orientation != VERTICAL) throw new IllegalArgumentException(orientation + is not a legal orientation); -this.orientation = orientation; +setOrientation(orientation); changeListener = createChangeListener(); model.addChangeListener(changeListener); updateUI(); Index: javax/swing/plaf/basic/BasicTreeUI.java === RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicTreeUI.java,v retrieving revision 1.77 diff -u -r1.77 BasicTreeUI.java --- javax/swing/plaf/basic/BasicTreeUI.java 14 Sep 2005 19:06:02 - 1.77 +++ javax/swing/plaf/basic/BasicTreeUI.java 14 Sep 2005 20:21:48 - @@ -1328,6 +1328,7 @@ */ public void installUI(JComponent c) { +prepareForUIInstall(); super.installUI(c); tree = (JTree) c; installDefaults(); @@ -1371,6 +1372,7 @@ */ public void uninstallUI(JComponent c) { +prepareForUIUninstall(); uninstallDefaults(); uninstallKeyboardActions(); uninstallListeners(); Index: javax/swing/plaf/metal/MetalProgressBarUI.java === RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/metal/MetalProgressBarUI.java,v retrieving revision 1.2 diff -u -r1.2 MetalProgressBarUI.java --- javax/swing/plaf/metal/MetalProgressBarUI.java 2 Jul 2005 20:32:51 - 1.2 +++ javax/swing/plaf/metal/MetalProgressBarUI.java 14 Sep 2005 20:21:48 - @@ -38,17 +38,17 @@ package javax.swing.plaf.metal; +import java.util.HashMap; + import javax.swing.JComponent; import javax.swing.plaf.ComponentUI; import javax.swing.plaf.basic.BasicProgressBarUI; public class MetalProgressBarUI extends BasicProgressBarUI -{ - - // FIXME: maybe replace by a Map of instances when this becomes stateful - /** The shared UI instance for MetalProgressBarUIs */ - private static MetalProgressBarUI instance = null; +{ + /** The UI instances for MetalTreeUIs */ + private static HashMap instances = null; /** * Constructs a new instance of MetalProgressBarUI. @@ -67,8 +67,19 @@ */ public static ComponentUI createUI(JComponent component) { -if (instance == null) - instance = new MetalProgressBarUI(); +if (instances == null) + instances = new HashMap(); + +Object o = instances.get(component); +MetalProgressBarUI instance; +if (o == null) + { +instance = new MetalProgressBarUI(); +instances.put(component, instance); + } +else + instance = (MetalProgressBarUI) o; + return instance; } } ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
Re: [cp-patches] Patch: convert new Boolean(X) to Boolean.valueOf(X)
Archie Cobbs wrote: Mark Wielaard wrote: While messing around with FindBugs, I came up with the following useful patch. It converts all new Boolean(X) instances to Boolean.valueOf(X). Ok? [...] - return new Boolean(true); + return Boolean.valueOf(true); OK, but if you know the actual value then using Boolean.TRUE and Boolean.FALSE seems more appropriate then valueOf(). Could you make that change? That shouldn't be necessary .. the method inliner will likely take care of that (Boolean.valueOf() is guaranteed to return either Boolean.TRUE or Boolean.FALSE) so the ultimate effect should be the same. None of this is necessary. But we do it anyway to make the code better. For me Boolean.TRUE reads much more cleanly than Boolean.valueOf(true). I think it improbable that it is less efficient either. David Daney ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] FYI: ComponentView addition
Implemented createComponent. Attached. 2005-09-14 Anthony Balkissoon [EMAIL PROTECTED] * javax/swing/text/ComponentView.java: (createComponent): Implemented. --Tony Index: javax/swing/text/ComponentView.java === RCS file: /cvsroot/classpath/classpath/javax/swing/text/ComponentView.java,v retrieving revision 1.9 diff -u -r1.9 ComponentView.java --- javax/swing/text/ComponentView.java 13 Sep 2005 23:44:49 - 1.9 +++ javax/swing/text/ComponentView.java 14 Sep 2005 20:16:26 - @@ -76,7 +76,7 @@ */ protected Component createComponent() { -return null; +return StyleConstants.getComponent(getElement().getAttributes()); } /** ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] FYI: DefaultStyledDocument fixlet
One more fixlet to DefaultStyledDocument. This lets me startup BeanShell: http://kennke.org/~roman/bsh.png Still needed a little tweak on BeanShells side though. Seems a little issue in java.io. Will file a bug report for this. 2005-09-14 Roman Kennke [EMAIL PROTECTED] * javax/swing/text/DefaultStyledDocument.java (insertUpdate): Tweaked attribute comparison to avoid NPE. /RomanIndex: javax/swing/text/DefaultStyledDocument.java === RCS file: /cvsroot/classpath/classpath/javax/swing/text/DefaultStyledDocument.java,v retrieving revision 1.10 diff -u -r1.10 DefaultStyledDocument.java --- javax/swing/text/DefaultStyledDocument.java 14 Sep 2005 21:26:06 - 1.10 +++ javax/swing/text/DefaultStyledDocument.java 14 Sep 2005 21:57:58 - @@ -1074,7 +1074,7 @@ // joined with the next element. if (i == endOffset - 1) { -if (attr.isEqual(next.getAttributes())) +if (next.getAttributes().isEqual(attr)) spec.setDirection(ElementSpec.JoinNextDirection); } // If we are at the first new element, then check if it could be___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
Re: [cp-patches] Patch: convert new Boolean(X) to Boolean.valueOf(X)
David Daney wrote: Archie Cobbs wrote: Mark Wielaard wrote: While messing around with FindBugs, I came up with the following useful patch. It converts all new Boolean(X) instances to Boolean.valueOf(X). Ok? [...] - return new Boolean(true); + return Boolean.valueOf(true); OK, but if you know the actual value then using Boolean.TRUE and Boolean.FALSE seems more appropriate then valueOf(). Could you make that change? That shouldn't be necessary .. the method inliner will likely take care of that (Boolean.valueOf() is guaranteed to return either Boolean.TRUE or Boolean.FALSE) so the ultimate effect should be the same. None of this is necessary. But we do it anyway to make the code better. For me Boolean.TRUE reads much more cleanly than Boolean.valueOf(true). I think it improbable that it is less efficient either. Apologies, I didn't see that you were referring to the specific patch chunk that used the literal constant true.. I completely agree with you in that case! All I meant to say is that Boolean.valueOf(x) is not worse than x ? Boolean.TRUE : Boolean.FALSE. -Archie __ Archie Cobbs *CTO, Awarix* http://www.awarix.com ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] Patch: Class.pd is transient
FindBugs is complaining that Class.pd will mess up serialization. I don't know if this is the best fix. Comments? AG 2005-09-14 Anthony Green [EMAIL PROTECTED] * java/lang/Class.java (pd): ProtectionDomain is not serializable. Make this field transient. Index: java/lang/Class.java === RCS file: /cvsroot/classpath/classpath/java/lang/Class.java,v retrieving revision 1.39 diff -u -r1.39 Class.java --- java/lang/Class.java13 Sep 2005 21:25:11 - 1.39 +++ java/lang/Class.java14 Sep 2005 23:45:41 - @@ -101,7 +101,7 @@ /** The class signers. */ private Object[] signers = null; /** The class protection domain. */ - private final ProtectionDomain pd; + private final transient ProtectionDomain pd; /* We use an inner class, so that Class doesn't have a static initializer */ private static final class StaticData ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] Patch: close charset provider readers
We should close each reader we open. Ok? 2005-09-14 Anthony Green [EMAIL PROTECTED] * java/nio/charset/Charset.java (providers2): close() each reader we open. Index: java/nio/charset/Charset.java === RCS file: /cvsroot/classpath/classpath/java/nio/charset/Charset.java,v retrieving revision 1.24 diff -u -r1.24 Charset.java --- java/nio/charset/Charset.java 31 Aug 2005 17:01:43 - 1.24 +++ java/nio/charset/Charset.java 14 Sep 2005 23:32:58 - @@ -281,6 +281,7 @@ (CharsetProvider) ((Class.forName(s)).newInstance()); set.add(p); } + rdr.close(); } providers = new CharsetProvider[set.size()]; ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] Patch: replace NullPointerException with ClassCastException
This doesn't really fix a bug. FindBugs was complaining about a potential null dereference. This patch essentially turns a potential NullPointerException into a ClassCastException, which is no worse - and quiets FindBugs on this issue. Ok? AG 2005-09-14 Anthony Green [EMAIL PROTECTED] * java/security/KeyPairGenerator.java (getInstance): Remove instanceof test. Now we'll get a ClassCastException instead of a NullPointerException. Index: java/security/KeyPairGenerator.java === RCS file: /cvsroot/classpath/classpath/java/security/KeyPairGenerator.java,v retrieving revision 1.15 diff -u -r1.15 KeyPairGenerator.java --- java/security/KeyPairGenerator.java 9 Aug 2005 06:13:54 - 1.15 +++ java/security/KeyPairGenerator.java 15 Sep 2005 00:20:19 - @@ -251,7 +251,7 @@ { result = new DummyKeyPairGenerator((KeyPairGeneratorSpi) o, algorithm); } -else if (o instanceof KeyPairGenerator) +else { result = (KeyPairGenerator) o; result.algorithm = algorithm; ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] Patch: fix || expressions in jdwp code
These | operators should have been ||. Ok? AG 2005-09-14 Anthony Green [EMAIL PROTECTED] * gnu/classpath/jdwp/event/filters/StepFilter.java (StepFilter): Short circuit this conditional. * gnu/classpath/jdwp/event/filters/ThreadOnlyFilter.java (ThreadOnlyFilter): Ditto. Index: gnu/classpath/jdwp/event/filters/StepFilter.java === RCS file: /cvsroot/classpath/classpath/gnu/classpath/jdwp/event/filters/StepFilter.java,v retrieving revision 1.1 diff -u -r1.1 StepFilter.java --- gnu/classpath/jdwp/event/filters/StepFilter.java26 Aug 2005 21:52:28 - 1.1 +++ gnu/classpath/jdwp/event/filters/StepFilter.java15 Sep 2005 00:23:45 - @@ -66,7 +66,7 @@ public StepFilter (ThreadId tid, int size, int depth) throws InvalidThreadException { -if (tid == null | tid.getReference().get () == null) +if (tid == null || tid.getReference().get () == null) throw new InvalidThreadException (tid.getId ()); _tid = tid; Index: gnu/classpath/jdwp/event/filters/ThreadOnlyFilter.java === RCS file: /cvsroot/classpath/classpath/gnu/classpath/jdwp/event/filters/ThreadOnlyFilter.java,v retrieving revision 1.1 diff -u -r1.1 ThreadOnlyFilter.java --- gnu/classpath/jdwp/event/filters/ThreadOnlyFilter.java 26 Aug 2005 21:52:28 - 1.1 +++ gnu/classpath/jdwp/event/filters/ThreadOnlyFilter.java 15 Sep 2005 00:23:45 - @@ -66,7 +66,7 @@ public ThreadOnlyFilter (ThreadId tid) throws InvalidThreadException { -if (tid == null | tid.getReference().get () == null) +if (tid == null || tid.getReference().get () == null) throw new InvalidThreadException (tid.getId ()); _tid = tid; ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] Patch: compare strings with equals()
'==' on Strings only works when we expect the strings to be interned, which isn't the case here. Ok? AG 2005-09-14 Anthony Green [EMAIL PROTECTED] * java/security/Identity.java (equals, identityEquals): Don't use `==' to compare uninterned Strings. Use String.equals(). Index: java/security/Identity.java === RCS file: /cvsroot/classpath/classpath/java/security/Identity.java,v retrieving revision 1.10 diff -u -r1.10 Identity.java --- java/security/Identity.java 2 Jul 2005 20:32:40 - 1.10 +++ java/security/Identity.java 14 Sep 2005 23:54:58 - @@ -297,8 +297,8 @@ if (identity == this) return true; - if Identity) identity).getName() == this.name) - (((Identity) identity).getScope() == this.scope)) + if Identity) identity).getName().equals(this.name)) + (((Identity) identity).getScope().equals(this.scope))) return true; return identityEquals((Identity) identity); @@ -319,8 +319,8 @@ */ protected boolean identityEquals(Identity identity) { -return ((identity.getName() == this.name) - (identity.getPublicKey() == this.publicKey)); +return ((identity.getName().equals(this.name)) + (identity.getPublicKey().equals(this.publicKey))); } /** ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] Patch: compute aspect ratios with fp division
Another integer division problem. OK? AG 2005-09-14 Anthony Green [EMAIL PROTECTED] * javax/imageio/ImageReader.java (getAspectRatio): Don't use integer division when computing aspect ratio. Index: javax/imageio/ImageReader.java === RCS file: /cvsroot/classpath/classpath/javax/imageio/ImageReader.java,v retrieving revision 1.5 diff -u -r1.5 ImageReader.java --- javax/imageio/ImageReader.java 2 Jul 2005 20:32:45 - 1.5 +++ javax/imageio/ImageReader.java 15 Sep 2005 00:00:52 - @@ -126,7 +126,7 @@ public float getAspectRatio(int imageIndex) throws IOException { -return (float) (getWidth(imageIndex) / getHeight(imageIndex)); + return ((float) getWidth(imageIndex)) / ((float) getHeight(imageIndex)); } public Locale[] getAvailableLocales() ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] Patch: throw IOExceptions on closed PushbackInputStream operations
If you try an operation on a closed PushbackInputStream, you'll probably get a NullPointerException. This patch turns them into IOExceptions with an appropriate message. I think this is a better response based on the spec (any error should throw an IOException). OK? AG 2005-09-14 Anthony Green [EMAIL PROTECTED] * java/io/PushbackInputStream.java (available, read, skip): Handle closed stream operations gracefully. Index: java/io/PushbackInputStream.java === RCS file: /cvsroot/classpath/classpath/java/io/PushbackInputStream.java,v retrieving revision 1.16 diff -u -r1.16 PushbackInputStream.java --- java/io/PushbackInputStream.java2 Jul 2005 20:32:38 - 1.16 +++ java/io/PushbackInputStream.java15 Sep 2005 00:18:49 - @@ -116,7 +116,11 @@ */ public int available() throws IOException { -return (buf.length - pos) + super.available(); +try { + return (buf.length - pos) + super.available(); +} catch (NullPointerException npe) { + throw new IOException (Stream closed); +} } /** @@ -168,8 +172,11 @@ */ public synchronized int read() throws IOException { +if (buf == null) + throw new IOException (Stream closed); + if (pos buf.length) - return ((int) buf[pos++]) 0xFF; + return ((int) buf[pos++]) 0xFF; return super.read(); } @@ -200,6 +207,9 @@ */ public synchronized int read(byte[] b, int off, int len) throws IOException { +if (buf == null) + throw new IOException (Stream closed); + int numBytes = Math.min(buf.length - pos, len); if (numBytes 0) @@ -312,6 +322,9 @@ */ public synchronized long skip(long n) throws IOException { +if (buf == null) + throw new IOException (Stream closed); + final long origN = n; if (n 0L) ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] Patch: minor URLStreamHandler cleanup
All this does is remove a redundant null pointer check. This could never be null since we would have thrown an exception a couple of lines before (see the first line of the patch). Ok? AG 2005-09-14 Anthony Green [EMAIL PROTECTED] * java/net/URLStreamHandler.java: Remove redundant null pointer check. Index: java/net/URLStreamHandler.java === RCS file: /cvsroot/classpath/classpath/java/net/URLStreamHandler.java,v retrieving revision 1.33 diff -u -r1.33 URLStreamHandler.java --- java/net/URLStreamHandler.java 2 Jul 2005 20:32:39 - 1.33 +++ java/net/URLStreamHandler.java 15 Sep 2005 00:20:46 - @@ -511,7 +511,7 @@ int size = protocol.length() + authority.length() + file.length() + 24; StringBuffer sb = new StringBuffer(size); -if (protocol != null protocol.length() 0) +if (protocol.length() 0) { sb.append(protocol); sb.append(:); ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
Re: [cp-patches] Patch: fix || expressions in jdwp code
Anthony Green wrote: These | operators should have been ||. Ok? Well, I don't know if you think you need permission from me, but I would say, How the heck did that escape my attention??? Puzzled (and grateful), Keith ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches