[kaffe] CVS kaffe (robilad): Resynced with GNU Classpath: swing corba jawt and KeyPairGenerator fixes

Kaffe CVS cvs-commits at kaffe.org
Wed Aug 10 04:43:17 PDT 2005


PatchSet 6800 
Date: 2005/08/10 11:37:43
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU Classpath: swing corba jawt and KeyPairGenerator fixes

Members: 
	ChangeLog:1.4325->1.4326 
	libraries/clib/awt/classpath-gtk/gtk-peer/gtk_jawt.c:1.2->1.3 
	libraries/clib/classpath/classpath_jawt.h:1.3->1.4 
	libraries/javalib/Makefile.am:1.378->1.379 
	libraries/javalib/Makefile.in:1.468->1.469 
	libraries/javalib/all.files:1.148->1.149 
	libraries/javalib/gnu/java/security/provider/DSAKeyPairGenerator.java:1.2->1.3 
	libraries/javalib/java/security/KeyPairGenerator.java:1.6->1.7 
	libraries/javalib/javax/swing/JTree.java:1.24->1.25 
	libraries/javalib/javax/swing/plaf/basic/BasicTreeUI.java:1.14->1.15 
	libraries/javalib/org/omg/DynamicAny/FieldNameHelper.java:INITIAL->1.1 
	libraries/javalib/org/omg/DynamicAny/_DynAnyFactoryStub.java:INITIAL->1.1 
	libraries/javalib/org/omg/DynamicAny/_DynAnyStub.java:INITIAL->1.1 
	libraries/javalib/org/omg/DynamicAny/_DynArrayStub.java:INITIAL->1.1 
	libraries/javalib/org/omg/DynamicAny/_DynEnumStub.java:INITIAL->1.1 
	libraries/javalib/org/omg/DynamicAny/_DynFixedStub.java:INITIAL->1.1 
	libraries/javalib/org/omg/DynamicAny/_DynSequenceStub.java:INITIAL->1.1 
	libraries/javalib/org/omg/DynamicAny/_DynStructStub.java:INITIAL->1.1 
	libraries/javalib/org/omg/DynamicAny/_DynUnionStub.java:INITIAL->1.1 
	libraries/javalib/org/omg/DynamicAny/_DynValueStub.java:INITIAL->1.1 
	libraries/javalib/org/omg/DynamicAny/package.html:INITIAL->1.1 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.4325 kaffe/ChangeLog:1.4326
--- kaffe/ChangeLog:1.4325	Wed Aug 10 11:03:14 2005
+++ kaffe/ChangeLog	Wed Aug 10 11:37:43 2005
@@ -1,5 +1,70 @@
 2005-08-10  Dalibor Topic  <robilad at kaffe.org>
 
+	Resynced with GNU Classpath.
+
+	2005-08-08  Casey Marshall  <csm at gnu.org>
+
+        PR classpath/23120
+        * gnu/java/security/provider/DSAKeyPairGenerator.java
+        (<init>): made public; set default values.
+        (initialize): just call 'initialize(int,boolean,SecureRandom).'
+        (initialize): just call 'initialize(DSAParams,SecureRandom).'
+        (initialize): check all values for 'null' before overwriting.
+        (initialize): fill in defaults or generate new parameters here.
+        (generateKeyPair): don't create parameters; fill in 'random' if
+        'null;' use 'random,' not a new Random object, when generating
+        random numbers.
+        (getDefaults): fix keysize check.
+
+        PR classpath/22990
+        * java/security/KeyPairGenerator.java (initialize): do nothing.
+
+	2005-08-08  Tom Tromey  <tromey at redhat.com>
+
+        PR classpath/23285:
+        * native/jni/classpath/classpath_jawt.h
+        (classpath_jawt_get_awt_version, classpath_jawt_lock,
+        classpath_jawt_unlock, classpath_jawt_create_lock,
+        classpath_jawt_destroy_lock): Use '(void)' in prototype.
+        * native/jni/gtk-peer/Makefile.am (libgtkpeer_la_SOURCES): Added
+        gtk_jawt.c.
+        * native/jni/gtk-peer/gtk_jawt.c: New file from libgcj.
+        (classpath_jawt_create_lock, classpath_jawt_destroy_lock): Use
+        cp_gtk_gdk_env.
+
+	2005-08-08  Audrius Meskauskas  <AudriusA at Bioinformatics.org>
+
+        * org/omg/DynamicAny/FieldNameHelper.java: New file.
+
+	2005-08-08  Audrius Meskauskas  <AudriusA at Bioinformatics.org>
+
+        * org/omg/DynamicAny/_DynAnyFactoryStub.java,
+        org/omg/DynamicAny/_DynAnyStub.java,
+        org/omg/DynamicAny/_DynArrayStub.java,
+        org/omg/DynamicAny/_DynEnumStub.java,
+        org/omg/DynamicAny/_DynFixedStub.java,
+        org/omg/DynamicAny/_DynStructStub.java,
+        org/omg/DynamicAny/_DynUnionStub.java,
+        org/omg/DynamicAny/_DynValueStub.java,
+        org/omg/DynamicAny/_DynSequenceStub.java: New files.
+
+	2005-08-08  Lillian Angel  <langel at redhat.com>
+
+        Fixes bug #23252
+        * javax/swing/JTree.java
+        (setModel): Changed to allow model to be null.
+        * javax/swing/plaf/basic/BasicTreeUI.java
+        (setModel): Changed to depend on JTree functions
+        (getPathBounds): Fixed to work when model = null.
+        (getPathForRow): Likewise.
+        (getRowCount): Likewise.
+        (installListeners): Likewise.
+        (installUI): Likewise.
+        (paint): Likewise.
+        (getPreferredSize): Likewise.
+
+2005-08-10  Dalibor Topic  <robilad at kaffe.org>
+
 	* kaffe/kaffevm/jit3/global-regs.c,
 	kaffe/kaffevm/jit3/global-regs.h:
 	New files. Spilt out global register handling code 
