[kaffe] CVS kaffe (dalibor): Partially resynced with GNU Classpath

Kaffe CVS cvs-commits at kaffe.org
Tue Sep 16 05:38:03 PDT 2003


PatchSet 4039 
Date: 2003/09/16 12:35:52
Author: dalibor
Branch: HEAD
Tag: (none) 
Log:
Partially resynced with GNU Classpath

Members: 
	ChangeLog:1.1635->1.1636 
	libraries/javalib/gnu/java/rmi/rmic/Compile_gcj.java:1.1->1.2 
	libraries/javalib/gnu/java/rmi/rmic/Compile_jikes.java:1.1->1.2 
	libraries/javalib/gnu/java/rmi/rmic/Compiler.java:1.1->1.2 
	libraries/javalib/gnu/java/rmi/rmic/CompilerProcess.java:1.1->1.2 
	libraries/javalib/gnu/java/rmi/rmic/RMIC.java:1.1->1.2 
	libraries/javalib/java/awt/BasicStroke.java:1.3->1.4 
	libraries/javalib/java/awt/Color.java:1.14->1.15 
	libraries/javalib/java/security/Policy.java:1.1->1.2 
	libraries/javalib/java/security/acl/Acl.java:1.3->1.4 
	libraries/javalib/java/util/logging/LogManager.java:1.3->1.4 
	libraries/javalib/java/util/logging/Logger.java:1.1->1.2 
	libraries/javalib/java/util/logging/SimpleFormatter.java:1.1->1.2 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.1635 kaffe/ChangeLog:1.1636
--- kaffe/ChangeLog:1.1635	Mon Sep 15 16:43:11 2003
+++ kaffe/ChangeLog	Tue Sep 16 12:35:52 2003
@@ -1,3 +1,21 @@
+2003-09-16  Dalibor Topic <robilad at kaffe.org>
+
+	* libraries/javalib/gnu/java/rmi/rmic/Compile_gcj.java,
+	libraries/javalib/gnu/java/rmi/rmic/Compile_jikes.java,
+	libraries/javalib/gnu/java/rmi/rmic/Compile_kjc.java,
+	libraries/javalib/gnu/java/rmi/rmic/Compiler.java,
+	libraries/javalib/gnu/java/rmi/rmic/CompilerProcess.java,
+	libraries/javalib/gnu/java/rmi/rmic/RMIC.java,
+	libraries/javalib/gnu/java/rmi/rmic/RMICException.java,
+	libraries/javalib/java/awt/BasicStroke.java,
+	libraries/javalib/java/awt/Color.java,
+	libraries/javalib/java/security/acl/Acl.java,
+	libraries/javalib/java/security/Policy.java,
+	libraries/javalib/java/util/logging/LogManager.java,
+	libraries/javalib/java/util/logging/Logger.java,
+	libraries/javalib/java/util/logging/SimpleFormatter.java:
+	Resynced with GNU Classpath.
+	
 2003-09-15  Dalibor Topic <robilad at kaffe.org>
 
 	* developers/check-classpath-merge-status:
Index: kaffe/libraries/javalib/gnu/java/rmi/rmic/Compile_gcj.java
diff -u kaffe/libraries/javalib/gnu/java/rmi/rmic/Compile_gcj.java:1.1 kaffe/libraries/javalib/gnu/java/rmi/rmic/Compile_gcj.java:1.2
--- kaffe/libraries/javalib/gnu/java/rmi/rmic/Compile_gcj.java:1.1	Mon Aug 18 17:40:33 2003
+++ kaffe/libraries/javalib/gnu/java/rmi/rmic/Compile_gcj.java	Tue Sep 16 12:35:53 2003
@@ -1,5 +1,5 @@
 /*
-  Copyright (c) 2001 Free Software Foundation, Inc.
+  Copyright (c) 2001, 2003 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
Index: kaffe/libraries/javalib/gnu/java/rmi/rmic/Compile_jikes.java
diff -u kaffe/libraries/javalib/gnu/java/rmi/rmic/Compile_jikes.java:1.1 kaffe/libraries/javalib/gnu/java/rmi/rmic/Compile_jikes.java:1.2
--- kaffe/libraries/javalib/gnu/java/rmi/rmic/Compile_jikes.java:1.1	Mon Aug 18 17:40:33 2003
+++ kaffe/libraries/javalib/gnu/java/rmi/rmic/Compile_jikes.java	Tue Sep 16 12:35:53 2003
@@ -37,10 +37,10 @@
 
 package gnu.java.rmi.rmic;
 
-/** Subclass of Compiler that can be used to invoke kjc.  */
+/** Subclass of Compiler that can be used to invoke jikes.  */
 public class Compile_jikes extends CompilerProcess
 {
-  /** Compiler arguments to invoke kjc */
+  /** Compiler arguments to invoke jikes */
   private static final String [] COMPILER_ARGS = 
   {
     "jikes"
Index: kaffe/libraries/javalib/gnu/java/rmi/rmic/Compiler.java
diff -u kaffe/libraries/javalib/gnu/java/rmi/rmic/Compiler.java:1.1 kaffe/libraries/javalib/gnu/java/rmi/rmic/Compiler.java:1.2
--- kaffe/libraries/javalib/gnu/java/rmi/rmic/Compiler.java:1.1	Mon Aug 18 17:40:33 2003
+++ kaffe/libraries/javalib/gnu/java/rmi/rmic/Compiler.java	Tue Sep 16 12:35:53 2003
@@ -1,5 +1,5 @@
 /*
-  Copyright (c) 2001 Free Software Foundation, Inc.
+  Copyright (c) 2001, 2003 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -37,10 +37,12 @@
 
 package gnu.java.rmi.rmic;
 
-/** A Compiler object can be used to compile a .java file into a
+/**
+ * A Compiler object can be used to compile a .java file into a
  * .class file.  This is an abstract class; the
  * <code>getInstance()</code> method is used to obtain the actual
- * compiler object.  */
+ * compiler object.
+ */
 public abstract class Compiler
 {
   // Can't directly instantiate.
@@ -68,11 +70,11 @@
     return null;
   }
 
-  /** Get the directory where output files will be put.  */
-  public String getDestination ()
-  {
-    return dest;
-  }
+   /** Get the directory where output files will be put.  */
+   public String getDestination ()
+   {
+     return dest;
+   }
 
   /** Set the directory where output files will be put.  */
   public void setDestination (String dest)
Index: kaffe/libraries/javalib/gnu/java/rmi/rmic/CompilerProcess.java
diff -u kaffe/libraries/javalib/gnu/java/rmi/rmic/CompilerProcess.java:1.1 kaffe/libraries/javalib/gnu/java/rmi/rmic/CompilerProcess.java:1.2
--- kaffe/libraries/javalib/gnu/java/rmi/rmic/CompilerProcess.java:1.1	Mon Aug 18 17:40:33 2003
+++ kaffe/libraries/javalib/gnu/java/rmi/rmic/CompilerProcess.java	Tue Sep 16 12:35:53 2003
@@ -1,5 +1,5 @@
 /*
-  Copyright (c) 2001 Free Software Foundation, Inc.
+  Copyright (c) 2001, 2003 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -39,44 +39,50 @@
 
 import java.io.InputStream;
 
-/** Subclass of Compiler that can be subclassed to invoke a process to
- * do its work.  */
+/**
+ * Subclass of Compiler that can be subclassed to invoke a process to
+ * do its work.
+ */
 public abstract class CompilerProcess extends Compiler
 {
   /** This is used to compute the command line for the process.  */
   public abstract String[] computeArguments (String filename);
 
-  /** This is used to compute the command line for the process.
-   *  Most compilers typically arrange their arguments as in 
-   *  <compiler name and arguments> <optional destination> <filename>.
-   *  This method builds an argument array out that. It should be used
-   * to define computeArguments for those compilers that follow the
-   * argument convention described above.
-   */
-  public static String[] computeTypicalArguments (String[] compilerArgs, String destination, String filename) 
-  {
-    /* length of compiler specific arguments */
-    final int len = compilerArgs.length;
-    /* length of returned array of arguments */
-    final int arglen = len + (destination == null ? 0 : 2) + 1;
-
-    /* Allocate String array for computed arguments. */
-    String [] args = new String[arglen];
-
-    /* Fill in compiler arguments. */
-    System.arraycopy(compilerArgs, 0, args, 0, len);
-
-    /* Fill in destination argument if necessary. */
-    if (destination != null) {
-      args[len] = "-d";
-      args[len + 1] = destination;
-    }
+   /**
+    * This is used to compute the command line for the process.
+    * Most compilers typically arrange their arguments as in
+    * <compiler name and arguments> <optional destination> <filename>.
+    * This method builds an argument array out that. It should be used
+    * to define computeArguments for those compilers that follow the
+    * argument convention described above.
+    */
+   public static String[] computeTypicalArguments(String[] compilerArgs,
+	String destination, String filename)
+   {
+     /* length of compiler specific arguments */
+     final int len = compilerArgs.length;
+
+     /* length of returned array of arguments */
+     final int arglen = len + (destination == null ? 0 : 2) + 1;
+
+     /* Allocate String array for computed arguments. */
+     String [] args = new String[arglen];
+
+     /* Fill in compiler arguments. */
+     System.arraycopy(compilerArgs, 0, args, 0, len);
+
+     /* Fill in destination argument if necessary. */
+     if (destination != null)
+      {
+	args[len] = "-d";
+	args[len + 1] = destination;
+      }
 
-    /* Fill in filename */
-    args[arglen - 1] = filename;
+     /* Fill in filename */
+     args[arglen - 1] = filename;
 
-    return args;
-  }
+     return args;
+   }
 
   public void compile (String name) throws Exception
   {
@@ -85,18 +91,16 @@
 
     /* Print compiler output to System.out. */
     InputStream procin = p.getInputStream();
-    for (int ch = procin.read(); ch != -1; ch = procin.read()) {
-	    System.out.print((char) ch);
-    }
+    for (int ch = procin.read(); ch != -1; ch = procin.read())
+      System.out.print((char) ch);
 
     /* Collect compiler error output in a buffer.
      * If compilation fails, it will be used for an error message.
      */
     StringBuffer stderr = new StringBuffer();
     InputStream procerr = p.getErrorStream();
-    for (int ch = procerr.read(); ch != -1; ch = procerr.read()) {
-	    stderr.append((char) ch);
-    }
+    for (int ch = procerr.read(); ch != -1; ch = procerr.read())
+      stderr.append((char) ch);
 
     int result;
     while (true)
Index: kaffe/libraries/javalib/gnu/java/rmi/rmic/RMIC.java
diff -u kaffe/libraries/javalib/gnu/java/rmi/rmic/RMIC.java:1.1 kaffe/libraries/javalib/gnu/java/rmi/rmic/RMIC.java:1.2
--- kaffe/libraries/javalib/gnu/java/rmi/rmic/RMIC.java:1.1	Mon Aug 18 17:40:33 2003
+++ kaffe/libraries/javalib/gnu/java/rmi/rmic/RMIC.java	Tue Sep 16 12:35:53 2003
@@ -1,5 +1,5 @@
 /*
-  Copyright (c) 1996, 1997, 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+  Copyright (c) 1996, 1997, 1998, 1999, 2001, 2002, 2003 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -222,7 +222,7 @@
 	ctrl.indent();
 	out.println("extends java.rmi.server.RemoteStub");
 	
-	// Output interface we implement
+	// Output interfaces we implement
 	out.print("implements ");
 	/* Scan implemented interfaces, and only print remote interfaces. */ 
         Class[] ifaces = clazz.getInterfaces(); 
Index: kaffe/libraries/javalib/java/awt/BasicStroke.java
diff -u kaffe/libraries/javalib/java/awt/BasicStroke.java:1.3 kaffe/libraries/javalib/java/awt/BasicStroke.java:1.4
--- kaffe/libraries/javalib/java/awt/BasicStroke.java:1.3	Wed Sep  3 13:35:02 2003
+++ kaffe/libraries/javalib/java/awt/BasicStroke.java	Tue Sep 16 12:35:54 2003
@@ -77,40 +77,40 @@
   public BasicStroke(float width, int cap, int join, float miterlimit,
                      float[] dash, float dashPhase)
   {
-    if (width < 0.0f ) {
+    if (width < 0.0f )
       throw new IllegalArgumentException("width " + width + " < 0");
-    }
-    else if (cap < CAP_BUTT || cap > CAP_SQUARE) {
-      throw new IllegalArgumentException("cap " + cap + " out of range [" + CAP_BUTT + ".." + CAP_SQUARE + "]");
-    }
-    else if (miterlimit < 1.0f && join == JOIN_MITER) {
-      throw new IllegalArgumentException("miterlimit " + miterlimit + " < 1.0f while join == JOIN_MITER");
-    }
-    else if (join < JOIN_MITER || join > JOIN_BEVEL) {
-      throw new IllegalArgumentException("join " + join + " out of range [" + JOIN_MITER + ".." + JOIN_BEVEL + "]");
-    }
-    else if (dashPhase < 0.0f && dash != null) {
-      throw new IllegalArgumentException("dashPhase " + dashPhase + " < 0.0f while dash != null");
-    }
-    else if (dash != null) {
-      if (dash.length == 0) {
+    else if (cap < CAP_BUTT || cap > CAP_SQUARE)
+      throw new IllegalArgumentException("cap " + cap + " out of range ["
+					 + CAP_BUTT + ".." + CAP_SQUARE + "]");
+    else if (miterlimit < 1.0f && join == JOIN_MITER)
+      throw new IllegalArgumentException("miterlimit " + miterlimit
+					 + " < 1.0f while join == JOIN_MITER");
+    else if (join < JOIN_MITER || join > JOIN_BEVEL)
+      throw new IllegalArgumentException("join " + join + " out of range ["
+					 + JOIN_MITER + ".." + JOIN_BEVEL
+					 + "]");
+    else if (dashPhase < 0.0f && dash != null)
+      throw new IllegalArgumentException("dashPhase " + dashPhase
+					 + " < 0.0f while dash != null");
+    else if (dash != null)
+      if (dash.length == 0)
 	throw new IllegalArgumentException("dash.length is 0");
-      }
-      else {
-	boolean allZero = true;
-
-	for ( int i = 0; i < dash.length; ++i) {
-	  if (dash[i] != 0.0f) {
-	    allZero = false;
-	    break;
-	  }
+      else
+	{
+	  boolean allZero = true;
+	  
+	  for ( int i = 0; i < dash.length; ++i)
+	    {
+	      if (dash[i] != 0.0f)
+		{
+		  allZero = false;
+		  break;
+		}
+	    }
+	  
+	  if (allZero)
+	    throw new IllegalArgumentException("all dashes are 0.0f");
 	}
-
-	if (allZero) {
-	  throw new IllegalArgumentException("all dashes are 0.0f");
-	}
-      }
-    }
 
     this.width = width;
     this.cap = cap;
Index: kaffe/libraries/javalib/java/awt/Color.java
diff -u kaffe/libraries/javalib/java/awt/Color.java:1.14 kaffe/libraries/javalib/java/awt/Color.java:1.15
--- kaffe/libraries/javalib/java/awt/Color.java:1.14	Sat May 17 17:30:10 2003
+++ kaffe/libraries/javalib/java/awt/Color.java	Tue Sep 16 12:35:54 2003
@@ -517,7 +517,7 @@
   public int getAlpha()
   {
     // Do not inline getRGB() to value, because of SystemColor.
-    return (getRGB() & ALPHA_MASK) >> 24;
+    return (getRGB() & ALPHA_MASK) >>> 24;
   }
 
   /**
Index: kaffe/libraries/javalib/java/security/Policy.java
diff -u kaffe/libraries/javalib/java/security/Policy.java:1.1 kaffe/libraries/javalib/java/security/Policy.java:1.2
--- kaffe/libraries/javalib/java/security/Policy.java:1.1	Sat May 31 06:01:16 2003
+++ kaffe/libraries/javalib/java/security/Policy.java	Tue Sep 16 12:35:54 2003
@@ -39,7 +39,7 @@
 
 import java.util.Collections;
 import java.util.Enumeration;
-import java.util.HashMap;
+import java.util.LinkedHashMap;
 import java.util.Map;
 
 /**
@@ -154,7 +154,7 @@
   private static void setup(final Policy policy)
   {
     if (policy.pd2pc == null)
-      policy.pd2pc = Collections.synchronizedMap(new HashMap());
+      policy.pd2pc = Collections.synchronizedMap(new LinkedHashMap());
 
     ProtectionDomain pd = policy.getClass().getProtectionDomain();
     if (pd.getCodeSource() != null)
Index: kaffe/libraries/javalib/java/security/acl/Acl.java
diff -u kaffe/libraries/javalib/java/security/acl/Acl.java:1.3 kaffe/libraries/javalib/java/security/acl/Acl.java:1.4
--- kaffe/libraries/javalib/java/security/acl/Acl.java:1.3	Thu Aug  7 18:36:36 2003
+++ kaffe/libraries/javalib/java/security/acl/Acl.java	Tue Sep 16 12:35:54 2003
@@ -52,7 +52,7 @@
  * <code>Principal</code> belongs have an ACL entry, the permissions for
  * the individual <code>Principal</code> take precedence over the 
  * permissions of the <code>Group</code> if there is a conflict.
- * <p
+ * <p>
  * Additionally, the ACL interface extends the <code>Owner</code> interface
  * and so an ACL has owners.  Actions which modify the ACL are restricted
  * to owners.
Index: kaffe/libraries/javalib/java/util/logging/LogManager.java
diff -u kaffe/libraries/javalib/java/util/logging/LogManager.java:1.3 kaffe/libraries/javalib/java/util/logging/LogManager.java:1.4
--- kaffe/libraries/javalib/java/util/logging/LogManager.java:1.3	Sun Jan 12 19:56:23 2003
+++ kaffe/libraries/javalib/java/util/logging/LogManager.java	Tue Sep 16 12:35:55 2003
@@ -52,6 +52,7 @@
 import java.util.Enumeration;
 import java.util.Iterator;
 import java.util.Map;
+import java.util.StringTokenizer;
 import java.lang.ref.WeakReference;
 
 /**
@@ -167,6 +168,7 @@
      * the order in which classes are initialized.
      */
     Logger.getLogger("global").setParent(rootLogger);
+    Logger.getLogger("global").setUseParentHandlers(true);
   }
 
 
@@ -520,7 +522,7 @@
 
   public synchronized void readConfiguration(InputStream inputStream)
     throws IOException, SecurityException
-  {
+  {	
     Properties   newProperties;
     Enumeration  keys;
 
@@ -532,12 +534,36 @@
 
     while (keys.hasMoreElements())
     {
-      String key = (String) keys.nextElement();
+      String key = ((String) keys.nextElement()).trim();
       String value = newProperties.getProperty(key);
-
+  
       if (value == null)
 	continue;
-
+	
+	  value = value.trim();
+	
+	  if("handlers".equals(key))
+        {
+          StringTokenizer tokenizer = new StringTokenizer(value);
+          while(tokenizer.hasMoreTokens())
+            {
+              String handlerName = tokenizer.nextToken();	
+              try
+                {
+              	  Class handlerClass = Class.forName(handlerName);
+              	  getLogger("").addHandler((Handler)handlerClass.newInstance()); 
+                }
+              catch (ClassCastException ex)
+                {
+                  System.err.println("[LogManager] class " + handlerName + " is not subclass of java.util.logging.Handler");
+                }
+              catch (Exception ex)
+                {
+                  //System.out.println("[LogManager.readConfiguration]"+ex);
+                }
+            }
+        }
+	  
       if (key.endsWith(".level"))
       {
 	String loggerName = key.substring(0, key.length() - 6);
@@ -550,6 +576,7 @@
 	  }
 	  catch (Exception _)
 	  {
+        //System.out.println("[LogManager.readConfiguration] "+_);
 	  }
 	  continue;
 	}
Index: kaffe/libraries/javalib/java/util/logging/Logger.java
diff -u kaffe/libraries/javalib/java/util/logging/Logger.java:1.1 kaffe/libraries/javalib/java/util/logging/Logger.java:1.2
--- kaffe/libraries/javalib/java/util/logging/Logger.java:1.1	Mon Nov 11 12:01:53 2002
+++ kaffe/libraries/javalib/java/util/logging/Logger.java	Tue Sep 16 12:35:55 2003
@@ -589,9 +589,10 @@
 			       String message,
 			       Object param)
   {
+  	StackTraceElement caller = getCallerStackFrame();
     logp(level,
-	 /* sourceClass*/ null,
-	 /* sourceMethod */ null,
+	 caller.getClassName(),
+	 caller.getMethodName(),
 	 message,
 	 param);
   }
@@ -601,9 +602,10 @@
 			       String message,
 			       Object[] params)
   {
+    StackTraceElement caller = getCallerStackFrame();
     logp(level,
-	 /* sourceClass*/ null,
-	 /* sourceMethod */ null,
+	 caller.getClassName(),
+	 caller.getMethodName(),
 	 message,
 	 params);
   }
@@ -613,9 +615,10 @@
 			       String message,
 			       Throwable thrown)
   {
+	StackTraceElement caller = getCallerStackFrame();    
     logp(level,
-	 /* sourceClass*/ null,
-	 /* sourceMethod */ null,
+	 caller.getClassName(),
+	 caller.getMethodName(),
 	 message,
 	 thrown);
   }
@@ -1164,4 +1167,23 @@
 
     this.parent = parent;
   }
+  
+  /**
+   * Gets the StackTraceElement of the first class that is not this class.
+   * That should be the initial caller of a logging method.
+   * @return caller of the initial looging method
+   */
+  private StackTraceElement getCallerStackFrame()
+  {
+    Throwable t = new Throwable();
+    StackTraceElement[] stackTrace = t.getStackTrace();
+    int index = 0;
+    // skip to stackentries until this class
+    while(!stackTrace[index].getClassName().equals(getClass().getName())){index++;}
+    // skip the stackentries of this class
+    while(stackTrace[index].getClassName().equals(getClass().getName())){index++;}
+
+    return stackTrace[index];
+  }
+  
 }
Index: kaffe/libraries/javalib/java/util/logging/SimpleFormatter.java
diff -u kaffe/libraries/javalib/java/util/logging/SimpleFormatter.java:1.1 kaffe/libraries/javalib/java/util/logging/SimpleFormatter.java:1.2
--- kaffe/libraries/javalib/java/util/logging/SimpleFormatter.java:1.1	Mon Nov 11 12:01:53 2002
+++ kaffe/libraries/javalib/java/util/logging/SimpleFormatter.java	Tue Sep 16 12:35:55 2003
@@ -106,7 +106,9 @@
 
     buf.append(dateFormat.format(new Date(record.getMillis())));
     buf.append(' ');
-    buf.append(record.getLoggerName());
+    buf.append(record.getSourceClassName());
+    buf.append(' ');
+    buf.append(record.getSourceMethodName());
     buf.append(lineSep);
 
     buf.append(record.getLevel());




More information about the kaffe mailing list