src/share/classes/com/sun/corba/se/impl/encoding/CDRInputStream_1_0.java

changeset 1618
4145ba26d9ff
parent 443
3c73273667ae
child 1655
bfd167e38830
equal deleted inserted replaced
1617:880a9f4ce67a 1618:4145ba26d9ff
1 /* 1 /*
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this 7 * published by the Free Software Foundation. Oracle designates this
30 * 30 *
31 */ 31 */
32 32
33 package com.sun.corba.se.impl.encoding; 33 package com.sun.corba.se.impl.encoding;
34 34
35 import java.io.Serializable;
35 import java.io.IOException; 36 import java.io.IOException;
36 import java.io.Serializable; 37
37 import java.io.ByteArrayInputStream;
38 import java.io.ObjectInputStream;
39 import java.io.IOException;
40 import java.io.StreamCorruptedException;
41 import java.io.OptionalDataException;
42 import java.io.IOException;
43
44 import java.util.Stack;
45
46 import java.net.URL;
47 import java.net.MalformedURLException; 38 import java.net.MalformedURLException;
48 39
49 import java.nio.ByteBuffer; 40 import java.nio.ByteBuffer;
50 41
51 import java.lang.reflect.InvocationTargetException; 42 import java.lang.reflect.InvocationTargetException;
52 import java.lang.reflect.Method; 43 import java.lang.reflect.Method;
53 44
54 import java.math.BigDecimal; 45 import java.math.BigDecimal;
55
56 import java.rmi.Remote;
57 import java.rmi.StubNotFoundException;
58 46
59 import java.security.AccessController; 47 import java.security.AccessController;
60 import java.security.PrivilegedExceptionAction; 48 import java.security.PrivilegedExceptionAction;
61 import java.security.PrivilegedActionException; 49 import java.security.PrivilegedActionException;
62 50
63 import org.omg.CORBA.SystemException; 51 import org.omg.CORBA.SystemException;
64 import org.omg.CORBA.Object;
65 import org.omg.CORBA.Principal;
66 import org.omg.CORBA.TypeCode;
67 import org.omg.CORBA.Any;
68 import org.omg.CORBA.portable.Delegate;
69 import org.omg.CORBA.portable.ValueBase; 52 import org.omg.CORBA.portable.ValueBase;
70 import org.omg.CORBA.portable.IndirectionException; 53 import org.omg.CORBA.portable.IndirectionException;
71 import org.omg.CORBA.CompletionStatus; 54 import org.omg.CORBA.CompletionStatus;
72 import org.omg.CORBA.TCKind; 55 import org.omg.CORBA.TCKind;
73 import org.omg.CORBA.TypeCodePackage.BadKind; 56 import org.omg.CORBA.TypeCodePackage.BadKind;
80 import org.omg.CORBA.portable.CustomValue; 63 import org.omg.CORBA.portable.CustomValue;
81 import org.omg.CORBA.portable.StreamableValue; 64 import org.omg.CORBA.portable.StreamableValue;
82 import org.omg.CORBA.MARSHAL; 65 import org.omg.CORBA.MARSHAL;
83 import org.omg.CORBA.portable.IDLEntity; 66 import org.omg.CORBA.portable.IDLEntity;
84 67
85 import javax.rmi.PortableRemoteObject;
86 import javax.rmi.CORBA.Tie; 68 import javax.rmi.CORBA.Tie;
87 import javax.rmi.CORBA.Util;
88 import javax.rmi.CORBA.ValueHandler; 69 import javax.rmi.CORBA.ValueHandler;
89 70
90 import com.sun.corba.se.pept.protocol.MessageMediator; 71 import com.sun.corba.se.pept.protocol.MessageMediator;
91 import com.sun.corba.se.pept.transport.ByteBufferPool; 72 import com.sun.corba.se.pept.transport.ByteBufferPool;
92 73
93 import com.sun.corba.se.spi.protocol.RequestDispatcherRegistry;
94 import com.sun.corba.se.spi.protocol.CorbaClientDelegate; 74 import com.sun.corba.se.spi.protocol.CorbaClientDelegate;
95 75
96 import com.sun.corba.se.spi.ior.IOR; 76 import com.sun.corba.se.spi.ior.IOR;
97 import com.sun.corba.se.spi.ior.IORFactories; 77 import com.sun.corba.se.spi.ior.IORFactories;
98 import com.sun.corba.se.spi.ior.iiop.GIOPVersion; 78 import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
99 79
100 import com.sun.corba.se.spi.orb.ORB; 80 import com.sun.corba.se.spi.orb.ORB;
101 import com.sun.corba.se.spi.orb.ORBVersionFactory; 81 import com.sun.corba.se.spi.orb.ORBVersionFactory;
102 import com.sun.corba.se.spi.orb.ORBVersion;
103
104 import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
105 82
106 import com.sun.corba.se.spi.logging.CORBALogDomains; 83 import com.sun.corba.se.spi.logging.CORBALogDomains;
107 import com.sun.corba.se.spi.presentation.rmi.PresentationManager; 84 import com.sun.corba.se.spi.presentation.rmi.PresentationManager;
108 import com.sun.corba.se.spi.presentation.rmi.StubAdapter; 85 import com.sun.corba.se.spi.presentation.rmi.StubAdapter;
109 import com.sun.corba.se.spi.presentation.rmi.PresentationDefaults; 86 import com.sun.corba.se.spi.presentation.rmi.PresentationDefaults;
723 // clz is a stub class iff StubAdapter.isStubClass( clz ). 700 // clz is a stub class iff StubAdapter.isStubClass( clz ).
724 // In addition, clz is a IDL stub class iff 701 // In addition, clz is a IDL stub class iff
725 // IDLEntity.class.isAssignableFrom( clz ). 702 // IDLEntity.class.isAssignableFrom( clz ).
726 // 3. If clz is an interface, use it to create the appropriate 703 // 3. If clz is an interface, use it to create the appropriate
727 // stub factory. 704 // stub factory.
705
728 public org.omg.CORBA.Object read_Object(Class clz) 706 public org.omg.CORBA.Object read_Object(Class clz)
729 { 707 {
730 // In any case, we must first read the IOR. 708 // In any case, we must first read the IOR.
731 IOR ior = IORFactories.makeIOR(parent) ; 709 IOR ior = IORFactories.makeIOR(parent) ;
732 if (ior.isNil()) 710 if (ior.isNil()) {
733 return null ; 711 return null ;
712 }
734 713
735 PresentationManager.StubFactoryFactory sff = ORB.getStubFactoryFactory() ; 714 PresentationManager.StubFactoryFactory sff = ORB.getStubFactoryFactory() ;
736 String codeBase = ior.getProfile().getCodebase() ; 715 String codeBase = ior.getProfile().getCodebase() ;
737 PresentationManager.StubFactory stubFactory = null ; 716 PresentationManager.StubFactory stubFactory = null ;
738 717
739 if (clz == null) { 718 if (clz == null) {
740 RepositoryId rid = RepositoryId.cache.getId( ior.getTypeId() ) ; 719 RepositoryId rid = RepositoryId.cache.getId( ior.getTypeId() ) ;
741 String className = rid.getClassName() ; 720 String className = rid.getClassName() ;
721 orb.validateIORClass(className);
742 boolean isIDLInterface = rid.isIDLType() ; 722 boolean isIDLInterface = rid.isIDLType() ;
743 723
744 if (className == null || className.equals( "" )) 724 if (className == null || className.equals( "" ))
745 stubFactory = null ; 725 stubFactory = null ;
746 else 726 else
759 stubFactory = PresentationDefaults.makeStaticStubFactory( 739 stubFactory = PresentationDefaults.makeStaticStubFactory(
760 clz ) ; 740 clz ) ;
761 } else { 741 } else {
762 // clz is an interface class 742 // clz is an interface class
763 boolean isIDL = IDLEntity.class.isAssignableFrom( clz ) ; 743 boolean isIDL = IDLEntity.class.isAssignableFrom( clz ) ;
764
765 stubFactory = sff.createStubFactory( clz.getName(), 744 stubFactory = sff.createStubFactory( clz.getName(),
766 isIDL, codeBase, clz, clz.getClassLoader() ) ; 745 isIDL, codeBase, clz, clz.getClassLoader() ) ;
767 } 746 }
768
769 return internalIORToObject( ior, stubFactory, orb ) ; 747 return internalIORToObject( ior, stubFactory, orb ) ;
770 } 748 }
771 749
772 /* 750 /*
773 * This is used as a general utility (e.g., the PortableInterceptor 751 * This is used as a general utility (e.g., the PortableInterceptor

mercurial