/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code 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
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* Licensed Materials - Property of IBM
* RMI-IIOP v1.0
* Copyright IBM Corp. 1998 1999 All Rights Reserved
*
*/
{
// These should be visible in all the nested classes
}
/**
* Get the ObjectStreamClass that describes the fields in the stream.
*
* REVISIT! This doesn't work since we have our own ObjectStreamClass.
*/
return null;
}
/**
* Return true if the named field is defaulted and has no value
* in this stream.
*/
throws IOException, IllegalArgumentException {
}
/**
* Get the value of the named boolean field from the persistent field.
*/
throws IOException, IllegalArgumentException {
return defvalue;
}
/**
* Get the value of the named char field from the persistent fields.
*/
throws IOException, IllegalArgumentException {
return defvalue;
}
/**
* Get the value of the named byte field from the persistent fields.
*/
throws IOException, IllegalArgumentException {
return defvalue;
}
/**
* Get the value of the named short field from the persistent fields.
*/
throws IOException, IllegalArgumentException {
return defvalue;
}
/**
* Get the value of the named int field from the persistent fields.
*/
throws IOException, IllegalArgumentException {
return defvalue;
}
/**
* Get the value of the named long field from the persistent fields.
*/
throws IOException, IllegalArgumentException {
return defvalue;
}
/**
* Get the value of the named float field from the persistent fields.
*/
throws IOException, IllegalArgumentException {
return defvalue;
}
/**
* Get the value of the named double field from the persistent field.
*/
throws IOException, IllegalArgumentException {
return defvalue;
}
/**
* Get the value of the named Object field from the persistent field.
*/
throws IOException, IllegalArgumentException {
return defvalue;
}
}
}
public InputStreamHook()
throws IOException {
super();
}
public void defaultReadObject()
{
}
public abstract void defaultReadObjectDelegate();
// See java.io.ObjectInputStream.GetField
// Remember that this is equivalent to defaultReadObject
// in RMI-IIOP
// We were treating readFields same as defaultReadObject. It is
// incorrect if the state is readOptionalData. If this line
// is uncommented, it will throw a stream corrupted exception.
// _REVISIT_: The ideal fix would be to add a new state. In
// writeObject user may do one of the following
// 1. Call defaultWriteObject()
// 2. Put out optional fields
// 3. Call writeFields
// We have the state defined for (1) and (2) but not for (3), so
// we should ideally introduce a new state for 3 and have the
// beginDefaultReadObject do nothing.
//readObjectState.beginDefaultReadObject(this);
return new HookGetFields(fieldValueMap);
}
// The following is a State pattern implementation of what
// should be done when the sender's Serializable has a
// writeObject method. This was especially necessary for
// RMI-IIOP stream format version 2. Please see the
// state diagrams in the docs directory of the workspace.
//
// On the reader's side, the main factors are whether or not
// we have a readObject method and whether or not the
// sender wrote default data
}
protected abstract byte getStreamFormatVersion();
// Description of possible actions
protected static class ReadObjectState {
boolean calledDefaultWriteObject,
boolean hasReadObject) throws IOException {}
}
= new InReadObjectOptionalDataState();
= new InReadObjectNoMoreOptionalDataState();
= new InReadObjectDefaultsSentState();
= new NoReadObjectDefaultsSentState();
boolean calledDefaultWriteObject,
boolean hasReadObject)
throws IOException {
if (hasReadObject) {
else {
try {
} catch( Exception e ) {
// This will happen for Big Integer which uses
// writeFields in it's writeObject. We should be past
// start_value by now.
// NOTE: If we don't log any exception here we should
// be fine. If there is an error, it will be caught
// while reading the optional data.
}
}
} else {
else
// XXX I18N and logging needed.
throw new StreamCorruptedException("No default data sent");
}
}
}
// REVISIT. If a readObject exits here without reading
// default data, we won't skip it. This could be done automatically
// as in line 1492 in IIOPInputStream.
boolean calledDefaultWriteObject,
boolean hasReadObject)
{
throw utilWrapper.badBeginUnmarshalCustomValue() ;
}
}
}
}
boolean calledDefaultWriteObject,
boolean hasReadObject)
{
throw utilWrapper.badBeginUnmarshalCustomValue() ;
}
{
// XXX I18N and logging needed.
throw new StreamCorruptedException("Default data already read");
}
}
}
protected void throwOptionalDataIncompatibleException()
{
throw omgWrapper.rmiiiopOptionalDataIncompatible2() ;
}
boolean calledDefaultWriteObject,
boolean hasReadObject) {
// This should never happen.
throw utilWrapper.badBeginUnmarshalCustomValue() ;
}
// In stream format version 2, we can skip over
// the optional data this way. In stream format version 1,
// we will probably wind up with an error if we're
// unmarshaling a superclass.
}
}
// Read the fake valuetype header in stream format version 2
}
throw new StreamCorruptedException(
"Default data must be read first");
}
// Fix Date interop bug. For older versions of the ORB don't do
// anything for readData(). Before this used to throw
// StreamCorruptedException for older versions of the ORB where
// calledDefaultWriteObject always returns true.
// XXX I18N and logging needed.
throw new StreamCorruptedException("Default data must be read first");
}
}
}
boolean calledDefaultWriteObject,
boolean hasReadObject)
{
// This should never happen.
throw utilWrapper.badBeginUnmarshalCustomValue() ;
}
{
}
}
{
// XXX I18N and logging needed.
throw new StreamCorruptedException("Default data not sent or already read/passed");
}
}
protected static class InReadObjectNoMoreOptionalDataState
extends InReadObjectOptionalDataState {
}
}
// Code should read default fields before calling this
}
}
}
}