提交 96a1305a 编写于 作者: C coffeys

8000642: Better handling of objects for transportation

Reviewed-by: alanb, mchung, skoivu
上级 6694d73f
/* /*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 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
...@@ -33,6 +33,8 @@ package com.sun.corba.se.impl.corba; ...@@ -33,6 +33,8 @@ package com.sun.corba.se.impl.corba;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.List ; import java.util.List ;
import java.util.ArrayList ; import java.util.ArrayList ;
...@@ -504,7 +506,13 @@ public class AnyImpl extends Any ...@@ -504,7 +506,13 @@ public class AnyImpl extends Any
public org.omg.CORBA.portable.OutputStream create_output_stream() public org.omg.CORBA.portable.OutputStream create_output_stream()
{ {
//debug.log ("create_output_stream"); //debug.log ("create_output_stream");
return new AnyOutputStream(orb); final ORB finalorb = this.orb;
return AccessController.doPrivileged(new PrivilegedAction<AnyOutputStream>() {
@Override
public AnyOutputStream run() {
return new AnyOutputStream(finalorb);
}
});
} }
/** /**
......
/* /*
* Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 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
...@@ -600,7 +600,8 @@ public final class TypeCodeImpl extends TypeCode ...@@ -600,7 +600,8 @@ public final class TypeCodeImpl extends TypeCode
} }
public static CDROutputStream newOutputStream(ORB orb) { public static CDROutputStream newOutputStream(ORB orb) {
TypeCodeOutputStream tcos = new TypeCodeOutputStream((ORB)orb); TypeCodeOutputStream tcos =
sun.corba.OutputStreamFactory.newTypeCodeOutputStream(orb);
//if (debug) System.out.println("Created TypeCodeOutputStream " + tcos + //if (debug) System.out.println("Created TypeCodeOutputStream " + tcos +
// " with no parent"); // " with no parent");
return tcos; return tcos;
......
/* /*
* Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2004, 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
...@@ -66,7 +66,7 @@ import org.omg.CORBA.CompletionStatus; ...@@ -66,7 +66,7 @@ import org.omg.CORBA.CompletionStatus;
* *
* @author Ram Jeyaraman * @author Ram Jeyaraman
*/ */
public class IDLJavaSerializationOutputStream extends CDROutputStreamBase { final class IDLJavaSerializationOutputStream extends CDROutputStreamBase {
private ORB orb; private ORB orb;
private byte encodingVersion; private byte encodingVersion;
......
/* /*
* 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
...@@ -196,7 +196,8 @@ public final class TypeCodeOutputStream extends EncapsOutputStream ...@@ -196,7 +196,8 @@ public final class TypeCodeOutputStream extends EncapsOutputStream
} }
public TypeCodeOutputStream createEncapsulation(org.omg.CORBA.ORB _orb) { public TypeCodeOutputStream createEncapsulation(org.omg.CORBA.ORB _orb) {
TypeCodeOutputStream encap = new TypeCodeOutputStream((ORB)_orb, isLittleEndian()); TypeCodeOutputStream encap =
sun.corba.OutputStreamFactory.newTypeCodeOutputStream((ORB)_orb, isLittleEndian());
encap.setEnclosingOutputStream(this); encap.setEnclosingOutputStream(this);
encap.makeEncapsulation(); encap.makeEncapsulation();
//if (TypeCodeImpl.debug) System.out.println("Created TypeCodeOutputStream " + encap + " with parent " + this); //if (TypeCodeImpl.debug) System.out.println("Created TypeCodeOutputStream " + encap + " with parent " + this);
...@@ -211,7 +212,8 @@ public final class TypeCodeOutputStream extends EncapsOutputStream ...@@ -211,7 +212,8 @@ public final class TypeCodeOutputStream extends EncapsOutputStream
public static TypeCodeOutputStream wrapOutputStream(OutputStream os) { public static TypeCodeOutputStream wrapOutputStream(OutputStream os) {
boolean littleEndian = ((os instanceof CDROutputStream) ? ((CDROutputStream)os).isLittleEndian() : false); boolean littleEndian = ((os instanceof CDROutputStream) ? ((CDROutputStream)os).isLittleEndian() : false);
TypeCodeOutputStream tos = new TypeCodeOutputStream((ORB)os.orb(), littleEndian); TypeCodeOutputStream tos =
sun.corba.OutputStreamFactory.newTypeCodeOutputStream((ORB)os.orb(), littleEndian);
tos.setEnclosingOutputStream(os); tos.setEnclosingOutputStream(os);
//if (TypeCodeImpl.debug) System.out.println("Created TypeCodeOutputStream " + tos + " with parent " + os); //if (TypeCodeImpl.debug) System.out.println("Created TypeCodeOutputStream " + tos + " with parent " + os);
return tos; return tos;
......
/* /*
* 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
...@@ -155,7 +155,8 @@ public final class CDREncapsCodec ...@@ -155,7 +155,8 @@ public final class CDREncapsCodec
// be versioned. This can be handled once this work is complete. // be versioned. This can be handled once this work is complete.
// Create output stream with default endianness. // Create output stream with default endianness.
EncapsOutputStream cdrOut = new EncapsOutputStream( EncapsOutputStream cdrOut =
sun.corba.OutputStreamFactory.newEncapsOutputStream(
(com.sun.corba.se.spi.orb.ORB)orb, giopVersion ); (com.sun.corba.se.spi.orb.ORB)orb, giopVersion );
// This is an encapsulation, so put out the endian: // This is an encapsulation, so put out the endian:
......
...@@ -659,7 +659,8 @@ public abstract class RequestInfoImpl ...@@ -659,7 +659,8 @@ public abstract class RequestInfoImpl
// Convert the "core" service context to an // Convert the "core" service context to an
// "IOP" ServiceContext by writing it to a // "IOP" ServiceContext by writing it to a
// CDROutputStream and reading it back. // CDROutputStream and reading it back.
EncapsOutputStream out = new EncapsOutputStream(myORB); EncapsOutputStream out =
sun.corba.OutputStreamFactory.newEncapsOutputStream(myORB);
context.write( out, GIOPVersion.V1_2 ); context.write( out, GIOPVersion.V1_2 );
InputStream inputStream = out.create_input_stream(); InputStream inputStream = out.create_input_stream();
...@@ -695,8 +696,8 @@ public abstract class RequestInfoImpl ...@@ -695,8 +696,8 @@ public abstract class RequestInfoImpl
{ {
int id = 0 ; int id = 0 ;
// Convert IOP.service_context to core.ServiceContext: // Convert IOP.service_context to core.ServiceContext:
EncapsOutputStream outputStream = new EncapsOutputStream( EncapsOutputStream outputStream =
myORB ); sun.corba.OutputStreamFactory.newEncapsOutputStream(myORB);
InputStream inputStream = null; InputStream inputStream = null;
UnknownServiceContext coreServiceContext = null; UnknownServiceContext coreServiceContext = null;
ServiceContextHelper.write( outputStream, service_context ); ServiceContextHelper.write( outputStream, service_context );
......
...@@ -300,11 +300,11 @@ public class IIOPInputStream ...@@ -300,11 +300,11 @@ public class IIOPInputStream
resetStream(); resetStream();
} }
public final void setOrbStream(org.omg.CORBA_2_3.portable.InputStream os) { final void setOrbStream(org.omg.CORBA_2_3.portable.InputStream os) {
orbStream = os; orbStream = os;
} }
public final org.omg.CORBA_2_3.portable.InputStream getOrbStream() { final org.omg.CORBA_2_3.portable.InputStream getOrbStream() {
return orbStream; return orbStream;
} }
...@@ -327,11 +327,11 @@ public class IIOPInputStream ...@@ -327,11 +327,11 @@ public class IIOPInputStream
return (javax.rmi.CORBA.ValueHandler) vhandler; return (javax.rmi.CORBA.ValueHandler) vhandler;
} }
public final void increaseRecursionDepth(){ final void increaseRecursionDepth(){
recursionDepth++; recursionDepth++;
} }
public final int decreaseRecursionDepth(){ final int decreaseRecursionDepth(){
return --recursionDepth; return --recursionDepth;
} }
......
/* /*
* Copyright (c) 1998, 2004, 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
...@@ -124,19 +124,19 @@ public class IIOPOutputStream ...@@ -124,19 +124,19 @@ public class IIOPOutputStream
} }
} }
public final void setOrbStream(org.omg.CORBA_2_3.portable.OutputStream os) { final void setOrbStream(org.omg.CORBA_2_3.portable.OutputStream os) {
orbStream = os; orbStream = os;
} }
public final org.omg.CORBA_2_3.portable.OutputStream getOrbStream() { final org.omg.CORBA_2_3.portable.OutputStream getOrbStream() {
return orbStream; return orbStream;
} }
public final void increaseRecursionDepth(){ final void increaseRecursionDepth(){
recursionDepth++; recursionDepth++;
} }
public final int decreaseRecursionDepth(){ final int decreaseRecursionDepth(){
return --recursionDepth; return --recursionDepth;
} }
......
...@@ -251,7 +251,7 @@ public abstract class InputStreamHook extends ObjectInputStream ...@@ -251,7 +251,7 @@ public abstract class InputStreamHook extends ObjectInputStream
} }
protected abstract byte getStreamFormatVersion(); protected abstract byte getStreamFormatVersion();
protected abstract org.omg.CORBA_2_3.portable.InputStream getOrbStream(); abstract org.omg.CORBA_2_3.portable.InputStream getOrbStream();
// Description of possible actions // Description of possible actions
protected static class ReadObjectState { protected static class ReadObjectState {
......
...@@ -179,7 +179,7 @@ public abstract class OutputStreamHook extends ObjectOutputStream ...@@ -179,7 +179,7 @@ public abstract class OutputStreamHook extends ObjectOutputStream
putFields.write(this); putFields.write(this);
} }
public abstract org.omg.CORBA_2_3.portable.OutputStream getOrbStream(); abstract org.omg.CORBA_2_3.portable.OutputStream getOrbStream();
protected abstract void beginOptionalCustomData(); protected abstract void beginOptionalCustomData();
......
...@@ -128,7 +128,8 @@ public class EncapsulationUtility ...@@ -128,7 +128,8 @@ public class EncapsulationUtility
static public void writeEncapsulation( WriteContents obj, static public void writeEncapsulation( WriteContents obj,
OutputStream os ) OutputStream os )
{ {
EncapsOutputStream out = new EncapsOutputStream( (ORB)os.orb() ) ; EncapsOutputStream out =
sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)os.orb());
out.putEndian() ; out.putEndian() ;
......
/* /*
* 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
...@@ -95,7 +95,8 @@ public class GenericTaggedProfile extends GenericIdentifiable implements TaggedP ...@@ -95,7 +95,8 @@ public class GenericTaggedProfile extends GenericIdentifiable implements TaggedP
public org.omg.IOP.TaggedProfile getIOPProfile() public org.omg.IOP.TaggedProfile getIOPProfile()
{ {
EncapsOutputStream os = new EncapsOutputStream( orb ) ; EncapsOutputStream os =
sun.corba.OutputStreamFactory.newEncapsOutputStream(orb);
write( os ) ; write( os ) ;
InputStream is = (InputStream)(os.create_input_stream()) ; InputStream is = (InputStream)(os.create_input_stream()) ;
return org.omg.IOP.TaggedProfileHelper.read( is ) ; return org.omg.IOP.TaggedProfileHelper.read( is ) ;
......
/* /*
* Copyright (c) 2000, 2006, 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
...@@ -213,7 +213,8 @@ public class IORImpl extends IdentifiableContainerBase implements IOR ...@@ -213,7 +213,8 @@ public class IORImpl extends IdentifiableContainerBase implements IOR
{ {
StringWriter bs; StringWriter bs;
MarshalOutputStream s = new EncapsOutputStream(factory); MarshalOutputStream s =
sun.corba.OutputStreamFactory.newEncapsOutputStream(factory);
s.putEndian(); s.putEndian();
write( (OutputStream)s ); write( (OutputStream)s );
bs = new StringWriter(); bs = new StringWriter();
...@@ -237,7 +238,8 @@ public class IORImpl extends IdentifiableContainerBase implements IOR ...@@ -237,7 +238,8 @@ public class IORImpl extends IdentifiableContainerBase implements IOR
} }
public org.omg.IOP.IOR getIOPIOR() { public org.omg.IOP.IOR getIOPIOR() {
EncapsOutputStream os = new EncapsOutputStream(factory); EncapsOutputStream os =
sun.corba.OutputStreamFactory.newEncapsOutputStream(factory);
write(os); write(os);
InputStream is = (InputStream) (os.create_input_stream()); InputStream is = (InputStream) (os.create_input_stream());
return org.omg.IOP.IORHelper.read(is); return org.omg.IOP.IORHelper.read(is);
......
...@@ -87,7 +87,8 @@ public class ObjectKeyImpl implements ObjectKey ...@@ -87,7 +87,8 @@ public class ObjectKeyImpl implements ObjectKey
public byte[] getBytes( org.omg.CORBA.ORB orb ) public byte[] getBytes( org.omg.CORBA.ORB orb )
{ {
EncapsOutputStream os = new EncapsOutputStream( (ORB)orb ) ; EncapsOutputStream os =
sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)orb);
write( os ) ; write( os ) ;
return os.toByteArray() ; return os.toByteArray() ;
} }
......
/* /*
* 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
...@@ -61,7 +61,8 @@ public class TaggedComponentFactoryFinderImpl extends ...@@ -61,7 +61,8 @@ public class TaggedComponentFactoryFinderImpl extends
public TaggedComponent create( org.omg.CORBA.ORB orb, public TaggedComponent create( org.omg.CORBA.ORB orb,
org.omg.IOP.TaggedComponent comp ) org.omg.IOP.TaggedComponent comp )
{ {
EncapsOutputStream os = new EncapsOutputStream( (ORB)orb ) ; EncapsOutputStream os =
sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)orb);
org.omg.IOP.TaggedComponentHelper.write( os, comp ) ; org.omg.IOP.TaggedComponentHelper.write( os, comp ) ;
InputStream is = (InputStream)(os.create_input_stream() ) ; InputStream is = (InputStream)(os.create_input_stream() ) ;
// Skip the component ID: we just wrote it out above // Skip the component ID: we just wrote it out above
......
/* /*
* Copyright (c) 2000, 2004, 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
...@@ -247,7 +247,8 @@ public class IIOPProfileImpl extends IdentifiableBase implements IIOPProfile ...@@ -247,7 +247,8 @@ public class IIOPProfileImpl extends IdentifiableBase implements IIOPProfile
public org.omg.IOP.TaggedProfile getIOPProfile() public org.omg.IOP.TaggedProfile getIOPProfile()
{ {
EncapsOutputStream os = new EncapsOutputStream( orb ) ; EncapsOutputStream os =
sun.corba.OutputStreamFactory.newEncapsOutputStream(orb);
os.write_long( getId() ) ; os.write_long( getId() ) ;
write( os ) ; write( os ) ;
InputStream is = (InputStream)(os.create_input_stream()) ; InputStream is = (InputStream)(os.create_input_stream()) ;
......
/* /*
* 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
...@@ -132,8 +132,9 @@ public class IIOPProfileTemplateImpl extends TaggedProfileTemplateBase ...@@ -132,8 +132,9 @@ public class IIOPProfileTemplateImpl extends TaggedProfileTemplateBase
// Note that this cannot be accomplished with a codec! // Note that this cannot be accomplished with a codec!
// Use the byte order of the given stream // Use the byte order of the given stream
OutputStream encapsulatedOS = new EncapsOutputStream( (ORB)os.orb(), OutputStream encapsulatedOS =
((CDROutputStream)os).isLittleEndian() ) ; sun.corba.OutputStreamFactory.newEncapsOutputStream(
(ORB)os.orb(), ((CDROutputStream)os).isLittleEndian() ) ;
okeyTemplate.write( id, encapsulatedOS ) ; okeyTemplate.write( id, encapsulatedOS ) ;
EncapsulationUtility.writeOutputStream( encapsulatedOS, os ) ; EncapsulationUtility.writeOutputStream( encapsulatedOS, os ) ;
......
...@@ -550,7 +550,7 @@ public class ORBImpl extends com.sun.corba.se.spi.orb.ORB ...@@ -550,7 +550,7 @@ public class ORBImpl extends com.sun.corba.se.spi.orb.ORB
public synchronized org.omg.CORBA.portable.OutputStream create_output_stream() public synchronized org.omg.CORBA.portable.OutputStream create_output_stream()
{ {
checkShutdownState(); checkShutdownState();
return new EncapsOutputStream(this); return sun.corba.OutputStreamFactory.newEncapsOutputStream(this);
} }
/** /**
......
/* /*
* Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 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
...@@ -149,7 +149,7 @@ public class ORBSingleton extends ORB ...@@ -149,7 +149,7 @@ public class ORBSingleton extends ORB
} }
public OutputStream create_output_stream() { public OutputStream create_output_stream() {
return new EncapsOutputStream(this); return sun.corba.OutputStreamFactory.newEncapsOutputStream(this);
} }
public TypeCode create_struct_tc(String id, public TypeCode create_struct_tc(String id,
......
/* /*
* Copyright (c) 2001, 2012, 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
...@@ -1794,8 +1794,7 @@ public class CorbaMessageMediatorImpl ...@@ -1794,8 +1794,7 @@ public class CorbaMessageMediatorImpl
if (msg.getGIOPVersion().lessThan(GIOPVersion.V1_2)) { if (msg.getGIOPVersion().lessThan(GIOPVersion.V1_2)) {
// locate msgs 1.0 & 1.1 :=> grow, // locate msgs 1.0 & 1.1 :=> grow,
// REVISIT - build from factory outputObject = sun.corba.OutputStreamFactory.newCDROutputObject(
outputObject = new CDROutputObject(
(ORB) messageMediator.getBroker(), (ORB) messageMediator.getBroker(),
this, this,
GIOPVersion.V1_0, GIOPVersion.V1_0,
...@@ -1804,8 +1803,7 @@ public class CorbaMessageMediatorImpl ...@@ -1804,8 +1803,7 @@ public class CorbaMessageMediatorImpl
ORBConstants.STREAM_FORMAT_VERSION_1); ORBConstants.STREAM_FORMAT_VERSION_1);
} else { } else {
// 1.2 :=> stream // 1.2 :=> stream
// REVISIT - build from factory outputObject = sun.corba.OutputStreamFactory.newCDROutputObject(
outputObject = new CDROutputObject(
(ORB) messageMediator.getBroker(), (ORB) messageMediator.getBroker(),
messageMediator, messageMediator,
reply, reply,
...@@ -1959,7 +1957,8 @@ public class CorbaMessageMediatorImpl ...@@ -1959,7 +1957,8 @@ public class CorbaMessageMediatorImpl
ReplyMessage.NEEDS_ADDRESSING_MODE, ReplyMessage.NEEDS_ADDRESSING_MODE,
null, null); null, null);
// REVISIT: via acceptor factory. // REVISIT: via acceptor factory.
CDROutputObject outputObject = new CDROutputObject( CDROutputObject outputObject =
sun.corba.OutputStreamFactory.newCDROutputObject(
(ORB)messageMediator.getBroker(), (ORB)messageMediator.getBroker(),
this, this,
messageMediator.getGIOPVersion(), messageMediator.getGIOPVersion(),
...@@ -2126,7 +2125,7 @@ public class CorbaMessageMediatorImpl ...@@ -2126,7 +2125,7 @@ public class CorbaMessageMediatorImpl
ex.printStackTrace(pw); ex.printStackTrace(pw);
pw.flush(); // NOTE: you must flush or baos will be empty. pw.flush(); // NOTE: you must flush or baos will be empty.
EncapsOutputStream encapsOutputStream = EncapsOutputStream encapsOutputStream =
new EncapsOutputStream((ORB)mediator.getBroker()); sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)mediator.getBroker());
encapsOutputStream.putEndian(); encapsOutputStream.putEndian();
encapsOutputStream.write_wstring(baos.toString()); encapsOutputStream.write_wstring(baos.toString());
UnknownServiceContext serviceContext = UnknownServiceContext serviceContext =
...@@ -2203,12 +2202,11 @@ public class CorbaMessageMediatorImpl ...@@ -2203,12 +2202,11 @@ public class CorbaMessageMediatorImpl
// REVISIT = do not use null. // REVISIT = do not use null.
// //
if (messageMediator.getConnection() == null) { if (messageMediator.getConnection() == null) {
// REVISIT - needs factory
replyOutputObject = replyOutputObject =
new CDROutputObject(orb, messageMediator, sun.corba.OutputStreamFactory.newCDROutputObject(orb,
messageMediator.getReplyHeader(), messageMediator, messageMediator.getReplyHeader(),
messageMediator.getStreamFormatVersion(), messageMediator.getStreamFormatVersion(),
BufferManagerFactory.GROW); BufferManagerFactory.GROW);
} else { } else {
replyOutputObject = messageMediator.getConnection().getAcceptor() replyOutputObject = messageMediator.getConnection().getAcceptor()
.createOutputObject(messageMediator.getBroker(), messageMediator); .createOutputObject(messageMediator.getBroker(), messageMediator);
......
/* /*
* 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
...@@ -214,7 +214,7 @@ public abstract class CorbaContactInfoBase ...@@ -214,7 +214,7 @@ public abstract class CorbaContactInfoBase
messageMediator; messageMediator;
OutputObject outputObject = OutputObject outputObject =
new CDROutputObject(orb, messageMediator, sun.corba.OutputStreamFactory.newCDROutputObject(orb, messageMediator,
corbaMessageMediator.getRequestHeader(), corbaMessageMediator.getRequestHeader(),
corbaMessageMediator.getStreamFormatVersion()); corbaMessageMediator.getStreamFormatVersion());
......
/* /*
* Copyright (c) 2003, 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
...@@ -134,7 +134,7 @@ public class SharedCDRContactInfoImpl ...@@ -134,7 +134,7 @@ public class SharedCDRContactInfoImpl
messageMediator; messageMediator;
// NOTE: GROW. // NOTE: GROW.
OutputObject outputObject = OutputObject outputObject =
new CDROutputObject(orb, messageMediator, sun.corba.OutputStreamFactory.newCDROutputObject(orb, messageMediator,
corbaMessageMediator.getRequestHeader(), corbaMessageMediator.getRequestHeader(),
corbaMessageMediator.getStreamFormatVersion(), corbaMessageMediator.getStreamFormatVersion(),
BufferManagerFactory.GROW); BufferManagerFactory.GROW);
......
/* /*
* Copyright (c) 2001, 2010, 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
...@@ -534,9 +534,9 @@ public class SocketOrChannelAcceptorImpl ...@@ -534,9 +534,9 @@ public class SocketOrChannelAcceptorImpl
{ {
CorbaMessageMediator corbaMessageMediator = (CorbaMessageMediator) CorbaMessageMediator corbaMessageMediator = (CorbaMessageMediator)
messageMediator; messageMediator;
return new CDROutputObject((ORB) broker, corbaMessageMediator, return sun.corba.OutputStreamFactory.newCDROutputObject((ORB) broker,
corbaMessageMediator.getReplyHeader(), corbaMessageMediator, corbaMessageMediator.getReplyHeader(),
corbaMessageMediator.getStreamFormatVersion()); corbaMessageMediator.getStreamFormatVersion());
} }
//////////////////////////////////////////////////// ////////////////////////////////////////////////////
......
/* /*
* Copyright (c) 2001, 2012, 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
...@@ -1587,8 +1587,8 @@ public class SocketOrChannelConnectionImpl ...@@ -1587,8 +1587,8 @@ public class SocketOrChannelConnectionImpl
{ {
// REVISIT: See comments in CDROutputObject constructor. // REVISIT: See comments in CDROutputObject constructor.
CDROutputObject outputObject = CDROutputObject outputObject =
new CDROutputObject((ORB)orb, null, giopVersion, this, msg, sun.corba.OutputStreamFactory.newCDROutputObject((ORB)orb, null, giopVersion,
ORBConstants.STREAM_FORMAT_VERSION_1); this, msg, ORBConstants.STREAM_FORMAT_VERSION_1);
msg.write(outputObject); msg.write(outputObject);
outputObject.writeTo(this); outputObject.writeTo(this);
......
/* /*
* 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
...@@ -42,7 +42,8 @@ public abstract class TaggedComponentBase extends IdentifiableBase ...@@ -42,7 +42,8 @@ public abstract class TaggedComponentBase extends IdentifiableBase
public org.omg.IOP.TaggedComponent getIOPComponent( public org.omg.IOP.TaggedComponent getIOPComponent(
org.omg.CORBA.ORB orb ) org.omg.CORBA.ORB orb )
{ {
EncapsOutputStream os = new EncapsOutputStream( (ORB)orb ) ; EncapsOutputStream os =
sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)orb);
write( os ) ; write( os ) ;
InputStream is = (InputStream)(os.create_input_stream() ) ; InputStream is = (InputStream)(os.create_input_stream() ) ;
return org.omg.IOP.TaggedComponentHelper.read( is ) ; return org.omg.IOP.TaggedComponentHelper.read( is ) ;
......
/* /*
* Copyright (c) 1998, 2003, 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
...@@ -92,7 +92,8 @@ public abstract class ServiceContext { ...@@ -92,7 +92,8 @@ public abstract class ServiceContext {
*/ */
public void write(OutputStream s, GIOPVersion gv) throws SystemException public void write(OutputStream s, GIOPVersion gv) throws SystemException
{ {
EncapsOutputStream os = new EncapsOutputStream( (ORB)(s.orb()), gv ) ; EncapsOutputStream os =
sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)(s.orb()), gv);
os.putEndian() ; os.putEndian() ;
writeData( os ) ; writeData( os ) ;
byte[] data = os.toByteArray() ; byte[] data = os.toByteArray() ;
......
/* /*
* 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;
/** /**
* OutputStream provides interface for writing of all of the mapped IDL type * OutputStream provides interface for writing of all of the mapped IDL type
* to the stream. It extends org.omg.CORBA.portable.OutputStream, and defines * to the stream. It extends org.omg.CORBA.portable.OutputStream, and defines
...@@ -43,6 +47,40 @@ package org.omg.CORBA_2_3.portable; ...@@ -43,6 +47,40 @@ package org.omg.CORBA_2_3.portable;
public abstract class OutputStream extends org.omg.CORBA.portable.OutputStream { public abstract class OutputStream extends org.omg.CORBA.portable.OutputStream {
private static final String ALLOW_SUBCLASS_PROP = "jdk.corba.allowOutputStreamSubclass";
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 OutputStream(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 OutputStream() {
this(checkPermission());
}
/** /**
* Marshals a value type to the output stream. * Marshals a value type to the output stream.
* @param value is the acutal value to write * @param value is the acutal value to write
......
/*
* 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 com.sun.corba.se.impl.corba.AnyImpl;
import com.sun.corba.se.impl.encoding.BufferManagerWrite;
import com.sun.corba.se.impl.encoding.CDROutputObject;
import com.sun.corba.se.impl.encoding.EncapsOutputStream;
import com.sun.corba.se.impl.encoding.TypeCodeOutputStream;
import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
import com.sun.corba.se.pept.protocol.MessageMediator;
import com.sun.corba.se.spi.orb.ORB;
import com.sun.corba.se.spi.transport.CorbaConnection;
import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
import java.security.AccessController;
import java.security.PrivilegedAction;
public final class OutputStreamFactory {
private OutputStreamFactory() {
}
public static TypeCodeOutputStream newTypeCodeOutputStream(
final ORB orb) {
return AccessController.doPrivileged(
new PrivilegedAction<TypeCodeOutputStream>() {
@Override
public TypeCodeOutputStream run() {
return new TypeCodeOutputStream(orb);
}
});
}
public static TypeCodeOutputStream newTypeCodeOutputStream(
final ORB orb, final boolean littleEndian) {
return AccessController.doPrivileged(
new PrivilegedAction<TypeCodeOutputStream>() {
@Override
public TypeCodeOutputStream run() {
return new TypeCodeOutputStream(orb, littleEndian);
}
});
}
public static EncapsOutputStream newEncapsOutputStream(
final ORB orb) {
return AccessController.doPrivileged(
new PrivilegedAction<EncapsOutputStream>() {
@Override
public EncapsOutputStream run() {
return new EncapsOutputStream(
(com.sun.corba.se.spi.orb.ORB)orb);
}
});
}
public static EncapsOutputStream newEncapsOutputStream(
final ORB orb, final GIOPVersion giopVersion) {
return AccessController.doPrivileged(
new PrivilegedAction<EncapsOutputStream>() {
@Override
public EncapsOutputStream run() {
return new EncapsOutputStream(
(com.sun.corba.se.spi.orb.ORB)orb, giopVersion);
}
});
}
public static EncapsOutputStream newEncapsOutputStream(
final ORB orb, final boolean isLittleEndian) {
return AccessController.doPrivileged(
new PrivilegedAction<EncapsOutputStream>() {
@Override
public EncapsOutputStream run() {
return new EncapsOutputStream(
(com.sun.corba.se.spi.orb.ORB)orb, isLittleEndian);
}
});
}
public static CDROutputObject newCDROutputObject(
final ORB orb, final MessageMediator messageMediator,
final Message header, final byte streamFormatVersion) {
return AccessController.doPrivileged(
new PrivilegedAction<CDROutputObject>() {
@Override
public CDROutputObject run() {
return new CDROutputObject(orb, messageMediator,
header, streamFormatVersion);
}
});
}
public static CDROutputObject newCDROutputObject(
final ORB orb, final MessageMediator messageMediator,
final Message header, final byte streamFormatVersion,
final int strategy) {
return AccessController.doPrivileged(
new PrivilegedAction<CDROutputObject>() {
@Override
public CDROutputObject run() {
return new CDROutputObject(orb, messageMediator,
header, streamFormatVersion, strategy);
}
});
}
public static CDROutputObject newCDROutputObject(
final ORB orb, final CorbaMessageMediator mediator,
final GIOPVersion giopVersion, final CorbaConnection connection,
final Message header, final byte streamFormatVersion) {
return AccessController.doPrivileged(
new PrivilegedAction<CDROutputObject>() {
@Override
public CDROutputObject run() {
return new CDROutputObject(orb, mediator,
giopVersion, connection, header, streamFormatVersion);
}
});
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册