[cp-patches] FYI: Added ASN.1 encoding/decoding support to DH keys
hello there, the attached patch --already committed-- adds support for ASN.1 DER encoding and decoding to DH keys. 2006-02-12 Raif S. Naffah [EMAIL PROTECTED] * gnu/javax/crypto/key/dh/GnuDHPublicKey.java (GnuDHPublicKey(4)): Call constructor with 5 arguments. (GnuDHPublicKey): New constructor. (getEncoded): Removed. (valueOf): Added support for ASN.1 encoding. (getEncoded(int)): Likewise. (equals): New method. * gnu/javax/crypto/key/dh/GnuDHPrivateKey.java (GnuDHPrivateKey(4)): Call constructor with 5 arguments. (GnuDHPrivateKey(5)): New constructor. (getEncoded): Removed. (valueOf): Added support for ASN.1 encoding. (getEncoded(int)): Likewise. (equals): New method. * gnu/javax/crypto/key/dh/GnuDHKeyPairGenerator.java (PREFERRED_ENCODING_FORMAT): New constant. (DEFAULT_ENCODING_FORMAT): Likewise. (preferredFormat): New field. (setup): Handle preferred encoding format identifier. (generate): Call constructors with format identifier. * gnu/javax/crypto/key/dh/GnuDHKey.java (defaultFormat): New field. (GnuDHKey): Added an int argument. (getEncoded): New method. (getFormat): New implementation. (getEncoded(int)): New abstract method. * gnu/javax/crypto/key/dh/DHKeyPairX509Codec.java: New file. * gnu/javax/crypto/key/dh/DHKeyPairPKCS8Codec.java: Likewise. * gnu/javax/crypto/jce/GnuCrypto.java (run): Added mappings for DH key-pair generator and key-factory. * gnu/javax/crypto/jce/sig/DHKeyPairGeneratorSpi.java: New file. * gnu/javax/crypto/jce/sig/DHKeyFactory.java: Likewise. * gnu/java/security/jce/sig/KeyPairGeneratorAdapter.java: Made it public. * gnu/java/security/jce/sig/EncodedKeyFactory.java (invokeConstructor): New method. (getConcreteClass): Likewise. (getConcreteCtor): Likewise. (invokeValueOf): Likewise. (getValueOfMethod): Likewise. (engineGeneratePublic): Add support for DH keys. (engineGeneratePrivate): Likewise. (decodeDHPublicKey(DHPublicKeySpec)): New method. (decodeDHPublicKey(byte[])): Likewise. (decodeDHPrivateKey(DHPrivateKeySpec)): Likewise. (decodeDHPrivateKey(byte[])): Likewise. the Mauve tests TestOfFormat and TestOfKeyFactory, both in gnu/testlet/gnu/java/security/jce, have been amended to test the above. cheers; rsn Index: EncodedKeyFactory.java === RCS file: /cvsroot/classpath/classpath/gnu/java/security/jce/sig/EncodedKeyFactory.java,v retrieving revision 1.3 diff -u -r1.3 EncodedKeyFactory.java --- EncodedKeyFactory.java 11 Feb 2006 08:48:51 - 1.3 +++ EncodedKeyFactory.java 12 Feb 2006 08:21:13 - @@ -44,6 +44,9 @@ import gnu.java.security.key.rsa.GnuRSAPrivateKey; import gnu.java.security.key.rsa.GnuRSAPublicKey; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; import java.math.BigInteger; import java.security.InvalidKeyException; import java.security.InvalidParameterException; @@ -60,6 +63,11 @@ import java.security.spec.RSAPublicKeySpec; import java.security.spec.X509EncodedKeySpec; +import javax.crypto.interfaces.DHPrivateKey; +import javax.crypto.interfaces.DHPublicKey; +import javax.crypto.spec.DHPrivateKeySpec; +import javax.crypto.spec.DHPublicKeySpec; + /** * A factory for keys encoded in either the X.509 format (for public keys) or * the PKCS#8 format (for private keys). @@ -69,6 +77,118 @@ { // implicit 0-arguments constructor + // Class methods + // -- + + private static Object invokeConstructor(String className, Object[] params) + throws InvalidKeySpecException + { +Class clazz = getConcreteClass(className); +try + { +Constructor ctor = getConcreteCtor(clazz); +Object result = ctor.newInstance(params); +return result; + } +catch (InstantiationException x) + { +InvalidKeySpecException y = new InvalidKeySpecException(); +y.initCause(x); +throw y; + } +catch (IllegalAccessException x) + { +InvalidKeySpecException y = new InvalidKeySpecException(); +y.initCause(y); +throw y; + } +catch (InvocationTargetException x) + { +InvalidKeySpecException y = new InvalidKeySpecException(); +y.initCause(x); +throw y; + } + } + + private static Class getConcreteClass(String className) + throws InvalidKeySpecException + { +try + { +Class result = Class.forName(className); +return result; + } +catch (ClassNotFoundException x) + { +InvalidKeySpecException y = new
[cp-patches] FYI: InputStreamReader fix (PR 26220)
Hi, Committed. Regards, Jeroen 2006-02-12 Jeroen Frijters [EMAIL PROTECTED] Fixes PR 26220 * java/io/InputStreamReader.java (InputStreamReader(InputStream)): Use SystemProperties. (InputStreamReader(InputStream,Charset)): Corrected @since tag. Throw NullPointerException if in is null. Added maxBytesPerChar initialisation. (InputStreamReader(InputStream,CharsetDecoder)): Corrected @since tag. Throw NullPointerException if in is null. Index: java/io/InputStreamReader.java === RCS file: /cvsroot/classpath/classpath/java/io/InputStreamReader.java,v retrieving revision 1.28 diff -u -r1.28 InputStreamReader.java --- java/io/InputStreamReader.java 4 Jan 2006 00:11:33 - 1.28 +++ java/io/InputStreamReader.java 12 Feb 2006 09:28:09 - @@ -1,5 +1,6 @@ /* InputStreamReader.java -- Reader than transforms bytes to chars - Copyright (C) 1998, 1999, 2001, 2003, 2004, 2005 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2001, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -38,6 +39,7 @@ package java.io; +import gnu.classpath.SystemProperties; import gnu.java.nio.charset.EncodingHelper; import java.nio.ByteBuffer; @@ -145,7 +147,7 @@ this.in = in; try { - encoding = System.getProperty(file.encoding); + encoding = SystemProperties.getProperty(file.encoding); // Don't use NIO if avoidable if(EncodingHelper.isISOLatin1(encoding)) { @@ -231,12 +233,20 @@ * charset to decode the bytes in the InputStream into * characters. * - * @since 1.5 + * @since 1.4 */ public InputStreamReader(InputStream in, Charset charset) { +if (in == null) + throw new NullPointerException(); this.in = in; decoder = charset.newDecoder(); +try { + maxBytesPerChar = charset.newEncoder().maxBytesPerChar(); +} catch(UnsupportedOperationException _){ + maxBytesPerChar = 1f; +} + decoder.onMalformedInput(CodingErrorAction.REPLACE); decoder.onUnmappableCharacter(CodingErrorAction.REPLACE); decoder.reset(); @@ -247,9 +257,11 @@ * Creates an InputStreamReader that uses the given charset decoder * to decode the bytes in the InputStream into characters. * - * @since 1.5 + * @since 1.4 */ public InputStreamReader(InputStream in, CharsetDecoder decoder) { +if (in == null) + throw new NullPointerException(); this.in = in; this.decoder = decoder;
[cp-patches] FYI: Small InputStream fix
Hi, Committed. Regards, Jeroen 2006-02-12 Jeroen Frijters [EMAIL PROTECTED] * java/io/InputStream.java (read(byte[],int,int)): Changed argument validation to prevent integer overflow. Remove redundant check. Index: java/io/InputStream.java === RCS file: /cvsroot/classpath/classpath/java/io/InputStream.java,v retrieving revision 1.10 diff -u -r1.10 InputStream.java --- java/io/InputStream.java2 Jul 2005 20:32:38 - 1.10 +++ java/io/InputStream.java10 Feb 2006 11:50:37 - @@ -193,10 +193,8 @@ */ public int read(byte[] b, int off, int len) throws IOException { -if (off 0 || len 0 || off + len b.length) +if (off 0 || len 0 || b.length - off len) throw new IndexOutOfBoundsException(); -if (b.length == 0) - return 0; int i, ch;
[cp-patches] FYI: Reformatted two rmi classes
Hi, i reformatted two rmi classes to be able to add javadocs. 2006-02-12 Wolfgang Baer [EMAIL PROTECTED] * java/rmi/MarshalledObject.java: Reformatted. * java/rmi/Naming.java: Likewise. Wolfgang Index: java/rmi/Naming.java === RCS file: /cvsroot/classpath/classpath/java/rmi/Naming.java,v retrieving revision 1.10 diff -u -r1.10 Naming.java --- java/rmi/Naming.java 2 Jul 2005 20:32:40 - 1.10 +++ java/rmi/Naming.java 12 Feb 2006 11:35:19 - @@ -1,5 +1,6 @@ /* Naming.java -- - Copyright (c) 1996, 1997, 1998, 1999, 2004 Free Software Foundation, Inc. + Copyright (c) 1996, 1997, 1998, 1999, 2004, 2006 + Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -76,136 +77,150 @@ * @author Andrew John Hughes ([EMAIL PROTECTED]) * @since 1.1 */ -public final class Naming { - +public final class Naming +{ /** * This class isn't intended to be instantiated. */ - private Naming() {} + private Naming() + { + } -/** - * Looks for the remote object that is associated with the named service. - * Name and location is given in form of a URL without a scheme: - * - * pre - * //host:port/service-name - * /pre - * - * The port is optional. - * - * @param name the service name and location - * @return Remote-object that implements the named service - * @throws NotBoundException if no object implements the service - * @throws MalformedURLException - * @throws RemoteException - */ -public static Remote lookup(String name) throws NotBoundException, MalformedURLException, RemoteException { -URL u = parseURL(name); - String serviceName = getName(u); - return (getRegistry(u).lookup(serviceName)); -} + /** + * Looks for the remote object that is associated with the named service. + * Name and location is given in form of a URL without a scheme: + * + * pre + * //host:port/service-name + * /pre + * + * The port is optional. + * + * @param name the service name and location + * @return Remote-object that implements the named service + * @throws NotBoundException if no object implements the service + * @throws MalformedURLException + * @throws RemoteException + */ + public static Remote lookup(String name) throws NotBoundException, +MalformedURLException, RemoteException + { +URL u = parseURL(name); +String serviceName = getName(u); +return (getRegistry(u).lookup(serviceName)); + } -/** - * Try to bind the given object to the given service name. - * @param name - * @param obj - * @throws AlreadyBoundException - * @throws MalformedURLException - * @throws RemoteException - */ -public static void bind(String name, Remote obj) throws AlreadyBoundException, MalformedURLException, RemoteException { -URL u = parseURL(name); - String serviceName = getName(u); - getRegistry(u).bind(serviceName, obj); -} + /** + * Try to bind the given object to the given service name. + * + * @param name + * @param obj + * @throws AlreadyBoundException + * @throws MalformedURLException + * @throws RemoteException + */ + public static void bind(String name, Remote obj) +throws AlreadyBoundException, MalformedURLException, RemoteException + { +URL u = parseURL(name); +String serviceName = getName(u); +getRegistry(u).bind(serviceName, obj); + } -/** - * Remove a binding for a given service name. - * @param name - * @throws RemoteException - * @throws NotBoundException - * @throws MalformedURLException - */ -public static void unbind(String name) throws RemoteException, NotBoundException, MalformedURLException { -URL u = parseURL(name); - String serviceName = getName(u); - getRegistry(u).unbind(serviceName); -} + /** + * Remove a binding for a given service name. + * + * @param name + * @throws RemoteException + * @throws NotBoundException + * @throws MalformedURLException + */ + public static void unbind(String name) throws RemoteException, +NotBoundException, MalformedURLException + { +URL u = parseURL(name); +String serviceName = getName(u); +getRegistry(u).unbind(serviceName); + } -/** - * Forces the binding between the given Remote-object and the given service name, even - * if there was already an object bound to this name. - * @param name - * @param obj - * @throws RemoteException - * @throws MalformedURLException - */ -public static void rebind(String name, Remote obj) throws RemoteException, MalformedURLException { -URL u = parseURL(name); - String serviceName = getName(u); - getRegistry(u).rebind(serviceName, obj); -} + /** + * Forces the binding between the given Remote-object and the given service + * name, even if there was already an object bound to this name. + * + * @param name + * @param obj + * @throws RemoteException + * @throws MalformedURLException + */ + public static void rebind(String name, Remote obj)
[cp-patches] FYI: Small GtkGenericPeer cleanup
Hi, A long time ago Graydon replaced all usage of the EventQueue through the GtkGenericPeer field q, where replaced by explicit method calls to get the current queue. But the old infrastructure was still in place. This removes that and replaces the last remaining usage of q with q() in GtkComponentPeer. 2006-02-12 Mark Wielaard [EMAIL PROTECTED] * gnu/java/awt/peer/gtk/GtkComponentPeer.java (postKeyEvent): Call q() to get EventQueue. * gnu/java/awt/peer/gtk/GtkGenericPeer.java (q): Remove static field. (enableQueue): Remove static method. * gnu/java/awt/peer/gtk/GtkToolkit.java (getSystemEventQueueImpl): Don't call GtkGenericPeer.enableQueue(). Committed, Mark ? gnu/java/awt/peer/gtk/GtkPopupMenuPeer.java.menu Index: gnu/java/awt/peer/gtk/GtkComponentPeer.java === RCS file: /sources/classpath/classpath/gnu/java/awt/peer/gtk/GtkComponentPeer.java,v retrieving revision 1.102 diff -u -r1.102 GtkComponentPeer.java --- gnu/java/awt/peer/gtk/GtkComponentPeer.java 11 Feb 2006 20:45:16 - 1.102 +++ gnu/java/awt/peer/gtk/GtkComponentPeer.java 12 Feb 2006 11:37:04 - @@ -47,6 +47,7 @@ import java.awt.Container; import java.awt.Cursor; import java.awt.Dimension; +import java.awt.EventQueue; import java.awt.Font; import java.awt.FontMetrics; import java.awt.Graphics; @@ -587,6 +588,8 @@ KeyEvent keyEvent = new KeyEvent (awtComponent, id, when, mods, keyCode, keyChar, keyLocation); +EventQueue q = q(); + // Also post a KEY_TYPED event if keyEvent is a key press that // doesn't represent an action or modifier key. if (keyEvent.getID () == KeyEvent.KEY_PRESSED @@ -595,15 +598,17 @@ keyCode != KeyEvent.VK_CONTROL keyCode != KeyEvent.VK_ALT)) { -synchronized (q) - { -q().postEvent (keyEvent); -q().postEvent (new KeyEvent (awtComponent, KeyEvent.KEY_TYPED, when, mods, -KeyEvent.VK_UNDEFINED, keyChar, keyLocation)); +synchronized(q) + { + q.postEvent(keyEvent); + keyEvent = new KeyEvent(awtComponent, KeyEvent.KEY_TYPED, when, +mods, KeyEvent.VK_UNDEFINED, keyChar, +keyLocation); + q.postEvent(keyEvent); } } else - q().postEvent (keyEvent); + q.postEvent(keyEvent); } protected void postFocusEvent (int id, boolean temporary) Index: gnu/java/awt/peer/gtk/GtkGenericPeer.java === RCS file: /sources/classpath/classpath/gnu/java/awt/peer/gtk/GtkGenericPeer.java,v retrieving revision 1.17 diff -u -r1.17 GtkGenericPeer.java --- gnu/java/awt/peer/gtk/GtkGenericPeer.java 14 Jul 2005 22:07:02 - 1.17 +++ gnu/java/awt/peer/gtk/GtkGenericPeer.java 12 Feb 2006 11:37:04 - @@ -52,9 +52,6 @@ // The widget or other java-side object we wrap. protected Object awtWidget; - // Global event queue. - protected static EventQueue q = null; - // Dispose of our native state. public native void dispose (); @@ -68,12 +65,6 @@ this.awtWidget = awtWidget; } - public static void enableQueue (EventQueue sq) - { -if (q == null) - q = sq; - } - protected void postActionEvent (String command, int mods) { q().postEvent (new ActionEvent (awtWidget, ActionEvent.ACTION_PERFORMED, Index: gnu/java/awt/peer/gtk/GtkToolkit.java === RCS file: /sources/classpath/classpath/gnu/java/awt/peer/gtk/GtkToolkit.java,v retrieving revision 1.79 diff -u -r1.79 GtkToolkit.java --- gnu/java/awt/peer/gtk/GtkToolkit.java 2 Sep 2005 09:15:22 - 1.79 +++ gnu/java/awt/peer/gtk/GtkToolkit.java 12 Feb 2006 11:37:04 - @@ -608,7 +608,6 @@ if (q == null) { q = new EventQueue(); -GtkGenericPeer.enableQueue (q); } } return q; signature.asc Description: This is a digitally signed message part
[cp-patches] FYI: Javadoc updates for java.rmi
Hi, I had some javadoc fixes in my local tree and expanded them today to cover the whole package. 2006-02-12 Wolfgang Baer [EMAIL PROTECTED] * java/rmi/MarshalledObject.java: Added api docs to the class. * java/rmi/Remote.java: Added interface api docs. * java/rmi/package.html: Added package description. * java/rmi/AccessException.java: Minor api doc fixes. * java/rmi/NoSuchObjectException.java: Likewise. * java/rmi/AlreadyBoundException.java: Likewise. * java/rmi/RemoteException.java: Likewise. * java/rmi/NotBoundException.java: Likewise. * java/rmi/RMISecurityException.java: Likewise. * java/rmi/StubNotFoundException.java: Likewise. Wolfgang Index: java/rmi/AccessException.java === RCS file: /cvsroot/classpath/classpath/java/rmi/AccessException.java,v retrieving revision 1.4 diff -u -r1.4 AccessException.java --- java/rmi/AccessException.java 2 Jul 2005 20:32:40 - 1.4 +++ java/rmi/AccessException.java 12 Feb 2006 12:23:08 - @@ -1,5 +1,6 @@ /* AccessException.java -- thrown if the caller does not have access - Copyright (c) 1996, 1997, 1998, 1999, 2002 Free Software Foundation, Inc. + Copyright (c) 1996, 1997, 1998, 1999, 2002, 2006 + Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -43,7 +44,7 @@ * * @author unknown * @see Naming - * @see ActivationSystem + * @see java.rmi.activation.ActivationSystem * @since 1.1 */ public class AccessException extends RemoteException Index: java/rmi/AlreadyBoundException.java === RCS file: /cvsroot/classpath/classpath/java/rmi/AlreadyBoundException.java,v retrieving revision 1.4 diff -u -r1.4 AlreadyBoundException.java --- java/rmi/AlreadyBoundException.java 2 Jul 2005 20:32:40 - 1.4 +++ java/rmi/AlreadyBoundException.java 12 Feb 2006 12:23:08 - @@ -1,5 +1,6 @@ /* AlreadyBoundException.java -- thrown if a binding is already bound - Copyright (c) 1996, 1997, 1998, 1999, 2002 Free Software Foundation, Inc. + Copyright (c) 1996, 1997, 1998, 1999, 2002, 2006 + Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -42,8 +43,8 @@ * bound. * * @author unknown - * @see Naming#bind(String, Remote) - * @see Registry#bind(String, Remote) + * @see java.rmi.Naming#bind(String, Remote) + * @see java.rmi.registry.Registry#bind(String, Remote) * @since 1.1 * @status updated to 1.4 */ Index: java/rmi/NoSuchObjectException.java === RCS file: /cvsroot/classpath/classpath/java/rmi/NoSuchObjectException.java,v retrieving revision 1.4 diff -u -r1.4 NoSuchObjectException.java --- java/rmi/NoSuchObjectException.java 2 Jul 2005 20:32:40 - 1.4 +++ java/rmi/NoSuchObjectException.java 12 Feb 2006 12:23:08 - @@ -1,5 +1,6 @@ /* NoSuchObjectException.java -- thrown if the remote object no longer exists - Copyright (c) 1996, 1997, 1998, 1999, 2002 Free Software Foundation, Inc. + Copyright (c) 1996, 1997, 1998, 1999, 2002, 2006 + Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -43,9 +44,9 @@ * obey the semantics of at most once. * * @author unknown - * @see RemoteObject#toStub(Remote) - * @see UnicastRemoteObject#unexportObject(Remote, boolean) - * @see Activatable#unexportObject(Remote, boolean) + * @see java.rmi.server.RemoteObject#toStub(Remote) + * @see java.rmi.server.UnicastRemoteObject#unexportObject(Remote, boolean) + * @see java.rmi.activation.Activatable#unexportObject(Remote, boolean) * @since 1.1 * @status updated to 1.4 */ Index: java/rmi/NotBoundException.java === RCS file: /cvsroot/classpath/classpath/java/rmi/NotBoundException.java,v retrieving revision 1.4 diff -u -r1.4 NotBoundException.java --- java/rmi/NotBoundException.java 2 Jul 2005 20:32:40 - 1.4 +++ java/rmi/NotBoundException.java 12 Feb 2006 12:23:08 - @@ -1,5 +1,6 @@ /* NotBoundException.java -- attempt to use a registry name with no binding - Copyright (c) 1996, 1997, 1998, 1999, 2002 Free Software Foundation, Inc. + Copyright (c) 1996, 1997, 1998, 1999, 2002, 2006 + Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -42,10 +43,10 @@ * associated binding. * * @author unknown - * @see Naming#lookup(String) - * @see Naming#unbind(String) - * @see Registry#lookup(String) - * @see Registry#unbind(String) + * @see java.rmi.Naming#lookup(String) + * @see java.rmi.Naming#unbind(String) + * @see java.rmi.registry.Registry#lookup(String) + * @see java.rmi.registry.Registry#unbind(String) * @since 1.1 * @status updated to 1.4 */ Index: java/rmi/RemoteException.java === RCS file:
Re: [cp-patches] FYI: SwingPropertyChangeSupport
On Mon, 2006-02-06 at 12:56 +, Roman Kennke wrote: 2006-02-06 Roman Kennke [EMAIL PROTECTED] * javax/swing/event/SwingPropertyChangeSupport.java (listeners): Removed field. (propertyListeners): Removed field. (source): Removed field. (SwingPropertyChangeSupport()): Removed initialization of removed fields. (addPropertyChangeListener): Removed methods. (removePropertyChangeListener): Removed methods. (getPropertyChangeListeners): Removed methods. (firePropertyChange): Removed methods. (hasListeners): Removed methods. This showed some regressions in mauve: FAIL: gnu.testlet.javax.swing.event.SwingPropertyChangeSupport.addPropertyChangeListener: (PropertyChangeListener) (number 3) FAIL: gnu.testlet.javax.swing.event.SwingPropertyChangeSupport.addPropertyChangeListener: (String, PropertyChangeListener) (number 3) Fixed as follows: 2006-02-12 Mark Wielaard [EMAIL PROTECTED] * java/beans/PropertyChangeSupport.java (addPropertyChangeListener): Silently ignores null listener. (addPropertyChangeListener(String, PropertyChangeListener): Likewise. (getPropertyChangeListeners): Returns empty PropertyChangeListener array for null propertyName. Committed, Mark Index: java/beans/PropertyChangeSupport.java === RCS file: /sources/classpath/classpath/java/beans/PropertyChangeSupport.java,v retrieving revision 1.14 diff -u -r1.14 PropertyChangeSupport.java --- java/beans/PropertyChangeSupport.java 30 Nov 2005 15:25:12 - 1.14 +++ java/beans/PropertyChangeSupport.java 12 Feb 2006 13:53:21 - @@ -1,5 +1,6 @@ /* PropertyChangeSupport.java -- support to manage property change listeners - Copyright (C) 1998, 1999, 2000, 2002, 2005 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2000, 2002, 2005, 2006 + Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -120,14 +121,17 @@ * property change events will be sent to this listener. The listener add * is not unique: that is, emn/em adds with the same listener will * result in emn/em events being sent to that listener for every - * property change. Adding a null listener may cause a NullPointerException - * down the road. This method will unwrap a PropertyChangeListenerProxy, + * property change. Adding a null listener is silently ignored. + * This method will unwrap a PropertyChangeListenerProxy, * registering the underlying delegate to the named property list. * * @param l the listener to add */ public synchronized void addPropertyChangeListener(PropertyChangeListener l) { +if (l == null) + return; + if (l instanceof PropertyChangeListenerProxy) { PropertyChangeListenerProxy p = (PropertyChangeListenerProxy) l; @@ -216,8 +220,8 @@ * cumulative, too; if you are registered to listen to receive events on * all property changes, and then you register on a particular property, * you will receive change events for that property twice. Adding a null - * listener may cause a NullPointerException down the road. This method - * will unwrap a PropertyChangeListenerProxy, registering the underlying + * listener is silently ignored. This method will unwrap a + * PropertyChangeListenerProxy, registering the underlying * delegate to the named property list if the names match, and discarding * it otherwise. * @@ -228,6 +232,9 @@ public synchronized void addPropertyChangeListener(String propertyName, PropertyChangeListener l) { +if (l == null) + return; + while (l instanceof PropertyChangeListenerProxy) { PropertyChangeListenerProxy p = (PropertyChangeListenerProxy) l; @@ -290,17 +297,16 @@ /** * Returns an array of all property change listeners registered under the - * given property name. If there are no registered listeners, this returns - * an empty array. + * given property name. If there are no registered listeners, or + * propertyName is null, this returns an empty array. * * @return the array of registered listeners - * @throws NullPointerException if propertyName is null * @since 1.4 */ public synchronized PropertyChangeListener[] getPropertyChangeListeners(String propertyName) { -if (children == null) +if (children == null || propertyName == null) return new PropertyChangeListener[0]; PropertyChangeSupport s = (PropertyChangeSupport) children.get(propertyName); @@ -455,7 +461,6 @@ * * @param propertyName the property that may be listened on * @return whether the property is being listened on - * @throws NullPointerException if propertyName is null */ public synchronized boolean hasListeners(String propertyName) { signature.asc
[cp-patches] Patch: request for approval of serialization related fixes
Hi, this is my first patch proposition to classpath. I just have my paperwork done with FSF and I have created an account on savannah as ojolly. Those patches are both dealing with serialization. One deals with the generation of back reference handle in the output stream which was forgotten when a proxy was serialized, hence creating an offset in the back references for further objects while the other deals with the choice of the construtor to use when deserializing an object. The first constructor of the first concrete non serializable super class was selected instead of the first non serializable super class, either concrete or abstract. It is reported in bugzilla as bug 14144 ( http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14144 ) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14144 Those patches will make pass 2 dedicated tests in mauve in java/io/InputOutputStream directory. Thanks for the feedback. Olivier Index: ObjectInputStream.java === RCS file: /sources/classpath/classpath/java/io/ObjectInputStream.java,v retrieving revision 1.74 diff -u -r1.74 ObjectInputStream.java --- ObjectInputStream.java 6 Feb 2006 11:50:46 - 1.74 +++ ObjectInputStream.java 12 Feb 2006 15:12:43 - @@ -565,9 +565,8 @@ if (first_nonserial == null) first_nonserial = clazz; else - while (Serializable.class.isAssignableFrom(first_nonserial) - || Modifier.isAbstract(first_nonserial.getModifiers())) - first_nonserial = first_nonserial.getSuperclass(); + while (Serializable.class.isAssignableFrom(first_nonserial)) +first_nonserial = first_nonserial.getSuperclass(); final Class local_constructor_class = first_nonserial; Index: ObjectOutputStream.java === RCS file: /sources/classpath/classpath/java/io/ObjectOutputStream.java,v retrieving revision 1.65 diff -u -r1.65 ObjectOutputStream.java --- ObjectOutputStream.java 17 Dec 2005 16:29:45 - 1.65 +++ ObjectOutputStream.java 12 Feb 2006 15:13:01 - @@ -421,6 +421,8 @@ for (int i = 0; i intfs.length; i++) realOutput.writeUTF(intfs[i].getName()); +assignNewHandle(osc); + boolean oldmode = setBlockDataMode(true); annotateProxyClass(osc.forClass()); setBlockDataMode(oldmode);
[cp-patches] Patch: FYI: javadoc fixlets
I'm checking this in. I ran across a couple of javadoc warnings pointed out by Eclipse. Tom 2006-02-12 Tom Tromey [EMAIL PROTECTED] * gnu/classpath/ServiceProviderLoadingAction.java: Javadoc fix. * gnu/classpath/ServiceFactory.java (ServiceIterator): Javadoc fix. (securityContext): Likewise. (log): Likewise. Index: gnu/classpath/ServiceFactory.java === RCS file: /cvsroot/classpath/classpath/gnu/classpath/ServiceFactory.java,v retrieving revision 1.4 diff -u -r1.4 ServiceFactory.java --- gnu/classpath/ServiceFactory.java 2 Jul 2005 20:32:10 - 1.4 +++ gnu/classpath/ServiceFactory.java 12 Feb 2006 19:34:33 - @@ -282,7 +282,7 @@ * An iterator over service providers that are listed in service * provider configuration files, which get passed as an Enumeration * of URLs. This is a helper class for [EMAIL PROTECTED] - * ServiceFactory#lookupProviders}. + * ServiceFactory#lookupProviders(Class, ClassLoader)}. * * @author a href=mailto:[EMAIL PROTECTED]Sascha Brawer/a */ @@ -314,7 +314,8 @@ * The security context used when loading and initializing service * providers. We want to load and initialize all plug-in service * providers under the same security context, namely the one that - * was active when [EMAIL PROTECTED] #lookupProviders} has been called. + * was active when [EMAIL PROTECTED] #lookupProviders(Class, ClassLoader)} has + * been called. */ private final AccessControlContext securityContext; @@ -527,7 +528,7 @@ * framework. This call returns very quickly if no log message will * be produced, so there is not much overhead in the standard case. * - * @param the severity of the message, for instance [EMAIL PROTECTED] + * @param level the severity of the message, for instance [EMAIL PROTECTED] * Level#WARNING}. * * @param msg the log message, for instance code#x201c;Could not Index: gnu/classpath/ServiceProviderLoadingAction.java === RCS file: /cvsroot/classpath/classpath/gnu/classpath/ServiceProviderLoadingAction.java,v retrieving revision 1.2 diff -u -r1.2 ServiceProviderLoadingAction.java --- gnu/classpath/ServiceProviderLoadingAction.java 2 Jul 2005 20:32:10 - 1.2 +++ gnu/classpath/ServiceProviderLoadingAction.java 12 Feb 2006 19:34:33 - @@ -48,9 +48,9 @@ * codePriviledgedAction/code in order to restrict the loaded * service providers to the [EMAIL PROTECTED] java.security.AccessControlContext} * that was active when [EMAIL PROTECTED] - * gnu.classpath.ServiceFactory#lookupProviders} was called, even - * though the actual loading is delayed to the time when the provider - * is actually needed. + * gnu.classpath.ServiceFactory#lookupProviders(Class, ClassLoader)} was + * called, even though the actual loading is delayed to the time when the + * provider is actually needed. * * @author a href=mailto:[EMAIL PROTECTED]Sascha Brawer/a */
[cp-patches] FYI: fix for unicode characters in file names outside basic plane causing exceptions in URLs
Hi all, the attached patch fixes PR 26218. Respective Mauve test is gnu/testlet/java/io/File/UnicodeURL.java. 2006-02-12 Dalibor Topic [EMAIL PROTECTED] Fixes PR 26218. * gnu/java/net/protocol/file/Connection.java (unquote): Convert Unicode characters outside basic plane to UTF-8, rather than throwing an exception. cheers, dalibor topic Index: gnu/java/net/protocol/file/Connection.java === RCS file: /sources/classpath/classpath/gnu/java/net/protocol/file/Connection.java,v retrieving revision 1.18 diff -u -r1.18 Connection.java --- gnu/java/net/protocol/file/Connection.java 17 Nov 2005 10:58:47 - 1.18 +++ gnu/java/net/protocol/file/Connection.java 12 Feb 2006 19:22:36 - @@ -135,21 +135,18 @@ * @exception MalformedURLException If the given string contains invalid * escape sequences. * - * Sadly the same as URI.unquote, but there's nothing we can do to - * make it accessible. - * */ public static String unquote(String str) throws MalformedURLException { if (str == null) return null; -byte[] buf = new byte[str.length()]; + +final int MAX_BYTES_PER_UTF_8_CHAR = 3; +byte[] buf = new byte[str.length()*MAX_BYTES_PER_UTF_8_CHAR]; int pos = 0; for (int i = 0; i str.length(); i++) { char c = str.charAt(i); - if (c 127) - throw new MalformedURLException(str + : Invalid character); if (c == '%') { if (i + 2 = str.length()) @@ -160,6 +157,15 @@ throw new MalformedURLException(str + : Invalid quoted character); buf[pos++] = (byte) (hi * 16 + lo); } + else if (c 127) { + try { + byte [] c_as_bytes = Character.toString(c).getBytes(utf-8); + System.arraycopy(c_as_bytes, 0, buf, pos, c_as_bytes.length); + } + catch (java.io.UnsupportedEncodingException x2) { + throw (Error) new InternalError().initCause(x2); + } + } else buf[pos++] = (byte) c; }
[cp-patches] RFC: fixlet for URLClassLoader.addURLImpl
Hi all, the attached patch is part of the fallout of work on Kaffe's bug #16. It turns out that addURLImpl can occasionally get confused whether an URL points to a directory or not, based on the string check alone, for example when the directory ends in a Unicode character outside the basic plane. Using File.isDiectory delegates that to the operating system, and makes the code a bit cleaner, in my opinion. 2006-02-12 Dalibor Topic [EMAIL PROTECTED] * java/net/URLClassLoader.java (addURLImpl) Check if a file URL points to a directory before using a JarURLClassLoader. Index: java/net/URLClassLoader.java === RCS file: /sources/classpath/classpath/java/net/URLClassLoader.java,v retrieving revision 1.44 diff -u -r1.44 URLClassLoader.java --- java/net/URLClassLoader.java 18 Jan 2006 00:19:13 - 1.44 +++ java/net/URLClassLoader.java 12 Feb 2006 20:44:04 - @@ -723,13 +723,13 @@ { String file = newUrl.getFile(); String protocol = newUrl.getProtocol(); + File dir = new File(file); // If we have a file: URL, we want to make it absolute // here, before we decide whether it is really a jar. URL absoluteURL; if (file.equals (protocol)) { - File dir = new File(file); URL absUrl; try { @@ -756,10 +756,11 @@ } // Check that it is not a directory -if (! (file.endsWith(/) || file.endsWith(File.separator))) - loader = new JarURLLoader(this, newUrl, absoluteURL); -else if (file.equals(protocol)) - loader = new FileURLLoader(this, newUrl, absoluteURL); +if (file.equals(protocol)) + if (dir.isDirectory()) + loader = new FileURLLoader(this, newUrl, absoluteURL); + else + loader = new JarURLLoader(this, newUrl, absoluteURL); else loader = new RemoteURLLoader(this, newUrl);
Re: [cp-patches] Re: RFC: Don't unnecessary double queue GtkComponentPeer.repaint() events
Hi Mark, On Fri, 2006-02-10 at 12:48 -0500, Thomas Fitzsimmons wrote: 2006-02-09 Mark Wielaard [EMAIL PROTECTED] * gnu/java/awt/peer/gtk/GtkComponentPeer.java (repaintTimer): Removed field. (repaint): Immediately post to queue when tm = 0, otherwise call RepaintTimerTask.schedule(). (RepaintTimerTask): Make static. (RepaintTimerTask.repaintTimer): New static final field. (RepaintTimerTask.awtComponent): New field. (schedule): New static method. OK to commit? This is so awesome! I was working on fixing this same bug. Thanks! Lillian
Re: Hashtable's and the tale of runtime
Tom Tromey wrote: At some point we changed libgcj's hash function to this: // This was chosen to yield relatively well distributed results on // both 32- and 64-bit architectures. Note 0x7fff is prime. return (jint) ((unsigned long) obj % 0x7fff); What if you're on a 32-bit machine and all the object addresses are less than 0x8000.. won't that give you the same result as just returning (jint)obj ? -Archie __ Archie Cobbs *CTO, Awarix* http://www.awarix.com
New GNU Classpath developer Olivier Jolly
Hi all, Olivier Jolly (Zeograd on irc) has been added as new GNU Classpath hacker to savannah. Olivier wrote multiple mauve tests for serialization and Proxy. And now has submitted patches to make these tests PASS. Olivier, please post a patch and ChangeLog entry to add yourself to the AUTHORS file to the classpath-patches mailinglist. You can consider that patch pre-approved so feel free to commit it immediately as a test of your new powers. But remember that with power comes responsibility! (*) Thanks, Mark (*) http://www.gnu.org/software/classpath/docs/hacking.html -- Escape the Java Trap with GNU Classpath! http://www.gnu.org/philosophy/java-trap.html Join the community at http://planet.classpath.org/ signature.asc Description: This is a digitally signed message part
Re: New GNU Classpath developer Olivier Jolly
Hi Olivier. Nice to have you here and thanks for joining our effort! cya Robert Mark Wielaard wrote: Hi all, Olivier Jolly (Zeograd on irc) has been added as new GNU Classpath hacker to savannah. Olivier wrote multiple mauve tests for serialization and Proxy. And now has submitted patches to make these tests PASS. Olivier, please post a patch and ChangeLog entry to add yourself to the AUTHORS file to the classpath-patches mailinglist. You can consider that patch pre-approved so feel free to commit it immediately as a test of your new powers. But remember that with power comes responsibility! (*) Thanks, Mark (*) http://www.gnu.org/software/classpath/docs/hacking.html signature.asc Description: OpenPGP digital signature
Re: New GNU Classpath developer Olivier Jolly
Hi all, I just proudly committed an update to AUTHORS, and I will soon repropose a serialization patch with suggestions from Mark taken in account. I do hope I'll help a lot in improving classpath. Regards Olivier Robert Schuster a écrit : Hi Olivier. Nice to have you here and thanks for joining our effort! cya Robert Mark Wielaard wrote: Hi all, Olivier Jolly (Zeograd on irc) has been added as new GNU Classpath hacker to savannah. Olivier wrote multiple mauve tests for serialization and Proxy. And now has submitted patches to make these tests PASS. Olivier, please post a patch and ChangeLog entry to add yourself to the AUTHORS file to the classpath-patches mailinglist. You can consider that patch pre-approved so feel free to commit it immediately as a test of your new powers. But remember that with power comes responsibility! (*) Thanks, Mark (*) http://www.gnu.org/software/classpath/docs/hacking.html
[commit-cp] classpath ./ChangeLog java/io/InputStream.java
CVSROOT:/cvsroot/classpath Module name:classpath Branch: Changes by: Jeroen Frijters [EMAIL PROTECTED] 06/02/12 09:40:04 Modified files: . : ChangeLog java/io: InputStream.java Log message: 2006-02-12 Jeroen Frijters [EMAIL PROTECTED] * java/io/InputStream.java (read(byte[],int,int)): Changed argument validation to prevent integer overflow. Remove redundant check. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/ChangeLog.diff?tr1=1.6341tr2=1.6342r1=textr2=text http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/java/io/InputStream.java.diff?tr1=1.10tr2=1.11r1=textr2=text
[commit-cp] classpath ./ChangeLog gnu/java/awt/peer/gtk/Gtk...
CVSROOT:/sources/classpath Module name:classpath Branch: Changes by: Mark Wielaard [EMAIL PROTECTED] 06/02/12 11:40:04 Modified files: . : ChangeLog gnu/java/awt/peer/gtk: GtkComponentPeer.java GtkGenericPeer.java GtkToolkit.java Log message: * gnu/java/awt/peer/gtk/GtkComponentPeer.java (postKeyEvent): Call q() to get EventQueue. * gnu/java/awt/peer/gtk/GtkGenericPeer.java (q): Remove static field. (enableQueue): Remove static method. * gnu/java/awt/peer/gtk/GtkToolkit.java (getSystemEventQueueImpl): Don't call GtkGenericPeer.enableQueue(). CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/ChangeLog.diff?tr1=1.6343tr2=1.6344r1=textr2=text http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/gnu/java/awt/peer/gtk/GtkComponentPeer.java.diff?tr1=1.102tr2=1.103r1=textr2=text http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/gnu/java/awt/peer/gtk/GtkGenericPeer.java.diff?tr1=1.17tr2=1.18r1=textr2=text http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/gnu/java/awt/peer/gtk/GtkToolkit.java.diff?tr1=1.79tr2=1.80r1=textr2=text
[commit-cp] classpath java/rmi/RMISecurityException.java ja...
CVSROOT:/cvsroot/classpath Module name:classpath Branch: Changes by: Wolfgang Baer [EMAIL PROTECTED] 06/02/12 12:27:02 Modified files: java/rmi : RMISecurityException.java Remote.java AlreadyBoundException.java NotBoundException.java RemoteException.java AccessException.java NoSuchObjectException.java package.html StubNotFoundException.java MarshalledObject.java . : ChangeLog Log message: 2006-02-12 Wolfgang Baer [EMAIL PROTECTED] * java/rmi/MarshalledObject.java: Added api docs to the class. * java/rmi/Remote.java: Added interface api docs. * java/rmi/package.html: Added package description. * java/rmi/AccessException.java: Minor api doc fixes. * java/rmi/NoSuchObjectException.java: Likewise. * java/rmi/AlreadyBoundException.java: Likewise. * java/rmi/RemoteException.java: Likewise. * java/rmi/NotBoundException.java: Likewise. * java/rmi/RMISecurityException.java: Likewise. * java/rmi/StubNotFoundException.java: Likewise. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/java/rmi/RMISecurityException.java.diff?tr1=1.4tr2=1.5r1=textr2=text http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/java/rmi/Remote.java.diff?tr1=1.4tr2=1.5r1=textr2=text http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/java/rmi/AlreadyBoundException.java.diff?tr1=1.4tr2=1.5r1=textr2=text http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/java/rmi/NotBoundException.java.diff?tr1=1.4tr2=1.5r1=textr2=text http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/java/rmi/RemoteException.java.diff?tr1=1.5tr2=1.6r1=textr2=text http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/java/rmi/AccessException.java.diff?tr1=1.4tr2=1.5r1=textr2=text http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/java/rmi/NoSuchObjectException.java.diff?tr1=1.4tr2=1.5r1=textr2=text http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/java/rmi/package.html.diff?tr1=1.2tr2=1.3r1=textr2=text http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/java/rmi/StubNotFoundException.java.diff?tr1=1.4tr2=1.5r1=textr2=text http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/java/rmi/MarshalledObject.java.diff?tr1=1.10tr2=1.11r1=textr2=text http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/ChangeLog.diff?tr1=1.6344tr2=1.6345r1=textr2=text
[commit-cp] classpath ./ChangeLog java/beans/PropertyChange...
CVSROOT:/sources/classpath Module name:classpath Branch: Changes by: Mark Wielaard [EMAIL PROTECTED] 06/02/12 13:53:54 Modified files: . : ChangeLog java/beans : PropertyChangeSupport.java Log message: * java/beans/PropertyChangeSupport.java (addPropertyChangeListener): Silently ignores null listener. (addPropertyChangeListener(String, PropertyChangeListener): Likewise. (getPropertyChangeListeners): Returns empty PropertyChangeListener array for null propertyName. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/ChangeLog.diff?tr1=1.6345tr2=1.6346r1=textr2=text http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/java/beans/PropertyChangeSupport.java.diff?tr1=1.14tr2=1.15r1=textr2=text
[commit-cp] classpath javax/sound/sampled/LineEvent.java ./...
CVSROOT:/cvsroot/classpath Module name:classpath Branch: Changes by: Tom Tromey [EMAIL PROTECTED] 06/02/12 18:35:41 Modified files: javax/sound/sampled: LineEvent.java . : ChangeLog Log message: * javax/sound/sampled/LineEvent.java (readObject): New method. (writeObject): Likewise. (serialVersionUID): New field. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/javax/sound/sampled/LineEvent.java.diff?tr1=1.1tr2=1.2r1=textr2=text http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/ChangeLog.diff?tr1=1.6346tr2=1.6347r1=textr2=text
[commit-cp] classpath ./ChangeLog gnu/java/net/protocol/fil...
CVSROOT:/sources/classpath Module name:classpath Branch: Changes by: Dalibor Topic [EMAIL PROTECTED] 06/02/12 19:25:46 Modified files: . : ChangeLog gnu/java/net/protocol/file: Connection.java Log message: Respect unicode characters in file names outside of basic plane in file URLs 2006-02-12 Dalibor Topic [EMAIL PROTECTED] Fixes PR 26218. * gnu/java/net/protocol/file/Connection.java (unquote): Convert Unicode characters outside basic plane to UTF-8, rather than throwing an exception. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/ChangeLog.diff?tr1=1.6347tr2=1.6348r1=textr2=text http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/gnu/java/net/protocol/file/Connection.java.diff?tr1=1.18tr2=1.19r1=textr2=text