[kaffe] CVS kaffe (dalibor): Resynced with GNU Classpath

Kaffe CVS cvs-commits at kaffe.org
Tue Aug 17 10:58:49 PDT 2004


PatchSet 5072 
Date: 2004/08/17 17:54:56
Author: dalibor
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU Classpath

2004-08-15  Dalibor Topic  <robilad at kaffe.org>

        * libraries/javalib/java/text/AttributedString.java:
        Resynced with GNU Classpath.

        2004-08-16  Tom Tromey  <tromey at redhat.com>

        Bug 9949.
        * java/text/AttributedString.java (AttributedString): Use
        ArrayList to build array of attribute ranges.  Don't use
        nextCount', not count.

2004-08-15  Dalibor Topic  <robilad at kaffe.org>

        * libraries/javalib/java/lang/Compiler.java:
        Resynced with GNU Classpath.

        * libraries/javalib/java/lang/VMCompiler.java:
        New file. Taken from GNU Classpath.

        * libraries/javalib/Makefile.am,
        libraries/javalib/Makefile.in,
        libraries/javalib/all.files:
        Regenerated.

        2004-08-16  Tom Tromey  <tromey at redhat.com>

        * java/lang/Compiler.java: Rewrote in terms of VMCompiler.
        * vm/reference/java/lang/VMCompiler.java: New file.

2004-08-15  Dalibor Topic  <robilad at kaffe.org>

        * libraries/javalib/java/io/File.java:
        Resynced with GNU Classpath.

        2004-08-16  Jeroen Frijters  <jeroen at frijters.net>

        * java/io/File.java File(String,String): Fixed handling of empty
        path.
2004-08-15  Dalibor Topic  <robilad at kaffe.org>

        * libraries/javalib/java/security/DummyKeyPairGenerator.java,
        libraries/javalib/java/security/DummyMessageDigest.java,
        libraries/javalib/java/security/DummySignature.java,
        libraries/javalib/java/security/MessageDigest.java,
        libraries/javalib/java/security/MessageDigestSpi.java,
        libraries/javalib/java/security/Signature.java,
        libraries/javalib/java/security/SignatureSpi.java,
        libraries/javalib/javax/crypto/MacSpi.java:
        Resynced with GNU Classpath.

        * libraries/javalib/java/security/KeyPairGenerator.java,
        libraries/javalib/java/security/KeyPairGeneratorSpi.java:
        Replaced by implementation from GNU Classpath.

        2004-08-15  Casey Marshall  <csm at gnu.org>

        * java/security/DummyKeyPairGenerator.java (clone): removed
        useless instanceof check.
        * java/security/DummyMessageDigest.java (clone): likewise.
        * java/security/DummySignature.java (clone): likewise.
        * java/security/MessageDigest.java (clone): remove useless
        instanceof check.
        * java/security/MessageDigestSpi.java (clone): likewise.
        * java/security/Signature.java (clone): provide meaningful
        implementation.
        * java/security/SignatureSpi.java (clone): likewise.
        * javax/crypto/MacSpi.java (clone): likewise.

Members: 
	ChangeLog:1.2630->1.2631 
	libraries/javalib/Makefile.am:1.222->1.223 
	libraries/javalib/Makefile.in:1.299->1.300 
	libraries/javalib/all.files:1.16->1.17 
	libraries/javalib/java/io/File.java:1.53->1.54 
	libraries/javalib/java/lang/Compiler.java:1.5->1.6 
	libraries/javalib/java/lang/VMCompiler.java:INITIAL->1.1 
	libraries/javalib/java/rmi/server/UID.java:1.3->1.4 
	libraries/javalib/java/security/DummyKeyPairGenerator.java:INITIAL->1.1 
	libraries/javalib/java/security/DummyMessageDigest.java:1.1->1.2 
	libraries/javalib/java/security/DummySignature.java:INITIAL->1.1 
	libraries/javalib/java/security/KeyPairGenerator.java:1.3->1.4 
	libraries/javalib/java/security/KeyPairGeneratorSpi.java:1.1->1.2 
	libraries/javalib/java/security/MessageDigest.java:1.6->1.7 
	libraries/javalib/java/security/MessageDigestSpi.java:1.2->1.3 
	libraries/javalib/java/security/Signature.java:1.5->1.6 
	libraries/javalib/java/security/SignatureSpi.java:1.3->1.4 
	libraries/javalib/java/text/AttributedString.java:1.7->1.8 
	libraries/javalib/javax/crypto/MacSpi.java:1.1->1.2 
	libraries/javalib/javax/swing/JDesktopPane.java:1.1->1.2 
	libraries/javalib/javax/swing/plaf/basic/BasicSplitPaneUI.java:1.2->1.3 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2630 kaffe/ChangeLog:1.2631
