提交 f6fa0224 编写于 作者: M msheppar

8025767: Enhance IIOP Streams

Summary: modify org.omg.CORBA_2_3.portable.InputStream inheritance structure.
Reviewed-by: alanb, coffeys, skoivu
上级 325d45f2
...@@ -82,11 +82,18 @@ public class AnyImpl extends Any ...@@ -82,11 +82,18 @@ public class AnyImpl extends Any
super((ORB)orb); super((ORB)orb);
} }
public org.omg.CORBA.portable.InputStream create_input_stream() public org.omg.CORBA.portable.InputStream create_input_stream() {
{ final org.omg.CORBA.portable.InputStream is = super
return new AnyInputStream( .create_input_stream();
(com.sun.corba.se.impl.encoding.EncapsInputStream) AnyInputStream aIS = AccessController
super.create_input_stream()); .doPrivileged(new PrivilegedAction<AnyInputStream>() {
@Override
public AnyInputStream run() {
return new AnyInputStream(
(com.sun.corba.se.impl.encoding.EncapsInputStream) is);
}
});
return aIS;
} }
} }
......
/* /*
* Copyright (c) 2001, 2004, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -36,11 +36,10 @@ import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry; ...@@ -36,11 +36,10 @@ import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry;
import com.sun.corba.se.impl.protocol.giopmsgheaders.Message; import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
import com.sun.corba.se.spi.orb.ORB; import com.sun.corba.se.spi.orb.ORB;
import com.sun.corba.se.spi.logging.CORBALogDomains; import com.sun.corba.se.spi.logging.CORBALogDomains;
import com.sun.corba.se.impl.logging.ORBUtilSystemException; import com.sun.corba.se.impl.logging.ORBUtilSystemException;
import sun.corba.EncapsInputStreamFactory;
/** /**
* Encapsulations are supposed to explicitly define their * Encapsulations are supposed to explicitly define their
* code sets and GIOP version. The original resolution to issue 2784 * code sets and GIOP version. The original resolution to issue 2784
...@@ -148,7 +147,7 @@ public class EncapsInputStream extends CDRInputStream ...@@ -148,7 +147,7 @@ public class EncapsInputStream extends CDRInputStream
} }
public CDRInputStream dup() { public CDRInputStream dup() {
return new EncapsInputStream(this); return EncapsInputStreamFactory.newEncapsInputStream(this);
} }
protected CodeSetConversion.BTCConverter createCharBTCConverter() { protected CodeSetConversion.BTCConverter createCharBTCConverter() {
......
/* /*
* Copyright (c) 2001, 2004, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -39,6 +39,8 @@ import com.sun.corba.se.impl.encoding.BufferManagerFactory; ...@@ -39,6 +39,8 @@ import com.sun.corba.se.impl.encoding.BufferManagerFactory;
import com.sun.corba.se.impl.protocol.giopmsgheaders.Message; import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
import com.sun.corba.se.impl.orbutil.ORBConstants; import com.sun.corba.se.impl.orbutil.ORBConstants;
import sun.corba.EncapsInputStreamFactory;
/** /**
* Encapsulations are supposed to explicitly define their * Encapsulations are supposed to explicitly define their
* code sets and GIOP version. The original resolution to issue 2784 * code sets and GIOP version. The original resolution to issue 2784
...@@ -107,11 +109,11 @@ public class EncapsOutputStream extends CDROutputStream ...@@ -107,11 +109,11 @@ public class EncapsOutputStream extends CDROutputStream
public org.omg.CORBA.portable.InputStream create_input_stream() { public org.omg.CORBA.portable.InputStream create_input_stream() {
freeInternalCaches(); freeInternalCaches();
return new EncapsInputStream(orb(), return EncapsInputStreamFactory.newEncapsInputStream(orb(),
getByteBuffer(), getByteBuffer(),
getSize(), getSize(),
isLittleEndian(), isLittleEndian(),
getGIOPVersion()); getGIOPVersion());
} }
protected CodeSetConversion.CTBConverter createCharCTBConverter() { protected CodeSetConversion.CTBConverter createCharCTBConverter() {
......
/* /*
* Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -64,6 +64,8 @@ import com.sun.corba.se.impl.encoding.CDRInputStream; ...@@ -64,6 +64,8 @@ import com.sun.corba.se.impl.encoding.CDRInputStream;
import com.sun.corba.se.impl.encoding.CDROutputStream; import com.sun.corba.se.impl.encoding.CDROutputStream;
import com.sun.corba.se.impl.encoding.MarshalInputStream; import com.sun.corba.se.impl.encoding.MarshalInputStream;
import sun.corba.EncapsInputStreamFactory;
public class TypeCodeInputStream extends EncapsInputStream implements TypeCodeReader public class TypeCodeInputStream extends EncapsInputStream implements TypeCodeReader
{ {
private Map typeMap = null; private Map typeMap = null;
...@@ -157,11 +159,13 @@ public class TypeCodeInputStream extends EncapsInputStream implements TypeCodeRe ...@@ -157,11 +159,13 @@ public class TypeCodeInputStream extends EncapsInputStream implements TypeCodeRe
// create an encapsulation using the marshal buffer // create an encapsulation using the marshal buffer
if (is instanceof CDRInputStream) { if (is instanceof CDRInputStream) {
encap = new TypeCodeInputStream((ORB)_orb, encapBuffer, encapBuffer.length, encap = EncapsInputStreamFactory.newTypeCodeInputStream((ORB) _orb,
((CDRInputStream)is).isLittleEndian(), encapBuffer, encapBuffer.length,
((CDRInputStream)is).getGIOPVersion()); ((CDRInputStream) is).isLittleEndian(),
((CDRInputStream) is).getGIOPVersion());
} else { } else {
encap = new TypeCodeInputStream((ORB)_orb, encapBuffer, encapBuffer.length); encap = EncapsInputStreamFactory.newTypeCodeInputStream((ORB) _orb,
encapBuffer, encapBuffer.length);
} }
encap.setEnclosingInputStream(is); encap.setEnclosingInputStream(is);
encap.makeEncapsulation(); encap.makeEncapsulation();
......
...@@ -61,6 +61,8 @@ import java.math.BigDecimal; ...@@ -61,6 +61,8 @@ import java.math.BigDecimal;
import java.math.BigInteger; import java.math.BigInteger;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import sun.corba.EncapsInputStreamFactory;
public final class TypeCodeOutputStream extends EncapsOutputStream public final class TypeCodeOutputStream extends EncapsOutputStream
{ {
private OutputStream enclosure = null; private OutputStream enclosure = null;
...@@ -77,9 +79,9 @@ public final class TypeCodeOutputStream extends EncapsOutputStream ...@@ -77,9 +79,9 @@ public final class TypeCodeOutputStream extends EncapsOutputStream
public org.omg.CORBA.portable.InputStream create_input_stream() public org.omg.CORBA.portable.InputStream create_input_stream()
{ {
//return new TypeCodeInputStream((ORB)orb(), getByteBuffer(), getIndex(), isLittleEndian()); TypeCodeInputStream tcis = EncapsInputStreamFactory
TypeCodeInputStream tcis .newTypeCodeInputStream((ORB) orb(), getByteBuffer(),
= new TypeCodeInputStream((ORB)orb(), getByteBuffer(), getIndex(), isLittleEndian(), getGIOPVersion()); getIndex(), isLittleEndian(), getGIOPVersion());
//if (TypeCodeImpl.debug) { //if (TypeCodeImpl.debug) {
//System.out.println("Created TypeCodeInputStream " + tcis + " with no parent"); //System.out.println("Created TypeCodeInputStream " + tcis + " with no parent");
//tcis.printBuffer(); //tcis.printBuffer();
......
...@@ -33,6 +33,8 @@ import org.omg.CORBA.LocalObject; ...@@ -33,6 +33,8 @@ import org.omg.CORBA.LocalObject;
import com.sun.corba.se.spi.ior.iiop.GIOPVersion; import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
import com.sun.corba.se.spi.logging.CORBALogDomains; import com.sun.corba.se.spi.logging.CORBALogDomains;
import sun.corba.EncapsInputStreamFactory;
import com.sun.corba.se.impl.corba.AnyImpl; import com.sun.corba.se.impl.corba.AnyImpl;
import com.sun.corba.se.impl.encoding.EncapsInputStream; import com.sun.corba.se.impl.encoding.EncapsInputStream;
import com.sun.corba.se.impl.encoding.EncapsOutputStream; import com.sun.corba.se.impl.encoding.EncapsOutputStream;
...@@ -193,8 +195,9 @@ public final class CDREncapsCodec ...@@ -193,8 +195,9 @@ public final class CDREncapsCodec
// it is turned into a FormatMismatch exception. // it is turned into a FormatMismatch exception.
try { try {
EncapsInputStream cdrIn = new EncapsInputStream( orb, data, EncapsInputStream cdrIn = EncapsInputStreamFactory.newEncapsInputStream( orb, data,
data.length, giopVersion ); data.length, giopVersion );
cdrIn.consumeEndian(); cdrIn.consumeEndian();
......
/* /*
* Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -370,7 +370,7 @@ public class IIOPInputStream ...@@ -370,7 +370,7 @@ public class IIOPInputStream
* @exception IOException Any of the usual Input/Output related exceptions. * @exception IOException Any of the usual Input/Output related exceptions.
* @since JDK1.1 * @since JDK1.1
*/ */
public final Object readObjectDelegate() throws IOException public final synchronized Object readObjectDelegate() throws IOException
{ {
try { try {
...@@ -389,7 +389,7 @@ public class IIOPInputStream ...@@ -389,7 +389,7 @@ public class IIOPInputStream
} }
} }
final Object simpleReadObject(Class clz, final synchronized Object simpleReadObject(Class clz,
String repositoryID, String repositoryID,
com.sun.org.omg.SendingContext.CodeBase sender, com.sun.org.omg.SendingContext.CodeBase sender,
int offset) int offset)
...@@ -461,7 +461,7 @@ public class IIOPInputStream ...@@ -461,7 +461,7 @@ public class IIOPInputStream
return obj; return obj;
} }
public final void simpleSkipObject(String repositoryID, public final synchronized void simpleSkipObject(String repositoryID,
com.sun.org.omg.SendingContext.CodeBase sender) com.sun.org.omg.SendingContext.CodeBase sender)
/* throws OptionalDataException, ClassNotFoundException, IOException */ /* throws OptionalDataException, ClassNotFoundException, IOException */
{ {
...@@ -559,7 +559,7 @@ public class IIOPInputStream ...@@ -559,7 +559,7 @@ public class IIOPInputStream
* objects. * objects.
* @since JDK1.1 * @since JDK1.1
*/ */
public final void defaultReadObjectDelegate() final synchronized void defaultReadObjectDelegate()
/* throws IOException, ClassNotFoundException, NotActiveException */ /* throws IOException, ClassNotFoundException, NotActiveException */
{ {
try { try {
...@@ -988,7 +988,7 @@ public class IIOPInputStream ...@@ -988,7 +988,7 @@ public class IIOPInputStream
} }
} }
private Object inputObject(Class clz, private synchronized Object inputObject(Class clz,
String repositoryID, String repositoryID,
com.sun.org.omg.SendingContext.CodeBase sender, com.sun.org.omg.SendingContext.CodeBase sender,
int offset) int offset)
...@@ -1317,7 +1317,7 @@ public class IIOPInputStream ...@@ -1317,7 +1317,7 @@ public class IIOPInputStream
* a form of custom marshaling. * a form of custom marshaling.
* *
*/ */
private Object inputObjectUsingFVD(Class clz, private synchronized Object inputObjectUsingFVD(Class clz,
String repositoryID, String repositoryID,
com.sun.org.omg.SendingContext.CodeBase sender, com.sun.org.omg.SendingContext.CodeBase sender,
int offset) int offset)
......
...@@ -201,7 +201,7 @@ public abstract class InputStreamHook extends ObjectInputStream ...@@ -201,7 +201,7 @@ public abstract class InputStreamHook extends ObjectInputStream
readObjectState.endDefaultReadObject(this); readObjectState.endDefaultReadObject(this);
} }
public abstract void defaultReadObjectDelegate(); abstract void defaultReadObjectDelegate();
abstract void readFields(java.util.Map fieldToValueMap) abstract void readFields(java.util.Map fieldToValueMap)
throws java.io.InvalidClassException, java.io.StreamCorruptedException, throws java.io.InvalidClassException, java.io.StreamCorruptedException,
......
/* /*
* Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -47,6 +47,8 @@ import com.sun.corba.se.impl.encoding.CDROutputStream ; ...@@ -47,6 +47,8 @@ import com.sun.corba.se.impl.encoding.CDROutputStream ;
import com.sun.corba.se.impl.encoding.EncapsOutputStream ; import com.sun.corba.se.impl.encoding.EncapsOutputStream ;
import com.sun.corba.se.impl.encoding.EncapsInputStream ; import com.sun.corba.se.impl.encoding.EncapsInputStream ;
import sun.corba.EncapsInputStreamFactory;
/** /**
* This static utility class contains various utility methods for reading and * This static utility class contains various utility methods for reading and
* writing CDR encapsulations. * writing CDR encapsulations.
...@@ -108,8 +110,8 @@ public class EncapsulationUtility ...@@ -108,8 +110,8 @@ public class EncapsulationUtility
static public InputStream getEncapsulationStream( InputStream is ) static public InputStream getEncapsulationStream( InputStream is )
{ {
byte[] data = readOctets( is ) ; byte[] data = readOctets( is ) ;
EncapsInputStream result = new EncapsInputStream( is.orb(), data, EncapsInputStream result = EncapsInputStreamFactory.newEncapsInputStream( is.orb(), data,
data.length ) ; data.length ) ;
result.consumeEndian() ; result.consumeEndian() ;
return result ; return result ;
} }
......
/* /*
* Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -49,6 +49,8 @@ import com.sun.corba.se.impl.ior.ObjectKeyImpl ; ...@@ -49,6 +49,8 @@ import com.sun.corba.se.impl.ior.ObjectKeyImpl ;
import com.sun.corba.se.impl.logging.IORSystemException ; import com.sun.corba.se.impl.logging.IORSystemException ;
import com.sun.corba.se.impl.encoding.EncapsInputStream ; import com.sun.corba.se.impl.encoding.EncapsInputStream ;
import sun.corba.EncapsInputStreamFactory;
/** Based on the magic and scid, return the appropriate /** Based on the magic and scid, return the appropriate
* ObjectKeyTemplate. Expects to be called with a valid * ObjectKeyTemplate. Expects to be called with a valid
...@@ -217,7 +219,7 @@ public class ObjectKeyFactoryImpl implements ObjectKeyFactory ...@@ -217,7 +219,7 @@ public class ObjectKeyFactoryImpl implements ObjectKeyFactory
public ObjectKey create( byte[] key ) public ObjectKey create( byte[] key )
{ {
OctetSeqHolder osh = new OctetSeqHolder() ; OctetSeqHolder osh = new OctetSeqHolder() ;
EncapsInputStream is = new EncapsInputStream( orb, key, key.length ) ; EncapsInputStream is = EncapsInputStreamFactory.newEncapsInputStream( orb, key, key.length );
ObjectKeyTemplate oktemp = create( is, fullKey, osh ) ; ObjectKeyTemplate oktemp = create( is, fullKey, osh ) ;
if (oktemp == null) if (oktemp == null)
......
...@@ -70,6 +70,8 @@ import com.sun.corba.se.impl.ior.EncapsulationUtility ; ...@@ -70,6 +70,8 @@ import com.sun.corba.se.impl.ior.EncapsulationUtility ;
import com.sun.corba.se.impl.encoding.EncapsInputStream ; import com.sun.corba.se.impl.encoding.EncapsInputStream ;
import com.sun.corba.se.impl.encoding.EncapsOutputStream ; import com.sun.corba.se.impl.encoding.EncapsOutputStream ;
import sun.corba.EncapsInputStreamFactory;
import com.sun.corba.se.impl.util.JDKBridge; import com.sun.corba.se.impl.util.JDKBridge;
import com.sun.corba.se.impl.logging.IORSystemException; import com.sun.corba.se.impl.logging.IORSystemException;
...@@ -170,8 +172,8 @@ public class IIOPProfileImpl extends IdentifiableBase implements IIOPProfile ...@@ -170,8 +172,8 @@ public class IIOPProfileImpl extends IdentifiableBase implements IIOPProfile
throw wrapper.invalidTaggedProfile() ; throw wrapper.invalidTaggedProfile() ;
} }
EncapsInputStream istr = new EncapsInputStream((ORB)orb, profile.profile_data, EncapsInputStream istr = EncapsInputStreamFactory.newEncapsInputStream((ORB)orb, profile.profile_data,
profile.profile_data.length); profile.profile_data.length);
istr.consumeEndian(); istr.consumeEndian();
init( istr ) ; init( istr ) ;
} }
......
/* /*
* Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -115,6 +115,7 @@ import com.sun.corba.se.impl.util.JDKBridge; ...@@ -115,6 +115,7 @@ import com.sun.corba.se.impl.util.JDKBridge;
import java.util.concurrent.ConcurrentMap; import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import sun.corba.EncapsInputStreamFactory;
/** /**
* ClientDelegate is the RMI client-side subcontract or representation * ClientDelegate is the RMI client-side subcontract or representation
...@@ -847,8 +848,8 @@ public class CorbaClientRequestDispatcherImpl ...@@ -847,8 +848,8 @@ public class CorbaClientRequestDispatcherImpl
} }
byte[] data = ((UnknownServiceContext)sc).getData(); byte[] data = ((UnknownServiceContext)sc).getData();
EncapsInputStream in = EncapsInputStream in =
new EncapsInputStream((ORB)messageMediator.getBroker(), EncapsInputStreamFactory.newEncapsInputStream((ORB)messageMediator.getBroker(),
data, data.length); data, data.length);
in.consumeEndian(); in.consumeEndian();
String msg = String msg =
......
/* /*
* Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -36,7 +36,8 @@ import java.io.IOException; ...@@ -36,7 +36,8 @@ import java.io.IOException;
import java.util.Iterator; import java.util.Iterator;
import java.rmi.RemoteException; import java.rmi.RemoteException;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.security.AccessController;
import java.security.PrivilegedAction;
import javax.rmi.CORBA.Util; import javax.rmi.CORBA.Util;
import javax.rmi.CORBA.Tie; import javax.rmi.CORBA.Tie;
...@@ -111,6 +112,7 @@ import com.sun.corba.se.impl.protocol.giopmsgheaders.KeyAddr; ...@@ -111,6 +112,7 @@ import com.sun.corba.se.impl.protocol.giopmsgheaders.KeyAddr;
import com.sun.corba.se.impl.protocol.giopmsgheaders.ProfileAddr; import com.sun.corba.se.impl.protocol.giopmsgheaders.ProfileAddr;
import com.sun.corba.se.impl.protocol.giopmsgheaders.ReferenceAddr; import com.sun.corba.se.impl.protocol.giopmsgheaders.ReferenceAddr;
import com.sun.corba.se.impl.transport.CorbaContactInfoListIteratorImpl; import com.sun.corba.se.impl.transport.CorbaContactInfoListIteratorImpl;
import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
import com.sun.corba.se.impl.util.JDKBridge; import com.sun.corba.se.impl.util.JDKBridge;
/** /**
...@@ -156,10 +158,17 @@ public class SharedCDRClientRequestDispatcherImpl ...@@ -156,10 +158,17 @@ public class SharedCDRClientRequestDispatcherImpl
ByteBufferWithInfo bbwi = cdrOutputObject.getByteBufferWithInfo(); ByteBufferWithInfo bbwi = cdrOutputObject.getByteBufferWithInfo();
cdrOutputObject.getMessageHeader().setSize(bbwi.byteBuffer, bbwi.getSize()); cdrOutputObject.getMessageHeader().setSize(bbwi.byteBuffer, bbwi.getSize());
final ORB inOrb = orb;
CDRInputObject cdrInputObject = final ByteBuffer inBuffer = bbwi.byteBuffer;
new CDRInputObject(orb, null, bbwi.byteBuffer, final Message inMsg = cdrOutputObject.getMessageHeader();
cdrOutputObject.getMessageHeader()); CDRInputObject cdrInputObject = AccessController
.doPrivileged(new PrivilegedAction<CDRInputObject>() {
@Override
public CDRInputObject run() {
return new CDRInputObject(inOrb, null, inBuffer,
inMsg);
}
});
messageMediator.setInputObject(cdrInputObject); messageMediator.setInputObject(cdrInputObject);
cdrInputObject.setMessageMediator(messageMediator); cdrInputObject.setMessageMediator(messageMediator);
...@@ -192,9 +201,17 @@ public class SharedCDRClientRequestDispatcherImpl ...@@ -192,9 +201,17 @@ public class SharedCDRClientRequestDispatcherImpl
cdrOutputObject = (CDROutputObject) messageMediator.getOutputObject(); cdrOutputObject = (CDROutputObject) messageMediator.getOutputObject();
bbwi = cdrOutputObject.getByteBufferWithInfo(); bbwi = cdrOutputObject.getByteBufferWithInfo();
cdrOutputObject.getMessageHeader().setSize(bbwi.byteBuffer, bbwi.getSize()); cdrOutputObject.getMessageHeader().setSize(bbwi.byteBuffer, bbwi.getSize());
cdrInputObject = final ORB inOrb2 = orb;
new CDRInputObject(orb, null, bbwi.byteBuffer, final ByteBuffer inBuffer2 = bbwi.byteBuffer;
cdrOutputObject.getMessageHeader()); final Message inMsg2 = cdrOutputObject.getMessageHeader();
cdrInputObject = AccessController
.doPrivileged(new PrivilegedAction<CDRInputObject>() {
@Override
public CDRInputObject run() {
return new CDRInputObject(inOrb2, null, inBuffer2,
inMsg2);
}
});
messageMediator.setInputObject(cdrInputObject); messageMediator.setInputObject(cdrInputObject);
cdrInputObject.setMessageMediator(messageMediator); cdrInputObject.setMessageMediator(messageMediator);
......
/* /*
* Copyright (c) 1998, 2009, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -36,6 +36,8 @@ import java.util.Collections ; ...@@ -36,6 +36,8 @@ import java.util.Collections ;
import org.omg.CosNaming.NamingContextExt ; import org.omg.CosNaming.NamingContextExt ;
import org.omg.CosNaming.NamingContextExtHelper ; import org.omg.CosNaming.NamingContextExtHelper ;
import sun.corba.EncapsInputStreamFactory;
import com.sun.corba.se.spi.ior.IOR; import com.sun.corba.se.spi.ior.IOR;
import com.sun.corba.se.spi.ior.IORTemplate; import com.sun.corba.se.spi.ior.IORTemplate;
import com.sun.corba.se.spi.ior.ObjectKey; import com.sun.corba.se.spi.ior.ObjectKey;
...@@ -114,8 +116,8 @@ public class INSURLOperationImpl implements Operation ...@@ -114,8 +116,8 @@ public class INSURLOperationImpl implements Operation
buf[j] = (byte)((ORBUtility.hexOf(str.charAt(i)) << UN_SHIFT) & 0xF0); buf[j] = (byte)((ORBUtility.hexOf(str.charAt(i)) << UN_SHIFT) & 0xF0);
buf[j] |= (byte)(ORBUtility.hexOf(str.charAt(i+1)) & 0x0F); buf[j] |= (byte)(ORBUtility.hexOf(str.charAt(i+1)) & 0x0F);
} }
EncapsInputStream s = new EncapsInputStream(orb, buf, buf.length, EncapsInputStream s = EncapsInputStreamFactory.newEncapsInputStream(orb, buf, buf.length,
orb.getORBData().getGIOPVersion()); orb.getORBData().getGIOPVersion());
s.consumeEndian(); s.consumeEndian();
return s.read_Object() ; return s.read_Object() ;
} }
......
/* /*
* Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -58,6 +58,9 @@ import com.sun.corba.se.impl.orbutil.ORBUtility ; ...@@ -58,6 +58,9 @@ import com.sun.corba.se.impl.orbutil.ORBUtility ;
import com.sun.corba.se.impl.util.Utility ; import com.sun.corba.se.impl.util.Utility ;
import com.sun.corba.se.impl.logging.ORBUtilSystemException ; import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
import sun.corba.EncapsInputStreamFactory;
public class ServiceContexts { public class ServiceContexts {
private static boolean isDebugging( OutputStream os ) private static boolean isDebugging( OutputStream os )
{ {
...@@ -198,11 +201,11 @@ public class ServiceContexts { ...@@ -198,11 +201,11 @@ public class ServiceContexts {
// Note: As of Jan 2001, no standard OMG or Sun service contexts // Note: As of Jan 2001, no standard OMG or Sun service contexts
// ship wchar data or are defined as using anything but GIOP 1.0 CDR. // ship wchar data or are defined as using anything but GIOP 1.0 CDR.
EncapsInputStream eis EncapsInputStream eis
= new EncapsInputStream(orb, = EncapsInputStreamFactory.newEncapsInputStream(orb,
data, data,
data.length, data.length,
giopVersion, giopVersion,
codeBase); codeBase);
eis.consumeEndian(); eis.consumeEndian();
// Now the input stream passed to a ServiceContext // Now the input stream passed to a ServiceContext
......
/* /*
* Copyright (c) 1998, 2000, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -31,6 +31,10 @@ ...@@ -31,6 +31,10 @@
package org.omg.CORBA_2_3.portable; package org.omg.CORBA_2_3.portable;
import java.io.SerializablePermission;
import java.security.AccessController;
import java.security.PrivilegedAction;
/** /**
* InputStream provides for the reading of all of the mapped IDL types * InputStream provides for the reading of all of the mapped IDL types
* from the stream. It extends org.omg.CORBA.portable.InputStream. This * from the stream. It extends org.omg.CORBA.portable.InputStream. This
...@@ -43,6 +47,43 @@ package org.omg.CORBA_2_3.portable; ...@@ -43,6 +47,43 @@ package org.omg.CORBA_2_3.portable;
public abstract class InputStream extends org.omg.CORBA.portable.InputStream { public abstract class InputStream extends org.omg.CORBA.portable.InputStream {
private static final String ALLOW_SUBCLASS_PROP = "jdk.corba.allowInputStreamSubclass";
private static final boolean allowSubclass = AccessController.doPrivileged(
new PrivilegedAction<Boolean>() {
@Override
public Boolean run() {
String prop = System.getProperty(ALLOW_SUBCLASS_PROP);
return prop == null ? false :
(prop.equalsIgnoreCase("false") ? false : true);
}
});
private static Void checkPermission() {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
if (!allowSubclass)
sm.checkPermission(new
SerializablePermission("enableSubclassImplementation"));
}
return null;
}
private InputStream(Void ignore) { }
/**
* Create a new instance of this class.
*
* throw SecurityException if SecurityManager is installed and
* enableSubclassImplementation SerializablePermission
* is not granted or jdk.corba.allowOutputStreamSubclass system
* property is either not set or is set to 'false'
*/
public InputStream() {
this(checkPermission());
}
/** /**
* Unmarshalls a value type from the input stream. * Unmarshalls a value type from the input stream.
* @return the value type unmarshalled from the input stream * @return the value type unmarshalled from the input stream
......
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* 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.
*/
package sun.corba;
import java.nio.ByteBuffer;
import java.security.AccessController;
import java.security.PrivilegedAction;
import com.sun.corba.se.impl.encoding.EncapsInputStream;
import com.sun.corba.se.impl.encoding.TypeCodeInputStream;
import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
import com.sun.corba.se.pept.protocol.MessageMediator;
import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
import com.sun.corba.se.spi.orb.ORB;
import com.sun.org.omg.SendingContext.CodeBase;
public class EncapsInputStreamFactory {
public static EncapsInputStream newEncapsInputStream(
final org.omg.CORBA.ORB orb, final byte[] buf, final int size,
final boolean littleEndian, final GIOPVersion version) {
return AccessController
.doPrivileged(new PrivilegedAction<EncapsInputStream>() {
@Override
public EncapsInputStream run() {
return new EncapsInputStream(orb, buf, size,
littleEndian, version);
}
});
}
public static EncapsInputStream newEncapsInputStream(
final org.omg.CORBA.ORB orb, final ByteBuffer byteBuffer,
final int size, final boolean littleEndian,
final GIOPVersion version) {
return AccessController
.doPrivileged(new PrivilegedAction<EncapsInputStream>() {
@Override
public EncapsInputStream run() {
return new EncapsInputStream(orb, byteBuffer, size,
littleEndian, version);
}
});
}
public static EncapsInputStream newEncapsInputStream(
final org.omg.CORBA.ORB orb, final byte[] data, final int size) {
return AccessController
.doPrivileged(new PrivilegedAction<EncapsInputStream>() {
@Override
public EncapsInputStream run() {
return new EncapsInputStream(orb, data, size);
}
});
}
public static EncapsInputStream newEncapsInputStream(
final EncapsInputStream eis) {
return AccessController
.doPrivileged(new PrivilegedAction<EncapsInputStream>() {
@Override
public EncapsInputStream run() {
return new EncapsInputStream(eis);
}
});
}
public static EncapsInputStream newEncapsInputStream(
final org.omg.CORBA.ORB orb, final byte[] data, final int size,
final GIOPVersion version) {
return AccessController
.doPrivileged(new PrivilegedAction<EncapsInputStream>() {
@Override
public EncapsInputStream run() {
return new EncapsInputStream(orb, data, size, version);
}
});
}
public static EncapsInputStream newEncapsInputStream(
final org.omg.CORBA.ORB orb, final byte[] data, final int size,
final GIOPVersion version, final CodeBase codeBase) {
return AccessController
.doPrivileged(new PrivilegedAction<EncapsInputStream>() {
@Override
public EncapsInputStream run() {
return new EncapsInputStream(orb, data, size, version,
codeBase);
}
});
}
public static TypeCodeInputStream newTypeCodeInputStream(
final org.omg.CORBA.ORB orb, final byte[] buf, final int size,
final boolean littleEndian, final GIOPVersion version) {
return AccessController
.doPrivileged(new PrivilegedAction<TypeCodeInputStream>() {
@Override
public TypeCodeInputStream run() {
return new TypeCodeInputStream(orb, buf, size,
littleEndian, version);
}
});
}
public static TypeCodeInputStream newTypeCodeInputStream(
final org.omg.CORBA.ORB orb, final ByteBuffer byteBuffer,
final int size, final boolean littleEndian,
final GIOPVersion version) {
return AccessController
.doPrivileged(new PrivilegedAction<TypeCodeInputStream>() {
@Override
public TypeCodeInputStream run() {
return new TypeCodeInputStream(orb, byteBuffer, size,
littleEndian, version);
}
});
}
public static TypeCodeInputStream newTypeCodeInputStream(
final org.omg.CORBA.ORB orb, final byte[] data, final int size) {
return AccessController
.doPrivileged(new PrivilegedAction<TypeCodeInputStream>() {
@Override
public TypeCodeInputStream run() {
return new TypeCodeInputStream(orb, data, size);
}
});
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册