PropertyChangeEvent.java (oldVal): Renamed to oldValue.

* java/beans/PropertyChangeEvent.java (oldVal): Renamed to oldValue.
	(newVal): Renamed to newValue.
	* java/beans/PropertyVetoException.java (changeEvent): Renamed to evt.
	* java/beans/beancontext/BeanContextServiceRevokedEvent.java
	(revokeNow): Renamed to invalidateRefs.
	* java/io/OptionalDataException.java: Updated FIXME.
	(eof): New placeholder field.
	(length); Ditto.
	* java/io/WriteAbortedException.java (message): Made transient.
	* java/lang/ClassNotFoundException.java: Updated comments for JDK 1.2.
	* java/lang/Throwable.java (stackTrace): Made transient.
	* java/net/InetAddress.java: Made Serializable.
	* java/security/KeyPair.java: Made Serializable.
	* java/security/Provider.java: Replaced with Classpath version that
	implements serialization and proper methods.
	* java/text/ChoiceFormat.java (strings): Renamed to choiceFormats.
	(limits): Renamed to choiceLimits.

Serialization changes per:
http://java.sun.com/products/jdk/1.2/docs/api/serialized-form.html

From-SVN: r34726
This commit is contained in:
Warren Levy 2000-06-27 05:10:03 +00:00 committed by Warren Levy
parent cf1748bfce
commit 7b245d2461
12 changed files with 271 additions and 97 deletions

View File

@ -1,3 +1,23 @@
2000-06-26 Warren Levy <warrenl@cygnus.com>
* java/beans/PropertyChangeEvent.java (oldVal): Renamed to oldValue.
(newVal): Renamed to newValue.
* java/beans/PropertyVetoException.java (changeEvent): Renamed to evt.
* java/beans/beancontext/BeanContextServiceRevokedEvent.java
(revokeNow): Renamed to invalidateRefs.
* java/io/OptionalDataException.java: Updated FIXME.
(eof): New placeholder field.
(length); Ditto.
* java/io/WriteAbortedException.java (message): Made transient.
* java/lang/ClassNotFoundException.java: Updated comments for JDK 1.2.
* java/lang/Throwable.java (stackTrace): Made transient.
* java/net/InetAddress.java: Made Serializable.
* java/security/KeyPair.java: Made Serializable.
* java/security/Provider.java: Replaced with Classpath version that
implements serialization and proper methods.
* java/text/ChoiceFormat.java (strings): Renamed to choiceFormats.
(limits): Renamed to choiceLimits.
2000-06-24 Tom Tromey <tromey@cygnus.com>
* java/lang/natDouble.cc (parseDouble): Renamed from

View File

@ -1,5 +1,5 @@
/* java.beans.PropertyChangeEvent
Copyright (C) 1998 Free Software Foundation, Inc.
Copyright (C) 1998, 2000 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -50,8 +50,8 @@ package java.beans;
public class PropertyChangeEvent extends java.util.EventObject {
String propertyName;
Object oldVal;
Object newVal;
Object oldValue;
Object newValue;
Object propagationId;
/** Create a new PropertyChangeEvent. Remember that if
@ -60,14 +60,14 @@ public class PropertyChangeEvent extends java.util.EventObject {
** from the old PropertyChangeEvent.
** @param source the Bean containing the property.
** @param propertyName the property's name.
** @param oldVal the old value of the property.
** @param newVal the new value of the property.
** @param oldValue the old value of the property.
** @param newValue the new value of the property.
**/
public PropertyChangeEvent(Object source, String propertyName, Object oldVal, Object newVal) {
super(source);
this.propertyName = propertyName;
this.oldVal = oldVal;
this.newVal = newVal;
oldValue = oldVal;
newValue = newVal;
}
/** Get the property name.
@ -81,14 +81,14 @@ public class PropertyChangeEvent extends java.util.EventObject {
** @return the property's old value.
**/
public Object getOldValue() {
return oldVal;
return oldValue;
}
/** Get the property's new value.
** @return the property's new value.
**/
public Object getNewValue() {
return newVal;
return newValue;
}
/** Set the propagation ID. This is a way for the event

View File

@ -1,5 +1,5 @@
/* java.beans.PropertyVetoException
Copyright (C) 1998 Free Software Foundation, Inc.
Copyright (C) 1998, 2000 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -37,7 +37,7 @@ package java.beans;
**/
public class PropertyVetoException extends Exception {
PropertyChangeEvent changeEvent;
PropertyChangeEvent evt;
/** Instantiate this exception with the given message and property change.
** @param msg the reason for the veto.
@ -45,11 +45,11 @@ public class PropertyVetoException extends Exception {
**/
public PropertyVetoException(String msg, PropertyChangeEvent changeEvent) {
super(msg);
this.changeEvent = changeEvent;
evt = changeEvent;
}
/** Get the PropertyChange event that was vetoed. **/
public PropertyChangeEvent getPropertyChangeEvent() {
return changeEvent;
return evt;
}
}