--- kaffe/ChangeLog:1.2630	Mon Aug 16 10:33:34 2004
+++ kaffe/ChangeLog	Tue Aug 17 17:54:56 2004
@@ -6,6 +6,100 @@
 
 2004-08-15  Dalibor Topic  <robilad at kaffe.org>
 
+	* libraries/javalib/java/text/AttributedString.java:
+	Resynced with GNU Classpath.
+
+	2004-08-16  Tom Tromey  <tromey at redhat.com>
+
+        Bug 9949.
+        * java/text/AttributedString.java (AttributedString): Use
+        ArrayList to build array of attribute ranges.  Don't use
+        `attribs' before it is set.
+
+2004-08-15  Dalibor Topic  <robilad at kaffe.org>
+
+	* libraries/javalib/javax/swing/JDesktopPane.java,
+	libraries/javalib/javax/swing/plaf/basic/BasicSplitPaneUI.java:
+	Resynced with GNU Classpath.
+
+	2004-08-16  Tom Tromey  <tromey at redhat.com>
+
+        Bug 9948.
+        * javax/swing/JDesktopPane.java (LIVE_DRAG_MODE): Now final.
+        (OUTLINE_DRAG_MODE): LIVE_DRAG_MODE.
+        * javax/swing/plaf/basic/BasicSplitPaneUI.java
+        (NON_CONTINUOUS_DIVIDER): Now final.  Initialize.
+
+2004-08-15  Dalibor Topic  <robilad at kaffe.org>
+
+	* libraries/javalib/java/rmi/server/UID.java:
+	Resynced with GNU Classpath.
+
+	2004-08-16  Tom Tromey  <tromey at redhat.com>
+
+        Bug 9944.
+        * java/rmi/server/UID.java (UID): Read `nextCount', not count.
+
+2004-08-15  Dalibor Topic  <robilad at kaffe.org>
+
+	* libraries/javalib/java/lang/Compiler.java:
+	Resynced with GNU Classpath.
+
+	* libraries/javalib/java/lang/VMCompiler.java:
+	New file. Taken from GNU Classpath.
+
+	* libraries/javalib/Makefile.am,
+	libraries/javalib/Makefile.in,
+	libraries/javalib/all.files:
+	Regenerated.
+
+	2004-08-16  Tom Tromey  <tromey at redhat.com>
+
+        * java/lang/Compiler.java: Rewrote in terms of VMCompiler.
+        * vm/reference/java/lang/VMCompiler.java: New file.
+
+2004-08-15  Dalibor Topic  <robilad at kaffe.org>
+
+	* libraries/javalib/java/io/File.java:
+	Resynced with GNU Classpath.
+
+	2004-08-16  Jeroen Frijters  <jeroen at frijters.net>
+
+        * java/io/File.java File(String,String): Fixed handling of empty
+        path.
+
+2004-08-15  Dalibor Topic  <robilad at kaffe.org>
+
+	* libraries/javalib/java/security/DummyKeyPairGenerator.java,
+	libraries/javalib/java/security/DummyMessageDigest.java,
+	libraries/javalib/java/security/DummySignature.java,
+	libraries/javalib/java/security/MessageDigest.java,
+	libraries/javalib/java/security/MessageDigestSpi.java,
+	libraries/javalib/java/security/Signature.java,
+	libraries/javalib/java/security/SignatureSpi.java,
+	libraries/javalib/javax/crypto/MacSpi.java:
+	Resynced with GNU Classpath.
+
+	* libraries/javalib/java/security/KeyPairGenerator.java,
+	libraries/javalib/java/security/KeyPairGeneratorSpi.java:
+	Replaced by implementation from GNU Classpath.
+
+	2004-08-15  Casey Marshall  <csm at gnu.org>
+
+        * java/security/DummyKeyPairGenerator.java (clone): removed
+        useless instanceof check.
+        * java/security/DummyMessageDigest.java (clone): likewise.
+        * java/security/DummySignature.java (clone): likewise.
+        * java/security/MessageDigest.java (clone): remove useless
+        instanceof check.
+        * java/security/MessageDigestSpi.java (clone): likewise.
+        * java/security/Signature.java (clone): provide meaningful
+        implementation.
+        * java/security/SignatureSpi.java (clone): likewise.
+        * javax/crypto/MacSpi.java (clone): likewise.
+
+2004-08-15  Dalibor Topic  <robilad at kaffe.org>
+
         * include/Makefile.am:
 	Added new libxmlj includes, and remove no longer needed ones.
 