Index: kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gtk_jawt.c
diff -u kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gtk_jawt.c:1.2 kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gtk_jawt.c:1.3
--- kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gtk_jawt.c:1.2	Mon Jul  4 00:04:04 2005
+++ kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gtk_jawt.c	Wed Aug 10 11:37:47 2005
@@ -153,6 +153,21 @@
 }
 
 jint
+classpath_jawt_object_lock (jobject lock)
+{
+  JNIEnv *env = cp_gtk_gdk_env();
+  (*env)->MonitorEnter (env, lock);
+  return 0;
+}
+
+void
+classpath_jawt_object_unlock (jobject lock)
+{
+  JNIEnv *env = cp_gtk_gdk_env();
+  (*env)->MonitorExit (env, lock);
+}
+
+jint
 classpath_jawt_lock ()
 {
   gdk_threads_enter ();
@@ -163,4 +178,20 @@
 classpath_jawt_unlock ()
 {
   gdk_threads_leave ();
+}
+
+jobject
+classpath_jawt_create_lock ()
+{
+  JNIEnv *env = cp_gtk_gdk_env ();
+  jobject lock = (*env)->NewStringUTF (env, "jawt-lock");
+  NSA_SET_GLOBAL_REF (env, lock);
+  return lock;
+}
+
+void
+classpath_jawt_destroy_lock (jobject lock)
+{
+  JNIEnv *env = cp_gtk_gdk_env ();
+  NSA_DEL_GLOBAL_REF (env, lock);
 }
Index: kaffe/libraries/clib/classpath/classpath_jawt.h
diff -u kaffe/libraries/clib/classpath/classpath_jawt.h:1.3 kaffe/libraries/clib/classpath/classpath_jawt.h:1.4
--- kaffe/libraries/clib/classpath/classpath_jawt.h:1.3	Sat Jul 30 16:39:07 2005
+++ kaffe/libraries/clib/classpath/classpath_jawt.h	Wed Aug 10 11:37:47 2005
@@ -50,15 +50,15 @@
 
 #define CLASSPATH_JAWT_VERSION 0x10004
 
-jint     classpath_jawt_get_awt_version ();
+jint     classpath_jawt_get_awt_version (void);
 Display* classpath_jawt_get_default_display (JNIEnv* env, jobject canvas);
 Drawable classpath_jawt_get_drawable (JNIEnv* env, jobject canvas);
 VisualID classpath_jawt_get_visualID (JNIEnv* env, jobject canvas);
 jint     classpath_jawt_object_lock (jobject lock);
 void     classpath_jawt_object_unlock (jobject lock);
-jint     classpath_jawt_lock ();
-void     classpath_jawt_unlock ();
-jobject  classpath_jawt_create_lock ();
+jint     classpath_jawt_lock (void);
+void     classpath_jawt_unlock (void);
+jobject  classpath_jawt_create_lock (void);
 void     classpath_jawt_destroy_lock (jobject lock);
 
 #endif /* __classpath_jawt_h__ */
Index: kaffe/libraries/javalib/Makefile.am
diff -u kaffe/libraries/javalib/Makefile.am:1.378 kaffe/libraries/javalib/Makefile.am:1.379
--- kaffe/libraries/javalib/Makefile.am:1.378	Mon Aug  8 02:52:16 2005
+++ kaffe/libraries/javalib/Makefile.am	Wed Aug 10 11:37:47 2005
@@ -4671,12 +4671,22 @@
 	org/omg/DynamicAny/DynValueCommonOperations.java \
 	org/omg/DynamicAny/DynValueHelper.java \
 	org/omg/DynamicAny/DynValueOperations.java \
+	org/omg/DynamicAny/FieldNameHelper.java \
 	org/omg/DynamicAny/NameDynAnyPair.java \
 	org/omg/DynamicAny/NameDynAnyPairHelper.java \
 	org/omg/DynamicAny/NameDynAnyPairSeqHelper.java \
 	org/omg/DynamicAny/NameValuePair.java \
 	org/omg/DynamicAny/NameValuePairHelper.java \
-	org/omg/DynamicAny/NameValuePairSeqHelper.java
+	org/omg/DynamicAny/NameValuePairSeqHelper.java \
+	org/omg/DynamicAny/_DynAnyFactoryStub.java \
+	org/omg/DynamicAny/_DynAnyStub.java \
+	org/omg/DynamicAny/_DynArrayStub.java \
+	org/omg/DynamicAny/_DynEnumStub.java \
+	org/omg/DynamicAny/_DynFixedStub.java \
+	org/omg/DynamicAny/_DynSequenceStub.java \
+	org/omg/DynamicAny/_DynStructStub.java \
+	org/omg/DynamicAny/_DynUnionStub.java \
+	org/omg/DynamicAny/_DynValueStub.java
 org_omg_DynamicAny_DynAnyFactoryPackage_SRCS = \
 	org/omg/DynamicAny/DynAnyFactoryPackage/InconsistentTypeCode.java \
 	org/omg/DynamicAny/DynAnyFactoryPackage/InconsistentTypeCodeHelper.java
Index: kaffe/libraries/javalib/Makefile.in
diff -u kaffe/libraries/javalib/Makefile.in:1.468 kaffe/libraries/javalib/Makefile.in:1.469
--- kaffe/libraries/javalib/Makefile.in:1.468	Mon Aug  8 02:52:16 2005
+++ kaffe/libraries/javalib/Makefile.in	Wed Aug 10 11:37:48 2005
@@ -5299,12 +5299,22 @@
 	org/omg/DynamicAny/DynValueCommonOperations.java \
 	org/omg/DynamicAny/DynValueHelper.java \
 	org/omg/DynamicAny/DynValueOperations.java \
+	org/omg/DynamicAny/FieldNameHelper.java \
 	org/omg/DynamicAny/NameDynAnyPair.java \
 	org/omg/DynamicAny/NameDynAnyPairHelper.java \
 	org/omg/DynamicAny/NameDynAnyPairSeqHelper.java \
 	org/omg/DynamicAny/NameValuePair.java \
 	org/omg/DynamicAny/NameValuePairHelper.java \
-	org/omg/DynamicAny/NameValuePairSeqHelper.java
+	org/omg/DynamicAny/NameValuePairSeqHelper.java \
+	org/omg/DynamicAny/_DynAnyFactoryStub.java \
+	org/omg/DynamicAny/_DynAnyStub.java \
+	org/omg/DynamicAny/_DynArrayStub.java \
+	org/omg/DynamicAny/_DynEnumStub.java \
+	org/omg/DynamicAny/_DynFixedStub.java \
+	org/omg/DynamicAny/_DynSequenceStub.java \
+	org/omg/DynamicAny/_DynStructStub.java \
+	org/omg/DynamicAny/_DynUnionStub.java \
+	org/omg/DynamicAny/_DynValueStub.java
 
 org_omg_DynamicAny_DynAnyFactoryPackage_SRCS = \
 	org/omg/DynamicAny/DynAnyFactoryPackage/InconsistentTypeCode.java \
Index: kaffe/libraries/javalib/all.files
diff -u kaffe/libraries/javalib/all.files:1.148 kaffe/libraries/javalib/all.files:1.149
--- kaffe/libraries/javalib/all.files:1.148	Mon Aug  8 02:52:18 2005
+++ kaffe/libraries/javalib/all.files	Wed Aug 10 11:37:51 2005
@@ -4032,12 +4032,22 @@
 org/omg/DynamicAny/DynValueCommonOperations.java
 org/omg/DynamicAny/DynValueHelper.java
 org/omg/DynamicAny/DynValueOperations.java
+org/omg/DynamicAny/FieldNameHelper.java
 org/omg/DynamicAny/NameDynAnyPair.java
 org/omg/DynamicAny/NameDynAnyPairHelper.java
 org/omg/DynamicAny/NameDynAnyPairSeqHelper.java
 org/omg/DynamicAny/NameValuePair.java
 org/omg/DynamicAny/NameValuePairHelper.java
 org/omg/DynamicAny/NameValuePairSeqHelper.java
+org/omg/DynamicAny/_DynAnyFactoryStub.java
+org/omg/DynamicAny/_DynAnyStub.java
+org/omg/DynamicAny/_DynArrayStub.java
+org/omg/DynamicAny/_DynEnumStub.java
+org/omg/DynamicAny/_DynFixedStub.java
+org/omg/DynamicAny/_DynSequenceStub.java
+org/omg/DynamicAny/_DynStructStub.java
+org/omg/DynamicAny/_DynUnionStub.java
+org/omg/DynamicAny/_DynValueStub.java
 org/omg/IOP/CodeSets.java
 org/omg/IOP/Codec.java
 org/omg/IOP/CodecFactory.java
Index: kaffe/libraries/javalib/gnu/java/security/provider/DSAKeyPairGenerator.java
diff -u kaffe/libraries/javalib/gnu/java/security/provider/DSAKeyPairGenerator.java:1.2 kaffe/libraries/javalib/gnu/java/security/provider/DSAKeyPairGenerator.java:1.3
--- kaffe/libraries/javalib/gnu/java/security/provider/DSAKeyPairGenerator.java:1.2	Mon Jul  4 00:05:40 2005
+++ kaffe/libraries/javalib/gnu/java/security/provider/DSAKeyPairGenerator.java	Wed Aug 10 11:37:52 2005
@@ -1,5 +1,5 @@
 /* GnuDSAKeyPairGenerator.java --- Gnu DSA Key Pair Generator
-   Copyright (C) 1999 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -45,10 +45,12 @@
 import java.security.InvalidParameterException;
 import java.security.KeyPair;
 import java.security.KeyPairGeneratorSpi;
+import java.security.NoSuchAlgorithmException;
 import java.security.SecureRandom;
 import java.security.interfaces.DSAParams;
 import java.security.spec.AlgorithmParameterSpec;
 import java.security.spec.DSAParameterSpec;
+import java.security.spec.InvalidParameterSpecException;
 import java.util.Random;
 
 public class DSAKeyPairGenerator extends KeyPairGeneratorSpi 
@@ -60,18 +62,15 @@
 private BigInteger p = null; // the big prime
 private BigInteger g = null;
 
-DSAKeyPairGenerator()
+public DSAKeyPairGenerator()
 {
 	keysize = 1024;
+        getDefaults ();
 }
 
 public void initialize(int keysize, SecureRandom random)
 {
-	//if( ((keysize % 64) != 0) || (keysize < 512) || (keysize > 1024) )
-        //        throw new InvalidAlgorithmParameterException("Invalid key size");
-
-	this.keysize = keysize;
-	this.random = random;
+        initialize (keysize, false, random);
 }
 
 public void initialize(AlgorithmParameterSpec params,
@@ -81,65 +80,87 @@
 	if( !( params instanceof DSAParameterSpec ) )
 		throw new InvalidAlgorithmParameterException("Must be DSAParameterSpec");
 
+        try
+        {
+                initialize ((DSAParams) params, random);
+        }
+        catch (InvalidParameterException ipe)
+        {
+                InvalidAlgorithmParameterException iape =
+                        new InvalidAlgorithmParameterException();
+                iape.initCause (ipe);
+                throw iape;
+        }
+}
+
+public void initialize (DSAParams params, SecureRandom random)
+{
 	DSAParameterSpec dsaparameterspec = (DSAParameterSpec)params;
+        if (dsaparameterspec.getP() == null
+            || dsaparameterspec.getQ() == null
+            || dsaparameterspec.getG() == null)
+        {
+                throw new InvalidParameterException ("none of p, q, or g may be null");
+        }
 	p = dsaparameterspec.getP();
 	q = dsaparameterspec.getQ();
 	g = dsaparameterspec.getG();
 	this.random = random;
 }
 
-public void initialize(DSAParams params, SecureRandom random) 
-	throws InvalidParameterException
-{
-	if(params.getP() != null) 
-		p = params.getP();
-	else
-		throw new InvalidParameterException();
-
-	if(params.getQ() != null) 
-		q = params.getQ();
-	else
-		throw new InvalidParameterException();
-	
-	if(params.getG() != null) 
-		g = params.getG();
-	else
-		throw new InvalidParameterException();
-	
-	this.random = random;
-}
-
 public void initialize(int modlen, boolean genParams, SecureRandom random) 
 	throws InvalidParameterException
 {
 	if( ((modlen % 64) != 0) || (modlen < 512) || (modlen > 1024) )
                 throw new InvalidParameterException();
 
-	if( (genParams == false) && (modlen != 512) && (modlen != 768) && (modlen != 1024)  )
-		throw new InvalidParameterException();
-	this.keysize = modlen;
-	this.random = random;
-	p = null;
-	q = null;
-	g = null;
+        this.keysize = keysize;
+        this.random = random;
+        if (this.random == null)
+        {
+                this.random = new SecureRandom ();
+        }
+	if (genParams)
+        {
+                try
+                {
+                        AlgorithmParameterGenerator apgDSA = AlgorithmParameterGenerator.getInstance("DSA");
+                        apgDSA.init (modlen, random);
+                        AlgorithmParameters apDSA = apgDSA.generateParameters();
+                        DSAParameterSpec dsaparameterspec = (DSAParameterSpec)apDSA.getParameterSpec( DSAParameterSpec.class );
+                        p = dsaparameterspec.getP();
+                        q = dsaparameterspec.getQ();
+                        g = dsaparameterspec.getG();
+                }
+                catch (NoSuchAlgorithmException nsae)
+                {
+                        InvalidParameterException ipe =
+                                new InvalidParameterException ("can't generate DSA parameters");
+                        ipe.initCause (nsae);
+                        throw ipe;
+                }
+                catch (InvalidParameterSpecException ipse)
+                {
+                        InvalidParameterException ipe =
+                                new InvalidParameterException ("can't generate DSA parameters");
+                        ipe.initCause (ipse);
+                        throw ipe;
+                }
+        }
+        else if (!getDefaults ())
+        {
+                throw new InvalidParameterException ("unsupported key size: " + modlen);
+        }
 }
 
 public KeyPair generateKeyPair()
 {
-	if( getDefaults() == false) {
-		try {
-			AlgorithmParameterGenerator apgDSA = AlgorithmParameterGenerator.getInstance("DSA");
-			AlgorithmParameters apDSA = apgDSA.generateParameters();
-			DSAParameterSpec dsaparameterspec = (DSAParameterSpec)apDSA.getParameterSpec( DSAParameterSpec.class );
-			p = dsaparameterspec.getP();
-			q = dsaparameterspec.getQ();
-			g = dsaparameterspec.getG();
-		} catch ( Exception e ) {
-			return null;
-		}
-	}
+        if (random == null)
+                {
+                        random = new SecureRandom ();
+                }
 
-	BigInteger x = new BigInteger( 159, new Random() );
+	BigInteger x = new BigInteger( 159, random );
 
 	BigInteger y = g.modPow( x, p );
 
@@ -160,7 +181,7 @@
 		p = new BigInteger("e9e642599d355f37c97ffd3567120b8e25c9cd43e927b3a9670fbec5d890141922d2c3b3ad2480093799869d1e846aab49fab0ad26d2ce6a22219d470bce7d777d4a21fbe9c270b57f607002f3cef8393694cf45ee3688c11a8c56ab127a3daf", 16);
 		q = new BigInteger("9cdbd84c9f1ac2f38d0f80f42ab952e7338bf511", 16);
 		g = new BigInteger("30470ad5a005fb14ce2d9dcd87e38bc7d1b1c5facbaecbe95f190aa7a31d23c4dbbcbe06174544401a5b2c020965d8c2bd2171d3668445771f74ba084d2029d83c1c158547f3a9f1a2715be23d51ae4d3e5a1f6a7064f316933a346d3f529252", 16);
-	} else if( keysize == 512) {
+	} else if( keysize == 1024) {
 		p = new BigInteger("fd7f53811d75122952df4a9c2eece4e7f611b7523cef4400c31e3f80b6512669455d402251fb593d8d58fabfc5f5ba30f6cb9b556cd7813b801d346ff26660b76b9950a5a49f9fe8047b1022c24fbba9d7feb7c61bf83b57e7c6a8a6150f04fb83f6d3c51ec3023554135a169132f675f3ae2b61d72aeff22203199dd14801c7", 16);
 		q = new BigInteger("9760508f15230bccb292b982a2eb840bf0581cf5", 16);
 		g = new BigInteger("f7e1a085d69b3ddecbbcab5c36b857b97994afbbfa3aea82f9574c0b3d0782675159578ebad4594fe67107108180b449167123e84c281613b7cf09328cc8a6e13c167a8b547c8d28e0a3ae1e2bb3a675916ea37f0bfa213562f1fb627a01243bcca4f1bea8519089a883dfe15ae59f06928b665e807b552564014c3bfecf492a", 16);
Index: kaffe/libraries/javalib/java/security/KeyPairGenerator.java
diff -u kaffe/libraries/javalib/java/security/KeyPairGenerator.java:1.6 kaffe/libraries/javalib/java/security/KeyPairGenerator.java:1.7
--- kaffe/libraries/javalib/java/security/KeyPairGenerator.java:1.6	Mon Jul  4 00:07:14 2005
+++ kaffe/libraries/javalib/java/security/KeyPairGenerator.java	Wed Aug 10 11:37:52 2005
@@ -1,5 +1,5 @@
 /* KeyPairGenerator.java --- Key Pair Generator Class
-   Copyright (C) 1999, 2002, 2003, 2004  Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002, 2003, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -300,7 +300,6 @@
    */
   public void initialize(int keysize, SecureRandom random)
   {
-    initialize(keysize, random);
   }
 
   /**
Index: kaffe/libraries/javalib/javax/swing/JTree.java
diff -u kaffe/libraries/javalib/javax/swing/JTree.java:1.24 kaffe/libraries/javalib/javax/swing/JTree.java:1.25
--- kaffe/libraries/javalib/javax/swing/JTree.java:1.24	Sat Jul 30 16:39:26 2005
+++ kaffe/libraries/javalib/javax/swing/JTree.java	Wed Aug 10 11:37:53 2005
@@ -775,16 +775,17 @@
 	{
 		if (treeModel == model)
 			return;
-
-		TreeModel oldValue = treeModel;
-		treeModel = model;
-
-		firePropertyChange(TREE_MODEL_PROPERTY, oldValue, model);
-
+    
 		// add treeModelListener to the new model
 		if (treeModelListener == null)
 			treeModelListener = createTreeModelListener();
-		model.addTreeModelListener(treeModelListener);
+		if (model != null) // as setModel(null) is allowed
+			model.addTreeModelListener(treeModelListener);
+    
+    TreeModel oldValue = treeModel;
+    treeModel = model;
+
+    firePropertyChange(TREE_MODEL_PROPERTY, oldValue, model);
 	}
 
 	/**
Index: kaffe/libraries/javalib/javax/swing/plaf/basic/BasicTreeUI.java
diff -u kaffe/libraries/javalib/javax/swing/plaf/basic/BasicTreeUI.java:1.14 kaffe/libraries/javalib/javax/swing/plaf/basic/BasicTreeUI.java:1.15
--- kaffe/libraries/javalib/javax/swing/plaf/basic/BasicTreeUI.java:1.14	Mon Aug  8 02:52:27 2005
+++ kaffe/libraries/javalib/javax/swing/plaf/basic/BasicTreeUI.java	Wed Aug 10 11:37:53 2005
@@ -449,7 +449,7 @@
   protected void setModel(TreeModel model)
   {
     tree.setModel(model);
-    treeModel = model;
+    treeModel = tree.getModel();
   }
   
   /**
@@ -583,13 +583,16 @@
       {
         Object cell = path.getLastPathComponent();
         TreeModel mod = tree.getModel();
-        TreeNode root = (TreeNode) mod.getRoot();
-        if (!tree.isRootVisible()
-            && tree.isExpanded(new TreePath(root)))
-          root = getNextNode(root);
-        
-        Point loc = getCellLocation(0, 0, tree, mod, cell, root);
-        return getCellBounds(loc.x, loc.y, cell);
+        if (mod != null)
+        {
+          TreeNode root = (TreeNode) mod.getRoot();
+          if (!tree.isRootVisible()
+              && tree.isExpanded(new TreePath(root)))
+            root = getNextNode(root);
+          
+          Point loc = getCellLocation(0, 0, tree, mod, cell, root);
+          return getCellBounds(loc.x, loc.y, cell);
+        }
       }
     return null;
   }
@@ -605,20 +608,23 @@
    */
   public TreePath getPathForRow(JTree tree, int row)
   {
-    TreeNode node = ((TreeNode) (tree.getModel()).getRoot());
-    if (!tree.isRootVisible()
-        && tree.isExpanded(new TreePath(getPathToRoot(node, 0))))
-      node = getNextNode(node);
-    
-    for (int i = 0; i < row; i++)
-      node = getNextVisibleNode(node);
-    
-    // in case nothing was found
-    if (node == null)
-      return null;
-    
-    // something was found
-    return new TreePath(getPathToRoot(node, 0));
+    TreeModel mod = tree.getModel();
+    if (mod != null)
+    {
+      TreeNode node = ((TreeNode) mod.getRoot());
+      if (!tree.isRootVisible()
+          && tree.isExpanded(new TreePath(getPathToRoot(node, 0))))
+        node = getNextNode(node);
+      
+      for (int i = 0; i < row; i++)
+        node = getNextVisibleNode(node);
+      
+      if (node == null)
+        return null;
+      
+      return new TreePath(getPathToRoot(node, 0));
+    }
+    return null;
   }
   
   /**
@@ -647,20 +653,21 @@
    */
   public int getRowCount(JTree tree)
   {
-    TreeNode node = ((TreeNode) (tree.getModel())
-        .getRoot());
-    if (!tree.isRootVisible()
-        && tree.isExpanded(new TreePath((getPathToRoot(node, 0)))))
-      node = getNextNode(node);
-    
+    TreeModel mod = tree.getModel();
     int count = 0;
-    
-    while (node != null)
+    if (mod != null)
+    {
+      TreeNode node = ((TreeNode) mod.getRoot());
+      if (!tree.isRootVisible()
+          && tree.isExpanded(new TreePath((getPathToRoot(node, 0)))))
+        node = getNextNode(node);
+
+      while (node != null)
       {
         count++;
         node = getNextVisibleNode(node);
       }
-    
+    }
     return count;
   }
   
@@ -1162,7 +1169,8 @@
     tree.addComponentListener(componentListener);
     cellEditor.addCellEditorListener(cellEditorListener);
     tree.addTreeExpansionListener(treeExpansionListener);
-    treeModel.addTreeModelListener(treeModelListener);
+    if (treeModel != null)
+      treeModel.addTreeModelListener(treeModelListener);
   }
   
   /**
@@ -1175,9 +1183,11 @@
     super.installUI(c);
     installDefaults((JTree) c);
     tree = (JTree) c;
-    setModel(tree.getModel());
+    TreeModel mod = tree.getModel();
+    setModel(mod);
     tree.setRootVisible(true);
-    tree.expandPath(new TreePath(tree.getModel().getRoot()));
+    if (mod != null)
+      tree.expandPath(new TreePath(mod.getRoot()));
     treeSelectionModel = tree.getSelectionModel();
     installListeners();
     installKeyboardActions();
@@ -1227,15 +1237,18 @@
   {
     JTree tree = (JTree) c;
     TreeModel mod = tree.getModel();
-    Object root = mod.getRoot();
-    
-    if (!tree.isRootVisible())
-      tree.expandPath(new TreePath(root));
-    
-    paintRecursive(g, 0, 0, 0, 0, tree, mod, root);
-    
-    if (hasControlIcons())
-      paintControlIcons(g, 0, 0, 0, 0, tree, mod, root);
+    if (mod != null)
+    {
+      Object root = mod.getRoot();
+      
+      if (!tree.isRootVisible())
+        tree.expandPath(new TreePath(root));
+      
+      paintRecursive(g, 0, 0, 0, 0, tree, mod, root);
+      
+      if (hasControlIcons())
+        paintControlIcons(g, 0, 0, 0, 0, tree, mod, root);
+    }
   }
   
   /**
@@ -1295,23 +1308,26 @@
   public Dimension getPreferredSize(JComponent c, boolean checkConsistancy)
   {
     // FIXME: checkConsistancy not implemented, c not used
-    TreeNode node = ((TreeNode) (tree.getModel())
-        .getRoot());
+    TreeModel model = tree.getModel();
     int maxWidth = 0;
     int count = 0;
-    if (node != null)
+    if (model != null)
+    {
+      TreeNode node = (TreeNode) model.getRoot();
+      if (node != null)
       {
         maxWidth = (int) (getCellBounds(0, 0, node).getWidth());
         while (node != null)
-          {
-            count++;
-            TreeNode nextNode = getNextVisibleNode(node);
-            if (nextNode != null)
-              maxWidth = Math.max(maxWidth, (int) (getCellBounds(0, 0, nextNode)
-                  .getWidth()));
-            node = nextNode;
-          }
+        {
+          count++;
+          TreeNode nextNode = getNextVisibleNode(node);
+          if (nextNode != null)
+            maxWidth = Math.max(maxWidth, (int) (getCellBounds(0, 0, nextNode)
+                .getWidth()));
+          node = nextNode;
+        }
       }
+    }
     return new Dimension(maxWidth, (getRowHeight() * count));
   }
   
===================================================================
Checking out kaffe/libraries/javalib/org/omg/DynamicAny/FieldNameHelper.java
RCS:  /home/cvs/kaffe/kaffe/libraries/javalib/org/omg/DynamicAny/FieldNameHelper.java,v
VERS: 1.1
***************
--- /dev/null	Sun Aug  4 19:57:58 2002
+++ kaffe/libraries/javalib/org/omg/DynamicAny/FieldNameHelper.java	Wed Aug 10 11:43:17 2005
@@ -0,0 +1,120 @@
+/* FieldNameHelper.java --
+   Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.DynamicAny;
+
+import gnu.CORBA.Restricted_ORB;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+/**
+ * A helper for the FieldName.  The fields {@link NameValuePair#id},
+ * {@link NameDynAnyPair#id} and return values of methods
+ * <code>current_member_name()</code>, <code>member_name()</code> in several
+ * interfaces officially have the "FieldName" type. This type is directly
+ * mapped into java String and needs no helper. The helper
+ * is included only as a part of the formal standard.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public abstract class FieldNameHelper
+{
+  /**
+   * Insert the FieldName into Any (uses {@link Any.insert_string}).
+   *
+   * @param a the Any to insert into.
+   * @param that the string to insert.
+   */
+  public static void insert(Any a, String that)
+  {
+    a.insert_string(that);
+  }
+
+  /**
+   * Extract the FieldName from Any ((uses {@link Any.extract_string}).
+   *
+   * @param a the Any to extract from.
+   */
+  public static String extract(Any a)
+  {
+    return a.extract_string();
+  }
+
+  /**
+   * Return an alias typecode.
+   */
+  public static TypeCode type()
+  {
+    ORB orb = Restricted_ORB.Singleton;
+    return orb.create_alias_tc(id(), "FieldName", orb.create_string_tc(0));
+  }
+
+  /**
+   * Return the FieldName repository id.
+   * @return "IDL:omg.org/DynamicAny/FieldName:1.0", always.
+   */
+  public static String id()
+  {
+    return "IDL:omg.org/DynamicAny/FieldName:1.0";
+  }
+
+  /**
+   * Calls {@link InputStream#read_string()}.
+   *
+   * @param instream the stream to read from.
+   */
+  public static String read(InputStream istream)
+  {
+    return istream.read_string();
+  }
+
+  /**
+   * Calls {@link OutputStream#write_string()}.
+   *
+   * @param ostream the stream to write into.
+   * @param value the string (FieldName) value to write.
+   */
+  public static void write(OutputStream ostream, String value)
+  {
+    ostream.write_string(value);
+  }
+}
\ No newline at end of file
===================================================================
Checking out kaffe/libraries/javalib/org/omg/DynamicAny/_DynAnyFactoryStub.java
RCS:  /home/cvs/kaffe/kaffe/libraries/javalib/org/omg/DynamicAny/_DynAnyFactoryStub.java,v
VERS: 1.1
***************
--- /dev/null	Sun Aug  4 19:57:58 2002
+++ kaffe/libraries/javalib/org/omg/DynamicAny/_DynAnyFactoryStub.java	Wed Aug 10 11:43:17 2005
@@ -0,0 +1,111 @@
+/* _DynAnyFactoryStub.java --
+   Copyright (C) 2005 Free Software Foundation, Inc.
+ This file is part of GNU Classpath.
+ GNU Classpath is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+ GNU Classpath is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ General Public License for more details.
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING.  If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA.
+ Linking this library statically or dynamically with other modules is
+ making a combined work based on this library.  Thus, the terms and
+ conditions of the GNU General Public License cover the whole
+ combination.
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent
+ modules, and to copy and distribute the resulting executable under
+ terms of your choice, provided that you also meet, for each linked
+ independent module, the terms and conditions of the license of that
+ module.  An independent module is a module which is not derived from
+ or based on this library.  If you modify this library, you may extend
+ this exception to your version of the library, but you are not
+ obligated to do so.  If you do not wish to do so, delete this
+ exception statement from your version. */
+
+
+package org.omg.DynamicAny;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.MARSHAL;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.Delegate;
+import org.omg.CORBA.portable.ObjectImpl;
+import org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode;
+
+import java.io.Serializable;
+
+/**
+ * Should provide support for remote invocation of methods on
+ * DynAnyFactory. As DynAny can never be remote at least till 1.5 inclusive,
+ * this class is not in use. DynAnyFactory should be obtained from the
+ * {@link ORB#resolve_initial_references}.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class _DynAnyFactoryStub
+  extends ObjectImpl
+  implements DynAnyFactory, Serializable
+{
+  /**
+   * Use serialVersionUID (v1.4) for interoperability.
+   */
+  private static final long serialVersionUID = -6575269659020082310L;
+
+  /**
+   * Create the DynAnyFactory stub.
+   */
+  public _DynAnyFactoryStub()
+  {
+  }
+
+  /**
+   * Create the naming context stub with the given delegate.
+   */
+  public _DynAnyFactoryStub(Delegate delegate)
+  {
+    _set_delegate(delegate);
+  }
+
+  /**
+   * Return the array of repository ids for this object.
+   */
+  public String[] _ids()
+  {
+    return new String[] { DynAnyFactoryHelper.id() };
+  }
+
+  /**
+   * The remote call of this DynAnyFactory method is not possible
+   * (the created DynAny would not be transferred to client).
+   *
+   * @throws MARSHAL, always.
+   */
+  public DynAny create_dyn_any(Any _0)
+                        throws InconsistentTypeCode
+  {
+    throw new MARSHAL(NOT_APPLICABLE);
+  }
+
+  /**
+   * The remote call of this DynAnyFactory method is not possible
+   * (the created DynAny would not be transferred to client).
+   *
+   * @throws MARSHAL, always.
+   */
+  public DynAny create_dyn_any_from_type_code(TypeCode _0)
+                                       throws InconsistentTypeCode
+  {
+    throw new MARSHAL(NOT_APPLICABLE);
+  }
+
+  static String NOT_APPLICABLE =
+    "DynAnyFactory is always local objects. " +
+    "It is never accessed on remote side via stub.";
+}
\ No newline at end of file
===================================================================
Checking out kaffe/libraries/javalib/org/omg/DynamicAny/_DynAnyStub.java
RCS:  /home/cvs/kaffe/kaffe/libraries/javalib/org/omg/DynamicAny/_DynAnyStub.java,v
VERS: 1.1
***************
--- /dev/null	Sun Aug  4 19:57:58 2002
+++ kaffe/libraries/javalib/org/omg/DynamicAny/_DynAnyStub.java	Wed Aug 10 11:43:17 2005
@@ -0,0 +1,625 @@
+/* _DynAnyStub.java --
+   Copyright (C) 2005 Free Software Foundation, Inc.
+ This file is part of GNU Classpath.
+ GNU Classpath is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+ GNU Classpath is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ General Public License for more details.
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING.  If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA.
+ Linking this library statically or dynamically with other modules is
+ making a combined work based on this library.  Thus, the terms and
+ conditions of the GNU General Public License cover the whole
+ combination.
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent
+ modules, and to copy and distribute the resulting executable under
+ terms of your choice, provided that you also meet, for each linked
+ independent module, the terms and conditions of the license of that
+ module.  An independent module is a module which is not derived from
+ or based on this library.  If you modify this library, you may extend
+ this exception to your version of the library, but you are not
+ obligated to do so.  If you do not wish to do so, delete this
+ exception statement from your version. */
+
+
+package org.omg.DynamicAny;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.MARSHAL;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.Delegate;
+import org.omg.CORBA.portable.ObjectImpl;
+import org.omg.DynamicAny.DynAnyPackage.InvalidValue;
+import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
+
+import java.io.Serializable;
+
+/**
+ * Should provide support for remote invocation of methods on DynAny. As
+ * DynAny can never be remote at least till 1.5 inclusive, this class is
+ * not in use.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class _DynAnyStub
+  extends ObjectImpl
+  implements DynAny, Serializable
+{

*** Patch too long, truncated ***



More information about the kaffe mailing list