View File

@ -1,5 +1,5 @@
/* java.beans.beancontext.BeanContextServiceRevokedEvent
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -41,7 +41,7 @@ public class BeanContextServiceRevokedEvent extends BeanContextEvent {
* available.
*/
protected Class serviceClass;
private boolean revokeNow;
private boolean invalidateRefs;
/**
* Create a new service revoked event.
@ -55,7 +55,7 @@ public class BeanContextServiceRevokedEvent extends BeanContextEvent {
public BeanContextServiceRevokedEvent(BeanContextServices services, Class serviceClass, boolean revokeNow) {
super(services);
this.serviceClass = serviceClass;
this.revokeNow = revokeNow;
invalidateRefs = revokeNow;
}
/**
@ -94,6 +94,6 @@ public class BeanContextServiceRevokedEvent extends BeanContextEvent {
* usable.
*/
public boolean isCurrentServiceInvalidNow() {
return revokeNow;
return invalidateRefs;
}
}

View File

@ -19,6 +19,10 @@ package java.io;
public class OptionalDataException extends ObjectStreamException
{
// FIXME: Need to set these fields per the doc in a constructor.
public boolean eof;
public int length;
public OptionalDataException()
{
super();

View File

@ -1,6 +1,6 @@
/* WriteAbortedException.java -- An exception occured while writing a
serialization stream
Copyright (C) 1998 Free Software Foundation, Inc.
Copyright (C) 1998, 2000 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -47,7 +47,7 @@ public class WriteAbortedException extends ObjectStreamException
* The detailed exception that caused this exception to be thrown
*/
public Exception detail;
private String message;
private transient String message;
/*************************************************************************/

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1998, 1999 Free Software Foundation
/* Copyright (C) 1998, 1999, 2000 Free Software Foundation
This file is part of libgcj.
@ -20,6 +20,9 @@ package java.lang;
public class ClassNotFoundException extends Exception
{
// TODO12:
// Throwable ex;
public ClassNotFoundException()
{
super();
@ -28,6 +31,7 @@ public class ClassNotFoundException extends Exception
// TODO12:
// public ClassNotFoundException(String msg, Throwable ex)
// {
// FIXME: Set 'ex' here.
// }
public ClassNotFoundException(String msg)

View File

@ -164,5 +164,5 @@ public class Throwable implements Serializable
// Name of this field comes from serialization spec.
private String detailMessage;
private byte stackTrace[];
private transient byte stackTrace[];
}

View File

@ -22,10 +22,10 @@ package java.net;
* Status: Believed complete and correct.
*/
public final class InetAddress
public final class InetAddress implements java.io.Serializable
{
String hostname;
byte[] address;
String hostname;
InetAddress (byte[] address, String hostname)
{

View File

@ -17,7 +17,7 @@ package java.security;
* Status: Believed complete and correct.
*/
public class KeyPair /* FIXME: implements serializable */
public class KeyPair implements java.io.Serializable
{
public KeyPair (PublicKey publicKey, PrivateKey privateKey)
{

View File

@ -1,53 +1,197 @@
/* Copyright (C) 2000 Free Software Foundation
/* Provider.java -- Security provider information
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
This file is part of libgcj.
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.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
package java.security;
import java.io.Serializable;
import java.util.Properties;
/**
* @author Warren Levy <warrenl@cygnus.com>
* @date February 7, 2000.
* This class represents a Java security architecture service provider.
* The services provided by a such a provider can range from security
* algorithms to key generation.
* <p>
* Providers are installed by name and verion number. There is one
* standard provider supplied with the class library. This is the
* "GNU" provider, which can also be accessed by the alias "SUN" for
* compatibility with the JDK.
*
* @version 0.0
*
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
public abstract class Provider extends Properties implements Serializable
{
/*************************************************************************/
/*
* Instance Variables
*/
/**
* Written using on-line Java Platform 1.2 API Specification.
* Status: Partially implemented.
* This is a textual description of the provider
*/
private String info;
/**
* This is the name of the provider
*/
private String name;
/**
* This is the version number of the provider
*/
private double version;
/*************************************************************************/
/*
* Constructors
*/
public abstract class Provider extends Properties
/**
* This method initializes a new instance of <code>Provider</code> to have
* the specified name, version, and description information.
*
* @param name The name to assign to this <code>Provider</code>.
* @param version The version number for this <code>Provider</code>.
* @param info A textual description of this provider.
*/
protected
Provider(String name, double version, String info)
{
// FIXME: Check the following property values against specs!
protected Provider(String name, double version, String info)
{
super();
put("java.security.Provider.Name", name);
put("java.security.Provider.Version", Double.toString(version));
put("java.security.Provider.Info", info);
}
this.name = name;
this.version = version;
this.info = info;
}
public String getName()
{
return getProperty("java.security.Provider.Name");
}
/*************************************************************************/
public double getVersion()
{
return Double.valueOf(getProperty("java.security.Provider.Version")).doubleValue();
}
/*
* Instance Methods
*/
public String getInfo()
{
return getProperty("java.security.Provider.Info");
}
public String toString()
{
// FIXME: Check this string against the spec.
return getName() + " " + getProperty("java.security.Provider.Version");
}
/**
* This method returns the name assigned to this <code>Provider</code>.
*
* @return The <code>Provider</code>'s name.
*/
public String
getName()
{
return(name);
}
/*************************************************************************/
/**
* This method retunrs the version number of this <code>Provider</code>.
*
* @return The <code>Provider</code>'s version number.
*/
public double
getVersion()
{
return(version);
}
/*************************************************************************/
/**
* This method returns a textual description of the <code>Provider</code>.
*
* @return A description of the <code>Provider</code>.
*/
public String
getInfo()
{
return(info);
}
/*************************************************************************/
/**
* This method sets the specified key to have the specified value.
*
* @param key The property key
* @param value The property value
*
* @return The previous value for this key, or <code>null</code> if no previous value.
*/
public Object
put(Object key, Object value)
{
return(super.put(key, value));
}
/*************************************************************************/
/**
* This method removes the specified key entry (and its associated value)
* from the property mapping list.
*
* @param key The key to remove
*
* @return The previous value for this key, or <code>null</code> if no previous value.
*/
public Object
remove(Object key)
{
return(super.remove(key));
}
/*************************************************************************/
/**
* This method clears the entire property list such that it no longer
* contains the properties used to look up the services provided by
* the <code>Provider</code>.
*/
public void
clear()
{
super.clear();
}
/*************************************************************************/
/**
* This method returns a <code>String</code> representation of this
* object. This will include the <code>Provider</code> name and
* version number.
*
* @return A <code>String</code> representation of this object.
*/
public String
toString()
{
return(getClass().getName() + ": name=" + getName() + " version=" + version);
}
} // class Provider

View File

@ -84,14 +84,14 @@ public class ChoiceFormat extends NumberFormat
++index;
}
strings = new String[stringVec.size()];
stringVec.copyInto(strings);
choiceFormats = new String[stringVec.size()];
stringVec.copyInto(choiceFormats);
limits = new double[limitVec.size()];
for (int i = 0; i < limits.length; ++i)
choiceLimits = new double[limitVec.size()];
for (int i = 0; i < choiceLimits.length; ++i)
{
Double d = (Double) limitVec.elementAt(i);
limits[i] = d.doubleValue();
choiceLimits[i] = d.doubleValue();
}
}
@ -101,15 +101,15 @@ public class ChoiceFormat extends NumberFormat
applyPattern (newPattern);
}
public ChoiceFormat (double[] limits, String[] strings)
public ChoiceFormat (double[] choiceLimits, String[] choiceFormats)
{
super ();
setChoices (limits, strings);
setChoices (choiceLimits, choiceFormats);
}
public Object clone ()
{
return new ChoiceFormat (limits, strings);
return new ChoiceFormat (choiceLimits, choiceFormats);
}
public boolean equals (Object obj)
@ -117,12 +117,12 @@ public class ChoiceFormat extends NumberFormat
if (! (obj instanceof ChoiceFormat))
return false;
ChoiceFormat cf = (ChoiceFormat) obj;
if (limits.length != cf.limits.length)
if (choiceLimits.length != cf.choiceLimits.length)
return false;
for (int i = limits.length - 1; i >= 0; --i)
for (int i = choiceLimits.length - 1; i >= 0; --i)
{
if (limits[i] != cf.limits[i]
|| !strings[i].equals(cf.strings[i]))
if (choiceLimits[i] != cf.choiceLimits[i]
|| !choiceFormats[i].equals(cf.choiceFormats[i]))
return false;
}
return true;
@ -137,42 +137,42 @@ public class ChoiceFormat extends NumberFormat
public StringBuffer format (double num, StringBuffer appendBuf,
FieldPosition pos)
{
if (limits.length == 0)
if (choiceLimits.length == 0)
return appendBuf;
int index = 0;
if (! Double.isNaN(num) && num >= limits[0])
if (! Double.isNaN(num) && num >= choiceLimits[0])
{
for (; index < limits.length - 1; ++index)
for (; index < choiceLimits.length - 1; ++index)
{
if (limits[index] <= num
&& index != limits.length - 2
&& num < limits[index + 1])
if (choiceLimits[index] <= num
&& index != choiceLimits.length - 2
&& num < choiceLimits[index + 1])
break;
}
}
return appendBuf.append(strings[index]);
return appendBuf.append(choiceFormats[index]);
}
public Object[] getFormats ()
{
return (Object[]) strings.clone();
return (Object[]) choiceFormats.clone();
}
public double[] getLimits ()
{
return (double[]) limits.clone();
return (double[]) choiceLimits.clone();
}
public int hashCode ()
{
int hash = 0;
for (int i = 0; i < limits.length; ++i)
for (int i = 0; i < choiceLimits.length; ++i)
{
long v = Double.doubleToLongBits(limits[i]);
long v = Double.doubleToLongBits(choiceLimits[i]);
hash ^= (v ^ (v >>> 32));
hash ^= strings[i].hashCode();
hash ^= choiceFormats[i].hashCode();
}
return hash;
}
@ -238,12 +238,12 @@ public class ChoiceFormat extends NumberFormat
public Number parse (String sourceStr, ParsePosition pos)
{
int index = pos.getIndex();
for (int i = 0; i < limits.length; ++i)
for (int i = 0; i < choiceLimits.length; ++i)
{
if (sourceStr.startsWith(strings[i], index))
if (sourceStr.startsWith(choiceFormats[i], index))
{
pos.setIndex(index + strings[i].length());
return new Double (limits[i]);
pos.setIndex(index + choiceFormats[i].length());
return new Double (choiceLimits[i]);
}
}
pos.setErrorIndex(index);
@ -255,12 +255,14 @@ public class ChoiceFormat extends NumberFormat
return nextDouble (d, false);
}
public void setChoices (double[] limits, String[] strings)
public void setChoices (double[] choiceLimits, String[] choiceFormats)
{
if (limits.length != strings.length)
if (choiceLimits == null || choiceFormats == null)
throw new NullPointerException ();
if (choiceLimits.length != choiceFormats.length)
throw new IllegalArgumentException ();
this.strings = (String[]) strings.clone();
this.limits = (double[]) limits.clone();
this.choiceFormats = (String[]) choiceFormats.clone();
this.choiceLimits = (double[]) choiceLimits.clone();
}
private final void quoteString (StringBuffer dest, String text)
@ -288,18 +290,18 @@ public class ChoiceFormat extends NumberFormat
public String toPattern ()
{
StringBuffer result = new StringBuffer ();
for (int i = 0; i < limits.length; ++i)
for (int i = 0; i < choiceLimits.length; ++i)
{
result.append(limits[i]);
result.append(choiceLimits[i]);
result.append('#');
quoteString (result, strings[i]);
quoteString (result, choiceFormats[i]);
}
return result.toString();
}
// Formats and limits.
private String[] strings;
private double[] limits;
private String[] choiceFormats;
private double[] choiceLimits;
// Number of mantissa bits in double.
private static final int mantissaBits = 52;