Index: kaffe/libraries/javalib/Makefile.am
diff -u kaffe/libraries/javalib/Makefile.am:1.222 kaffe/libraries/javalib/Makefile.am:1.223
--- kaffe/libraries/javalib/Makefile.am:1.222	Mon Aug 16 02:43:44 2004
+++ kaffe/libraries/javalib/Makefile.am	Tue Aug 17 17:54:58 2004
@@ -1922,6 +1922,7 @@
 	java/lang/UnsatisfiedLinkError.java \
 	java/lang/UnsupportedClassVersionError.java \
 	java/lang/UnsupportedOperationException.java \
+	java/lang/VMCompiler.java \
 	java/lang/VMObject.java \
 	java/lang/VMSecurityManager.java \
 	java/lang/VMThread.java \
@@ -2171,7 +2172,9 @@
 	java/security/DigestInputStream.java \
 	java/security/DigestOutputStream.java \
 	java/security/DomainCombiner.java \
+	java/security/DummyKeyPairGenerator.java \
 	java/security/DummyMessageDigest.java \
+	java/security/DummySignature.java \
 	java/security/GeneralSecurityException.java \
 	java/security/Guard.java \
 	java/security/GuardedObject.java \
Index: kaffe/libraries/javalib/Makefile.in
diff -u kaffe/libraries/javalib/Makefile.in:1.299 kaffe/libraries/javalib/Makefile.in:1.300
--- kaffe/libraries/javalib/Makefile.in:1.299	Mon Aug 16 02:43:44 2004
+++ kaffe/libraries/javalib/Makefile.in	Tue Aug 17 17:55:00 2004
@@ -2390,6 +2390,7 @@
 	java/lang/UnsatisfiedLinkError.java \
 	java/lang/UnsupportedClassVersionError.java \
 	java/lang/UnsupportedOperationException.java \
+	java/lang/VMCompiler.java \
 	java/lang/VMObject.java \
 	java/lang/VMSecurityManager.java \
 	java/lang/VMThread.java \
@@ -2654,7 +2655,9 @@
 	java/security/DigestInputStream.java \
 	java/security/DigestOutputStream.java \
 	java/security/DomainCombiner.java \
+	java/security/DummyKeyPairGenerator.java \
 	java/security/DummyMessageDigest.java \
+	java/security/DummySignature.java \
 	java/security/GeneralSecurityException.java \
 	java/security/Guard.java \
 	java/security/GuardedObject.java \
Index: kaffe/libraries/javalib/all.files
diff -u kaffe/libraries/javalib/all.files:1.16 kaffe/libraries/javalib/all.files:1.17
--- kaffe/libraries/javalib/all.files:1.16	Mon Aug 16 02:43:46 2004
+++ kaffe/libraries/javalib/all.files	Tue Aug 17 17:55:00 2004
@@ -1502,6 +1502,7 @@
 java/lang/UnsatisfiedLinkError.java
 java/lang/UnsupportedClassVersionError.java
 java/lang/UnsupportedOperationException.java
+java/lang/VMCompiler.java
 java/lang/VMObject.java
 java/lang/VMSecurityManager.java
 java/lang/VMThread.java
@@ -1736,7 +1737,9 @@
 java/security/DigestInputStream.java
 java/security/DigestOutputStream.java
 java/security/DomainCombiner.java
+java/security/DummyKeyPairGenerator.java
 java/security/DummyMessageDigest.java
+java/security/DummySignature.java
 java/security/GeneralSecurityException.java
 java/security/Guard.java
 java/security/GuardedObject.java
