Tue, 19 Feb 2013 21:44:41 +0100
Merge
1.1 --- a/make/com/sun/corba/minclude/com_sun_corba_se_impl_orbutil.jmk Fri Feb 15 01:49:36 2013 +0400 1.2 +++ b/make/com/sun/corba/minclude/com_sun_corba_se_impl_orbutil.jmk Tue Feb 19 21:44:41 2013 +0100 1.3 @@ -1,5 +1,5 @@ 1.4 # 1.5 -# Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved. 1.6 +# Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. 1.7 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 # 1.9 # This code is free software; you can redistribute it and/or modify it 1.10 @@ -29,10 +29,6 @@ 1.11 com/sun/corba/se/impl/orbutil/DenseIntMapImpl.java \ 1.12 com/sun/corba/se/impl/orbutil/GetPropertyAction.java \ 1.13 com/sun/corba/se/impl/orbutil/HexOutputStream.java \ 1.14 - com/sun/corba/se/impl/orbutil/IIOPInputStream_1_3.java \ 1.15 - com/sun/corba/se/impl/orbutil/IIOPInputStream_1_3_1.java \ 1.16 - com/sun/corba/se/impl/orbutil/IIOPOutputStream_1_3.java \ 1.17 - com/sun/corba/se/impl/orbutil/IIOPOutputStream_1_3_1.java \ 1.18 com/sun/corba/se/impl/orbutil/LegacyHookGetFields.java \ 1.19 com/sun/corba/se/impl/orbutil/LegacyHookPutFields.java \ 1.20 com/sun/corba/se/impl/orbutil/LogKeywords.java \ 1.21 @@ -45,19 +41,11 @@ 1.22 com/sun/corba/se/impl/orbutil/ORBUtility.java \ 1.23 com/sun/corba/se/impl/orbutil/ORBClassLoader.java \ 1.24 com/sun/corba/se/impl/orbutil/RepIdDelegator.java \ 1.25 - com/sun/corba/se/impl/orbutil/RepIdDelegator_1_3.java \ 1.26 - com/sun/corba/se/impl/orbutil/RepIdDelegator_1_3_1.java \ 1.27 - com/sun/corba/se/impl/orbutil/RepositoryIdCache_1_3.java \ 1.28 - com/sun/corba/se/impl/orbutil/RepositoryId_1_3.java \ 1.29 com/sun/corba/se/impl/orbutil/RepositoryIdFactory.java \ 1.30 com/sun/corba/se/impl/orbutil/RepositoryIdStrings.java \ 1.31 com/sun/corba/se/impl/orbutil/RepositoryIdUtility.java \ 1.32 com/sun/corba/se/impl/orbutil/RepositoryIdInterface.java \ 1.33 - com/sun/corba/se/impl/orbutil/RepositoryIdCache_1_3_1.java \ 1.34 - com/sun/corba/se/impl/orbutil/RepositoryId_1_3_1.java \ 1.35 com/sun/corba/se/impl/orbutil/StackImpl.java \ 1.36 - com/sun/corba/se/impl/orbutil/ValueHandlerImpl_1_3_1.java \ 1.37 - com/sun/corba/se/impl/orbutil/ValueHandlerImpl_1_3.java \ 1.38 com/sun/corba/se/impl/orbutil/closure/Future.java \ 1.39 com/sun/corba/se/impl/orbutil/closure/Constant.java \ 1.40 com/sun/corba/se/impl/orbutil/concurrent/Sync.java \
2.1 --- a/src/share/classes/com/sun/corba/se/impl/activation/ServerMain.java Fri Feb 15 01:49:36 2013 +0400 2.2 +++ b/src/share/classes/com/sun/corba/se/impl/activation/ServerMain.java Tue Feb 19 21:44:41 2013 +0100 2.3 @@ -1,5 +1,5 @@ 2.4 /* 2.5 - * Copyright (c) 1997, 2002, Oracle and/or its affiliates. All rights reserved. 2.6 + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 2.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 2.8 * 2.9 * This code is free software; you can redistribute it and/or modify it 2.10 @@ -322,9 +322,9 @@ 2.11 com.sun.corba.se.spi.activation._ServerImplBase 2.12 { 2.13 private ORB orb; 2.14 - private Method installMethod ; 2.15 - private Method uninstallMethod ; 2.16 - private Method shutdownMethod ; 2.17 + private transient Method installMethod ; 2.18 + private transient Method uninstallMethod ; 2.19 + private transient Method shutdownMethod ; 2.20 private Object methodArgs[] ; 2.21 2.22 ServerCallback(ORB orb, Method installMethod, Method uninstallMethod,
3.1 --- a/src/share/classes/com/sun/corba/se/impl/corba/AnyImpl.java Fri Feb 15 01:49:36 2013 +0400 3.2 +++ b/src/share/classes/com/sun/corba/se/impl/corba/AnyImpl.java Tue Feb 19 21:44:41 2013 +0100 3.3 @@ -1,5 +1,5 @@ 3.4 /* 3.5 - * Copyright (c) 1997, 2004, Oracle and/or its affiliates. All rights reserved. 3.6 + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 3.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3.8 * 3.9 * This code is free software; you can redistribute it and/or modify it 3.10 @@ -1218,7 +1218,7 @@ 3.11 // See bug 4391648 for more info about the tcORB in this 3.12 // case. 3.13 RepositoryIdStrings repStrs 3.14 - = RepositoryIdFactory.getRepIdStringsFactory(tcORB); 3.15 + = RepositoryIdFactory.getRepIdStringsFactory(); 3.16 3.17 3.18 // Assertion: c instanceof Serializable? 3.19 @@ -1251,7 +1251,7 @@ 3.20 // Anything else 3.21 // We know that this is a TypeCodeImpl since it is our ORB 3.22 classTC = (TypeCodeImpl)ValueUtility.createTypeCodeForClass( 3.23 - tcORB, c, ORBUtility.createValueHandler(tcORB)); 3.24 + tcORB, c, ORBUtility.createValueHandler()); 3.25 // Intruct classTC to store its buffer 3.26 classTC.setCaching(true); 3.27 // Update the cache
4.1 --- a/src/share/classes/com/sun/corba/se/impl/encoding/CDRInputStream_1_0.java Fri Feb 15 01:49:36 2013 +0400 4.2 +++ b/src/share/classes/com/sun/corba/se/impl/encoding/CDRInputStream_1_0.java Tue Feb 19 21:44:41 2013 +0100 4.3 @@ -1,5 +1,5 @@ 4.4 /* 4.5 - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. 4.6 + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 4.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4.8 * 4.9 * This code is free software; you can redistribute it and/or modify it 4.10 @@ -269,8 +269,8 @@ 4.11 4.12 private final void createRepositoryIdHandlers() 4.13 { 4.14 - repIdUtil = RepositoryIdFactory.getRepIdUtility(orb); 4.15 - repIdStrs = RepositoryIdFactory.getRepIdStringsFactory(orb); 4.16 + repIdUtil = RepositoryIdFactory.getRepIdUtility(); 4.17 + repIdStrs = RepositoryIdFactory.getRepIdStringsFactory(); 4.18 } 4.19 4.20 public GIOPVersion getGIOPVersion() { 4.21 @@ -564,10 +564,7 @@ 4.22 4.23 checkForNegativeLength(len); 4.24 4.25 - if (orb != null && ORBUtility.isLegacyORB((ORB)orb)) 4.26 - return legacyReadString(len); 4.27 - else 4.28 - return internalReadString(len); 4.29 + return internalReadString(len); 4.30 } 4.31 4.32 private final String internalReadString(int len) { 4.33 @@ -588,54 +585,6 @@ 4.34 return new String(result, 0, getCharConverter().getNumChars()); 4.35 } 4.36 4.37 - private final String legacyReadString(int len) { 4.38 - 4.39 - // 4.40 - // Workaround for ORBs which send string lengths of 4.41 - // zero to mean empty string. 4.42 - // 4.43 - // 4.44 - // IMPORTANT: Do not replace 'new String("")' with "", it may result 4.45 - // in a Serialization bug (See serialization.zerolengthstring) and 4.46 - // bug id: 4728756 for details 4.47 - if (len == 0) 4.48 - return new String(""); 4.49 - 4.50 - len--; 4.51 - char[] c = new char[len]; 4.52 - 4.53 - int n = 0; 4.54 - while (n < len) { 4.55 - int avail; 4.56 - int bytes; 4.57 - int wanted; 4.58 - 4.59 - avail = bbwi.buflen - bbwi.position(); 4.60 - if (avail <= 0) { 4.61 - grow(1, 1); 4.62 - avail = bbwi.buflen - bbwi.position(); 4.63 - } 4.64 - wanted = len - n; 4.65 - bytes = (wanted < avail) ? wanted : avail; 4.66 - // Microbenchmarks are showing a loop of ByteBuffer.get(int) being 4.67 - // faster than ByteBuffer.get(byte[], int, int). 4.68 - for (int i=0; i<bytes; i++) { 4.69 - c[n+i] = (char) (bbwi.byteBuffer.get(bbwi.position()+i) & 0xFF); 4.70 - } 4.71 - bbwi.position(bbwi.position() + bytes); 4.72 - n += bytes; 4.73 - } 4.74 - 4.75 - // 4.76 - // Skip past terminating null byte 4.77 - // 4.78 - if (bbwi.position() + 1 > bbwi.buflen) 4.79 - alignAndCheck(1, 1); 4.80 - bbwi.position(bbwi.position() + 1); 4.81 - 4.82 - return new String(c); 4.83 - } 4.84 - 4.85 public final String read_string() { 4.86 return readStringOrIndirection(false); 4.87 } 4.88 @@ -1045,7 +994,7 @@ 4.89 4.90 try { 4.91 if (valueHandler == null) 4.92 - valueHandler = ORBUtility.createValueHandler(orb); 4.93 + valueHandler = ORBUtility.createValueHandler(); 4.94 4.95 value = valueHandler.readValue(parent, 4.96 indirection,
5.1 --- a/src/share/classes/com/sun/corba/se/impl/encoding/CDROutputStream_1_0.java Fri Feb 15 01:49:36 2013 +0400 5.2 +++ b/src/share/classes/com/sun/corba/se/impl/encoding/CDROutputStream_1_0.java Tue Feb 19 21:44:41 2013 +0100 5.3 @@ -1,5 +1,5 @@ 5.4 /* 5.5 - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. 5.6 + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 5.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5.8 * 5.9 * This code is free software; you can redistribute it and/or modify it 5.10 @@ -189,18 +189,8 @@ 5.11 5.12 private final void createRepositoryIdHandlers() 5.13 { 5.14 - if (orb != null) { 5.15 - // Get the appropriate versions based on the ORB version. The 5.16 - // ORB versioning info is only in the core ORB. 5.17 - repIdUtil 5.18 - = RepositoryIdFactory.getRepIdUtility(orb); 5.19 - repIdStrs 5.20 - = RepositoryIdFactory.getRepIdStringsFactory(orb); 5.21 - } else { 5.22 - // Get the latest versions 5.23 - repIdUtil = RepositoryIdFactory.getRepIdUtility(); 5.24 - repIdStrs = RepositoryIdFactory.getRepIdStringsFactory(); 5.25 - } 5.26 + repIdUtil = RepositoryIdFactory.getRepIdUtility(); 5.27 + repIdStrs = RepositoryIdFactory.getRepIdStringsFactory(); 5.28 } 5.29 5.30 public BufferManagerWrite getBufferManager() 5.31 @@ -705,7 +695,7 @@ 5.32 private void writeArray(Serializable array, Class clazz) { 5.33 5.34 if (valueHandler == null) 5.35 - valueHandler = ORBUtility.createValueHandler(orb); //d11638 5.36 + valueHandler = ORBUtility.createValueHandler(); //d11638 5.37 5.38 // Write value_tag 5.39 int indirection = writeValueTag(mustChunk, true, 5.40 @@ -768,7 +758,7 @@ 5.41 5.42 private void writeRMIIIOPValueType(Serializable object, Class clazz) { 5.43 if (valueHandler == null) 5.44 - valueHandler = ORBUtility.createValueHandler(orb); //d11638 5.45 + valueHandler = ORBUtility.createValueHandler(); //d11638 5.46 5.47 Serializable key = object; 5.48
6.1 --- a/src/share/classes/com/sun/corba/se/impl/io/FVDCodeBaseImpl.java Fri Feb 15 01:49:36 2013 +0400 6.2 +++ b/src/share/classes/com/sun/corba/se/impl/io/FVDCodeBaseImpl.java Tue Feb 19 21:44:41 2013 +0100 6.3 @@ -1,5 +1,5 @@ 6.4 /* 6.5 - * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved. 6.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. 6.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6.8 * 6.9 * This code is free software; you can redistribute it and/or modify it 6.10 @@ -86,7 +86,7 @@ 6.11 // default to using the current ORB version in case the 6.12 // vhandler is not set 6.13 if (vhandler == null) { 6.14 - vhandler = new ValueHandlerImpl(false); 6.15 + vhandler = ValueHandlerImpl.getInstance(false); 6.16 } 6.17 6.18 // Util.getCodebase may return null which would 6.19 @@ -120,7 +120,7 @@ 6.20 // default to using the current ORB version in case the 6.21 // vhandler is not set 6.22 if (vhandler == null) { 6.23 - vhandler = new ValueHandlerImpl(false); 6.24 + vhandler = ValueHandlerImpl.getInstance(false); 6.25 } 6.26 6.27 try{ 6.28 @@ -161,7 +161,7 @@ 6.29 // default to using the current ORB version in case the 6.30 // vhandler is not set 6.31 if (vhandler == null) { 6.32 - vhandler = new ValueHandlerImpl(false); 6.33 + vhandler = ValueHandlerImpl.getInstance(false); 6.34 } 6.35 6.36 Stack repIds = new Stack();
7.1 --- a/src/share/classes/com/sun/corba/se/impl/io/ObjectStreamClass.java Fri Feb 15 01:49:36 2013 +0400 7.2 +++ b/src/share/classes/com/sun/corba/se/impl/io/ObjectStreamClass.java Tue Feb 19 21:44:41 2013 +0100 7.3 @@ -1,5 +1,5 @@ 7.4 /* 7.5 - * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. 7.6 + * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. 7.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 7.8 * 7.9 * This code is free software; you can redistribute it and/or modify it 7.10 @@ -25,7 +25,7 @@ 7.11 /* 7.12 * Licensed Materials - Property of IBM 7.13 * RMI-IIOP v1.0 7.14 - * Copyright IBM Corp. 1998 1999 All Rights Reserved 7.15 + * Copyright IBM Corp. 1998 2012 All Rights Reserved 7.16 * 7.17 */ 7.18 7.19 @@ -56,7 +56,6 @@ 7.20 7.21 import java.util.Arrays; 7.22 import java.util.Comparator; 7.23 -import java.util.Hashtable; 7.24 7.25 import com.sun.corba.se.impl.util.RepositoryId; 7.26 7.27 @@ -83,8 +82,6 @@ 7.28 private static Object noArgsList[] = {}; 7.29 private static Class noTypesList[] = {}; 7.30 7.31 - private static Hashtable translatedFields; 7.32 - 7.33 /** true if represents enum type */ 7.34 private boolean isEnum; 7.35 7.36 @@ -384,6 +381,42 @@ 7.37 */ 7.38 } 7.39 7.40 + private static final class PersistentFieldsValue 7.41 + extends ClassValue<ObjectStreamField[]> { 7.42 + PersistentFieldsValue() { } 7.43 + 7.44 + protected ObjectStreamField[] computeValue(Class<?> type) { 7.45 + try { 7.46 + Field pf = type.getDeclaredField("serialPersistentFields"); 7.47 + int mods = pf.getModifiers(); 7.48 + if (Modifier.isPrivate(mods) && Modifier.isStatic(mods) && 7.49 + Modifier.isFinal(mods)) { 7.50 + pf.setAccessible(true); 7.51 + java.io.ObjectStreamField[] fields = 7.52 + (java.io.ObjectStreamField[])pf.get(type); 7.53 + return translateFields(fields); 7.54 + } 7.55 + } catch (NoSuchFieldException | IllegalAccessException | 7.56 + IllegalArgumentException | ClassCastException e) { 7.57 + } 7.58 + return null; 7.59 + } 7.60 + 7.61 + private static ObjectStreamField[] translateFields( 7.62 + java.io.ObjectStreamField[] fields) { 7.63 + ObjectStreamField[] translation = 7.64 + new ObjectStreamField[fields.length]; 7.65 + for (int i = 0; i < fields.length; i++) { 7.66 + translation[i] = new ObjectStreamField(fields[i].getName(), 7.67 + fields[i].getType()); 7.68 + } 7.69 + return translation; 7.70 + } 7.71 + } 7.72 + 7.73 + private static final PersistentFieldsValue persistentFieldsValue = 7.74 + new PersistentFieldsValue(); 7.75 + 7.76 /* 7.77 * Initialize class descriptor. This method is only invoked on class 7.78 * descriptors created via calls to lookupInternal(). This method is kept 7.79 @@ -416,35 +449,7 @@ 7.80 * If it is declared, use the declared serialPersistentFields. 7.81 * Otherwise, extract the fields from the class itself. 7.82 */ 7.83 - try { 7.84 - Field pf = cl.getDeclaredField("serialPersistentFields"); 7.85 - // serial bug 7; the serialPersistentFields were not 7.86 - // being read and stored as Accessible bit was not set 7.87 - pf.setAccessible(true); 7.88 - // serial bug 7; need to find if the field is of type 7.89 - // java.io.ObjectStreamField 7.90 - java.io.ObjectStreamField[] f = 7.91 - (java.io.ObjectStreamField[])pf.get(cl); 7.92 - int mods = pf.getModifiers(); 7.93 - if ((Modifier.isPrivate(mods)) && 7.94 - (Modifier.isStatic(mods)) && 7.95 - (Modifier.isFinal(mods))) 7.96 - { 7.97 - fields = (ObjectStreamField[])translateFields((Object[])pf.get(cl)); 7.98 - } 7.99 - } catch (NoSuchFieldException e) { 7.100 - fields = null; 7.101 - } catch (IllegalAccessException e) { 7.102 - fields = null; 7.103 - } catch (IllegalArgumentException e) { 7.104 - fields = null; 7.105 - } catch (ClassCastException e) { 7.106 - /* Thrown if a field serialPersistentField exists 7.107 - * but it is not of type ObjectStreamField. 7.108 - */ 7.109 - fields = null; 7.110 - } 7.111 - 7.112 + fields = persistentFieldsValue.get(cl); 7.113 7.114 if (fields == null) { 7.115 /* Get all of the declared fields for this 7.116 @@ -641,43 +646,6 @@ 7.117 superclass = null; 7.118 } 7.119 7.120 - private static Object[] translateFields(Object objs[]) 7.121 - throws NoSuchFieldException { 7.122 - try{ 7.123 - java.io.ObjectStreamField fields[] = (java.io.ObjectStreamField[])objs; 7.124 - Object translation[] = null; 7.125 - 7.126 - if (translatedFields == null) 7.127 - translatedFields = new Hashtable(); 7.128 - 7.129 - translation = (Object[])translatedFields.get(fields); 7.130 - 7.131 - if (translation != null) 7.132 - return translation; 7.133 - else { 7.134 - Class osfClass = Class.forName("com.sun.corba.se.impl.io.ObjectStreamField"); 7.135 - translation = (Object[])java.lang.reflect.Array.newInstance(osfClass, objs.length); 7.136 - Object arg[] = new Object[2]; 7.137 - Class types[] = {String.class, Class.class}; 7.138 - Constructor constructor = osfClass.getDeclaredConstructor(types); 7.139 - for (int i = fields.length -1; i >= 0; i--){ 7.140 - arg[0] = fields[i].getName(); 7.141 - arg[1] = fields[i].getType(); 7.142 - 7.143 - translation[i] = constructor.newInstance(arg); 7.144 - } 7.145 - translatedFields.put(fields, translation); 7.146 - 7.147 - } 7.148 - 7.149 - return (Object[])translation; 7.150 - } 7.151 - catch(Throwable t){ 7.152 - NoSuchFieldException nsfe = new NoSuchFieldException(); 7.153 - nsfe.initCause( t ) ; 7.154 - throw nsfe ; 7.155 - } 7.156 - } 7.157 7.158 /* 7.159 * Set the class this version descriptor matches. 7.160 @@ -1555,8 +1523,8 @@ 7.161 private boolean hasExternalizableBlockData; 7.162 Method writeObjectMethod; 7.163 Method readObjectMethod; 7.164 - private Method writeReplaceObjectMethod; 7.165 - private Method readResolveObjectMethod; 7.166 + private transient Method writeReplaceObjectMethod; 7.167 + private transient Method readResolveObjectMethod; 7.168 private Constructor cons ; 7.169 7.170 /**
8.1 --- a/src/share/classes/com/sun/corba/se/impl/io/ValueHandlerImpl.java Fri Feb 15 01:49:36 2013 +0400 8.2 +++ b/src/share/classes/com/sun/corba/se/impl/io/ValueHandlerImpl.java Tue Feb 19 21:44:41 2013 +0100 8.3 @@ -1,5 +1,5 @@ 8.4 /* 8.5 - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. 8.6 + * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. 8.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 8.8 * 8.9 * This code is free software; you can redistribute it and/or modify it 8.10 @@ -53,7 +53,7 @@ 8.11 import com.sun.corba.se.impl.logging.OMGSystemException; 8.12 import com.sun.corba.se.impl.logging.UtilSystemException; 8.13 8.14 -public class ValueHandlerImpl implements javax.rmi.CORBA.ValueHandlerMultiFormat { 8.15 +public final class ValueHandlerImpl implements javax.rmi.CORBA.ValueHandlerMultiFormat { 8.16 8.17 // Property to override our maximum stream format version 8.18 public static final String FORMAT_VERSION_PROPERTY 8.19 @@ -150,14 +150,22 @@ 8.20 writeValueWithVersion(out, value, streamFormatVersion); 8.21 } 8.22 8.23 - public ValueHandlerImpl(){} 8.24 + private ValueHandlerImpl(){} 8.25 8.26 - public ValueHandlerImpl(boolean isInputStream) { 8.27 + private ValueHandlerImpl(boolean isInputStream) { 8.28 this(); 8.29 useHashtables = false; 8.30 this.isInputStream = isInputStream; 8.31 } 8.32 8.33 + static ValueHandlerImpl getInstance() { 8.34 + return new ValueHandlerImpl(); 8.35 + } 8.36 + 8.37 + static ValueHandlerImpl getInstance(boolean isInputStream) { 8.38 + return new ValueHandlerImpl(isInputStream); 8.39 + } 8.40 + 8.41 /** 8.42 * Writes the value to the stream using java semantics. 8.43 * @param out The stream to write the value to 8.44 @@ -458,12 +466,7 @@ 8.45 return ObjectStreamClass.lookup(value.getClass()).writeReplace(value); 8.46 } 8.47 8.48 - /** 8.49 - * Encapsulates writing of Java char arrays so that the 1.3 subclass 8.50 - * can override it without exposing internals across packages. This 8.51 - * is a fix for bug 4367783. 8.52 - */ 8.53 - protected void writeCharArray(org.omg.CORBA_2_3.portable.OutputStream out, 8.54 + private void writeCharArray(org.omg.CORBA_2_3.portable.OutputStream out, 8.55 char[] array, 8.56 int offset, 8.57 int length) 8.58 @@ -576,12 +579,7 @@ 8.59 } 8.60 } 8.61 8.62 - /** 8.63 - * Encapsulates reading of Java char arrays so that the 1.3 subclass 8.64 - * can override it without exposing internals across packages. This 8.65 - * is a fix for bug 4367783. 8.66 - */ 8.67 - protected void readCharArray(org.omg.CORBA_2_3.portable.InputStream in, 8.68 + private void readCharArray(org.omg.CORBA_2_3.portable.InputStream in, 8.69 char[] array, 8.70 int offset, 8.71 int length) 8.72 @@ -795,7 +793,7 @@ 8.73 return RepositoryId.cache.getId(repId).isSequence(); 8.74 } 8.75 8.76 - protected String getOutputStreamClassName() { 8.77 + private String getOutputStreamClassName() { 8.78 return "com.sun.corba.se.impl.io.IIOPOutputStream"; 8.79 } 8.80 8.81 @@ -843,29 +841,11 @@ 8.82 private IIOPOutputStream createOutputStreamBuiltInNoPriv( 8.83 final String name 8.84 ) throws IOException { 8.85 - return 8.86 - name.equals( 8.87 - IIOPOutputStream 8.88 - .class.getName() 8.89 - ) ? 8.90 - new IIOPOutputStream() : 8.91 - 8.92 - name.equals( 8.93 - com.sun.corba.se.impl.orbutil.IIOPOutputStream_1_3 8.94 - .class.getName() 8.95 - ) ? 8.96 - new com.sun.corba.se.impl.orbutil.IIOPOutputStream_1_3() : 8.97 - 8.98 - name.equals( 8.99 - com.sun.corba.se.impl.orbutil.IIOPOutputStream_1_3_1 8.100 - .class.getName() 8.101 - ) ? 8.102 - new com.sun.corba.se.impl.orbutil.IIOPOutputStream_1_3_1() : 8.103 - 8.104 - null; 8.105 + return name.equals(IIOPOutputStream.class.getName()) ? 8.106 + new IIOPOutputStream() : null; 8.107 } 8.108 8.109 - protected String getInputStreamClassName() { 8.110 + private String getInputStreamClassName() { 8.111 return "com.sun.corba.se.impl.io.IIOPInputStream"; 8.112 } 8.113 8.114 @@ -913,26 +893,8 @@ 8.115 private IIOPInputStream createInputStreamBuiltInNoPriv( 8.116 final String name 8.117 ) throws IOException { 8.118 - return 8.119 - name.equals( 8.120 - IIOPInputStream 8.121 - .class.getName() 8.122 - ) ? 8.123 - new IIOPInputStream() : 8.124 - 8.125 - name.equals( 8.126 - com.sun.corba.se.impl.orbutil.IIOPInputStream_1_3 8.127 - .class.getName() 8.128 - ) ? 8.129 - new com.sun.corba.se.impl.orbutil.IIOPInputStream_1_3() : 8.130 - 8.131 - name.equals( 8.132 - com.sun.corba.se.impl.orbutil.IIOPInputStream_1_3_1 8.133 - .class.getName() 8.134 - ) ? 8.135 - new com.sun.corba.se.impl.orbutil.IIOPInputStream_1_3_1() : 8.136 - 8.137 - null; 8.138 + return name.equals(IIOPInputStream.class.getName()) ? 8.139 + new IIOPInputStream() : null; 8.140 } 8.141 8.142 /** 8.143 @@ -958,12 +920,7 @@ 8.144 8.145 } 8.146 8.147 - /** 8.148 - * Our JDK 1.3 and JDK 1.3.1 behavior subclasses override this. 8.149 - * The correct behavior is for a Java char to map to a CORBA wchar, 8.150 - * but our older code mapped it to a CORBA char. 8.151 - */ 8.152 - protected TCKind getJavaCharTCKind() { 8.153 + TCKind getJavaCharTCKind() { 8.154 return TCKind.tk_wchar; 8.155 } 8.156 }
9.1 --- a/src/share/classes/com/sun/corba/se/impl/io/ValueUtility.java Fri Feb 15 01:49:36 2013 +0400 9.2 +++ b/src/share/classes/com/sun/corba/se/impl/io/ValueUtility.java Tue Feb 19 21:44:41 2013 +0100 9.3 @@ -1,5 +1,5 @@ 9.4 /* 9.5 - * Copyright (c) 1999, 2002, Oracle and/or its affiliates. All rights reserved. 9.6 + * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. 9.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 9.8 * 9.9 * This code is free software; you can redistribute it and/or modify it 9.10 @@ -93,6 +93,14 @@ 9.11 null, // tk_abstract_interface 32 9.12 }; 9.13 9.14 + static { 9.15 + sun.corba.SharedSecrets.setJavaCorbaAccess(new sun.corba.JavaCorbaAccess() { 9.16 + public ValueHandlerImpl newValueHandlerImpl() { 9.17 + return ValueHandlerImpl.getInstance(); 9.18 + } 9.19 + }); 9.20 + } 9.21 + 9.22 public static String getSignature(ValueMember member) 9.23 throws ClassNotFoundException { 9.24
10.1 --- a/src/share/classes/com/sun/corba/se/impl/javax/rmi/CORBA/Util.java Fri Feb 15 01:49:36 2013 +0400 10.2 +++ b/src/share/classes/com/sun/corba/se/impl/javax/rmi/CORBA/Util.java Tue Feb 19 21:44:41 2013 +0100 10.3 @@ -112,6 +112,9 @@ 10.4 import com.sun.corba.se.impl.orbutil.ORBClassLoader; 10.5 import com.sun.corba.se.impl.logging.UtilSystemException; 10.6 import com.sun.corba.se.spi.logging.CORBALogDomains; 10.7 +import sun.corba.SharedSecrets; 10.8 +import sun.corba.JavaCorbaAccess; 10.9 + 10.10 10.11 /** 10.12 * Provides utility methods that can be used by stubs and ties to 10.13 @@ -125,7 +128,8 @@ 10.14 // Maps targets to ties. 10.15 private static IdentityHashtable exportedServants = new IdentityHashtable(); 10.16 10.17 - private static ValueHandlerImpl valueHandlerSingleton = new ValueHandlerImpl(); 10.18 + private static final ValueHandlerImpl valueHandlerSingleton = 10.19 + SharedSecrets.getJavaCorbaAccess().newValueHandlerImpl(); 10.20 10.21 private UtilSystemException utilWrapper = UtilSystemException.get( 10.22 CORBALogDomains.RPC_ENCODING);
11.1 --- a/src/share/classes/com/sun/corba/se/impl/orb/ORBImpl.java Fri Feb 15 01:49:36 2013 +0400 11.2 +++ b/src/share/classes/com/sun/corba/se/impl/orb/ORBImpl.java Tue Feb 19 21:44:41 2013 +0100 11.3 @@ -840,7 +840,7 @@ 11.4 // backward compatability 4365188 11.5 CodeBase cb; 11.6 11.7 - ValueHandler vh = ORBUtility.createValueHandler(this); 11.8 + ValueHandler vh = ORBUtility.createValueHandler(); 11.9 11.10 cb = (CodeBase)vh.getRunTimeCodeBase(); 11.11 return ORBUtility.connectAndGetIOR( this, cb ) ;
12.1 --- a/src/share/classes/com/sun/corba/se/impl/orbutil/IIOPInputStream_1_3.java Fri Feb 15 01:49:36 2013 +0400 12.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 12.3 @@ -1,57 +0,0 @@ 12.4 -/* 12.5 - * Copyright (c) 2000, 2002, Oracle and/or its affiliates. All rights reserved. 12.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 12.7 - * 12.8 - * This code is free software; you can redistribute it and/or modify it 12.9 - * under the terms of the GNU General Public License version 2 only, as 12.10 - * published by the Free Software Foundation. Oracle designates this 12.11 - * particular file as subject to the "Classpath" exception as provided 12.12 - * by Oracle in the LICENSE file that accompanied this code. 12.13 - * 12.14 - * This code is distributed in the hope that it will be useful, but WITHOUT 12.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12.17 - * version 2 for more details (a copy is included in the LICENSE file that 12.18 - * accompanied this code). 12.19 - * 12.20 - * You should have received a copy of the GNU General Public License version 12.21 - * 2 along with this work; if not, write to the Free Software Foundation, 12.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 12.23 - * 12.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 12.25 - * or visit www.oracle.com if you need additional information or have any 12.26 - * questions. 12.27 - */ 12.28 -package com.sun.corba.se.impl.orbutil; 12.29 - 12.30 -import java.io.*; 12.31 -import java.util.Hashtable; 12.32 - 12.33 -/** 12.34 - * Implements legacy behavior from before Ladybird to maintain 12.35 - * backwards compatibility. 12.36 - */ 12.37 -public class IIOPInputStream_1_3 extends com.sun.corba.se.impl.io.IIOPInputStream 12.38 -{ 12.39 - // The newer version in the io package correctly reads a wstring instead. 12.40 - // This concerns bug 4379597. 12.41 - protected String internalReadUTF(org.omg.CORBA.portable.InputStream stream) 12.42 - { 12.43 - return stream.read_string(); 12.44 - } 12.45 - 12.46 - /** 12.47 - * Before JDK 1.3.1_01, the PutField/GetField implementation 12.48 - * actually sent a Hashtable. 12.49 - */ 12.50 - public ObjectInputStream.GetField readFields() 12.51 - throws IOException, ClassNotFoundException, NotActiveException { 12.52 - Hashtable fields = (Hashtable)readObject(); 12.53 - return new LegacyHookGetFields(fields); 12.54 - } 12.55 - 12.56 - public IIOPInputStream_1_3() 12.57 - throws java.io.IOException { 12.58 - super(); 12.59 - } 12.60 -}
13.1 --- a/src/share/classes/com/sun/corba/se/impl/orbutil/IIOPInputStream_1_3_1.java Fri Feb 15 01:49:36 2013 +0400 13.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 13.3 @@ -1,54 +0,0 @@ 13.4 -/* 13.5 - * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved. 13.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 13.7 - * 13.8 - * This code is free software; you can redistribute it and/or modify it 13.9 - * under the terms of the GNU General Public License version 2 only, as 13.10 - * published by the Free Software Foundation. Oracle designates this 13.11 - * particular file as subject to the "Classpath" exception as provided 13.12 - * by Oracle in the LICENSE file that accompanied this code. 13.13 - * 13.14 - * This code is distributed in the hope that it will be useful, but WITHOUT 13.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13.17 - * version 2 for more details (a copy is included in the LICENSE file that 13.18 - * accompanied this code). 13.19 - * 13.20 - * You should have received a copy of the GNU General Public License version 13.21 - * 2 along with this work; if not, write to the Free Software Foundation, 13.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 13.23 - * 13.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 13.25 - * or visit www.oracle.com if you need additional information or have any 13.26 - * questions. 13.27 - */ 13.28 - 13.29 -/* 13.30 - */ 13.31 -package com.sun.corba.se.impl.orbutil; 13.32 - 13.33 -import java.io.*; 13.34 -import java.util.Hashtable; 13.35 - 13.36 -/** 13.37 - * Implements legacy behavior from Ladybird to maintain 13.38 - * backwards compatibility. 13.39 - */ 13.40 -public class IIOPInputStream_1_3_1 extends com.sun.corba.se.impl.io.IIOPInputStream 13.41 -{ 13.42 - public IIOPInputStream_1_3_1() 13.43 - throws java.io.IOException { 13.44 - super(); 13.45 - } 13.46 - 13.47 - /** 13.48 - * Before JDK 1.3.1_01, the PutField/GetField implementation 13.49 - * actually sent a Hashtable. 13.50 - */ 13.51 - public ObjectInputStream.GetField readFields() 13.52 - throws IOException, ClassNotFoundException, NotActiveException { 13.53 - 13.54 - Hashtable fields = (Hashtable)readObject(); 13.55 - return new LegacyHookGetFields(fields); 13.56 - } 13.57 -}
14.1 --- a/src/share/classes/com/sun/corba/se/impl/orbutil/IIOPOutputStream_1_3.java Fri Feb 15 01:49:36 2013 +0400 14.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 14.3 @@ -1,68 +0,0 @@ 14.4 -/* 14.5 - * Copyright (c) 2000, 2002, Oracle and/or its affiliates. All rights reserved. 14.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 14.7 - * 14.8 - * This code is free software; you can redistribute it and/or modify it 14.9 - * under the terms of the GNU General Public License version 2 only, as 14.10 - * published by the Free Software Foundation. Oracle designates this 14.11 - * particular file as subject to the "Classpath" exception as provided 14.12 - * by Oracle in the LICENSE file that accompanied this code. 14.13 - * 14.14 - * This code is distributed in the hope that it will be useful, but WITHOUT 14.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14.17 - * version 2 for more details (a copy is included in the LICENSE file that 14.18 - * accompanied this code). 14.19 - * 14.20 - * You should have received a copy of the GNU General Public License version 14.21 - * 2 along with this work; if not, write to the Free Software Foundation, 14.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 14.23 - * 14.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 14.25 - * or visit www.oracle.com if you need additional information or have any 14.26 - * questions. 14.27 - */ 14.28 -package com.sun.corba.se.impl.orbutil; 14.29 - 14.30 -import java.io.*; 14.31 - 14.32 -/** 14.33 - * Implements legacy behavior from before Ladybird to maintain 14.34 - * backwards compatibility. 14.35 - */ 14.36 -public class IIOPOutputStream_1_3 extends com.sun.corba.se.impl.io.IIOPOutputStream 14.37 -{ 14.38 - // We can't assume that the superclass's putFields 14.39 - // member will be non-private. We must allow 14.40 - // the RI to run on JDK 1.3.1 FCS as well as 14.41 - // the JDK 1.3.1_01 patch. 14.42 - private ObjectOutputStream.PutField putFields_1_3; 14.43 - 14.44 - // The newer version in the io package correctly writes a wstring instead. 14.45 - // This concerns bug 4379597. 14.46 - protected void internalWriteUTF(org.omg.CORBA.portable.OutputStream stream, 14.47 - String data) 14.48 - { 14.49 - stream.write_string(data); 14.50 - } 14.51 - 14.52 - public IIOPOutputStream_1_3() 14.53 - throws java.io.IOException { 14.54 - super(); 14.55 - } 14.56 - 14.57 - /** 14.58 - * Before JDK 1.3.1_01, the PutField/GetField implementation 14.59 - * actually sent a Hashtable. 14.60 - */ 14.61 - public ObjectOutputStream.PutField putFields() 14.62 - throws IOException { 14.63 - putFields_1_3 = new LegacyHookPutFields(); 14.64 - return putFields_1_3; 14.65 - } 14.66 - 14.67 - public void writeFields() 14.68 - throws IOException { 14.69 - putFields_1_3.write(this); 14.70 - } 14.71 -}
15.1 --- a/src/share/classes/com/sun/corba/se/impl/orbutil/IIOPOutputStream_1_3_1.java Fri Feb 15 01:49:36 2013 +0400 15.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 15.3 @@ -1,66 +0,0 @@ 15.4 -/* 15.5 - * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved. 15.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 15.7 - * 15.8 - * This code is free software; you can redistribute it and/or modify it 15.9 - * under the terms of the GNU General Public License version 2 only, as 15.10 - * published by the Free Software Foundation. Oracle designates this 15.11 - * particular file as subject to the "Classpath" exception as provided 15.12 - * by Oracle in the LICENSE file that accompanied this code. 15.13 - * 15.14 - * This code is distributed in the hope that it will be useful, but WITHOUT 15.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 15.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15.17 - * version 2 for more details (a copy is included in the LICENSE file that 15.18 - * accompanied this code). 15.19 - * 15.20 - * You should have received a copy of the GNU General Public License version 15.21 - * 2 along with this work; if not, write to the Free Software Foundation, 15.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 15.23 - * 15.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 15.25 - * or visit www.oracle.com if you need additional information or have any 15.26 - * questions. 15.27 - */ 15.28 - 15.29 -/* 15.30 - */ 15.31 -package com.sun.corba.se.impl.orbutil; 15.32 - 15.33 -import java.io.*; 15.34 -import java.util.Hashtable; 15.35 - 15.36 -/** 15.37 - * Implements legacy behavior from Ladybird to maintain 15.38 - * backwards compatibility. 15.39 - */ 15.40 -public class IIOPOutputStream_1_3_1 extends com.sun.corba.se.impl.io.IIOPOutputStream 15.41 -{ 15.42 - // We can't assume that the superclass's putFields 15.43 - // member will be non-private. We must allow 15.44 - // the RI to run on JDK 1.3.1 FCS as well as 15.45 - // the JDK 1.3.1_01 patch. 15.46 - private ObjectOutputStream.PutField putFields_1_3_1; 15.47 - 15.48 - public IIOPOutputStream_1_3_1() 15.49 - throws java.io.IOException { 15.50 - super(); 15.51 - } 15.52 - 15.53 - /** 15.54 - * Before JDK 1.3.1_01, the PutField/GetField implementation 15.55 - * actually sent a Hashtable. 15.56 - */ 15.57 - public ObjectOutputStream.PutField putFields() 15.58 - throws IOException { 15.59 - 15.60 - putFields_1_3_1 = new LegacyHookPutFields(); 15.61 - return putFields_1_3_1; 15.62 - } 15.63 - 15.64 - public void writeFields() 15.65 - throws IOException { 15.66 - 15.67 - putFields_1_3_1.write(this); 15.68 - } 15.69 -}
16.1 --- a/src/share/classes/com/sun/corba/se/impl/orbutil/ORBUtility.java Fri Feb 15 01:49:36 2013 +0400 16.2 +++ b/src/share/classes/com/sun/corba/se/impl/orbutil/ORBUtility.java Tue Feb 19 21:44:41 2013 +0100 16.3 @@ -1,5 +1,5 @@ 16.4 /* 16.5 - * Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved. 16.6 + * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. 16.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 16.8 * 16.9 * This code is free software; you can redistribute it and/or modify it 16.10 @@ -160,45 +160,13 @@ 16.11 } 16.12 16.13 /** 16.14 - * Creates the correct ValueHandler for the given ORB, 16.15 - * querying ORBVersion information. If the ORB or 16.16 - * ORBVersion is null, gets the ValueHandler from 16.17 - * Util.createValueHandler. 16.18 + * Return default ValueHandler 16.19 */ 16.20 - public static ValueHandler createValueHandler(ORB orb) { 16.21 - 16.22 - if (orb == null) 16.23 - return Util.createValueHandler(); 16.24 - 16.25 - ORBVersion version = orb.getORBVersion(); 16.26 - 16.27 - if (version == null) 16.28 - return Util.createValueHandler(); 16.29 - 16.30 - if (version.equals(ORBVersionFactory.getOLD())) 16.31 - return new ValueHandlerImpl_1_3(); 16.32 - if (version.equals(ORBVersionFactory.getNEW())) 16.33 - return new ValueHandlerImpl_1_3_1(); 16.34 - 16.35 + public static ValueHandler createValueHandler() { 16.36 return Util.createValueHandler(); 16.37 } 16.38 16.39 /** 16.40 - * Returns true if the given ORB could accurately be determined to be a 16.41 - * Kestrel or earlier ORB. Note: If passed the ORBSingleton, this will return 16.42 - * false. 16.43 - */ 16.44 - public static boolean isLegacyORB(ORB orb) 16.45 - { 16.46 - try { 16.47 - ORBVersion currentORB = orb.getORBVersion(); 16.48 - return currentORB.equals( ORBVersionFactory.getOLD() ) ; 16.49 - } catch (SecurityException se) { 16.50 - return false; 16.51 - } 16.52 - } 16.53 - 16.54 - /** 16.55 * Returns true if it was accurately determined that the remote ORB is 16.56 * a foreign (non-JavaSoft) ORB. Note: If passed the ORBSingleton, this 16.57 * will return false.
17.1 --- a/src/share/classes/com/sun/corba/se/impl/orbutil/ObjectStreamClass_1_3_1.java Fri Feb 15 01:49:36 2013 +0400 17.2 +++ b/src/share/classes/com/sun/corba/se/impl/orbutil/ObjectStreamClass_1_3_1.java Tue Feb 19 21:44:41 2013 +0100 17.3 @@ -1,5 +1,5 @@ 17.4 /* 17.5 - * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved. 17.6 + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. 17.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 17.8 * 17.9 * This code is free software; you can redistribute it and/or modify it 17.10 @@ -1119,8 +1119,8 @@ 17.11 private boolean hasExternalizableBlockData; 17.12 Method writeObjectMethod; 17.13 Method readObjectMethod; 17.14 - private Method writeReplaceObjectMethod; 17.15 - private Method readResolveObjectMethod; 17.16 + private transient Method writeReplaceObjectMethod; 17.17 + private transient Method readResolveObjectMethod; 17.18 17.19 /* 17.20 * ObjectStreamClass_1_3_1 that this one was built from.
18.1 --- a/src/share/classes/com/sun/corba/se/impl/orbutil/RepIdDelegator_1_3.java Fri Feb 15 01:49:36 2013 +0400 18.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 18.3 @@ -1,177 +0,0 @@ 18.4 -/* 18.5 - * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. 18.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 18.7 - * 18.8 - * This code is free software; you can redistribute it and/or modify it 18.9 - * under the terms of the GNU General Public License version 2 only, as 18.10 - * published by the Free Software Foundation. Oracle designates this 18.11 - * particular file as subject to the "Classpath" exception as provided 18.12 - * by Oracle in the LICENSE file that accompanied this code. 18.13 - * 18.14 - * This code is distributed in the hope that it will be useful, but WITHOUT 18.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 18.17 - * version 2 for more details (a copy is included in the LICENSE file that 18.18 - * accompanied this code). 18.19 - * 18.20 - * You should have received a copy of the GNU General Public License version 18.21 - * 2 along with this work; if not, write to the Free Software Foundation, 18.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18.23 - * 18.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 18.25 - * or visit www.oracle.com if you need additional information or have any 18.26 - * questions. 18.27 - */ 18.28 - 18.29 -package com.sun.corba.se.impl.orbutil; 18.30 - 18.31 -import org.omg.CORBA.ORB; 18.32 -import java.io.Serializable; 18.33 -import java.util.Hashtable; 18.34 -import java.net.MalformedURLException; 18.35 -import com.sun.corba.se.impl.io.TypeMismatchException; 18.36 -import com.sun.corba.se.impl.util.RepositoryId; 18.37 - 18.38 -/** 18.39 - * Delegates to the RepositoryId_1_3 implementation in 18.40 - * com.sun.corba.se.impl.orbutil. This is necessary to 18.41 - * overcome the fact that many of RepositoryId's methods 18.42 - * are static. 18.43 - */ 18.44 -public final class RepIdDelegator_1_3 18.45 - implements RepositoryIdStrings, 18.46 - RepositoryIdUtility, 18.47 - RepositoryIdInterface 18.48 -{ 18.49 - // RepositoryIdFactory methods 18.50 - 18.51 - public String createForAnyType(Class type) { 18.52 - return RepositoryId_1_3.createForAnyType(type); 18.53 - } 18.54 - 18.55 - public String createForJavaType(Serializable ser) 18.56 - throws TypeMismatchException 18.57 - { 18.58 - return RepositoryId_1_3.createForJavaType(ser); 18.59 - } 18.60 - 18.61 - public String createForJavaType(Class clz) 18.62 - throws TypeMismatchException 18.63 - { 18.64 - return RepositoryId_1_3.createForJavaType(clz); 18.65 - } 18.66 - 18.67 - public String createSequenceRepID(java.lang.Object ser) { 18.68 - return RepositoryId_1_3.createSequenceRepID(ser); 18.69 - } 18.70 - 18.71 - public String createSequenceRepID(Class clazz) { 18.72 - return RepositoryId_1_3.createSequenceRepID(clazz); 18.73 - } 18.74 - 18.75 - public RepositoryIdInterface getFromString(String repIdString) { 18.76 - return new RepIdDelegator_1_3(RepositoryId_1_3.cache.getId(repIdString)); 18.77 - } 18.78 - 18.79 - // RepositoryIdUtility methods 18.80 - 18.81 - public boolean isChunkedEncoding(int valueTag) { 18.82 - return RepositoryId.isChunkedEncoding(valueTag); 18.83 - } 18.84 - 18.85 - public boolean isCodeBasePresent(int valueTag) { 18.86 - return RepositoryId.isCodeBasePresent(valueTag); 18.87 - } 18.88 - 18.89 - public String getClassDescValueRepId() { 18.90 - return RepositoryId_1_3.kClassDescValueRepID; 18.91 - } 18.92 - 18.93 - public String getWStringValueRepId() { 18.94 - return RepositoryId_1_3.kWStringValueRepID; 18.95 - } 18.96 - 18.97 - public int getTypeInfo(int valueTag) { 18.98 - return RepositoryId.getTypeInfo(valueTag); 18.99 - } 18.100 - 18.101 - public int getStandardRMIChunkedNoRepStrId() { 18.102 - return RepositoryId.kPreComputed_StandardRMIChunked_NoRep; 18.103 - } 18.104 - 18.105 - public int getCodeBaseRMIChunkedNoRepStrId() { 18.106 - return RepositoryId.kPreComputed_CodeBaseRMIChunked_NoRep; 18.107 - } 18.108 - 18.109 - public int getStandardRMIChunkedId() { 18.110 - return RepositoryId.kPreComputed_StandardRMIChunked; 18.111 - } 18.112 - 18.113 - public int getCodeBaseRMIChunkedId() { 18.114 - return RepositoryId.kPreComputed_CodeBaseRMIChunked; 18.115 - } 18.116 - 18.117 - public int getStandardRMIUnchunkedId() { 18.118 - return RepositoryId.kPreComputed_StandardRMIUnchunked; 18.119 - } 18.120 - 18.121 - public int getCodeBaseRMIUnchunkedId() { 18.122 - return RepositoryId.kPreComputed_CodeBaseRMIUnchunked; 18.123 - } 18.124 - 18.125 - public int getStandardRMIUnchunkedNoRepStrId() { 18.126 - return RepositoryId.kPreComputed_StandardRMIUnchunked_NoRep; 18.127 - } 18.128 - 18.129 - public int getCodeBaseRMIUnchunkedNoRepStrId() { 18.130 - return RepositoryId.kPreComputed_CodeBaseRMIUnchunked_NoRep; 18.131 - } 18.132 - 18.133 - // RepositoryIdInterface methods 18.134 - 18.135 - public Class getClassFromType() throws ClassNotFoundException { 18.136 - return delegate.getClassFromType(); 18.137 - } 18.138 - 18.139 - public Class getClassFromType(String codebaseURL) 18.140 - throws ClassNotFoundException, MalformedURLException 18.141 - { 18.142 - return delegate.getClassFromType(codebaseURL); 18.143 - } 18.144 - 18.145 - public Class getClassFromType(Class expectedType, 18.146 - String codebaseURL) 18.147 - throws ClassNotFoundException, MalformedURLException 18.148 - { 18.149 - return delegate.getClassFromType(expectedType, codebaseURL); 18.150 - } 18.151 - 18.152 - public String getClassName() { 18.153 - return delegate.getClassName(); 18.154 - } 18.155 - 18.156 - // Constructor used for factory/utility cases 18.157 - public RepIdDelegator_1_3() {} 18.158 - 18.159 - // Constructor used by getIdFromString. All non-static 18.160 - // RepositoryId methods will use the provided delegate. 18.161 - private RepIdDelegator_1_3(RepositoryId_1_3 _delegate) { 18.162 - this.delegate = _delegate; 18.163 - } 18.164 - 18.165 - private RepositoryId_1_3 delegate = null; 18.166 - 18.167 - public String toString() { 18.168 - if (delegate != null) 18.169 - return delegate.toString(); 18.170 - else 18.171 - return this.getClass().getName(); 18.172 - } 18.173 - 18.174 - public boolean equals(Object obj) { 18.175 - if (delegate != null) 18.176 - return delegate.equals(obj); 18.177 - else 18.178 - return super.equals(obj); 18.179 - } 18.180 -}
19.1 --- a/src/share/classes/com/sun/corba/se/impl/orbutil/RepIdDelegator_1_3_1.java Fri Feb 15 01:49:36 2013 +0400 19.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 19.3 @@ -1,177 +0,0 @@ 19.4 -/* 19.5 - * Copyright (c) 2001, 2004, Oracle and/or its affiliates. All rights reserved. 19.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 19.7 - * 19.8 - * This code is free software; you can redistribute it and/or modify it 19.9 - * under the terms of the GNU General Public License version 2 only, as 19.10 - * published by the Free Software Foundation. Oracle designates this 19.11 - * particular file as subject to the "Classpath" exception as provided 19.12 - * by Oracle in the LICENSE file that accompanied this code. 19.13 - * 19.14 - * This code is distributed in the hope that it will be useful, but WITHOUT 19.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 19.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19.17 - * version 2 for more details (a copy is included in the LICENSE file that 19.18 - * accompanied this code). 19.19 - * 19.20 - * You should have received a copy of the GNU General Public License version 19.21 - * 2 along with this work; if not, write to the Free Software Foundation, 19.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 19.23 - * 19.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19.25 - * or visit www.oracle.com if you need additional information or have any 19.26 - * questions. 19.27 - */ 19.28 - 19.29 -package com.sun.corba.se.impl.orbutil; 19.30 - 19.31 -import org.omg.CORBA.ORB; 19.32 -import java.io.Serializable; 19.33 -import java.util.Hashtable; 19.34 -import java.net.MalformedURLException; 19.35 -import com.sun.corba.se.impl.io.TypeMismatchException; 19.36 -import com.sun.corba.se.impl.util.RepositoryId; 19.37 - 19.38 -/** 19.39 - * Delegates to the RepositoryId_1_3_1 implementation in 19.40 - * com.sun.corba.se.impl.orbutil. This is necessary to 19.41 - * overcome the fact that many of RepositoryId's methods 19.42 - * are static. 19.43 - */ 19.44 -public final class RepIdDelegator_1_3_1 19.45 - implements RepositoryIdStrings, 19.46 - RepositoryIdUtility, 19.47 - RepositoryIdInterface 19.48 -{ 19.49 - // RepositoryIdFactory methods 19.50 - 19.51 - public String createForAnyType(Class type) { 19.52 - return RepositoryId_1_3_1.createForAnyType(type); 19.53 - } 19.54 - 19.55 - public String createForJavaType(Serializable ser) 19.56 - throws TypeMismatchException 19.57 - { 19.58 - return RepositoryId_1_3_1.createForJavaType(ser); 19.59 - } 19.60 - 19.61 - public String createForJavaType(Class clz) 19.62 - throws TypeMismatchException 19.63 - { 19.64 - return RepositoryId_1_3_1.createForJavaType(clz); 19.65 - } 19.66 - 19.67 - public String createSequenceRepID(java.lang.Object ser) { 19.68 - return RepositoryId_1_3_1.createSequenceRepID(ser); 19.69 - } 19.70 - 19.71 - public String createSequenceRepID(Class clazz) { 19.72 - return RepositoryId_1_3_1.createSequenceRepID(clazz); 19.73 - } 19.74 - 19.75 - public RepositoryIdInterface getFromString(String repIdString) { 19.76 - return new RepIdDelegator_1_3_1(RepositoryId_1_3_1.cache.getId(repIdString)); 19.77 - } 19.78 - 19.79 - // RepositoryIdUtility methods 19.80 - 19.81 - public boolean isChunkedEncoding(int valueTag) { 19.82 - return RepositoryId.isChunkedEncoding(valueTag); 19.83 - } 19.84 - 19.85 - public boolean isCodeBasePresent(int valueTag) { 19.86 - return RepositoryId.isCodeBasePresent(valueTag); 19.87 - } 19.88 - 19.89 - public String getClassDescValueRepId() { 19.90 - return RepositoryId_1_3_1.kClassDescValueRepID; 19.91 - } 19.92 - 19.93 - public String getWStringValueRepId() { 19.94 - return RepositoryId_1_3_1.kWStringValueRepID; 19.95 - } 19.96 - 19.97 - public int getTypeInfo(int valueTag) { 19.98 - return RepositoryId.getTypeInfo(valueTag); 19.99 - } 19.100 - 19.101 - public int getStandardRMIChunkedNoRepStrId() { 19.102 - return RepositoryId.kPreComputed_StandardRMIChunked_NoRep; 19.103 - } 19.104 - 19.105 - public int getCodeBaseRMIChunkedNoRepStrId() { 19.106 - return RepositoryId.kPreComputed_CodeBaseRMIChunked_NoRep; 19.107 - } 19.108 - 19.109 - public int getStandardRMIChunkedId() { 19.110 - return RepositoryId.kPreComputed_StandardRMIChunked; 19.111 - } 19.112 - 19.113 - public int getCodeBaseRMIChunkedId() { 19.114 - return RepositoryId.kPreComputed_CodeBaseRMIChunked; 19.115 - } 19.116 - 19.117 - public int getStandardRMIUnchunkedId() { 19.118 - return RepositoryId.kPreComputed_StandardRMIUnchunked; 19.119 - } 19.120 - 19.121 - public int getCodeBaseRMIUnchunkedId() { 19.122 - return RepositoryId.kPreComputed_CodeBaseRMIUnchunked; 19.123 - } 19.124 - 19.125 - public int getStandardRMIUnchunkedNoRepStrId() { 19.126 - return RepositoryId.kPreComputed_StandardRMIUnchunked_NoRep; 19.127 - } 19.128 - 19.129 - public int getCodeBaseRMIUnchunkedNoRepStrId() { 19.130 - return RepositoryId.kPreComputed_CodeBaseRMIUnchunked_NoRep; 19.131 - } 19.132 - 19.133 - // RepositoryIdInterface methods 19.134 - 19.135 - public Class getClassFromType() throws ClassNotFoundException { 19.136 - return delegate.getClassFromType(); 19.137 - } 19.138 - 19.139 - public Class getClassFromType(String codebaseURL) 19.140 - throws ClassNotFoundException, MalformedURLException 19.141 - { 19.142 - return delegate.getClassFromType(codebaseURL); 19.143 - } 19.144 - 19.145 - public Class getClassFromType(Class expectedType, 19.146 - String codebaseURL) 19.147 - throws ClassNotFoundException, MalformedURLException 19.148 - { 19.149 - return delegate.getClassFromType(expectedType, codebaseURL); 19.150 - } 19.151 - 19.152 - public String getClassName() { 19.153 - return delegate.getClassName(); 19.154 - } 19.155 - 19.156 - // Constructor used for factory/utility cases 19.157 - public RepIdDelegator_1_3_1() {} 19.158 - 19.159 - // Constructor used by getIdFromString. All non-static 19.160 - // RepositoryId methods will use the provided delegate. 19.161 - private RepIdDelegator_1_3_1(RepositoryId_1_3_1 _delegate) { 19.162 - this.delegate = _delegate; 19.163 - } 19.164 - 19.165 - private RepositoryId_1_3_1 delegate = null; 19.166 - 19.167 - public String toString() { 19.168 - if (delegate != null) 19.169 - return delegate.toString(); 19.170 - else 19.171 - return this.getClass().getName(); 19.172 - } 19.173 - 19.174 - public boolean equals(Object obj) { 19.175 - if (delegate != null) 19.176 - return delegate.equals(obj); 19.177 - else 19.178 - return super.equals(obj); 19.179 - } 19.180 -}
20.1 --- a/src/share/classes/com/sun/corba/se/impl/orbutil/RepositoryIdCache_1_3.java Fri Feb 15 01:49:36 2013 +0400 20.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 20.3 @@ -1,108 +0,0 @@ 20.4 -/* 20.5 - * Copyright (c) 2000, 2002, Oracle and/or its affiliates. All rights reserved. 20.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 20.7 - * 20.8 - * This code is free software; you can redistribute it and/or modify it 20.9 - * under the terms of the GNU General Public License version 2 only, as 20.10 - * published by the Free Software Foundation. Oracle designates this 20.11 - * particular file as subject to the "Classpath" exception as provided 20.12 - * by Oracle in the LICENSE file that accompanied this code. 20.13 - * 20.14 - * This code is distributed in the hope that it will be useful, but WITHOUT 20.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 20.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 20.17 - * version 2 for more details (a copy is included in the LICENSE file that 20.18 - * accompanied this code). 20.19 - * 20.20 - * You should have received a copy of the GNU General Public License version 20.21 - * 2 along with this work; if not, write to the Free Software Foundation, 20.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20.23 - * 20.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20.25 - * or visit www.oracle.com if you need additional information or have any 20.26 - * questions. 20.27 - */ 20.28 -/* 20.29 - * Licensed Materials - Property of IBM 20.30 - * RMI-IIOP v1.0 20.31 - * Copyright IBM Corp. 1998 1999 All Rights Reserved 20.32 - * 20.33 - */ 20.34 - 20.35 -package com.sun.corba.se.impl.orbutil; 20.36 - 20.37 -import java.util.Stack; 20.38 -import java.util.Hashtable; 20.39 -import java.util.EmptyStackException; 20.40 -import java.util.Enumeration; 20.41 - 20.42 -// Really limited pool - in this case just creating several at a time... 20.43 -class RepositoryIdPool_1_3 extends Stack { 20.44 - 20.45 - private static int MAX_CACHE_SIZE = 4; 20.46 - private RepositoryIdCache_1_3 cache; 20.47 - 20.48 - public final synchronized RepositoryId_1_3 popId() { 20.49 - 20.50 - try { 20.51 - return (RepositoryId_1_3)super.pop(); 20.52 - } 20.53 - catch(EmptyStackException e) { 20.54 - increasePool(5); 20.55 - return (RepositoryId_1_3)super.pop(); 20.56 - } 20.57 - 20.58 - } 20.59 - 20.60 - // Pool management 20.61 - final void increasePool(int size) { 20.62 - //if (cache.size() <= MAX_CACHE_SIZE) 20.63 - for (int i = size; i > 0; i--) 20.64 - push(new RepositoryId_1_3()); 20.65 - /* 20.66 - // _REVISIT_ This will not work w/out either thread tracing or weak references. I am 20.67 - // betting that thread tracing almost completely negates benefit of reuse. Until either 20.68 - // 1.2 only inclusion or proof to the contrary, I'll leave it this way... 20.69 - else { 20.70 - int numToReclaim = cache.size() / 2; 20.71 - Enumeration keys = cache.keys(); 20.72 - Enumeration elements = cache.elements(); 20.73 - for (int i = numToReclaim; i > 0; i--) { 20.74 - Object key = keys.nextElement(); 20.75 - Object element = elements.nextElement(); 20.76 - 20.77 - push(element); 20.78 - cache.remove(key); 20.79 - } 20.80 - } 20.81 - */ 20.82 - } 20.83 - 20.84 - final void setCaches(RepositoryIdCache_1_3 cache) { 20.85 - this.cache = cache; 20.86 - } 20.87 - 20.88 -} 20.89 - 20.90 -public class RepositoryIdCache_1_3 extends Hashtable { 20.91 - 20.92 - private RepositoryIdPool_1_3 pool = new RepositoryIdPool_1_3(); 20.93 - 20.94 - public RepositoryIdCache_1_3() { 20.95 - pool.setCaches(this); 20.96 - } 20.97 - 20.98 - public final synchronized RepositoryId_1_3 getId(String key) { 20.99 - RepositoryId_1_3 repId = (RepositoryId_1_3)super.get(key); 20.100 - 20.101 - if (repId != null) 20.102 - return repId; 20.103 - else { 20.104 - //repId = pool.popId().init(key); 20.105 - repId = new RepositoryId_1_3(key); 20.106 - put(key, repId); 20.107 - return repId; 20.108 - } 20.109 - 20.110 - } 20.111 -}
21.1 --- a/src/share/classes/com/sun/corba/se/impl/orbutil/RepositoryIdCache_1_3_1.java Fri Feb 15 01:49:36 2013 +0400 21.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 21.3 @@ -1,102 +0,0 @@ 21.4 -/* 21.5 - * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved. 21.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 21.7 - * 21.8 - * This code is free software; you can redistribute it and/or modify it 21.9 - * under the terms of the GNU General Public License version 2 only, as 21.10 - * published by the Free Software Foundation. Oracle designates this 21.11 - * particular file as subject to the "Classpath" exception as provided 21.12 - * by Oracle in the LICENSE file that accompanied this code. 21.13 - * 21.14 - * This code is distributed in the hope that it will be useful, but WITHOUT 21.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 21.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 21.17 - * version 2 for more details (a copy is included in the LICENSE file that 21.18 - * accompanied this code). 21.19 - * 21.20 - * You should have received a copy of the GNU General Public License version 21.21 - * 2 along with this work; if not, write to the Free Software Foundation, 21.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 21.23 - * 21.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 21.25 - * or visit www.oracle.com if you need additional information or have any 21.26 - * questions. 21.27 - */ 21.28 - 21.29 -package com.sun.corba.se.impl.orbutil; 21.30 - 21.31 -import java.util.Stack; 21.32 -import java.util.Hashtable; 21.33 -import java.util.EmptyStackException; 21.34 -import java.util.Enumeration; 21.35 - 21.36 -// Really limited pool - in this case just creating several at a time... 21.37 -class RepositoryIdPool_1_3_1 extends Stack { 21.38 - 21.39 - private static int MAX_CACHE_SIZE = 4; 21.40 - private RepositoryIdCache_1_3_1 cache; 21.41 - 21.42 - public final synchronized RepositoryId_1_3_1 popId() { 21.43 - 21.44 - try { 21.45 - return (RepositoryId_1_3_1)super.pop(); 21.46 - } 21.47 - catch(EmptyStackException e) { 21.48 - increasePool(5); 21.49 - return (RepositoryId_1_3_1)super.pop(); 21.50 - } 21.51 - 21.52 - } 21.53 - 21.54 - // Pool management 21.55 - final void increasePool(int size) { 21.56 - //if (cache.size() <= MAX_CACHE_SIZE) 21.57 - for (int i = size; i > 0; i--) 21.58 - push(new RepositoryId_1_3_1()); 21.59 - /* 21.60 - // _REVISIT_ This will not work w/out either thread tracing or weak references. I am 21.61 - // betting that thread tracing almost completely negates benefit of reuse. Until either 21.62 - // 1.2 only inclusion or proof to the contrary, I'll leave it this way... 21.63 - else { 21.64 - int numToReclaim = cache.size() / 2; 21.65 - Enumeration keys = cache.keys(); 21.66 - Enumeration elements = cache.elements(); 21.67 - for (int i = numToReclaim; i > 0; i--) { 21.68 - Object key = keys.nextElement(); 21.69 - Object element = elements.nextElement(); 21.70 - 21.71 - push(element); 21.72 - cache.remove(key); 21.73 - } 21.74 - } 21.75 - */ 21.76 - } 21.77 - 21.78 - final void setCaches(RepositoryIdCache_1_3_1 cache) { 21.79 - this.cache = cache; 21.80 - } 21.81 - 21.82 -} 21.83 - 21.84 -public class RepositoryIdCache_1_3_1 extends Hashtable { 21.85 - 21.86 - private RepositoryIdPool_1_3_1 pool = new RepositoryIdPool_1_3_1(); 21.87 - 21.88 - public RepositoryIdCache_1_3_1() { 21.89 - pool.setCaches(this); 21.90 - } 21.91 - 21.92 - public final synchronized RepositoryId_1_3_1 getId(String key) { 21.93 - RepositoryId_1_3_1 repId = (RepositoryId_1_3_1)super.get(key); 21.94 - 21.95 - if (repId != null) 21.96 - return repId; 21.97 - else { 21.98 - //repId = pool.popId().init(key); 21.99 - repId = new RepositoryId_1_3_1(key); 21.100 - put(key, repId); 21.101 - return repId; 21.102 - } 21.103 - 21.104 - } 21.105 -}
22.1 --- a/src/share/classes/com/sun/corba/se/impl/orbutil/RepositoryIdFactory.java Fri Feb 15 01:49:36 2013 +0400 22.2 +++ b/src/share/classes/com/sun/corba/se/impl/orbutil/RepositoryIdFactory.java Tue Feb 19 21:44:41 2013 +0100 22.3 @@ -1,5 +1,5 @@ 22.4 /* 22.5 - * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved. 22.6 + * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. 22.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 22.8 * 22.9 * This code is free software; you can redistribute it and/or modify it 22.10 @@ -30,12 +30,6 @@ 22.11 22.12 public abstract class RepositoryIdFactory 22.13 { 22.14 - private static final RepIdDelegator_1_3 legacyDelegator 22.15 - = new RepIdDelegator_1_3(); 22.16 - 22.17 - private static final RepIdDelegator_1_3_1 ladybirdDelegator 22.18 - = new RepIdDelegator_1_3_1(); 22.19 - 22.20 private static final RepIdDelegator currentDelegator 22.21 = new RepIdDelegator(); 22.22 22.23 @@ -48,29 +42,6 @@ 22.24 } 22.25 22.26 /** 22.27 - * Checks the version of the ORB and returns the appropriate 22.28 - * RepositoryIdStrings instance. 22.29 - */ 22.30 - public static RepositoryIdStrings getRepIdStringsFactory(ORB orb) 22.31 - { 22.32 - if (orb != null) { 22.33 - switch (orb.getORBVersion().getORBType()) { 22.34 - case ORBVersion.NEWER: 22.35 - case ORBVersion.FOREIGN: 22.36 - case ORBVersion.JDK1_3_1_01: 22.37 - return currentDelegator; 22.38 - case ORBVersion.OLD: 22.39 - return legacyDelegator; 22.40 - case ORBVersion.NEW: 22.41 - return ladybirdDelegator; 22.42 - default: 22.43 - return currentDelegator; 22.44 - } 22.45 - } else 22.46 - return currentDelegator; 22.47 - } 22.48 - 22.49 - /** 22.50 * Returns the latest version RepositoryIdUtility instance 22.51 */ 22.52 public static RepositoryIdUtility getRepIdUtility() 22.53 @@ -78,26 +49,4 @@ 22.54 return currentDelegator; 22.55 } 22.56 22.57 - /** 22.58 - * Checks the version of the ORB and returns the appropriate 22.59 - * RepositoryIdUtility instance. 22.60 - */ 22.61 - public static RepositoryIdUtility getRepIdUtility(ORB orb) 22.62 - { 22.63 - if (orb != null) { 22.64 - switch (orb.getORBVersion().getORBType()) { 22.65 - case ORBVersion.NEWER: 22.66 - case ORBVersion.FOREIGN: 22.67 - case ORBVersion.JDK1_3_1_01: 22.68 - return currentDelegator; 22.69 - case ORBVersion.OLD: 22.70 - return legacyDelegator; 22.71 - case ORBVersion.NEW: 22.72 - return ladybirdDelegator; 22.73 - default: 22.74 - return currentDelegator; 22.75 - } 22.76 - } else 22.77 - return currentDelegator; 22.78 - } 22.79 }
23.1 --- a/src/share/classes/com/sun/corba/se/impl/orbutil/RepositoryId_1_3.java Fri Feb 15 01:49:36 2013 +0400 23.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 23.3 @@ -1,990 +0,0 @@ 23.4 -/* 23.5 - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. 23.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 23.7 - * 23.8 - * This code is free software; you can redistribute it and/or modify it 23.9 - * under the terms of the GNU General Public License version 2 only, as 23.10 - * published by the Free Software Foundation. Oracle designates this 23.11 - * particular file as subject to the "Classpath" exception as provided 23.12 - * by Oracle in the LICENSE file that accompanied this code. 23.13 - * 23.14 - * This code is distributed in the hope that it will be useful, but WITHOUT 23.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 23.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23.17 - * version 2 for more details (a copy is included in the LICENSE file that 23.18 - * accompanied this code). 23.19 - * 23.20 - * You should have received a copy of the GNU General Public License version 23.21 - * 2 along with this work; if not, write to the Free Software Foundation, 23.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 23.23 - * 23.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 23.25 - * or visit www.oracle.com if you need additional information or have any 23.26 - * questions. 23.27 - */ 23.28 -/* 23.29 - * Licensed Materials - Property of IBM 23.30 - * RMI-IIOP v1.0 23.31 - * Copyright IBM Corp. 1998 1999 All Rights Reserved 23.32 - * 23.33 - */ 23.34 - 23.35 -package com.sun.corba.se.impl.orbutil; 23.36 - 23.37 -import java.util.StringTokenizer; 23.38 -import java.util.Hashtable; 23.39 -import java.io.IOException; 23.40 -import java.lang.reflect.Method; 23.41 - 23.42 -// Imports for using codebase URL to load class 23.43 -import java.net.MalformedURLException; 23.44 -import org.omg.CORBA.portable.ValueBase; 23.45 -import org.omg.CORBA.portable.IDLEntity; 23.46 - 23.47 -import com.sun.corba.se.impl.util.JDKBridge; 23.48 -import com.sun.corba.se.impl.util.Utility; 23.49 -import com.sun.corba.se.impl.util.PackagePrefixChecker; 23.50 -import com.sun.corba.se.impl.util.IdentityHashtable; 23.51 -import com.sun.corba.se.impl.io.ObjectStreamClass; 23.52 - 23.53 -import javax.rmi.CORBA.Util; 23.54 - 23.55 -// keeping the original RepositoryId class that was shipped in 23.56 -// JDK 1.3. It has interoperability bugs 23.57 - 23.58 -public class RepositoryId_1_3 { 23.59 - 23.60 - // Legal IDL Identifier characters (1 = legal). Note 23.61 - // that '.' (2E) is marked as legal even though it is 23.62 - // not legal in IDL. This allows us to treat a fully 23.63 - // qualified Java name with '.' package separators 23.64 - // uniformly, and is safe because that is the only 23.65 - // legal use of '.' in a Java name. 23.66 - 23.67 - public static final RepositoryIdCache_1_3 cache = new RepositoryIdCache_1_3(); 23.68 - private static final byte[] IDL_IDENTIFIER_CHARS = { 23.69 - 23.70 - // 0 1 2 3 4 5 6 7 8 9 a b c d e f 23.71 - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 00-0f 23.72 - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 10-1f 23.73 - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,1,0, // 20-2f 23.74 - 1,1,1,1, 1,1,1,1, 1,1,0,0, 0,0,0,0, // 30-3f 23.75 - 0,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // 40-4f 23.76 - 1,1,1,1, 1,1,1,1, 1,1,1,0, 0,0,0,1, // 50-5f 23.77 - 0,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // 60-6f 23.78 - 1,1,1,1, 1,1,1,1, 1,1,1,0, 0,0,0,0, // 70-7f 23.79 - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 80-8f 23.80 - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 90-9f 23.81 - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // a0-af 23.82 - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // b0-bf 23.83 - 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // c0-cf 23.84 - 0,1,1,1, 1,1,1,0, 1,1,1,1, 1,0,0,1, // d0-df 23.85 - 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // e0-ef 23.86 - 0,1,1,1, 1,1,1,0, 1,1,1,1, 1,0,0,1, // f0-ff 23.87 - }; 23.88 - 23.89 - private static String defaultServerURL = null; 23.90 - private static boolean useCodebaseOnly = false; 23.91 - 23.92 - static { 23.93 - if (defaultServerURL == null) 23.94 - defaultServerURL = (String)JDKBridge.getLocalCodebase(); 23.95 - useCodebaseOnly = JDKBridge.useCodebaseOnly(); 23.96 - 23.97 - } 23.98 - 23.99 - private static IdentityHashtable classToRepStr = new IdentityHashtable(); 23.100 - private static IdentityHashtable classIDLToRepStr = new IdentityHashtable(); 23.101 - private static IdentityHashtable classSeqToRepStr = new IdentityHashtable(); 23.102 - 23.103 - private static IdentityHashtable repStrToByteArray = new IdentityHashtable(); 23.104 - private static Hashtable repStrToClass = new Hashtable(); 23.105 - 23.106 - private String repId = null; 23.107 - private boolean isSupportedFormat = true; 23.108 - private String typeString = null; 23.109 - private String versionString = null; 23.110 - private boolean isSequence = false; 23.111 - private boolean isRMIValueType = false; 23.112 - private boolean isIDLType = false; 23.113 - private String completeClassName = null; 23.114 - private String unqualifiedName = null; 23.115 - private String definedInId = null; 23.116 - private Class clazz = null; 23.117 - private String suid = null, actualSuid = null; 23.118 - private long suidLong = ObjectStreamClass.kDefaultUID, actualSuidLong = ObjectStreamClass.kDefaultUID; 23.119 - 23.120 - // Repository ID fragments 23.121 - private static final String kValuePrefix = "RMI:"; 23.122 - private static final String kIDLPrefix = "IDL:"; 23.123 - private static final String kIDLNamePrefix = "omg.org/"; 23.124 - private static final String kIDLClassnamePrefix = "org.omg."; 23.125 - private static final String kSequencePrefix = "["; 23.126 - private static final String kCORBAPrefix = "CORBA/"; 23.127 - private static final String kArrayPrefix = kValuePrefix + kSequencePrefix + kCORBAPrefix; 23.128 - private static final int kValuePrefixLength = kValuePrefix.length(); 23.129 - private static final int kIDLPrefixLength = kIDLPrefix.length(); 23.130 - private static final int kSequencePrefixLength = kSequencePrefix.length(); 23.131 - private static final String kInterfaceHashCode = ":0000000000000000"; 23.132 - private static final String kInterfaceOnlyHashStr = "0000000000000000"; 23.133 - private static final String kExternalizableHashStr = "0000000000000001"; 23.134 - 23.135 - // Value tag utility methods and constants 23.136 - public static final int kInitialValueTag= 0x7fffff00; 23.137 - public static final int kNoTypeInfo = 0; 23.138 - public static final int kSingleRepTypeInfo = 0x02; 23.139 - public static final int kPartialListTypeInfo = 0x06; 23.140 - public static final int kChunkedMask = 0x08; 23.141 - 23.142 - // Public, well known repository IDs 23.143 - 23.144 - // _REVISIT_ : A table structure with a good search routine for all of this 23.145 - // would be more efficient and easier to maintain... 23.146 - 23.147 - // String 23.148 - public static final String kWStringValueVersion = "1.0"; 23.149 - public static final String kWStringValueHash = ":"+kWStringValueVersion; 23.150 - public static final String kWStringStubValue = "WStringValue"; 23.151 - public static final String kWStringTypeStr = "omg.org/CORBA/"+kWStringStubValue; 23.152 - public static final String kWStringValueRepID = kIDLPrefix + kWStringTypeStr + kWStringValueHash; 23.153 - 23.154 - // Any 23.155 - public static final String kAnyRepID = kIDLPrefix + "omg.org/CORBA/Any"; 23.156 - 23.157 - // Class 23.158 - public static final String kClassDescValueHash = ":" + Long.toHexString( 23.159 - ObjectStreamClass.getSerialVersionUID(javax.rmi.CORBA.ClassDesc.class)); 23.160 - public static final String kClassDescStubValue = "ClassDesc"; 23.161 - public static final String kClassDescTypeStr = "javax.rmi.CORBA."+kClassDescStubValue; 23.162 - public static final String kClassDescValueRepID = kValuePrefix + kClassDescTypeStr + kClassDescValueHash; 23.163 - 23.164 - // Object 23.165 - public static final String kObjectValueHash = ":1.0"; 23.166 - public static final String kObjectStubValue = "Object"; 23.167 - 23.168 - // Sequence 23.169 - public static final String kSequenceValueHash = ":1.0"; 23.170 - public static final String kPrimitiveSequenceValueHash = ":0000000000000000"; 23.171 - 23.172 - // Serializable 23.173 - public static final String kSerializableValueHash = ":1.0"; 23.174 - public static final String kSerializableStubValue = "Serializable"; 23.175 - 23.176 - // Externalizable 23.177 - public static final String kExternalizableValueHash = ":1.0"; 23.178 - public static final String kExternalizableStubValue = "Externalizable"; 23.179 - 23.180 - // Remote (The empty string is used for java.rmi.Remote) 23.181 - public static final String kRemoteValueHash = ""; 23.182 - public static final String kRemoteStubValue = ""; 23.183 - public static final String kRemoteTypeStr = ""; 23.184 - public static final String kRemoteValueRepID = ""; 23.185 - 23.186 - private static final Hashtable kSpecialArrayTypeStrings = new Hashtable(); 23.187 - 23.188 - static { 23.189 - kSpecialArrayTypeStrings.put("CORBA.WStringValue", new StringBuffer(java.lang.String.class.getName())); 23.190 - kSpecialArrayTypeStrings.put("javax.rmi.CORBA.ClassDesc", new StringBuffer(java.lang.Class.class.getName())); 23.191 - kSpecialArrayTypeStrings.put("CORBA.Object", new StringBuffer(java.rmi.Remote.class.getName())); 23.192 - 23.193 - } 23.194 - 23.195 - private static final Hashtable kSpecialCasesRepIDs = new Hashtable(); 23.196 - 23.197 - static { 23.198 - kSpecialCasesRepIDs.put(java.lang.String.class, kWStringValueRepID); 23.199 - kSpecialCasesRepIDs.put(java.lang.Class.class, kClassDescValueRepID); 23.200 - kSpecialCasesRepIDs.put(java.rmi.Remote.class, kRemoteValueRepID); 23.201 - } 23.202 - 23.203 - private static final Hashtable kSpecialCasesStubValues = new Hashtable(); 23.204 - 23.205 - static { 23.206 - kSpecialCasesStubValues.put(java.lang.String.class, kWStringStubValue); 23.207 - kSpecialCasesStubValues.put(java.lang.Class.class, kClassDescStubValue); 23.208 - kSpecialCasesStubValues.put(java.lang.Object.class, kObjectStubValue); 23.209 - kSpecialCasesStubValues.put(java.io.Serializable.class, kSerializableStubValue); 23.210 - kSpecialCasesStubValues.put(java.io.Externalizable.class, kExternalizableStubValue); 23.211 - kSpecialCasesStubValues.put(java.rmi.Remote.class, kRemoteStubValue); 23.212 - } 23.213 - 23.214 - 23.215 - private static final Hashtable kSpecialCasesVersions = new Hashtable(); 23.216 - 23.217 - static { 23.218 - kSpecialCasesVersions.put(java.lang.String.class, kWStringValueHash); 23.219 - kSpecialCasesVersions.put(java.lang.Class.class, kClassDescValueHash); 23.220 - kSpecialCasesVersions.put(java.lang.Object.class, kObjectValueHash); 23.221 - kSpecialCasesVersions.put(java.io.Serializable.class, kSerializableValueHash); 23.222 - kSpecialCasesVersions.put(java.io.Externalizable.class, kExternalizableValueHash); 23.223 - kSpecialCasesVersions.put(java.rmi.Remote.class, kRemoteValueHash); 23.224 - } 23.225 - 23.226 - private static final Hashtable kSpecialCasesClasses = new Hashtable(); 23.227 - 23.228 - static { 23.229 - kSpecialCasesClasses.put(kWStringTypeStr, java.lang.String.class); 23.230 - kSpecialCasesClasses.put(kClassDescTypeStr, java.lang.Class.class); 23.231 - kSpecialCasesClasses.put(kRemoteTypeStr, java.rmi.Remote.class); 23.232 - 23.233 - kSpecialCasesClasses.put("org.omg.CORBA.WStringValue", java.lang.String.class); 23.234 - kSpecialCasesClasses.put("javax.rmi.CORBA.ClassDesc", java.lang.Class.class); 23.235 - //kSpecialCasesClasses.put(kRemoteTypeStr, java.rmi.Remote.class); 23.236 - } 23.237 - 23.238 - private static final Hashtable kSpecialCasesArrayPrefix = new Hashtable(); 23.239 - 23.240 - static { 23.241 - kSpecialCasesArrayPrefix.put(java.lang.String.class, kValuePrefix + kSequencePrefix + kCORBAPrefix); 23.242 - kSpecialCasesArrayPrefix.put(java.lang.Class.class, kValuePrefix + kSequencePrefix + "javax/rmi/CORBA/"); 23.243 - kSpecialCasesArrayPrefix.put(java.lang.Object.class, kValuePrefix + kSequencePrefix + "java/lang/"); 23.244 - kSpecialCasesArrayPrefix.put(java.io.Serializable.class, kValuePrefix + kSequencePrefix + "java/io/"); 23.245 - kSpecialCasesArrayPrefix.put(java.io.Externalizable.class, kValuePrefix + kSequencePrefix + "java/io/"); 23.246 - kSpecialCasesArrayPrefix.put(java.rmi.Remote.class, kValuePrefix + kSequencePrefix + kCORBAPrefix); 23.247 - } 23.248 - 23.249 - private static final Hashtable kSpecialPrimitives = new Hashtable(); 23.250 - 23.251 - static { 23.252 - kSpecialPrimitives.put("int","long"); 23.253 - kSpecialPrimitives.put("long","longlong"); 23.254 - kSpecialPrimitives.put("byte","octet"); 23.255 - } 23.256 - 23.257 - /** 23.258 - * Used to convert ascii to hex. 23.259 - */ 23.260 - private static final byte ASCII_HEX[] = { 23.261 - (byte)'0', 23.262 - (byte)'1', 23.263 - (byte)'2', 23.264 - (byte)'3', 23.265 - (byte)'4', 23.266 - (byte)'5', 23.267 - (byte)'6', 23.268 - (byte)'7', 23.269 - (byte)'8', 23.270 - (byte)'9', 23.271 - (byte)'A', 23.272 - (byte)'B', 23.273 - (byte)'C', 23.274 - (byte)'D', 23.275 - (byte)'E', 23.276 - (byte)'F', 23.277 - }; 23.278 - 23.279 - 23.280 - // Interface Rep ID Strings 23.281 - public static final String kjava_rmi_Remote = createForAnyType(java.rmi.Remote.class); 23.282 - public static final String korg_omg_CORBA_Object = createForAnyType(org.omg.CORBA.Object.class); 23.283 - 23.284 - // Dummy arguments for getIdFromHelper method 23.285 - public static final Class kNoParamTypes[] ={}; 23.286 - public static final Object kNoArgs[] = {}; 23.287 - 23.288 - 23.289 - RepositoryId_1_3(){} 23.290 - 23.291 - RepositoryId_1_3(String aRepId){ 23.292 - init(aRepId); 23.293 - } 23.294 - 23.295 - RepositoryId_1_3 init(String aRepId){ 23.296 - 23.297 - this.repId = aRepId; 23.298 - 23.299 - // Special case for remote 23.300 - if (aRepId.length() == 0) { 23.301 - clazz = java.rmi.Remote.class; 23.302 - typeString = ""; 23.303 - isRMIValueType = true; 23.304 - suid = kInterfaceOnlyHashStr; 23.305 - return this; 23.306 - } 23.307 - else if (aRepId.equals(kWStringValueRepID)) { 23.308 - clazz = java.lang.String.class; 23.309 - typeString = kWStringTypeStr; 23.310 - isIDLType = true; 23.311 - versionString = kWStringValueVersion; 23.312 - return this; 23.313 - } 23.314 - else { 23.315 - 23.316 - String repId = convertFromISOLatin1(aRepId); 23.317 - 23.318 - versionString = repId.substring(repId.indexOf(':', repId.indexOf(':')+1)); 23.319 - if (repId.startsWith(kIDLPrefix)) { 23.320 - typeString = 23.321 - repId.substring(kIDLPrefixLength, repId.indexOf(':', kIDLPrefixLength)); 23.322 - isIDLType = true; 23.323 - if (typeString.startsWith(kIDLNamePrefix)) 23.324 - completeClassName = kIDLClassnamePrefix + 23.325 - typeString.substring(kIDLNamePrefix.length()).replace('/','.'); 23.326 - else completeClassName = typeString.replace('/','.'); 23.327 - 23.328 - } 23.329 - else if (repId.startsWith(kValuePrefix)) { 23.330 - typeString = 23.331 - repId.substring(kValuePrefixLength, repId.indexOf(':', kValuePrefixLength)); 23.332 - isRMIValueType = true; 23.333 - 23.334 - if (versionString.indexOf('.') == -1) { 23.335 - actualSuid = versionString.substring(1); 23.336 - suid = actualSuid; // default if not explicitly specified 23.337 - 23.338 - if (actualSuid.indexOf(':') != -1){ 23.339 - // we have a declared hash also 23.340 - int pos = actualSuid.indexOf(':')+1; 23.341 - // actualSuid = suid.substring(pos); 23.342 - // suid = suid.substring(0, pos-1); 23.343 - suid = actualSuid.substring(pos); 23.344 - actualSuid = actualSuid.substring(0, pos-1); 23.345 - } 23.346 - 23.347 - } 23.348 - else { 23.349 - // _REVISIT_ : Special case version failure ? 23.350 - } 23.351 - } 23.352 - else isSupportedFormat = false; 23.353 - 23.354 - if (typeString.startsWith(kSequencePrefix)) { 23.355 - isSequence = true; 23.356 - } 23.357 - 23.358 - 23.359 - return this; 23.360 - } 23.361 - } 23.362 - 23.363 - public final String getUnqualifiedName() { 23.364 - if (unqualifiedName == null){ 23.365 - String className = getClassName(); 23.366 - int index = (className != null) ? className.lastIndexOf('.') : -1; 23.367 - if (index == -1){ 23.368 - unqualifiedName = className; 23.369 - definedInId = "IDL::1.0"; 23.370 - } 23.371 - else { 23.372 - unqualifiedName = className.substring(index); 23.373 - definedInId = "IDL:" + className.substring(0, index).replace('.','/') + ":1.0"; 23.374 - } 23.375 - } 23.376 - 23.377 - return unqualifiedName; 23.378 - } 23.379 - 23.380 - public final String getDefinedInId() { 23.381 - if (definedInId == null){ 23.382 - getUnqualifiedName(); 23.383 - } 23.384 - 23.385 - return definedInId; 23.386 - } 23.387 - 23.388 - public final String getTypeString() { 23.389 - return typeString; 23.390 - } 23.391 - 23.392 - public final String getVersionString() { 23.393 - return versionString; 23.394 - } 23.395 - 23.396 - public final String getSerialVersionUID() { 23.397 - return suid; 23.398 - } 23.399 - 23.400 - public final String getActualSerialVersionUID() { 23.401 - return actualSuid; 23.402 - } 23.403 - public final long getSerialVersionUIDAsLong() { 23.404 - return suidLong; 23.405 - } 23.406 - 23.407 - public final long getActualSerialVersionUIDAsLong() { 23.408 - return actualSuidLong; 23.409 - } 23.410 - 23.411 - public final boolean isRMIValueType() { 23.412 - return isRMIValueType; 23.413 - } 23.414 - 23.415 - public final boolean isIDLType() { 23.416 - return isIDLType; 23.417 - } 23.418 - 23.419 - public final String getRepositoryId() { 23.420 - return repId; 23.421 - } 23.422 - 23.423 - public static byte[] getByteArray(String repStr) { 23.424 - synchronized (repStrToByteArray){ 23.425 - return (byte[]) repStrToByteArray.get(repStr); 23.426 - } 23.427 - } 23.428 - 23.429 - public static void setByteArray(String repStr, byte[] repStrBytes) { 23.430 - synchronized (repStrToByteArray){ 23.431 - repStrToByteArray.put(repStr, repStrBytes); 23.432 - } 23.433 - } 23.434 - 23.435 - public final boolean isSequence() { 23.436 - return isSequence; 23.437 - } 23.438 - 23.439 - public final boolean isSupportedFormat() { 23.440 - return isSupportedFormat; 23.441 - } 23.442 - 23.443 - 23.444 - // This method will return the classname from the typestring OR if the classname turns out to be 23.445 - // a special class "pseudo" name, then the matching real classname is returned. 23.446 - public final String getClassName() { 23.447 - 23.448 - if (isRMIValueType) 23.449 - return typeString; 23.450 - else if (isIDLType) 23.451 - return completeClassName; 23.452 - else return null; 23.453 - 23.454 - } 23.455 - 23.456 - // This method calls getClazzFromType() and falls back to the repStrToClass 23.457 - // cache if no class was found. It's used where any class matching the 23.458 - // given repid is an acceptable result. 23.459 - public final Class getAnyClassFromType() throws ClassNotFoundException { 23.460 - try { 23.461 - return getClassFromType(); 23.462 - } catch (ClassNotFoundException cnfe) { 23.463 - Class clz = (Class)repStrToClass.get(repId); 23.464 - if (clz != null) 23.465 - return clz; 23.466 - else 23.467 - throw cnfe; 23.468 - } 23.469 - } 23.470 - 23.471 - public final Class getClassFromType() 23.472 - throws ClassNotFoundException { 23.473 - if (clazz != null) 23.474 - return clazz; 23.475 - 23.476 - Class specialCase = (Class)kSpecialCasesClasses.get(getClassName()); 23.477 - 23.478 - if (specialCase != null){ 23.479 - clazz = specialCase; 23.480 - return specialCase; 23.481 - } 23.482 - else 23.483 - { 23.484 - try{ 23.485 - return Util.loadClass(getClassName(), null, null); 23.486 - } 23.487 - catch(ClassNotFoundException cnfe){ 23.488 - if (defaultServerURL != null) { 23.489 - try{ 23.490 - return getClassFromType(defaultServerURL); 23.491 - } 23.492 - catch(MalformedURLException mue){ 23.493 - throw cnfe; 23.494 - } 23.495 - } 23.496 - else throw cnfe; 23.497 - } 23.498 - } 23.499 - 23.500 - } 23.501 - 23.502 - public final Class getClassFromType(Class expectedType, String codebase) 23.503 - throws ClassNotFoundException { 23.504 - if (clazz != null) 23.505 - return clazz; 23.506 - 23.507 - Class specialCase = (Class)kSpecialCasesClasses.get(getClassName()); 23.508 - 23.509 - if (specialCase != null){ 23.510 - clazz = specialCase; 23.511 - return specialCase; 23.512 - } else { 23.513 - ClassLoader expectedTypeClassLoader = (expectedType == null ? null : expectedType.getClassLoader()); 23.514 - return loadClassOfType(getClassName(), 23.515 - codebase, 23.516 - expectedTypeClassLoader, 23.517 - expectedType, 23.518 - expectedTypeClassLoader); 23.519 - } 23.520 - 23.521 - } 23.522 - 23.523 - public final Class getClassFromType(String url) 23.524 - throws ClassNotFoundException, MalformedURLException { 23.525 - return Util.loadClass(getClassName(), url, null); 23.526 - } 23.527 - 23.528 - public final String toString() { 23.529 - return repId; 23.530 - } 23.531 - 23.532 - private static String createHashString(java.io.Serializable ser) { 23.533 - 23.534 - return createHashString(ser.getClass()); 23.535 - } 23.536 - 23.537 - private static String createHashString(java.lang.Class clazz) { 23.538 - 23.539 - if (clazz.isInterface() || !java.io.Serializable.class.isAssignableFrom(clazz)) 23.540 - return kInterfaceHashCode; 23.541 - 23.542 - 23.543 - long actualLong = ObjectStreamClassUtil_1_3.computeStructuralUID(false, clazz); 23.544 - String hash = null; 23.545 - if (actualLong == 0) 23.546 - hash = kInterfaceOnlyHashStr; 23.547 - else if (actualLong == 1) 23.548 - hash = kExternalizableHashStr; 23.549 - else 23.550 - hash = Long.toHexString(actualLong).toUpperCase(); 23.551 - while(hash.length() < 16){ 23.552 - hash = "0" + hash; 23.553 - } 23.554 - 23.555 - long declaredLong = ObjectStreamClassUtil_1_3.computeSerialVersionUID(clazz); 23.556 - String declared = null; 23.557 - if (declaredLong == 0) 23.558 - declared = kInterfaceOnlyHashStr; 23.559 - else if (declaredLong == 1) 23.560 - declared = kExternalizableHashStr; 23.561 - else 23.562 - declared = Long.toHexString(declaredLong).toUpperCase(); 23.563 - while (declared.length() < 16){ 23.564 - declared = "0" + declared; 23.565 - } 23.566 - hash = hash + ":" + declared; 23.567 - 23.568 - return ":" + hash; 23.569 - } 23.570 - 23.571 - /** 23.572 - * Creates a repository ID for a sequence. This is for expert users only as 23.573 - * this method assumes the object passed is an array. If passed an object 23.574 - * that is not an array, it will produce a rep id for a sequence of zero 23.575 - * length. This would be an error. 23.576 - * @param ser The Java object to create a repository ID for 23.577 - **/ 23.578 - public static String createSequenceRepID(java.lang.Object ser){ 23.579 - return createSequenceRepID(ser.getClass()); 23.580 - } 23.581 - 23.582 - /** 23.583 - * Creates a repository ID for a sequence. This is for expert users only as 23.584 - * this method assumes the object passed is an array. If passed an object 23.585 - * that is not an array, it will produce a malformed rep id. 23.586 - * @param clazz The Java class to create a repository ID for 23.587 - **/ 23.588 - public static String createSequenceRepID(java.lang.Class clazz){ 23.589 - synchronized (classSeqToRepStr){ 23.590 - 23.591 - String repid = (String)classSeqToRepStr.get(clazz); 23.592 - if (repid != null) 23.593 - return repid; 23.594 - 23.595 - Class originalClazz = clazz; 23.596 - 23.597 - Class type = null; 23.598 - int numOfDims = 0; 23.599 - 23.600 - while ((type = clazz.getComponentType()) != null) { 23.601 - numOfDims++; 23.602 - clazz = type; 23.603 - } 23.604 - 23.605 - if (clazz.isPrimitive()) 23.606 - repid = kValuePrefix + originalClazz.getName() + kPrimitiveSequenceValueHash; 23.607 - else { 23.608 - StringBuffer buf = new StringBuffer(); 23.609 - buf.append(kValuePrefix); 23.610 - while(numOfDims-- > 0) { 23.611 - buf.append("["); 23.612 - } 23.613 - buf.append("L"); 23.614 - buf.append(convertToISOLatin1(clazz.getName())); 23.615 - buf.append(";"); 23.616 - buf.append(createHashString(clazz)); 23.617 - repid = buf.toString(); 23.618 - } 23.619 - classSeqToRepStr.put(originalClazz,repid); 23.620 - return repid; 23.621 - } 23.622 - 23.623 - } 23.624 - 23.625 - 23.626 - public static String createForSpecialCase(java.lang.Class clazz){ 23.627 - if (clazz.isArray()){ 23.628 - return createSequenceRepID(clazz); 23.629 - } 23.630 - else { 23.631 - return (String)kSpecialCasesRepIDs.get(clazz); 23.632 - } 23.633 - } 23.634 - 23.635 - public static String createForSpecialCase(java.io.Serializable ser){ 23.636 - Class clazz = ser.getClass(); 23.637 - if (clazz.isArray()){ 23.638 - return createSequenceRepID(ser); 23.639 - } 23.640 - else 23.641 - return createForSpecialCase(clazz); 23.642 - } 23.643 - 23.644 - /** 23.645 - * Creates a repository ID for a normal Java Type. 23.646 - * @param ser The Java object to create a repository ID for 23.647 - * @exception com.sun.corba.se.impl.io.TypeMismatchException if ser implements the 23.648 - * org.omg.CORBA.portable.IDLEntity interface which indicates it is an IDL Value type. 23.649 - **/ 23.650 - public static String createForJavaType(java.io.Serializable ser) 23.651 - throws com.sun.corba.se.impl.io.TypeMismatchException 23.652 - { 23.653 - synchronized (classToRepStr) { 23.654 - String repid = createForSpecialCase(ser); 23.655 - if (repid != null) 23.656 - return repid; 23.657 - Class clazz = ser.getClass(); 23.658 - repid = (String)classToRepStr.get(clazz); 23.659 - 23.660 - if (repid != null) 23.661 - return repid; 23.662 - 23.663 - repid = kValuePrefix + convertToISOLatin1(clazz.getName()) + 23.664 - createHashString(clazz); 23.665 - 23.666 - classToRepStr.put(clazz, repid); 23.667 - repStrToClass.put(repid, clazz); 23.668 - return repid; 23.669 - } 23.670 - } 23.671 - 23.672 - /** 23.673 - * Creates a repository ID for a normal Java Type. 23.674 - * @param clz The Java class to create a repository ID for 23.675 - * @exception com.sun.corba.se.impl.io.TypeMismatchException if ser implements the 23.676 - * org.omg.CORBA.portable.IDLEntity interface which indicates it is an IDL Value type. 23.677 - **/ 23.678 - public static String createForJavaType(Class clz) 23.679 - throws com.sun.corba.se.impl.io.TypeMismatchException 23.680 - { 23.681 - synchronized (classToRepStr){ 23.682 - String repid = createForSpecialCase(clz); 23.683 - if (repid != null) 23.684 - return repid; 23.685 - 23.686 - repid = (String)classToRepStr.get(clz); 23.687 - if (repid != null) 23.688 - return repid; 23.689 - 23.690 - repid = kValuePrefix + convertToISOLatin1(clz.getName()) + 23.691 - createHashString(clz); 23.692 - 23.693 - classToRepStr.put(clz, repid); 23.694 - repStrToClass.put(repid, clz); 23.695 - return repid; 23.696 - } 23.697 - } 23.698 - 23.699 - /** 23.700 - * Creates a repository ID for an IDL Java Type. 23.701 - * @param ser The IDL Value object to create a repository ID for 23.702 - * @param major The major version number 23.703 - * @param minor The minor version number 23.704 - * @exception com.sun.corba.se.impl.io.TypeMismatchException if ser does not implement the 23.705 - * org.omg.CORBA.portable.IDLEntity interface which indicates it is an IDL Value type. 23.706 - **/ 23.707 - public static String createForIDLType(Class ser, int major, int minor) 23.708 - throws com.sun.corba.se.impl.io.TypeMismatchException 23.709 - { 23.710 - synchronized (classIDLToRepStr){ 23.711 - String repid = (String)classIDLToRepStr.get(ser); 23.712 - if (repid != null) 23.713 - return repid; 23.714 - 23.715 - repid = kIDLPrefix + convertToISOLatin1(ser.getName()).replace('.','/') + 23.716 - ":" + major + "." + minor; 23.717 - classIDLToRepStr.put(ser, repid); 23.718 - return repid; 23.719 - } 23.720 - } 23.721 - 23.722 - private static String getIdFromHelper(Class clazz){ 23.723 - try { 23.724 - Class helperClazz = Utility.loadClassForClass(clazz.getName()+"Helper", null, 23.725 - clazz.getClassLoader(), clazz, clazz.getClassLoader()); 23.726 - Method idMethod = helperClazz.getDeclaredMethod("id", kNoParamTypes); 23.727 - return (String)idMethod.invoke(null, kNoArgs); 23.728 - } 23.729 - catch(java.lang.ClassNotFoundException cnfe) 23.730 - { 23.731 - throw new org.omg.CORBA.MARSHAL(cnfe.toString()); 23.732 - } 23.733 - catch(java.lang.NoSuchMethodException nsme) 23.734 - { 23.735 - throw new org.omg.CORBA.MARSHAL(nsme.toString()); 23.736 - } 23.737 - catch(java.lang.reflect.InvocationTargetException ite) 23.738 - { 23.739 - throw new org.omg.CORBA.MARSHAL(ite.toString()); 23.740 - } 23.741 - catch(java.lang.IllegalAccessException iae) 23.742 - { 23.743 - throw new org.omg.CORBA.MARSHAL(iae.toString()); 23.744 - } 23.745 - } 23.746 - 23.747 - /** 23.748 - * Createa a repository ID for the type if it is either a java type 23.749 - * or an IDL type. 23.750 - * @param type The type to create rep. id for 23.751 - * @return The rep. id. 23.752 - **/ 23.753 - public static String createForAnyType(Class type) { 23.754 - try{ 23.755 - if (type.isArray()) 23.756 - return createSequenceRepID(type); 23.757 - else if (IDLEntity.class.isAssignableFrom(type)) 23.758 - { 23.759 - try{ 23.760 - return getIdFromHelper(type); 23.761 - } 23.762 - catch(Throwable t) { 23.763 - return createForIDLType(type, 1, 0); 23.764 - } 23.765 - } 23.766 - else return createForJavaType(type); 23.767 - } 23.768 - catch(com.sun.corba.se.impl.io.TypeMismatchException e){ 23.769 - return null; 23.770 - } 23.771 - 23.772 - } 23.773 - 23.774 - public static boolean isAbstractBase(Class clazz) { 23.775 - return (clazz.isInterface() && 23.776 - IDLEntity.class.isAssignableFrom(clazz) && 23.777 - (!ValueBase.class.isAssignableFrom(clazz)) && 23.778 - (!org.omg.CORBA.Object.class.isAssignableFrom(clazz))); 23.779 - 23.780 - } 23.781 - 23.782 - /** 23.783 - * Convert strings with illegal IDL identifier characters. 23.784 - * <p> 23.785 - * Section 5.5.7 of OBV spec. 23.786 - */ 23.787 - private static String convertToISOLatin1 (String name) { 23.788 - 23.789 - int length = name.length(); 23.790 - if (length == 0) { 23.791 - return name; 23.792 - } 23.793 - StringBuffer buffer = null; 23.794 - 23.795 - for (int i = 0; i < length; i++) { 23.796 - 23.797 - char c = name.charAt(i); 23.798 - 23.799 - if (c > 255 || IDL_IDENTIFIER_CHARS[c] == 0) { 23.800 - 23.801 - // We gotta convert. Have we already started? 23.802 - 23.803 - if (buffer == null) { 23.804 - 23.805 - // No, so get set up... 23.806 - 23.807 - buffer = new StringBuffer(name.substring(0,i)); 23.808 - } 23.809 - 23.810 - // Convert the character into the IDL escape syntax... 23.811 - buffer.append( 23.812 - "\\U" + 23.813 - (char)ASCII_HEX[(c & 0xF000) >>> 12] + 23.814 - (char)ASCII_HEX[(c & 0x0F00) >>> 8] + 23.815 - (char)ASCII_HEX[(c & 0x00F0) >>> 4] + 23.816 - (char)ASCII_HEX[(c & 0x000F)]); 23.817 - 23.818 - } else { 23.819 - if (buffer != null) { 23.820 - buffer.append(c); 23.821 - } 23.822 - } 23.823 - } 23.824 - 23.825 - if (buffer != null) { 23.826 - name = buffer.toString(); 23.827 - } 23.828 - 23.829 - return name; 23.830 - } 23.831 - 23.832 - /** 23.833 - * Convert strings with ISO Latin 1 escape sequences back to original strings. 23.834 - * <p> 23.835 - * Section 5.5.7 of OBV spec. 23.836 - */ 23.837 - private static String convertFromISOLatin1 (String name) { 23.838 - 23.839 - int index = -1; 23.840 - StringBuffer buf = new StringBuffer(name); 23.841 - 23.842 - while ((index = buf.toString().indexOf("\\U")) != -1){ 23.843 - String str = "0000" + buf.toString().substring(index+2, index+6); 23.844 - 23.845 - // Convert Hexadecimal 23.846 - byte[] buffer = new byte[(str.length() - 4) / 2]; 23.847 - for (int i=4, j=0; i < str.length(); i +=2, j++) { 23.848 - buffer[j] = (byte)((ORBUtility.hexOf(str.charAt(i)) << 4) & 0xF0); 23.849 - buffer[j] |= (byte)((ORBUtility.hexOf(str.charAt(i+1)) << 0) & 0x0F); 23.850 - } 23.851 - buf = new StringBuffer(delete(buf.toString(), index, index+6)); 23.852 - buf.insert(index, (char)buffer[1]); 23.853 - } 23.854 - 23.855 - return buf.toString(); 23.856 - 23.857 - 23.858 - } 23.859 - 23.860 - private static String delete(String str, int from, int to) 23.861 - { 23.862 - return str.substring(0, from) + str.substring(to, str.length()); 23.863 - } 23.864 - 23.865 - private static String replace(String target, String arg, String source) 23.866 - { 23.867 - int i = 0; 23.868 - i = target.indexOf(arg); 23.869 - 23.870 - while(i != -1) 23.871 - { 23.872 - String left = target.substring(0, i); 23.873 - String right = target.substring(i+arg.length()); 23.874 - target = new String(left+source+right); 23.875 - i = target.indexOf(arg); 23.876 - } 23.877 - return target; 23.878 - } 23.879 - 23.880 - /* 23.881 - * Load a class and check that it is assignable to a given type. 23.882 - * @param className the class name. 23.883 - * @param remoteCodebase the codebase to use. May be null. 23.884 - * @param loader the class loader of last resort. May be null. 23.885 - * @param expectedType the expected type. May be null. 23.886 - * @return the loaded class. 23.887 - */ 23.888 - private Class loadClassOfType (String className, 23.889 - String remoteCodebase, 23.890 - ClassLoader loader, 23.891 - Class expectedType, 23.892 - ClassLoader expectedTypeClassLoader) 23.893 - throws ClassNotFoundException { 23.894 - 23.895 - Class loadedClass = null; 23.896 - 23.897 - try { 23.898 - //Sequence finding of the stubs according to spec 23.899 - try{ 23.900 - //If-else is put here for speed up of J2EE. 23.901 - //According to the OMG spec, the if clause is not dead code. 23.902 - //It can occur if some compiler has allowed generation 23.903 - //into org.omg.stub hierarchy for non-offending 23.904 - //classes. This will encourage people to 23.905 - //produce non-offending class stubs in their own hierarchy. 23.906 - if(!PackagePrefixChecker 23.907 - .hasOffendingPrefix(PackagePrefixChecker 23.908 - .withoutPackagePrefix(className))){ 23.909 - loadedClass = Util.loadClass 23.910 - (PackagePrefixChecker.withoutPackagePrefix(className), 23.911 - remoteCodebase, 23.912 - loader); 23.913 - } else { 23.914 - loadedClass = Util.loadClass 23.915 - (className, 23.916 - remoteCodebase, 23.917 - loader); 23.918 - } 23.919 - } catch (ClassNotFoundException cnfe) { 23.920 - loadedClass = Util.loadClass 23.921 - (className, 23.922 - remoteCodebase, 23.923 - loader); 23.924 - } 23.925 - if (expectedType == null) 23.926 - return loadedClass; 23.927 - } catch (ClassNotFoundException cnfe) { 23.928 - if (expectedType == null) 23.929 - throw cnfe; 23.930 - } 23.931 - 23.932 - // If no class was not loaded, or if the loaded class is not of the 23.933 - // correct type, make a further attempt to load the correct class 23.934 - // using the classloader of the expected type. 23.935 - // _REVISIT_ Is this step necessary, or should the Util,loadClass 23.936 - // algorithm always produce a valid class if the setup is correct? 23.937 - // Does the OMG standard algorithm need to be changed to include 23.938 - // this step? 23.939 - if (loadedClass == null || !expectedType.isAssignableFrom(loadedClass)) { 23.940 - if (expectedType.getClassLoader() != expectedTypeClassLoader) 23.941 - throw new IllegalArgumentException("expectedTypeClassLoader not class loader of expectedType."); 23.942 - 23.943 - if (expectedTypeClassLoader != null) 23.944 - loadedClass = expectedTypeClassLoader.loadClass(className); 23.945 - else 23.946 - loadedClass = ORBClassLoader.loadClass(className); 23.947 - } 23.948 - 23.949 - return loadedClass; 23.950 - } 23.951 - 23.952 - /** 23.953 - * Checks to see if the FullValueDescription should be retrieved. 23.954 - * @exception Throws IOException if suids do not match or if the repositoryID 23.955 - * is not an RMIValueType 23.956 - */ 23.957 - public static boolean useFullValueDescription(Class clazz, String repositoryID) 23.958 - throws IOException{ 23.959 - 23.960 - String clazzRepIDStr = createForAnyType(clazz); 23.961 - 23.962 - if (clazzRepIDStr.equals(repositoryID)) 23.963 - return false; 23.964 - 23.965 - RepositoryId_1_3 targetRepid; 23.966 - RepositoryId_1_3 clazzRepid; 23.967 - 23.968 - synchronized(cache) { 23.969 - // to avoid race condition where multiple threads could be 23.970 - // accessing this method, and their access to the cache may 23.971 - // be interleaved giving unexpected results 23.972 - 23.973 - targetRepid = cache.getId(repositoryID); 23.974 - clazzRepid = cache.getId(clazzRepIDStr); 23.975 - } 23.976 - 23.977 - if ((targetRepid.isRMIValueType()) && (clazzRepid.isRMIValueType())){ 23.978 - if (!targetRepid.getSerialVersionUID().equals(clazzRepid.getSerialVersionUID())) { 23.979 - 23.980 - String mssg = "Mismatched serialization UIDs : Source (Rep. ID" + 23.981 - clazzRepid + ") = " + 23.982 - clazzRepid.getSerialVersionUID() + " whereas Target (Rep. ID " + repositoryID + 23.983 - ") = " + targetRepid.getSerialVersionUID(); 23.984 - throw new IOException(mssg); 23.985 - } else { 23.986 - return true; 23.987 - } 23.988 - } else { 23.989 - 23.990 - throw new IOException("The repository ID is not of an RMI value type (Expected ID = " + clazzRepIDStr + "; Received ID = " + repositoryID +")"); 23.991 - } 23.992 - } 23.993 -}
24.1 --- a/src/share/classes/com/sun/corba/se/impl/orbutil/RepositoryId_1_3_1.java Fri Feb 15 01:49:36 2013 +0400 24.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 24.3 @@ -1,1065 +0,0 @@ 24.4 -/* 24.5 - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. 24.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 24.7 - * 24.8 - * This code is free software; you can redistribute it and/or modify it 24.9 - * under the terms of the GNU General Public License version 2 only, as 24.10 - * published by the Free Software Foundation. Oracle designates this 24.11 - * particular file as subject to the "Classpath" exception as provided 24.12 - * by Oracle in the LICENSE file that accompanied this code. 24.13 - * 24.14 - * This code is distributed in the hope that it will be useful, but WITHOUT 24.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 24.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 24.17 - * version 2 for more details (a copy is included in the LICENSE file that 24.18 - * accompanied this code). 24.19 - * 24.20 - * You should have received a copy of the GNU General Public License version 24.21 - * 2 along with this work; if not, write to the Free Software Foundation, 24.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 24.23 - * 24.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 24.25 - * or visit www.oracle.com if you need additional information or have any 24.26 - * questions. 24.27 - */ 24.28 - 24.29 -/* 24.30 - */ 24.31 -package com.sun.corba.se.impl.orbutil; 24.32 - 24.33 -import java.util.StringTokenizer; 24.34 -import java.util.Hashtable; 24.35 -import java.io.IOException; 24.36 -import java.lang.reflect.Method; 24.37 -import java.net.MalformedURLException; 24.38 -import org.omg.CORBA.portable.ValueBase; 24.39 -import org.omg.CORBA.portable.IDLEntity; 24.40 - 24.41 -//d11638 files in the same package, therefore remove their reference 24.42 -//import com.sun.corba.se.impl.util.JDKBridge; 24.43 -//import com.sun.corba.se.impl.util.IdentityHashtable; 24.44 -import com.sun.corba.se.impl.util.JDKBridge; 24.45 -import com.sun.corba.se.impl.util.Utility; 24.46 -import com.sun.corba.se.impl.util.PackagePrefixChecker; 24.47 -import com.sun.corba.se.impl.util.IdentityHashtable; 24.48 - 24.49 -import javax.rmi.CORBA.Util; 24.50 - 24.51 -/** 24.52 - * Because all methods in RepositoryId are static, we have 24.53 - * to duplicate all of this code, freezing it in its 1.3.1 24.54 - * form for backwards compatibility. 24.55 - * 24.56 - * For security reasons, we can't expose enough of 24.57 - * io/ObjectStreamClass, so it has to be duplicated in 24.58 - * orbutil. 24.59 - */ 24.60 -public class RepositoryId_1_3_1 { 24.61 - 24.62 - // Legal IDL Identifier characters (1 = legal). Note 24.63 - // that '.' (2E) is marked as legal even though it is 24.64 - // not legal in IDL. This allows us to treat a fully 24.65 - // qualified Java name with '.' package separators 24.66 - // uniformly, and is safe because that is the only 24.67 - // legal use of '.' in a Java name. 24.68 - 24.69 - private static final byte[] IDL_IDENTIFIER_CHARS = { 24.70 - 24.71 - // 0 1 2 3 4 5 6 7 8 9 a b c d e f 24.72 - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 00-0f 24.73 - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 10-1f 24.74 - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,1,0, // 20-2f 24.75 - 1,1,1,1, 1,1,1,1, 1,1,0,0, 0,0,0,0, // 30-3f 24.76 - 0,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // 40-4f 24.77 - 1,1,1,1, 1,1,1,1, 1,1,1,0, 0,0,0,1, // 50-5f 24.78 - 0,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // 60-6f 24.79 - 1,1,1,1, 1,1,1,1, 1,1,1,0, 0,0,0,0, // 70-7f 24.80 - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 80-8f 24.81 - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 90-9f 24.82 - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // a0-af 24.83 - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // b0-bf 24.84 - 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // c0-cf 24.85 - 0,1,1,1, 1,1,1,0, 1,1,1,1, 1,0,0,1, // d0-df 24.86 - 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // e0-ef 24.87 - 0,1,1,1, 1,1,1,0, 1,1,1,1, 1,0,0,1, // f0-ff 24.88 - }; 24.89 - 24.90 - 24.91 - private static final long serialVersionUID = 123456789L; 24.92 - 24.93 - private static String defaultServerURL = null; 24.94 - private static boolean useCodebaseOnly = false; 24.95 - 24.96 - static { 24.97 - if (defaultServerURL == null) 24.98 - defaultServerURL = (String)JDKBridge.getLocalCodebase(); 24.99 - useCodebaseOnly = JDKBridge.useCodebaseOnly(); 24.100 - 24.101 - } 24.102 - 24.103 - private static IdentityHashtable classToRepStr = new IdentityHashtable(); 24.104 - private static IdentityHashtable classIDLToRepStr = new IdentityHashtable(); 24.105 - private static IdentityHashtable classSeqToRepStr = new IdentityHashtable(); 24.106 - 24.107 - private static IdentityHashtable repStrToByteArray = new IdentityHashtable(); 24.108 - private static Hashtable repStrToClass = new Hashtable(); 24.109 - 24.110 - private String repId = null; 24.111 - private boolean isSupportedFormat = true; 24.112 - private String typeString = null; 24.113 - private String versionString = null; 24.114 - private boolean isSequence = false; 24.115 - private boolean isRMIValueType = false; 24.116 - private boolean isIDLType = false; 24.117 - private String completeClassName = null; 24.118 - private String unqualifiedName = null; 24.119 - private String definedInId = null; 24.120 - private Class clazz = null; 24.121 - private String suid = null, actualSuid = null; 24.122 - private long suidLong = ObjectStreamClass_1_3_1.kDefaultUID, actualSuidLong = ObjectStreamClass_1_3_1.kDefaultUID; 24.123 - 24.124 - // Repository ID fragments 24.125 - private static final String kSequenceKeyword = "seq"; 24.126 - private static final String kValuePrefix = "RMI:"; 24.127 - private static final String kIDLPrefix = "IDL:"; 24.128 - private static final String kIDLNamePrefix = "omg.org/"; 24.129 - private static final String kIDLClassnamePrefix = "org.omg."; 24.130 - private static final String kSequencePrefix = "["; 24.131 - private static final String kCORBAPrefix = "CORBA/"; 24.132 - private static final String kArrayPrefix = kValuePrefix + kSequencePrefix + kCORBAPrefix; 24.133 - private static final int kValuePrefixLength = kValuePrefix.length(); 24.134 - private static final int kIDLPrefixLength = kIDLPrefix.length(); 24.135 - private static final int kSequencePrefixLength = kSequencePrefix.length(); 24.136 - private static final String kInterfaceHashCode = ":0000000000000000"; 24.137 - private static final String kInterfaceOnlyHashStr = "0000000000000000"; 24.138 - private static final String kExternalizableHashStr = "0000000000000001"; 24.139 - 24.140 - // Value tag utility methods and constants 24.141 - public static final int kInitialValueTag= 0x7fffff00; 24.142 - public static final int kNoTypeInfo = 0; 24.143 - public static final int kSingleRepTypeInfo = 0x02; 24.144 - public static final int kPartialListTypeInfo = 0x06; 24.145 - public static final int kChunkedMask = 0x08; 24.146 - public static final int kPreComputed_StandardRMIUnchunked = RepositoryId_1_3_1.computeValueTag(false, RepositoryId_1_3_1.kSingleRepTypeInfo, false); 24.147 - public static final int kPreComputed_CodeBaseRMIUnchunked = RepositoryId_1_3_1.computeValueTag(true, RepositoryId_1_3_1.kSingleRepTypeInfo, false); 24.148 - public static final int kPreComputed_StandardRMIChunked = RepositoryId_1_3_1.computeValueTag(false, RepositoryId_1_3_1.kSingleRepTypeInfo, true); 24.149 - public static final int kPreComputed_CodeBaseRMIChunked = RepositoryId_1_3_1.computeValueTag(true, RepositoryId_1_3_1.kSingleRepTypeInfo, true); 24.150 - 24.151 - public static final int kPreComputed_StandardRMIUnchunked_NoRep = RepositoryId_1_3_1.computeValueTag(false, RepositoryId_1_3_1.kNoTypeInfo, false); 24.152 - public static final int kPreComputed_CodeBaseRMIUnchunked_NoRep = RepositoryId_1_3_1.computeValueTag(true, RepositoryId_1_3_1.kNoTypeInfo, false); 24.153 - public static final int kPreComputed_StandardRMIChunked_NoRep = RepositoryId_1_3_1.computeValueTag(false, RepositoryId_1_3_1.kNoTypeInfo, true); 24.154 - public static final int kPreComputed_CodeBaseRMIChunked_NoRep = RepositoryId_1_3_1.computeValueTag(true, RepositoryId_1_3_1.kNoTypeInfo, true); 24.155 - 24.156 - // Public, well known repository IDs 24.157 - 24.158 - // _REVISIT_ : A table structure with a good search routine for all of this 24.159 - // would be more efficient and easier to maintain... 24.160 - 24.161 - // String 24.162 - public static final String kWStringValueVersion = "1.0"; 24.163 - public static final String kWStringValueHash = ":"+kWStringValueVersion; 24.164 - public static final String kWStringStubValue = "WStringValue"; 24.165 - public static final String kWStringTypeStr = "omg.org/CORBA/"+kWStringStubValue; 24.166 - public static final String kWStringValueRepID = kIDLPrefix + kWStringTypeStr + kWStringValueHash; 24.167 - 24.168 - // Any 24.169 - public static final String kAnyRepID = kIDLPrefix + "omg.org/CORBA/Any"; 24.170 - 24.171 - // Class 24.172 - // Anita4: convert to uppercase 24.173 - public static final String kClassDescValueHash = ":" + 24.174 - Long.toHexString( 24.175 - ObjectStreamClass_1_3_1.getActualSerialVersionUID(javax.rmi.CORBA.ClassDesc.class)).toUpperCase() + ":" + 24.176 - Long.toHexString( 24.177 - ObjectStreamClass_1_3_1.getSerialVersionUID(javax.rmi.CORBA.ClassDesc.class)).toUpperCase(); 24.178 - public static final String kClassDescStubValue = "ClassDesc"; 24.179 - public static final String kClassDescTypeStr = "javax.rmi.CORBA."+kClassDescStubValue; 24.180 - public static final String kClassDescValueRepID = kValuePrefix + kClassDescTypeStr + kClassDescValueHash; 24.181 - 24.182 - // Object 24.183 - public static final String kObjectValueHash = ":1.0"; 24.184 - public static final String kObjectStubValue = "Object"; 24.185 - 24.186 - // Sequence 24.187 - public static final String kSequenceValueHash = ":1.0"; 24.188 - public static final String kPrimitiveSequenceValueHash = ":0000000000000000"; 24.189 - 24.190 - // Serializable 24.191 - public static final String kSerializableValueHash = ":1.0"; 24.192 - public static final String kSerializableStubValue = "Serializable"; 24.193 - 24.194 - // Externalizable 24.195 - public static final String kExternalizableValueHash = ":1.0"; 24.196 - public static final String kExternalizableStubValue = "Externalizable"; 24.197 - 24.198 - // Remote (The empty string is used for java.rmi.Remote) 24.199 - public static final String kRemoteValueHash = ""; 24.200 - public static final String kRemoteStubValue = ""; 24.201 - public static final String kRemoteTypeStr = ""; 24.202 - public static final String kRemoteValueRepID = ""; 24.203 - 24.204 - private static final Hashtable kSpecialArrayTypeStrings = new Hashtable(); 24.205 - 24.206 - static { 24.207 - kSpecialArrayTypeStrings.put("CORBA.WStringValue", new StringBuffer(java.lang.String.class.getName())); 24.208 - kSpecialArrayTypeStrings.put("javax.rmi.CORBA.ClassDesc", new StringBuffer(java.lang.Class.class.getName())); 24.209 - kSpecialArrayTypeStrings.put("CORBA.Object", new StringBuffer(java.rmi.Remote.class.getName())); 24.210 - 24.211 - } 24.212 - 24.213 - private static final Hashtable kSpecialCasesRepIDs = new Hashtable(); 24.214 - 24.215 - static { 24.216 - kSpecialCasesRepIDs.put(java.lang.String.class, kWStringValueRepID); 24.217 - kSpecialCasesRepIDs.put(java.lang.Class.class, kClassDescValueRepID); 24.218 - kSpecialCasesRepIDs.put(java.rmi.Remote.class, kRemoteValueRepID); 24.219 - } 24.220 - 24.221 - private static final Hashtable kSpecialCasesStubValues = new Hashtable(); 24.222 - 24.223 - static { 24.224 - kSpecialCasesStubValues.put(java.lang.String.class, kWStringStubValue); 24.225 - kSpecialCasesStubValues.put(java.lang.Class.class, kClassDescStubValue); 24.226 - kSpecialCasesStubValues.put(java.lang.Object.class, kObjectStubValue); 24.227 - kSpecialCasesStubValues.put(java.io.Serializable.class, kSerializableStubValue); 24.228 - kSpecialCasesStubValues.put(java.io.Externalizable.class, kExternalizableStubValue); 24.229 - kSpecialCasesStubValues.put(java.rmi.Remote.class, kRemoteStubValue); 24.230 - } 24.231 - 24.232 - 24.233 - private static final Hashtable kSpecialCasesVersions = new Hashtable(); 24.234 - 24.235 - static { 24.236 - kSpecialCasesVersions.put(java.lang.String.class, kWStringValueHash); 24.237 - kSpecialCasesVersions.put(java.lang.Class.class, kClassDescValueHash); 24.238 - kSpecialCasesVersions.put(java.lang.Object.class, kObjectValueHash); 24.239 - kSpecialCasesVersions.put(java.io.Serializable.class, kSerializableValueHash); 24.240 - kSpecialCasesVersions.put(java.io.Externalizable.class, kExternalizableValueHash); 24.241 - kSpecialCasesVersions.put(java.rmi.Remote.class, kRemoteValueHash); 24.242 - } 24.243 - 24.244 - private static final Hashtable kSpecialCasesClasses = new Hashtable(); 24.245 - 24.246 - static { 24.247 - kSpecialCasesClasses.put(kWStringTypeStr, java.lang.String.class); 24.248 - kSpecialCasesClasses.put(kClassDescTypeStr, java.lang.Class.class); 24.249 - kSpecialCasesClasses.put(kRemoteTypeStr, java.rmi.Remote.class); 24.250 - 24.251 - kSpecialCasesClasses.put("org.omg.CORBA.WStringValue", java.lang.String.class); 24.252 - kSpecialCasesClasses.put("javax.rmi.CORBA.ClassDesc", java.lang.Class.class); 24.253 - //kSpecialCasesClasses.put(kRemoteTypeStr, java.rmi.Remote.class); 24.254 - } 24.255 - 24.256 - private static final Hashtable kSpecialCasesArrayPrefix = new Hashtable(); 24.257 - 24.258 - static { 24.259 - kSpecialCasesArrayPrefix.put(java.lang.String.class, kValuePrefix + kSequencePrefix + kCORBAPrefix); 24.260 - kSpecialCasesArrayPrefix.put(java.lang.Class.class, kValuePrefix + kSequencePrefix + "javax/rmi/CORBA/"); 24.261 - kSpecialCasesArrayPrefix.put(java.lang.Object.class, kValuePrefix + kSequencePrefix + "java/lang/"); 24.262 - kSpecialCasesArrayPrefix.put(java.io.Serializable.class, kValuePrefix + kSequencePrefix + "java/io/"); 24.263 - kSpecialCasesArrayPrefix.put(java.io.Externalizable.class, kValuePrefix + kSequencePrefix + "java/io/"); 24.264 - kSpecialCasesArrayPrefix.put(java.rmi.Remote.class, kValuePrefix + kSequencePrefix + kCORBAPrefix); 24.265 - } 24.266 - 24.267 - private static final Hashtable kSpecialPrimitives = new Hashtable(); 24.268 - 24.269 - static { 24.270 - kSpecialPrimitives.put("int","long"); 24.271 - kSpecialPrimitives.put("long","longlong"); 24.272 - kSpecialPrimitives.put("byte","octet"); 24.273 - } 24.274 - 24.275 - /** 24.276 - * Used to convert ascii to hex. 24.277 - */ 24.278 - private static final byte ASCII_HEX[] = { 24.279 - (byte)'0', 24.280 - (byte)'1', 24.281 - (byte)'2', 24.282 - (byte)'3', 24.283 - (byte)'4', 24.284 - (byte)'5', 24.285 - (byte)'6', 24.286 - (byte)'7', 24.287 - (byte)'8', 24.288 - (byte)'9', 24.289 - (byte)'A', 24.290 - (byte)'B', 24.291 - (byte)'C', 24.292 - (byte)'D', 24.293 - (byte)'E', 24.294 - (byte)'F', 24.295 - }; 24.296 - 24.297 - 24.298 - // bug fix for 4328952; to eliminate possibility of overriding this 24.299 - // in a subclass. 24.300 - public static final RepositoryIdCache_1_3_1 cache = new RepositoryIdCache_1_3_1(); 24.301 - 24.302 - // Interface Rep ID Strings 24.303 - public static final String kjava_rmi_Remote = createForAnyType(java.rmi.Remote.class); 24.304 - public static final String korg_omg_CORBA_Object = createForAnyType(org.omg.CORBA.Object.class); 24.305 - 24.306 - // Dummy arguments for getIdFromHelper method 24.307 - public static final Class kNoParamTypes[] ={}; 24.308 - public static final Object kNoArgs[] = {}; 24.309 - 24.310 - 24.311 - // To create a RepositoryID, use code similar to the following: 24.312 - // RepositoryId.cache.getId( id ); 24.313 - 24.314 - RepositoryId_1_3_1(){} 24.315 - 24.316 - RepositoryId_1_3_1(String aRepId){ 24.317 - init(aRepId); 24.318 - } 24.319 - 24.320 - RepositoryId_1_3_1 init(String aRepId){ 24.321 - 24.322 - this.repId = aRepId; 24.323 - 24.324 - // Special case for remote 24.325 - if (aRepId.length() == 0) { 24.326 - clazz = java.rmi.Remote.class; 24.327 - typeString = ""; 24.328 - isRMIValueType = true; 24.329 - suid = kInterfaceOnlyHashStr; 24.330 - return this; 24.331 - } 24.332 - else if (aRepId.equals(kWStringValueRepID)) { 24.333 - clazz = java.lang.String.class; 24.334 - typeString = kWStringTypeStr; 24.335 - isIDLType = true; 24.336 - // fix where Attempting to obtain a FullValueDescription 24.337 - // for an RMI value type with a String field causes an exception. 24.338 - completeClassName = "java.lang.String"; 24.339 - versionString = kWStringValueVersion; 24.340 - return this; 24.341 - } 24.342 - else { 24.343 - 24.344 - String repId = convertFromISOLatin1(aRepId); 24.345 - 24.346 - versionString = repId.substring(repId.indexOf(':', repId.indexOf(':')+1)); 24.347 - if (repId.startsWith(kIDLPrefix)) { 24.348 - typeString = 24.349 - repId.substring(kIDLPrefixLength, repId.indexOf(':', kIDLPrefixLength)); 24.350 - isIDLType = true; 24.351 - if (typeString.startsWith(kIDLNamePrefix)) 24.352 - completeClassName = kIDLClassnamePrefix + 24.353 - typeString.substring(kIDLNamePrefix.length()).replace('/','.'); 24.354 - else completeClassName = typeString.replace('/','.'); 24.355 - 24.356 - } 24.357 - else if (repId.startsWith(kValuePrefix)) { 24.358 - typeString = 24.359 - repId.substring(kValuePrefixLength, repId.indexOf(':', kValuePrefixLength)); 24.360 - isRMIValueType = true; 24.361 - 24.362 - if (versionString.indexOf('.') == -1) { 24.363 - actualSuid = versionString.substring(1); 24.364 - suid = actualSuid; // default if not explicitly specified 24.365 - 24.366 - if (actualSuid.indexOf(':') != -1){ 24.367 - // we have a declared hash also 24.368 - int pos = actualSuid.indexOf(':')+1; 24.369 - // actualSuid = suid.substring(pos); 24.370 - // suid = suid.substring(0, pos-1); 24.371 - suid = actualSuid.substring(pos); 24.372 - actualSuid = actualSuid.substring(0, pos-1); 24.373 - } 24.374 - 24.375 - } 24.376 - else { 24.377 - // _REVISIT_ : Special case version failure ? 24.378 - } 24.379 - } 24.380 - else isSupportedFormat = false; 24.381 - 24.382 - if (typeString.startsWith(kSequencePrefix)) { 24.383 - isSequence = true; 24.384 - } 24.385 - 24.386 - 24.387 - return this; 24.388 - } 24.389 - } 24.390 - 24.391 - public final String getUnqualifiedName() { 24.392 - if (unqualifiedName == null){ 24.393 - String className = getClassName(); 24.394 - int index = className.lastIndexOf('.'); 24.395 - if (index == -1){ 24.396 - unqualifiedName = className; 24.397 - definedInId = "IDL::1.0"; 24.398 - } 24.399 - else { 24.400 - unqualifiedName = className.substring(index); 24.401 - definedInId = "IDL:" + className.substring(0, index).replace('.','/') + ":1.0"; 24.402 - } 24.403 - } 24.404 - 24.405 - return unqualifiedName; 24.406 - } 24.407 - 24.408 - public final String getDefinedInId() { 24.409 - if (definedInId == null){ 24.410 - getUnqualifiedName(); 24.411 - } 24.412 - 24.413 - return definedInId; 24.414 - } 24.415 - 24.416 - public final String getTypeString() { 24.417 - return typeString; 24.418 - } 24.419 - 24.420 - public final String getVersionString() { 24.421 - return versionString; 24.422 - } 24.423 - 24.424 - public final String getSerialVersionUID() { 24.425 - return suid; 24.426 - } 24.427 - 24.428 - public final String getActualSerialVersionUID() { 24.429 - return actualSuid; 24.430 - } 24.431 - public final long getSerialVersionUIDAsLong() { 24.432 - return suidLong; 24.433 - } 24.434 - 24.435 - public final long getActualSerialVersionUIDAsLong() { 24.436 - return actualSuidLong; 24.437 - } 24.438 - 24.439 - public final boolean isRMIValueType() { 24.440 - return isRMIValueType; 24.441 - } 24.442 - 24.443 - public final boolean isIDLType() { 24.444 - return isIDLType; 24.445 - } 24.446 - 24.447 - public final String getRepositoryId() { 24.448 - return repId; 24.449 - } 24.450 - 24.451 - public static byte[] getByteArray(String repStr) { 24.452 - synchronized (repStrToByteArray){ 24.453 - return (byte[]) repStrToByteArray.get(repStr); 24.454 - } 24.455 - } 24.456 - 24.457 - public static void setByteArray(String repStr, byte[] repStrBytes) { 24.458 - synchronized (repStrToByteArray){ 24.459 - repStrToByteArray.put(repStr, repStrBytes); 24.460 - } 24.461 - } 24.462 - 24.463 - public final boolean isSequence() { 24.464 - return isSequence; 24.465 - } 24.466 - 24.467 - public final boolean isSupportedFormat() { 24.468 - return isSupportedFormat; 24.469 - } 24.470 - 24.471 - 24.472 - // This method will return the classname from the typestring OR if the classname turns out to be 24.473 - // a special class "pseudo" name, then the matching real classname is returned. 24.474 - public final String getClassName() { 24.475 - 24.476 - if (isRMIValueType) 24.477 - return typeString; 24.478 - else if (isIDLType) 24.479 - return completeClassName; 24.480 - else return null; 24.481 - 24.482 - } 24.483 - 24.484 - // This method calls getClazzFromType() and falls back to the repStrToClass 24.485 - // cache if no class was found. It's used where any class matching the 24.486 - // given repid is an acceptable result. 24.487 - public final Class getAnyClassFromType() throws ClassNotFoundException { 24.488 - try { 24.489 - return getClassFromType(); 24.490 - } catch (ClassNotFoundException cnfe) { 24.491 - Class clz = (Class)repStrToClass.get(repId); 24.492 - if (clz != null) 24.493 - return clz; 24.494 - else 24.495 - throw cnfe; 24.496 - } 24.497 - } 24.498 - 24.499 - public final Class getClassFromType() 24.500 - throws ClassNotFoundException { 24.501 - if (clazz != null) 24.502 - return clazz; 24.503 - 24.504 - Class specialCase = (Class)kSpecialCasesClasses.get(getClassName()); 24.505 - 24.506 - if (specialCase != null){ 24.507 - clazz = specialCase; 24.508 - return specialCase; 24.509 - } 24.510 - else 24.511 - { 24.512 - try{ 24.513 - return Util.loadClass(getClassName(), null, null); 24.514 - } 24.515 - catch(ClassNotFoundException cnfe){ 24.516 - if (defaultServerURL != null) { 24.517 - try{ 24.518 - return getClassFromType(defaultServerURL); 24.519 - } 24.520 - catch(MalformedURLException mue){ 24.521 - throw cnfe; 24.522 - } 24.523 - } 24.524 - else throw cnfe; 24.525 - } 24.526 - } 24.527 - 24.528 - } 24.529 - 24.530 - public final Class getClassFromType(Class expectedType, String codebase) 24.531 - throws ClassNotFoundException { 24.532 - if (clazz != null) 24.533 - return clazz; 24.534 - 24.535 - Class specialCase = (Class)kSpecialCasesClasses.get(getClassName()); 24.536 - 24.537 - if (specialCase != null){ 24.538 - clazz = specialCase; 24.539 - return specialCase; 24.540 - } else { 24.541 - ClassLoader expectedTypeClassLoader = (expectedType == null ? null : expectedType.getClassLoader()); 24.542 - return loadClassOfType(getClassName(), 24.543 - codebase, 24.544 - expectedTypeClassLoader, 24.545 - expectedType, 24.546 - expectedTypeClassLoader); 24.547 - } 24.548 - 24.549 - } 24.550 - 24.551 - public final Class getClassFromType(String url) 24.552 - throws ClassNotFoundException, MalformedURLException { 24.553 - return Util.loadClass(getClassName(), url, null); 24.554 - } 24.555 - 24.556 - public final String toString() { 24.557 - return repId; 24.558 - } 24.559 - 24.560 - /** 24.561 - * Checks to see if the FullValueDescription should be retrieved. 24.562 - * @exception Throws IOException if suids do not match or if the repositoryID 24.563 - * is not an RMIValueType 24.564 - */ 24.565 - public static boolean useFullValueDescription(Class clazz, String repositoryID) 24.566 - throws IOException{ 24.567 - 24.568 - String clazzRepIDStr = createForAnyType(clazz); 24.569 - 24.570 - if (clazzRepIDStr.equals(repositoryID)) 24.571 - return false; 24.572 - 24.573 - RepositoryId_1_3_1 targetRepid; 24.574 - RepositoryId_1_3_1 clazzRepid; 24.575 - 24.576 - synchronized(cache) { 24.577 - // to avoid race condition where multiple threads could be 24.578 - // accessing this method, and their access to the cache may 24.579 - // be interleaved giving unexpected results 24.580 - 24.581 - targetRepid = cache.getId(repositoryID); 24.582 - clazzRepid = cache.getId(clazzRepIDStr); 24.583 - } 24.584 - //ObjectStreamClass osc = ObjectStreamClass.lookup(clazz); 24.585 - 24.586 - if ((targetRepid.isRMIValueType()) && (clazzRepid.isRMIValueType())){ 24.587 - if (!targetRepid.getSerialVersionUID().equals(clazzRepid.getSerialVersionUID())) { 24.588 - 24.589 - String mssg = "Mismatched serialization UIDs : Source (Rep. ID" + 24.590 - clazzRepid + ") = " + 24.591 - clazzRepid.getSerialVersionUID() + " whereas Target (Rep. ID " + repositoryID + 24.592 - ") = " + targetRepid.getSerialVersionUID(); 24.593 - //com.sun.corba.se.impl.io.ValueUtility.log("RepositoryId",mssg); 24.594 - throw new IOException(mssg); 24.595 - } 24.596 - else { 24.597 - return true; 24.598 - } 24.599 - } 24.600 - else { 24.601 - 24.602 - throw new IOException("The repository ID is not of an RMI value type (Expected ID = " + clazzRepIDStr + "; Received ID = " + repositoryID +")"); 24.603 - } 24.604 - } 24.605 - 24.606 - private static String createHashString(java.io.Serializable ser) { 24.607 - 24.608 - return createHashString(ser.getClass()); 24.609 - } 24.610 - 24.611 - private static String createHashString(java.lang.Class clazz) { 24.612 - 24.613 - if (clazz.isInterface() || !java.io.Serializable.class.isAssignableFrom(clazz)) 24.614 - return kInterfaceHashCode; 24.615 - 24.616 - //ObjectStreamClass osc = ObjectStreamClass.lookup(clazz); 24.617 - 24.618 - long actualLong = ObjectStreamClass_1_3_1.getActualSerialVersionUID(clazz); 24.619 - String hash = null; 24.620 - if (actualLong == 0) 24.621 - hash = kInterfaceOnlyHashStr; 24.622 - else if (actualLong == 1) 24.623 - hash = kExternalizableHashStr; 24.624 - else 24.625 - hash = Long.toHexString(actualLong).toUpperCase(); 24.626 - while(hash.length() < 16){ 24.627 - hash = "0" + hash; 24.628 - } 24.629 - 24.630 - long declaredLong = ObjectStreamClass_1_3_1.getSerialVersionUID(clazz); 24.631 - String declared = null; 24.632 - if (declaredLong == 0) 24.633 - declared = kInterfaceOnlyHashStr; 24.634 - else if (declaredLong == 1) 24.635 - declared = kExternalizableHashStr; 24.636 - else 24.637 - declared = Long.toHexString(declaredLong).toUpperCase(); 24.638 - while (declared.length() < 16){ 24.639 - declared = "0" + declared; 24.640 - } 24.641 - hash = hash + ":" + declared; 24.642 - 24.643 - return ":" + hash; 24.644 - } 24.645 - 24.646 - /** 24.647 - * Creates a repository ID for a sequence. This is for expert users only as 24.648 - * this method assumes the object passed is an array. If passed an object 24.649 - * that is not an array, it will produce a rep id for a sequence of zero 24.650 - * length. This would be an error. 24.651 - * @param ser The Java object to create a repository ID for 24.652 - **/ 24.653 - public static String createSequenceRepID(java.lang.Object ser){ 24.654 - return createSequenceRepID(ser.getClass()); 24.655 - } 24.656 - 24.657 - /** 24.658 - * Creates a repository ID for a sequence. This is for expert users only as 24.659 - * this method assumes the object passed is an array. If passed an object 24.660 - * that is not an array, it will produce a malformed rep id. 24.661 - * @param clazz The Java class to create a repository ID for 24.662 - **/ 24.663 - public static String createSequenceRepID(java.lang.Class clazz){ 24.664 - synchronized (classSeqToRepStr){ 24.665 - 24.666 - String repid = (String)classSeqToRepStr.get(clazz); 24.667 - if (repid != null) 24.668 - return repid; 24.669 - 24.670 - Class originalClazz = clazz; 24.671 - 24.672 - Class type = null; 24.673 - int numOfDims = 0; 24.674 - 24.675 - while ((type = clazz.getComponentType()) != null) { 24.676 - numOfDims++; 24.677 - clazz = type; 24.678 - } 24.679 - 24.680 - if (clazz.isPrimitive()) 24.681 - repid = kValuePrefix + originalClazz.getName() + kPrimitiveSequenceValueHash; 24.682 - else { 24.683 - StringBuffer buf = new StringBuffer(); 24.684 - buf.append(kValuePrefix); 24.685 - while(numOfDims-- > 0) { 24.686 - buf.append("["); 24.687 - } 24.688 - buf.append("L"); 24.689 - buf.append(convertToISOLatin1(clazz.getName())); 24.690 - buf.append(";"); 24.691 - buf.append(createHashString(clazz)); 24.692 - repid = buf.toString(); 24.693 - } 24.694 - classSeqToRepStr.put(originalClazz,repid); 24.695 - return repid; 24.696 - } 24.697 - 24.698 - } 24.699 - 24.700 - 24.701 - public static String createForSpecialCase(java.lang.Class clazz){ 24.702 - if (clazz.isArray()){ 24.703 - return createSequenceRepID(clazz); 24.704 - } 24.705 - else { 24.706 - return (String)kSpecialCasesRepIDs.get(clazz); 24.707 - } 24.708 - } 24.709 - 24.710 - public static String createForSpecialCase(java.io.Serializable ser){ 24.711 - Class clazz = ser.getClass(); 24.712 - if (clazz.isArray()){ 24.713 - return createSequenceRepID(ser); 24.714 - } 24.715 - else 24.716 - return createForSpecialCase(clazz); 24.717 - } 24.718 - 24.719 - /** 24.720 - * Creates a repository ID for a normal Java Type. 24.721 - * @param ser The Java object to create a repository ID for 24.722 - * @exception com.sun.corba.se.impl.io.TypeMismatchException if ser implements the 24.723 - * org.omg.CORBA.portable.IDLEntity interface which indicates it is an IDL Value type. 24.724 - **/ 24.725 - public static String createForJavaType(java.io.Serializable ser) 24.726 - throws com.sun.corba.se.impl.io.TypeMismatchException 24.727 - { 24.728 - synchronized (classToRepStr) { 24.729 - String repid = createForSpecialCase(ser); 24.730 - if (repid != null) 24.731 - return repid; 24.732 - Class clazz = ser.getClass(); 24.733 - repid = (String)classToRepStr.get(clazz); 24.734 - 24.735 - if (repid != null) 24.736 - return repid; 24.737 - 24.738 - repid = kValuePrefix + convertToISOLatin1(clazz.getName()) + 24.739 - createHashString(clazz); 24.740 - 24.741 - classToRepStr.put(clazz, repid); 24.742 - repStrToClass.put(repid, clazz); 24.743 - return repid; 24.744 - } 24.745 - } 24.746 - 24.747 - /** 24.748 - * Creates a repository ID for a normal Java Type. 24.749 - * @param clz The Java class to create a repository ID for 24.750 - * @exception com.sun.corba.se.impl.io.TypeMismatchException if ser implements the 24.751 - * org.omg.CORBA.portable.IDLEntity interface which indicates it is an IDL Value type. 24.752 - **/ 24.753 - public static String createForJavaType(Class clz) 24.754 - throws com.sun.corba.se.impl.io.TypeMismatchException 24.755 - { 24.756 - synchronized (classToRepStr){ 24.757 - String repid = createForSpecialCase(clz); 24.758 - if (repid != null) 24.759 - return repid; 24.760 - 24.761 - repid = (String)classToRepStr.get(clz); 24.762 - if (repid != null) 24.763 - return repid; 24.764 - 24.765 - repid = kValuePrefix + convertToISOLatin1(clz.getName()) + 24.766 - createHashString(clz); 24.767 - 24.768 - classToRepStr.put(clz, repid); 24.769 - repStrToClass.put(repid, clz); 24.770 - return repid; 24.771 - } 24.772 - } 24.773 - 24.774 - /** 24.775 - * Creates a repository ID for an IDL Java Type. 24.776 - * @param ser The IDL Value object to create a repository ID for 24.777 - * @param major The major version number 24.778 - * @param minor The minor version number 24.779 - * @exception com.sun.corba.se.impl.io.TypeMismatchException if ser does not implement the 24.780 - * org.omg.CORBA.portable.IDLEntity interface which indicates it is an IDL Value type. 24.781 - **/ 24.782 - public static String createForIDLType(Class ser, int major, int minor) 24.783 - throws com.sun.corba.se.impl.io.TypeMismatchException 24.784 - { 24.785 - synchronized (classIDLToRepStr){ 24.786 - String repid = (String)classIDLToRepStr.get(ser); 24.787 - if (repid != null) 24.788 - return repid; 24.789 - 24.790 - repid = kIDLPrefix + convertToISOLatin1(ser.getName()).replace('.','/') + 24.791 - ":" + major + "." + minor; 24.792 - classIDLToRepStr.put(ser, repid); 24.793 - return repid; 24.794 - } 24.795 - } 24.796 - 24.797 - private static String getIdFromHelper(Class clazz){ 24.798 - try { 24.799 - Class helperClazz = Utility.loadClassForClass(clazz.getName()+"Helper", null, 24.800 - clazz.getClassLoader(), clazz, clazz.getClassLoader()); 24.801 - Method idMethod = helperClazz.getDeclaredMethod("id", kNoParamTypes); 24.802 - return (String)idMethod.invoke(null, kNoArgs); 24.803 - } 24.804 - catch(java.lang.ClassNotFoundException cnfe) 24.805 - { 24.806 - throw new org.omg.CORBA.MARSHAL(cnfe.toString()); 24.807 - } 24.808 - catch(java.lang.NoSuchMethodException nsme) 24.809 - { 24.810 - throw new org.omg.CORBA.MARSHAL(nsme.toString()); 24.811 - } 24.812 - catch(java.lang.reflect.InvocationTargetException ite) 24.813 - { 24.814 - throw new org.omg.CORBA.MARSHAL(ite.toString()); 24.815 - } 24.816 - catch(java.lang.IllegalAccessException iae) 24.817 - { 24.818 - throw new org.omg.CORBA.MARSHAL(iae.toString()); 24.819 - } 24.820 - } 24.821 - 24.822 - /** 24.823 - * Createa a repository ID for the type if it is either a java type 24.824 - * or an IDL type. 24.825 - * @param type The type to create rep. id for 24.826 - * @return The rep. id. 24.827 - **/ 24.828 - public static String createForAnyType(Class type) { 24.829 - try{ 24.830 - if (type.isArray()) 24.831 - return createSequenceRepID(type); 24.832 - else if (IDLEntity.class.isAssignableFrom(type)) 24.833 - { 24.834 - try{ 24.835 - return getIdFromHelper(type); 24.836 - } 24.837 - catch(Throwable t) { 24.838 - return createForIDLType(type, 1, 0); 24.839 - } 24.840 - } 24.841 - else return createForJavaType(type); 24.842 - } 24.843 - catch(com.sun.corba.se.impl.io.TypeMismatchException e){ 24.844 - return null; 24.845 - } 24.846 - 24.847 - } 24.848 - 24.849 - public static boolean isAbstractBase(Class clazz) { 24.850 - return (clazz.isInterface() && 24.851 - IDLEntity.class.isAssignableFrom(clazz) && 24.852 - (!ValueBase.class.isAssignableFrom(clazz)) && 24.853 - (!org.omg.CORBA.Object.class.isAssignableFrom(clazz))); 24.854 - 24.855 - } 24.856 - 24.857 - public static boolean isAnyRequired(Class clazz) { 24.858 - return ((clazz == java.lang.Object.class) || 24.859 - (clazz == java.io.Serializable.class) || 24.860 - (clazz == java.io.Externalizable.class)); 24.861 - } 24.862 - 24.863 - public static long fromHex(String hexNumber) { 24.864 - if (hexNumber.startsWith("0x")) 24.865 - return Long.valueOf(hexNumber.substring(2), 16).longValue(); 24.866 - else return Long.valueOf(hexNumber, 16).longValue(); 24.867 - } 24.868 - 24.869 - /** 24.870 - * Convert strings with illegal IDL identifier characters. 24.871 - * <p> 24.872 - * Section 5.5.7 of OBV spec. 24.873 - */ 24.874 - private static String convertToISOLatin1 (String name) { 24.875 - 24.876 - int length = name.length(); 24.877 - if (length == 0) { 24.878 - return name; 24.879 - } 24.880 - StringBuffer buffer = null; 24.881 - 24.882 - for (int i = 0; i < length; i++) { 24.883 - 24.884 - char c = name.charAt(i); 24.885 - 24.886 - if (c > 255 || IDL_IDENTIFIER_CHARS[c] == 0) { 24.887 - 24.888 - // We gotta convert. Have we already started? 24.889 - 24.890 - if (buffer == null) { 24.891 - 24.892 - // No, so get set up... 24.893 - 24.894 - buffer = new StringBuffer(name.substring(0,i)); 24.895 - } 24.896 - 24.897 - // Convert the character into the IDL escape syntax... 24.898 - buffer.append( 24.899 - "\\U" + 24.900 - (char)ASCII_HEX[(c & 0xF000) >>> 12] + 24.901 - (char)ASCII_HEX[(c & 0x0F00) >>> 8] + 24.902 - (char)ASCII_HEX[(c & 0x00F0) >>> 4] + 24.903 - (char)ASCII_HEX[(c & 0x000F)]); 24.904 - 24.905 - } else { 24.906 - if (buffer != null) { 24.907 - buffer.append(c); 24.908 - } 24.909 - } 24.910 - } 24.911 - 24.912 - if (buffer != null) { 24.913 - name = buffer.toString(); 24.914 - } 24.915 - 24.916 - return name; 24.917 - } 24.918 - 24.919 - /** 24.920 - * Convert strings with ISO Latin 1 escape sequences back to original strings. 24.921 - * <p> 24.922 - * Section 5.5.7 of OBV spec. 24.923 - */ 24.924 - private static String convertFromISOLatin1 (String name) { 24.925 - 24.926 - int index = -1; 24.927 - StringBuffer buf = new StringBuffer(name); 24.928 - 24.929 - while ((index = buf.toString().indexOf("\\U")) != -1){ 24.930 - String str = "0000" + buf.toString().substring(index+2, index+6); 24.931 - 24.932 - // Convert Hexadecimal 24.933 - byte[] buffer = new byte[(str.length() - 4) / 2]; 24.934 - for (int i=4, j=0; i < str.length(); i +=2, j++) { 24.935 - buffer[j] = (byte)((ORBUtility.hexOf(str.charAt(i)) << 4) & 0xF0); 24.936 - buffer[j] |= (byte)((ORBUtility.hexOf(str.charAt(i+1)) << 0) & 0x0F); 24.937 - } 24.938 - buf = new StringBuffer(delete(buf.toString(), index, index+6)); 24.939 - buf.insert(index, (char)buffer[1]); 24.940 - } 24.941 - 24.942 - return buf.toString(); 24.943 - 24.944 - 24.945 - } 24.946 - 24.947 - private static String delete(String str, int from, int to) 24.948 - { 24.949 - return str.substring(0, from) + str.substring(to, str.length()); 24.950 - } 24.951 - 24.952 - private static String replace(String target, String arg, String source) 24.953 - { 24.954 - int i = 0; 24.955 - i = target.indexOf(arg); 24.956 - 24.957 - while(i != -1) 24.958 - { 24.959 - String left = target.substring(0, i); 24.960 - String right = target.substring(i+arg.length()); 24.961 - target = new String(left+source+right); 24.962 - i = target.indexOf(arg); 24.963 - } 24.964 - return target; 24.965 - } 24.966 - 24.967 - public static int computeValueTag(boolean codeBasePresent, int typeInfo, boolean chunkedEncoding){ 24.968 - int value_tag = kInitialValueTag; 24.969 - 24.970 - if (codeBasePresent) 24.971 - value_tag = value_tag | 0x00000001; 24.972 - 24.973 - value_tag = value_tag | typeInfo; 24.974 - 24.975 - if (chunkedEncoding) 24.976 - value_tag = value_tag | kChunkedMask; 24.977 - 24.978 - return value_tag; 24.979 - } 24.980 - 24.981 - public static boolean isCodeBasePresent(int value_tag){ 24.982 - return ((value_tag & 0x00000001) == 1); 24.983 - } 24.984 - 24.985 - public static int getTypeInfo(int value_tag){ 24.986 - return (value_tag & 0x00000006); 24.987 - } 24.988 - 24.989 - public static boolean isChunkedEncoding(int value_tag){ 24.990 - return ((value_tag & kChunkedMask) != 0); 24.991 - } 24.992 - 24.993 - public static String getServerURL(){ 24.994 - return defaultServerURL; 24.995 - } 24.996 - 24.997 - /* 24.998 - * Load a class and check that it is assignable to a given type. 24.999 - * @param className the class name. 24.1000 - * @param remoteCodebase the codebase to use. May be null. 24.1001 - * @param loader the class loader of last resort. May be null. 24.1002 - * @param expectedType the expected type. May be null. 24.1003 - * @return the loaded class. 24.1004 - */ 24.1005 - private Class loadClassOfType (String className, 24.1006 - String remoteCodebase, 24.1007 - ClassLoader loader, 24.1008 - Class expectedType, 24.1009 - ClassLoader expectedTypeClassLoader) 24.1010 - throws ClassNotFoundException { 24.1011 - 24.1012 - Class loadedClass = null; 24.1013 - 24.1014 - try { 24.1015 - //Sequence finding of the stubs according to spec 24.1016 - try{ 24.1017 - //If-else is put here for speed up of J2EE. 24.1018 - //According to the OMG spec, the if clause is not dead code. 24.1019 - //It can occur if some compiler has allowed generation 24.1020 - //into org.omg.stub hierarchy for non-offending 24.1021 - //classes. This will encourage people to 24.1022 - //produce non-offending class stubs in their own hierarchy. 24.1023 - if(!PackagePrefixChecker 24.1024 - .hasOffendingPrefix(PackagePrefixChecker 24.1025 - .withoutPackagePrefix(className))){ 24.1026 - loadedClass = Util.loadClass 24.1027 - (PackagePrefixChecker.withoutPackagePrefix(className), 24.1028 - remoteCodebase, 24.1029 - loader); 24.1030 - } else { 24.1031 - loadedClass = Util.loadClass 24.1032 - (className, 24.1033 - remoteCodebase, 24.1034 - loader); 24.1035 - } 24.1036 - } catch (ClassNotFoundException cnfe) { 24.1037 - loadedClass = Util.loadClass 24.1038 - (className, 24.1039 - remoteCodebase, 24.1040 - loader); 24.1041 - } 24.1042 - if (expectedType == null) 24.1043 - return loadedClass; 24.1044 - } catch (ClassNotFoundException cnfe) { 24.1045 - if (expectedType == null) 24.1046 - throw cnfe; 24.1047 - } 24.1048 - 24.1049 - // If no class was not loaded, or if the loaded class is not of the 24.1050 - // correct type, make a further attempt to load the correct class 24.1051 - // using the classloader of the expected type. 24.1052 - // _REVISIT_ Is this step necessary, or should the Util,loadClass 24.1053 - // algorithm always produce a valid class if the setup is correct? 24.1054 - // Does the OMG standard algorithm need to be changed to include 24.1055 - // this step? 24.1056 - if (loadedClass == null || !expectedType.isAssignableFrom(loadedClass)) { 24.1057 - if (expectedType.getClassLoader() != expectedTypeClassLoader) 24.1058 - throw new IllegalArgumentException("expectedTypeClassLoader not class loader of expectedType."); 24.1059 - 24.1060 - if (expectedTypeClassLoader != null) 24.1061 - loadedClass = expectedTypeClassLoader.loadClass(className); 24.1062 - else 24.1063 - loadedClass = Class.forName(className); 24.1064 - } 24.1065 - 24.1066 - return loadedClass; 24.1067 - } 24.1068 -}
25.1 --- a/src/share/classes/com/sun/corba/se/impl/orbutil/ValueHandlerImpl_1_3.java Fri Feb 15 01:49:36 2013 +0400 25.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 25.3 @@ -1,251 +0,0 @@ 25.4 -/* 25.5 - * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved. 25.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 25.7 - * 25.8 - * This code is free software; you can redistribute it and/or modify it 25.9 - * under the terms of the GNU General Public License version 2 only, as 25.10 - * published by the Free Software Foundation. Oracle designates this 25.11 - * particular file as subject to the "Classpath" exception as provided 25.12 - * by Oracle in the LICENSE file that accompanied this code. 25.13 - * 25.14 - * This code is distributed in the hope that it will be useful, but WITHOUT 25.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 25.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 25.17 - * version 2 for more details (a copy is included in the LICENSE file that 25.18 - * accompanied this code). 25.19 - * 25.20 - * You should have received a copy of the GNU General Public License version 25.21 - * 2 along with this work; if not, write to the Free Software Foundation, 25.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 25.23 - * 25.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 25.25 - * or visit www.oracle.com if you need additional information or have any 25.26 - * questions. 25.27 - */ 25.28 -/* 25.29 - * Licensed Materials - Property of IBM 25.30 - * RMI-IIOP v1.0 25.31 - * Copyright IBM Corp. 1998 1999 All Rights Reserved 25.32 - * 25.33 - */ 25.34 - 25.35 -package com.sun.corba.se.impl.orbutil; 25.36 - 25.37 -import javax.rmi.CORBA.Util; 25.38 -import javax.rmi.PortableRemoteObject; 25.39 - 25.40 -import java.util.Hashtable; 25.41 -import java.util.Stack; 25.42 -import java.io.IOException; 25.43 -import java.util.EmptyStackException; 25.44 - 25.45 -import com.sun.corba.se.impl.util.Utility; 25.46 -import com.sun.corba.se.impl.io.IIOPInputStream; 25.47 -import com.sun.corba.se.impl.io.IIOPOutputStream; 25.48 -import com.sun.corba.se.impl.util.RepositoryId; 25.49 -import com.sun.corba.se.impl.util.Utility; 25.50 - 25.51 -import org.omg.CORBA.TCKind; 25.52 -import org.omg.CORBA.MARSHAL; 25.53 -import org.omg.CORBA.CompletionStatus; 25.54 -import org.omg.CORBA.portable.IndirectionException; 25.55 -import com.sun.org.omg.SendingContext.CodeBase; 25.56 - 25.57 -import java.security.AccessController; 25.58 -import java.security.PrivilegedAction; 25.59 - 25.60 -/** 25.61 - * This class overrides behavior of our current ValueHandlerImpl to 25.62 - * provide backwards compatibility with JDK 1.3.0. 25.63 - */ 25.64 -public class ValueHandlerImpl_1_3 extends com.sun.corba.se.impl.io.ValueHandlerImpl { 25.65 - 25.66 - public ValueHandlerImpl_1_3(){ 25.67 - super(); 25.68 - } 25.69 - 25.70 - public ValueHandlerImpl_1_3(boolean isInputStream) { 25.71 - super(isInputStream); 25.72 - } 25.73 - 25.74 - /** 25.75 - * Writes the value to the stream using java semantics. 25.76 - * @param out The stream to write the value to 25.77 - * @param value The value to be written to the stream 25.78 - **/ 25.79 - public void writeValue(org.omg.CORBA.portable.OutputStream _out, java.io.Serializable value) { 25.80 - super.writeValue(_out, value); 25.81 - } 25.82 - 25.83 - /** 25.84 - * Reads a value from the stream using java semantics. 25.85 - * @param in The stream to read the value from 25.86 - * @param clazz The type of the value to be read in 25.87 - * @param sender The sending context runtime 25.88 - **/ 25.89 - public java.io.Serializable readValue(org.omg.CORBA.portable.InputStream _in, 25.90 - int offset, 25.91 - java.lang.Class clazz, 25.92 - String repositoryID, 25.93 - org.omg.SendingContext.RunTime _sender) 25.94 - { 25.95 - return super.readValue(_in, offset, clazz, repositoryID, _sender); 25.96 - } 25.97 - 25.98 - /** 25.99 - * Returns the repository ID for the given RMI value Class. 25.100 - * @param clz The class to return a repository ID for. 25.101 - * @return the repository ID of the Class. 25.102 - **/ 25.103 - public java.lang.String getRMIRepositoryID(java.lang.Class clz) { 25.104 - return RepositoryId_1_3.createForJavaType(clz); 25.105 - } 25.106 - 25.107 - /** 25.108 - * Indicates whether the given Class performs custom or 25.109 - * default marshaling. 25.110 - * @param clz The class to test for custom marshaling. 25.111 - * @return True if the class performs custom marshaling, false 25.112 - * if it does not. 25.113 - **/ 25.114 - public boolean isCustomMarshaled(java.lang.Class clz) { 25.115 - return super.isCustomMarshaled(clz); 25.116 - } 25.117 - 25.118 - /** 25.119 - * Returns the CodeBase for this ValueHandler. This is used by 25.120 - * the ORB runtime. The server sends the service context containing 25.121 - * the IOR for this CodeBase on the first GIOP reply. The clients 25.122 - * do the same on the first GIOP request. 25.123 - * @return the SendingContext.CodeBase of this ValueHandler. 25.124 - **/ 25.125 - public org.omg.SendingContext.RunTime getRunTimeCodeBase() { 25.126 - return super.getRunTimeCodeBase(); 25.127 - } 25.128 - 25.129 - /** 25.130 - * If the value contains a writeReplace method then the result 25.131 - * is returned. Otherwise, the value itself is returned. 25.132 - * @return the true value to marshal on the wire. 25.133 - **/ 25.134 - public java.io.Serializable writeReplace(java.io.Serializable value) { 25.135 - return super.writeReplace(value); 25.136 - } 25.137 - 25.138 - // methods supported for backward compatability so that the appropriate 25.139 - // Rep-id calculations take place based on the ORB version 25.140 - 25.141 - /** 25.142 - * Returns a boolean of whether or not RepositoryId indicates 25.143 - * FullValueDescriptor. 25.144 - * used for backward compatability 25.145 - */ 25.146 - 25.147 - public boolean useFullValueDescription(Class clazz, String repositoryID) 25.148 - throws IOException 25.149 - 25.150 - { 25.151 - return RepositoryId_1_3.useFullValueDescription(clazz, repositoryID); 25.152 - } 25.153 - 25.154 - public String getClassName(String id) 25.155 - { 25.156 - RepositoryId_1_3 repID = RepositoryId_1_3.cache.getId(id); 25.157 - return repID.getClassName(); 25.158 - } 25.159 - 25.160 - public Class getClassFromType(String id) 25.161 - throws ClassNotFoundException 25.162 - { 25.163 - RepositoryId_1_3 repId = RepositoryId_1_3.cache.getId(id); 25.164 - return repId.getClassFromType(); 25.165 - } 25.166 - 25.167 - public Class getAnyClassFromType(String id) 25.168 - throws ClassNotFoundException 25.169 - { 25.170 - RepositoryId_1_3 repId = RepositoryId_1_3.cache.getId(id); 25.171 - return repId.getAnyClassFromType(); 25.172 - } 25.173 - 25.174 - public String createForAnyType(Class cl) 25.175 - { 25.176 - return RepositoryId_1_3.createForAnyType(cl); 25.177 - } 25.178 - 25.179 - public String getDefinedInId(String id) 25.180 - { 25.181 - RepositoryId_1_3 repId = RepositoryId_1_3.cache.getId(id); 25.182 - return repId.getDefinedInId(); 25.183 - } 25.184 - 25.185 - public String getUnqualifiedName(String id) 25.186 - { 25.187 - RepositoryId_1_3 repId = RepositoryId_1_3.cache.getId(id); 25.188 - return repId.getUnqualifiedName(); 25.189 - } 25.190 - 25.191 - public String getSerialVersionUID(String id) 25.192 - { 25.193 - RepositoryId_1_3 repId = RepositoryId_1_3.cache.getId(id); 25.194 - return repId.getSerialVersionUID(); 25.195 - } 25.196 - 25.197 - public boolean isAbstractBase(Class clazz) 25.198 - { 25.199 - return RepositoryId_1_3.isAbstractBase(clazz); 25.200 - } 25.201 - 25.202 - public boolean isSequence(String id) 25.203 - { 25.204 - RepositoryId_1_3 repId = RepositoryId_1_3.cache.getId(id); 25.205 - return repId.isSequence(); 25.206 - } 25.207 - 25.208 - /** 25.209 - * Preserves the incorrect 1.3 behavior which truncates Java chars in 25.210 - * arrays to 8-bit CORBA chars. Bug 4367783. This enables us to 25.211 - * continue interoperating with our legacy ORBs. If this goes into 25.212 - * Ladybird, then Ladybird and Kestrel will interoperate as long as 25.213 - * people don't use chars greater than 8-bits. 25.214 - */ 25.215 - protected void writeCharArray(org.omg.CORBA_2_3.portable.OutputStream out, 25.216 - char[] array, 25.217 - int offset, 25.218 - int length) 25.219 - { 25.220 - out.write_char_array(array, offset, length); 25.221 - } 25.222 - 25.223 - /** 25.224 - * Preserves the incorrect 1.3 behavior which truncates Java chars in 25.225 - * arrays to 8-bit CORBA chars. Bug 4367783. This enables us to 25.226 - * continue interoperating with our legacy ORBs. If this goes into 25.227 - * Ladybird, then Ladybird and Kestrel will interoperate as long as 25.228 - * people don't use chars greater than 8-bits. 25.229 - */ 25.230 - protected void readCharArray(org.omg.CORBA_2_3.portable.InputStream in, 25.231 - char[] array, 25.232 - int offset, 25.233 - int length) 25.234 - { 25.235 - in.read_char_array(array, offset, length); 25.236 - } 25.237 - 25.238 - protected final String getOutputStreamClassName() { 25.239 - return "com.sun.corba.se.impl.orbutil.IIOPOutputStream_1_3"; 25.240 - } 25.241 - 25.242 - protected final String getInputStreamClassName() { 25.243 - return "com.sun.corba.se.impl.orbutil.IIOPInputStream_1_3"; 25.244 - } 25.245 - 25.246 - /** 25.247 - * Our JDK 1.3 and JDK 1.3.1 behavior subclasses override this. 25.248 - * The correct behavior is for a Java char to map to a CORBA wchar, 25.249 - * but our older code mapped it to a CORBA char. 25.250 - */ 25.251 - protected TCKind getJavaCharTCKind() { 25.252 - return TCKind.tk_char; 25.253 - } 25.254 -}
26.1 --- a/src/share/classes/com/sun/corba/se/impl/orbutil/ValueHandlerImpl_1_3_1.java Fri Feb 15 01:49:36 2013 +0400 26.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 26.3 @@ -1,77 +0,0 @@ 26.4 -/* 26.5 - * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved. 26.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 26.7 - * 26.8 - * This code is free software; you can redistribute it and/or modify it 26.9 - * under the terms of the GNU General Public License version 2 only, as 26.10 - * published by the Free Software Foundation. Oracle designates this 26.11 - * particular file as subject to the "Classpath" exception as provided 26.12 - * by Oracle in the LICENSE file that accompanied this code. 26.13 - * 26.14 - * This code is distributed in the hope that it will be useful, but WITHOUT 26.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 26.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 26.17 - * version 2 for more details (a copy is included in the LICENSE file that 26.18 - * accompanied this code). 26.19 - * 26.20 - * You should have received a copy of the GNU General Public License version 26.21 - * 2 along with this work; if not, write to the Free Software Foundation, 26.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 26.23 - * 26.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 26.25 - * or visit www.oracle.com if you need additional information or have any 26.26 - * questions. 26.27 - */ 26.28 -package com.sun.corba.se.impl.orbutil; 26.29 - 26.30 -import org.omg.CORBA.TCKind; 26.31 - 26.32 -/** 26.33 - * This class overrides behavior of our current ValueHandlerImpl to 26.34 - * provide backwards compatibility with JDK 1.3.1. 26.35 - */ 26.36 -public class ValueHandlerImpl_1_3_1 26.37 - extends com.sun.corba.se.impl.io.ValueHandlerImpl 26.38 -{ 26.39 - public ValueHandlerImpl_1_3_1() {} 26.40 - 26.41 - public ValueHandlerImpl_1_3_1(boolean isInputStream) { 26.42 - super(isInputStream); 26.43 - } 26.44 - 26.45 - /** 26.46 - * Our JDK 1.3 and JDK 1.3.1 behavior subclasses override this. 26.47 - * The correct behavior is for a Java char to map to a CORBA wchar, 26.48 - * but our older code mapped it to a CORBA char. 26.49 - */ 26.50 - protected TCKind getJavaCharTCKind() { 26.51 - return TCKind.tk_char; 26.52 - } 26.53 - 26.54 - /** 26.55 - * RepositoryId_1_3_1 performs an incorrect repId calculation 26.56 - * when using serialPersistentFields and one of the fields no longer 26.57 - * exists on the class itself. 26.58 - */ 26.59 - public boolean useFullValueDescription(Class clazz, String repositoryID) 26.60 - throws java.io.IOException 26.61 - { 26.62 - return RepositoryId_1_3_1.useFullValueDescription(clazz, repositoryID); 26.63 - } 26.64 - 26.65 - /** 26.66 - * Installs the legacy IIOPOutputStream_1_3_1 which does 26.67 - * PutFields/GetFields incorrectly. Bug 4407244. 26.68 - */ 26.69 - protected final String getOutputStreamClassName() { 26.70 - return "com.sun.corba.se.impl.orbutil.IIOPOutputStream_1_3_1"; 26.71 - } 26.72 - 26.73 - /** 26.74 - * Installs the legacy IIOPInputStream_1_3_1 which does 26.75 - * PutFields/GetFields incorrectly. Bug 4407244. 26.76 - */ 26.77 - protected final String getInputStreamClassName() { 26.78 - return "com.sun.corba.se.impl.orbutil.IIOPInputStream_1_3_1"; 26.79 - } 26.80 -}
27.1 --- a/src/share/classes/com/sun/corba/se/spi/orb/ORB.java Fri Feb 15 01:49:36 2013 +0400 27.2 +++ b/src/share/classes/com/sun/corba/se/spi/orb/ORB.java Tue Feb 19 21:44:41 2013 +0100 27.3 @@ -98,6 +98,7 @@ 27.4 import com.sun.corba.se.impl.presentation.rmi.PresentationManagerImpl ; 27.5 27.6 import com.sun.corba.se.impl.orbutil.ORBClassLoader ; 27.7 +import sun.awt.AppContext; 27.8 27.9 public abstract class ORB extends com.sun.corba.se.org.omg.CORBA.ORB 27.10 implements Broker, TypeCodeFactory 27.11 @@ -173,14 +174,7 @@ 27.12 27.13 protected MonitoringManager monitoringManager; 27.14 27.15 - // There is only one instance of the PresentationManager 27.16 - // that is shared between all ORBs. This is necessary 27.17 - // because RMI-IIOP requires the PresentationManager in 27.18 - // places where no ORB is available, so the PresentationManager 27.19 - // must be global. It is initialized here as well. 27.20 - protected static PresentationManager globalPM = null ; 27.21 - 27.22 - static { 27.23 + private static PresentationManager setupPresentationManager() { 27.24 staticWrapper = ORBUtilSystemException.get( 27.25 CORBALogDomains.RPC_PRESENTATION ) ; 27.26 27.27 @@ -220,10 +214,11 @@ 27.28 } 27.29 ) ; 27.30 27.31 - globalPM = new PresentationManagerImpl( useDynamicStub ) ; 27.32 - globalPM.setStubFactoryFactory( false, 27.33 + PresentationManager pm = new PresentationManagerImpl( useDynamicStub ) ; 27.34 + pm.setStubFactoryFactory( false, 27.35 PresentationDefaults.getStaticStubFactoryFactory() ) ; 27.36 - globalPM.setStubFactoryFactory( true, dynamicStubFactoryFactory ) ; 27.37 + pm.setStubFactoryFactory( true, dynamicStubFactoryFactory ) ; 27.38 + return pm; 27.39 } 27.40 27.41 public void destroy() { 27.42 @@ -234,11 +229,19 @@ 27.43 byteBufferPool = null; 27.44 } 27.45 27.46 - /** Get the single instance of the PresentationManager 27.47 + /** 27.48 + * Returns the Presentation Manager for the current thread group, using the ThreadGroup-specific 27.49 + * AppContext to hold it. Creates and records one if needed. 27.50 */ 27.51 public static PresentationManager getPresentationManager() 27.52 { 27.53 - return globalPM ; 27.54 + AppContext ac = AppContext.getAppContext(); 27.55 + PresentationManager pm = (PresentationManager) ac.get(PresentationManager.class); 27.56 + if (pm == null) { 27.57 + pm = setupPresentationManager(); 27.58 + ac.put(PresentationManager.class, pm); 27.59 + } 27.60 + return pm; 27.61 } 27.62 27.63 /** Get the appropriate StubFactoryFactory. This 27.64 @@ -248,8 +251,9 @@ 27.65 public static PresentationManager.StubFactoryFactory 27.66 getStubFactoryFactory() 27.67 { 27.68 - boolean useDynamicStubs = globalPM.useDynamicStubs() ; 27.69 - return globalPM.getStubFactoryFactory( useDynamicStubs ) ; 27.70 + PresentationManager gPM = getPresentationManager(); 27.71 + boolean useDynamicStubs = gPM.useDynamicStubs() ; 27.72 + return gPM.getStubFactoryFactory( useDynamicStubs ) ; 27.73 } 27.74 27.75 protected ORB()
28.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 28.2 +++ b/src/share/classes/sun/corba/JavaCorbaAccess.java Tue Feb 19 21:44:41 2013 +0100 28.3 @@ -0,0 +1,32 @@ 28.4 +/* 28.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 28.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 28.7 + * 28.8 + * This code is free software; you can redistribute it and/or modify it 28.9 + * under the terms of the GNU General Public License version 2 only, as 28.10 + * published by the Free Software Foundation. Oracle designates this 28.11 + * particular file as subject to the "Classpath" exception as provided 28.12 + * by Oracle in the LICENSE file that accompanied this code. 28.13 + * 28.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 28.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 28.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 28.17 + * version 2 for more details (a copy is included in the LICENSE file that 28.18 + * accompanied this code). 28.19 + * 28.20 + * You should have received a copy of the GNU General Public License version 28.21 + * 2 along with this work; if not, write to the Free Software Foundation, 28.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 28.23 + * 28.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 28.25 + * or visit www.oracle.com if you need additional information or have any 28.26 + * questions. 28.27 + */ 28.28 + 28.29 +package sun.corba; 28.30 + 28.31 +import com.sun.corba.se.impl.io.ValueHandlerImpl; 28.32 + 28.33 +public interface JavaCorbaAccess { 28.34 + public ValueHandlerImpl newValueHandlerImpl(); 28.35 +}
29.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 29.2 +++ b/src/share/classes/sun/corba/SharedSecrets.java Tue Feb 19 21:44:41 2013 +0100 29.3 @@ -0,0 +1,60 @@ 29.4 +/* 29.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 29.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 29.7 + * 29.8 + * This code is free software; you can redistribute it and/or modify it 29.9 + * under the terms of the GNU General Public License version 2 only, as 29.10 + * published by the Free Software Foundation. Oracle designates this 29.11 + * particular file as subject to the "Classpath" exception as provided 29.12 + * by Oracle in the LICENSE file that accompanied this code. 29.13 + * 29.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 29.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 29.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 29.17 + * version 2 for more details (a copy is included in the LICENSE file that 29.18 + * accompanied this code). 29.19 + * 29.20 + * You should have received a copy of the GNU General Public License version 29.21 + * 2 along with this work; if not, write to the Free Software Foundation, 29.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 29.23 + * 29.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 29.25 + * or visit www.oracle.com if you need additional information or have any 29.26 + * questions. 29.27 + */ 29.28 + 29.29 +package sun.corba; 29.30 + 29.31 +import com.sun.corba.se.impl.io.ValueUtility; 29.32 +import sun.misc.Unsafe; 29.33 + 29.34 +import java.security.AccessController; 29.35 + 29.36 +/** A repository of "shared secrets", which are a mechanism for 29.37 + calling implementation-private methods in another package without 29.38 + using reflection. A package-private class implements a public 29.39 + interface and provides the ability to call package-private methods 29.40 + within that package; the object implementing that interface is 29.41 + provided through a third package to which access is restricted. 29.42 + This framework avoids the primary disadvantage of using reflection 29.43 + for this purpose, namely the loss of compile-time checking. */ 29.44 + 29.45 +// SharedSecrets cloned in corba repo to avoid build issues 29.46 +public class SharedSecrets { 29.47 + private static final Unsafe unsafe = Unsafe.getUnsafe(); 29.48 + private static JavaCorbaAccess javaCorbaAccess; 29.49 + 29.50 + public static JavaCorbaAccess getJavaCorbaAccess() { 29.51 + if (javaCorbaAccess == null) { 29.52 + // Ensure ValueUtility is initialized; we know that that class 29.53 + // provides the shared secret 29.54 + unsafe.ensureClassInitialized(ValueUtility.class); 29.55 + } 29.56 + return javaCorbaAccess; 29.57 + } 29.58 + 29.59 + public static void setJavaCorbaAccess(JavaCorbaAccess access) { 29.60 + javaCorbaAccess = access; 29.61 + } 29.62 + 29.63 +}