Index: kaffe/libraries/javalib/java/io/File.java
diff -u kaffe/libraries/javalib/java/io/File.java:1.53 kaffe/libraries/javalib/java/io/File.java:1.54
--- kaffe/libraries/javalib/java/io/File.java:1.53	Sun Aug 15 22:12:50 2004
+++ kaffe/libraries/javalib/java/io/File.java	Tue Aug 17 17:55:01 2004
@@ -364,9 +364,9 @@
 	    if (separatorChar == '\\' /* TODO use ON_WINDOWS */)
 	      {
 		int skip = 0;
-		while(name.length() > skip &&
-		    (name.charAt(skip) == separatorChar ||
-		    name.charAt(skip) == '/'))
+		while(name.length() > skip
+		    && (name.charAt(skip) == separatorChar
+		    || name.charAt(skip) == '/'))
 		  {
 		    skip++;
 		  }
Index: kaffe/libraries/javalib/java/lang/Compiler.java
diff -u kaffe/libraries/javalib/java/lang/Compiler.java:1.5 kaffe/libraries/javalib/java/lang/Compiler.java:1.6
--- kaffe/libraries/javalib/java/lang/Compiler.java:1.5	Tue May 18 01:10:27 2004
+++ kaffe/libraries/javalib/java/lang/Compiler.java	Tue Aug 17 17:55:01 2004
@@ -1,5 +1,5 @@
 /* Compiler.java -- placeholder for Java-to-native runtime compilers
-   Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2001, 2002, 2004 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -76,8 +76,7 @@
    */
   public static boolean compileClass(Class oneClass)
   {
-    // Never succeed.
-    return false;
+    return VMCompiler.compileClass(oneClass);
   }
 
   /**
@@ -90,8 +89,7 @@
    */
   public static boolean compileClasses(String classNames)
   {
-    // Note the incredibly lame interface.  Always fail.
-    return false;
+    return VMCompiler.compileClasses(classNames);
   }
 
   /**
@@ -105,8 +103,7 @@
    */
   public static Object command(Object arg)
   {
-    // Our implementation defines this to a no-op.
-    return null;
+    return VMCompiler.command(arg);
   }
 
   /**
@@ -116,6 +113,7 @@
    */
   public static void enable()
   {
+    VMCompiler.enable();
   }
 
   /**
@@ -124,5 +122,6 @@
    */
   public static void disable()
   {
+    VMCompiler.disable();
   }
 }
===================================================================
Checking out kaffe/libraries/javalib/java/lang/VMCompiler.java
RCS:  /home/cvs/kaffe/kaffe/libraries/javalib/java/lang/VMCompiler.java,v
VERS: 1.1
***************
--- /dev/null	Sun Aug  4 19:57:58 2002
+++ kaffe/libraries/javalib/java/lang/VMCompiler.java	Tue Aug 17 17:58:49 2004
@@ -0,0 +1,112 @@
+/* VMClassLoader.java -- Reference implementation of compiler interface
+   Copyright (C) 2004 Free Software Foundation
+
+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 java.lang;
+
+/**
+ * This class is just a per-VM reflection of java.lang.Compiler.
+ * All methods are defined identically.
+ */
+final class VMCompiler
+{
+  /**
+   * Don't allow new `Compiler's to be made.
+   */
+  private VMCompiler()
+  {
+  }
+
+  /**
+   * Compile the class named by <code>oneClass</code>.
+   *
+   * @param oneClass the class to compile
+   * @return <code>false</code> if no compiler is available or
+   *         compilation failed, <code>true</code> if compilation succeeded
+   * @throws NullPointerException if oneClass is null
+   */
+  public static boolean compileClass(Class oneClass)
+  {
+    // Never succeed.
+    return false;
+  }
+
+  /**
+   * Compile the classes whose name matches <code>classNames</code>.
+   *
+   * @param classNames the name of classes to compile
+   * @return <code>false</code> if no compiler is available or
+   *         compilation failed, <code>true</code> if compilation succeeded
+   * @throws NullPointerException if classNames is null
+   */
+  public static boolean compileClasses(String classNames)
+  {
+    // Note the incredibly lame interface.  Always fail.
+    return false;
+  }
+
+  /**
+   * This method examines the argument and performs an operation
+   * according to the compilers documentation.  No specific operation
+   * is required.
+   *
+   * @param arg a compiler-specific argument
+   * @return a compiler-specific value, including null
+   * @throws NullPointerException if the compiler doesn't like a null arg
+   */
+  public static Object command(Object arg)
+  {
+    // Our implementation defines this to a no-op.
+    return null;
+  }
+
+  /**
+   * Calling <code>Compiler.enable()</code> will cause the compiler
+   * to resume operation if it was previously disabled; provided that a
+   * compiler even exists.
+   */
+  public static void enable()
+  {
+  }
+
+  /**
+   * Calling <code>Compiler.disable()</code> will cause the compiler
+   * to be suspended; provided that a compiler even exists.
+   */
+  public static void disable()
+  {
+  }
+}
Index: kaffe/libraries/javalib/java/rmi/server/UID.java
diff -u kaffe/libraries/javalib/java/rmi/server/UID.java:1.3 kaffe/libraries/javalib/java/rmi/server/UID.java:1.4
--- kaffe/libraries/javalib/java/rmi/server/UID.java:1.3	Mon Mar 22 11:24:58 2004
+++ kaffe/libraries/javalib/java/rmi/server/UID.java	Tue Aug 17 17:55:01 2004
@@ -1,5 +1,5 @@
 /*
-  Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+  Copyright (c) 1996, 1997, 1998, 1999, 2004 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -37,10 +37,13 @@
 
 package java.rmi.server;
 
-import java.io.DataInput;
+import java.io.Serializable;
 import java.io.DataOutput;
+import java.io.DataInput;
 import java.io.IOException;
-import java.io.Serializable;
+import java.util.Random;
+import java.lang.Thread;
+import java.lang.InterruptedException;
 
 public final class UID
 	implements Serializable {
@@ -62,7 +65,7 @@
  */
 public UID() {
 	synchronized (lock) {
-		if (count == Short.MAX_VALUE) {
+		if (nextCount == Short.MAX_VALUE) {
 			long newtime;
 			for (;;) {
 				newtime = System.currentTimeMillis();
===================================================================
Checking out kaffe/libraries/javalib/java/security/DummyKeyPairGenerator.java
RCS:  /home/cvs/kaffe/kaffe/libraries/javalib/java/security/DummyKeyPairGenerator.java,v
VERS: 1.1
***************
--- /dev/null	Sun Aug  4 19:57:58 2002
+++ kaffe/libraries/javalib/java/security/DummyKeyPairGenerator.java	Tue Aug 17 17:58:49 2004
@@ -0,0 +1,75 @@
+/* DummyKeyPairGenerator.java - Wrapper for KeyPairGeneratorSpi
+   Copyright (C) 1999, 2002 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 java.security;
+
+import java.security.spec.AlgorithmParameterSpec;
+
+final class DummyKeyPairGenerator extends KeyPairGenerator
+{
+  private KeyPairGeneratorSpi kpgSpi = null;
+
+  public DummyKeyPairGenerator(KeyPairGeneratorSpi kpgSpi, String algorithm)
+  {
+    super(algorithm);
+    this.kpgSpi = kpgSpi;
+  }
+
+  public Object clone() throws CloneNotSupportedException
+  {
+    KeyPairGenerator result = new DummyKeyPairGenerator
+            ((KeyPairGeneratorSpi) kpgSpi.clone(), this.getAlgorithm());
+    result.provider = this.getProvider();
+    return result;
+  }
+
+  public void initialize(int keysize, SecureRandom random)
+  {
+    kpgSpi.initialize(keysize, random);
+  }
+
+  public void initialize(AlgorithmParameterSpec params, SecureRandom random)
+    throws InvalidAlgorithmParameterException
+  {
+    kpgSpi.initialize(params, random);
+  }
+
+  public KeyPair generateKeyPair()
+  {
+    return kpgSpi.generateKeyPair();
+  }
+}
Index: kaffe/libraries/javalib/java/security/DummyMessageDigest.java
diff -u kaffe/libraries/javalib/java/security/DummyMessageDigest.java:1.1 kaffe/libraries/javalib/java/security/DummyMessageDigest.java:1.2
--- kaffe/libraries/javalib/java/security/DummyMessageDigest.java:1.1	Mon Aug 16 00:41:23 2004
+++ kaffe/libraries/javalib/java/security/DummyMessageDigest.java	Tue Aug 17 17:55:02 2004
@@ -49,11 +49,8 @@
 
   public Object clone() throws CloneNotSupportedException
   {
-    if (!(mdSpi instanceof Cloneable))
-      throw new CloneNotSupportedException();
-
     MessageDigest result = new DummyMessageDigest
-	((MessageDigestSpi) mdSpi.clone(), this.getAlgorithm());
+        ((MessageDigestSpi) mdSpi.clone(), this.getAlgorithm());
     result.provider = this.getProvider();
     return result;
   }
===================================================================
Checking out kaffe/libraries/javalib/java/security/DummySignature.java
RCS:  /home/cvs/kaffe/kaffe/libraries/javalib/java/security/DummySignature.java,v
VERS: 1.1
***************
--- /dev/null	Sun Aug  4 19:57:58 2002
+++ kaffe/libraries/javalib/java/security/DummySignature.java	Tue Aug 17 17:58:49 2004
@@ -0,0 +1,102 @@
+/* DummySignature.java - Signature wrapper for SignatureSpi.
+   Copyright (C) 1999, 2002 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 java.security;
+
+final class DummySignature extends Signature
+{
+  private SignatureSpi sigSpi = null;
+
+  public DummySignature(SignatureSpi sigSpi, String algorithm)
+  {
+    super(algorithm);
+    this.sigSpi = sigSpi;
+  }
+
+  public Object clone() throws CloneNotSupportedException
+  {
+    Signature result = new DummySignature
+            ((SignatureSpi) sigSpi.clone(), this.getAlgorithm());
+    result.provider = this.getProvider();
+    return result;
+  }
+
+  protected void engineInitVerify(PublicKey publicKey)
+    throws InvalidKeyException
+  {
+    sigSpi.engineInitVerify(publicKey);
+  }
+
+  protected void engineInitSign(PrivateKey privateKey)
+    throws InvalidKeyException
+  {
+    sigSpi.engineInitSign(privateKey);
+  }
+
+  protected void engineUpdate(byte b) throws SignatureException
+  {
+    sigSpi.engineUpdate(b);
+  }
+
+  protected void engineUpdate(byte[]b, int off, int len)
+    throws SignatureException
+  {
+    sigSpi.engineUpdate(b, off, len);
+  }
+
+  protected byte[] engineSign() throws SignatureException
+  {
+    return sigSpi.engineSign();
+  }
+
+  protected boolean engineVerify(byte[]sigBytes) throws SignatureException
+  {
+    return sigSpi.engineVerify(sigBytes);
+  }
+
+  protected void engineSetParameter(String param, Object value)
+    throws InvalidParameterException
+  {
+    sigSpi.engineSetParameter(param, value);
+  }
+
+  protected Object engineGetParameter(String param)
+    throws InvalidParameterException
+  {
+    return sigSpi.engineGetParameter(param);
+  }
+}
Index: kaffe/libraries/javalib/java/security/KeyPairGenerator.java
diff -u kaffe/libraries/javalib/java/security/KeyPairGenerator.java:1.3 kaffe/libraries/javalib/java/security/KeyPairGenerator.java:1.4
--- kaffe/libraries/javalib/java/security/KeyPairGenerator.java:1.3	Thu Feb 20 13:52:09 2003
+++ kaffe/libraries/javalib/java/security/KeyPairGenerator.java	Tue Aug 17 17:55:02 2004
@@ -1,85 +1,397 @@
+/* KeyPairGenerator.java --- Key Pair Generator Class
+   Copyright (C) 1999, 2002, 2003 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. */
 
-/*
- * Java core library component.
- *
- * Copyright (c) 1999
- *	Archie L. Cobbs.  All rights reserved.
- * Copyright (c) 1999
- *	Transvirtual Technologies, Inc.  All rights reserved.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file.
- *
- * Author: Archie L. Cobbs <archie at whistle.com>
- */
- 
 package java.security;
 
 import java.security.spec.AlgorithmParameterSpec;
 
-// See MessageDigest for a description of why this extends KeyPairGeneratorSpi
-// and the weirdness it causes.
+import gnu.java.security.Engine;
 
-public abstract class KeyPairGenerator extends KeyPairGeneratorSpi {
-	static final String ENGINE_CLASS = "KeyPairGenerator";
-	private final String algorithm;
-	private Provider provider;
-
-	protected KeyPairGenerator(String algorithm) {
-		this.algorithm = algorithm;
-	}
-
-	public String getAlgorithm() {
-		return algorithm;
-	}
-
-	public static KeyPairGenerator getInstance(String alg)
-			throws NoSuchAlgorithmException {
-		return getInstance(Security.getCryptInstance(
-			ENGINE_CLASS, alg));
-	}
-
-	public static KeyPairGenerator getInstance(String alg, String provider)
-			throws NoSuchAlgorithmException,
-				NoSuchProviderException {
-		return getInstance(Security.getCryptInstance(
-			ENGINE_CLASS, alg, provider));
-	}
-
-	private static KeyPairGenerator getInstance(Security.Engine e) {
-		// weirdness
-		KeyPairGenerator k = (KeyPairGenerator)e.getEngine();
-		k.provider = e.getProvider();
-		return k;
-	}
-
-	public final Provider getProvider() {
-		return provider;
-	}
-
-	public void initialize(int keysize) {
-		initialize(keysize, new SecureRandom());
-	}
-
-	// this class must be overridden by provider's class
-	public void initialize(int keysize, SecureRandom random) {
-		throw new UnsupportedOperationException();
-	}
-
-	public void initialize(AlgorithmParameterSpec params)
-			throws InvalidAlgorithmParameterException {
-		initialize(params, new SecureRandom());
-	}
-
-	// this class must be overridden by provider's class
-	public void initialize(AlgorithmParameterSpec params, SecureRandom r)
-                throws InvalidAlgorithmParameterException
-	{
-		throw new UnsupportedOperationException();
-	}
-
-	public final KeyPair genKeyPair() {
-		return /*engine.*/generateKeyPair();
-	}
+/**
+ * <p>The <code>KeyPairGenerator</code> class is used to generate pairs of
+ * public and private keys. Key pair generators are constructed using the
+ * <code>getInstance()</code> factory methods (static methods that return
+ * instances of a given class).</p>
+ *
+ * <p>A Key pair generator for a particular algorithm creates a public/private
+ * key pair that can be used with this algorithm. It also associates
+ * algorithm-specific parameters with each of the generated keys.</p>
+ *
+ * <p>There are two ways to generate a key pair: in an algorithm-independent
+ * manner, and in an algorithm-specific manner. The only difference between the
+ * two is the initialization of the object:</p>
+ *
+ * <ul>
+ * <li><b>Algorithm-Independent Initialization</b><br/>
+ *     All key pair generators share the concepts of a <i>keysize</i> and a
+ *     <i>source of randomness</i>. The <i>keysize</i> is interpreted differently
+ *     for different algorithms (e.g., in the case of the <i>DSA</i> algorithm,
+ *     the <i>keysize</i> corresponds to the length of the modulus). There is an
+ *     <code>initialize()</code> method in this <code>KeyPairGenerator</code>
+ *     class that takes these two universally shared types of arguments. There
+ *     is also one that takes just a <i>keysize</i> argument, and uses the
+ *     {@link SecureRandom} implementation of the highest-priority installed
+ *     provider as the <i>source of randomness</i>. (If none of the installed
+ *     providers supply an implementation of {@link SecureRandom}, a
+ *     system-provided source of randomness is used.)
+ *
+ *     <p>Since no other parameters are specified when you call the above
+ *     algorithm-independent initialize methods, it is up to the provider what
+ *     to do about the algorithm-specific parameters (if any) to be associated
+ *     with each of the keys.</p>
+ *
+ *     <p>If the algorithm is the <i>DSA</i> algorithm, and the <i>keysize</i>
+ *     (modulus size) is <code>512</code>, <code>768</code>, or <code>1024</code>,
+ *     then the <b>GNU</b> provider uses a set of precomputed values for the
+ *     <code>p</code>, <code>q</code>, and <code>g</code> parameters. If the
+ *     <i>modulus size</i> is not one of the above values, the <b>GNU</b>
+ *     provider creates a new set of parameters. Other providers might have
+ *     precomputed parameter sets for more than just the three modulus sizes
+ *     mentioned above. Still others might not have a list of precomputed
+ *     parameters at all and instead always create new parameter sets.</p></li>
+ * <li><b>Algorithm-Specific Initialization</b><br/>
+ *     For situations where a set of algorithm-specific parameters already
+ *     exists (e.g., so-called <i>community parameters</i> in <i>DSA</i>), there
+ *     are two initialize methods that have an {@link AlgorithmParameterSpec}
+ *     argument. One also has a {@link SecureRandom} argument, while the the
+ *     other uses the {@link SecureRandom} implementation of the highest-priority
+ *     installed provider as the source of randomness. (If none of the installed
+ *     providers supply an implementation of {@link SecureRandom}, a
+ *     system-provided source of randomness is used.)</li>
+ * </ul>
+ *
+ * <p>In case the client does not explicitly initialize the
+ * <code>KeyPairGenerator</code> (via a call to an initialize method), each
+ * provider must supply (and document) a default initialization. For example,
+ * the <b>GNU</b> provider uses a default modulus size (keysize) of
+ * <code>1024</code> bits.</p>
+ *
+ * <p>Note that this class is abstract and extends from {@link
+ * KeyPairGeneratorSpi} for historical reasons. Application developers should
+ * only take notice of the methods defined in this <code>KeyPairGenerator</code>
+ * class; all the methods in the superclass are intended for cryptographic
+ * service providers who wish to supply their own implementations of key pair
+ * generators.</p>
+ *
+ * @see Signature
+ * @see KeyPair
+ * @see AlgorithmParameterSpec
+ * @author Mark Benvenuto
+ * @author Casey Marshall
+ */
+public abstract class KeyPairGenerator extends KeyPairGeneratorSpi
+{
+  /** The service name for key pair generators. */
+  private static final String KEY_PAIR_GENERATOR = "KeyPairGenerator";
+
+  Provider provider;
+  private String algorithm;
+
+  /**
+   * Creates a <code>KeyPairGenerator</code> object for the specified 
+   * algorithm.
+   *
+   * @param algorithm the standard string name of the algorithm. 
+   * See Appendix A in the Java Cryptography Architecture API 
+   * Specification &amp; Reference for information about standard 
+   * algorithm names.
+   */
+  protected KeyPairGenerator(String algorithm)
+  {
+    this.algorithm = algorithm;
+    this.provider = null;
+  }
+
+  /**
+   * Returns the standard name of the algorithm for this key pair generator.
+   * See Appendix A in the Java Cryptography Architecture API Specification
+   * &amp; Reference for information about standard algorithm names.
+   *
+   * @return the standard string name of the algorithm.
+   */
+  public String getAlgorithm()
+  {
+    return algorithm;
+  }
+
+  /**
+   * Generates a <code>KeyPairGenerator</code> object that implements the
+   * specified digest algorithm. If the default provider package provides an
+   * implementation of the requested digest algorithm, an instance of
+   * <code>KeyPairGenerator</code> containing that implementation is returned.
+   * If the algorithm is not available in the default package, other packages
+   * are searched.
+   *
+   * @param algorithm the standard string name of the algorithm. See Appendix A
+   * in the Java Cryptography Architecture API Specification &amp; Reference for
+   * information about standard algorithm names.
+   * @return the new <code>KeyPairGenerator</code> object.
+   * @throws NoSuchAlgorithmException if the algorithm is not available in the
+   * environment.
+   */
+  public static KeyPairGenerator getInstance(String algorithm)
+    throws NoSuchAlgorithmException
+  {
+    Provider[] p = Security.getProviders();
+    for (int i = 0; i < p.length; i++)
+      {
+        try
+          {
+            return getInstance(algorithm, p[i]);
+	  }
+        catch (NoSuchAlgorithmException ignored) {}
+      }
+
+    throw new NoSuchAlgorithmException(algorithm);
+  }
+
+  /**
+   * Generates a <code>KeyPairGenerator</code> object implementing the 
+   * specified algorithm, as supplied from the specified provider, if 
+   * such an algorithm is available from the provider.
+   *
+   * @param algorithm the standard string name of the algorithm. See 
+   * Appendix A in the Java Cryptography Architecture API Specification 
+   * &amp; Reference for information about standard algorithm names.
+   * @param provider the string name of the provider.
+   * @return the new <code>KeyPairGenerator</code> object.
+   * @throws NoSuchAlgorithmException if the algorithm is not available 
+   * from the provider.
+   * @throws NoSuchProviderException if the provider is not available in the
+   * environment.
+   * @throws IllegalArgumentException if the provider name is <code>null</code>
+   * or empty.
+   * @see Provider
+   */
+  public static KeyPairGenerator getInstance(String algorithm, String provider)
+    throws NoSuchAlgorithmException, NoSuchProviderException
+  {
+    Provider p = Security.getProvider(provider);
+    if (p == null)
+      throw new NoSuchProviderException(provider);
+
+    return getInstance(algorithm, p);
+  }

*** Patch too long, truncated ***



More information about the kaffe mailing list