OpenJDK / icedtea / jdk7 / corba
changeset 867:70af8b7907a5 ppc-aix-port-b04
merge
author | Goetz |
---|---|
date | Mon, 11 Mar 2013 17:35:38 +0100 |
parents | 5edf518c7700 2b1fcbe4e785 |
children | 1503864858b3 |
files | .hgtags src/share/classes/com/sun/corba/se/impl/orbutil/IIOPInputStream_1_3.java src/share/classes/com/sun/corba/se/impl/orbutil/IIOPInputStream_1_3_1.java src/share/classes/com/sun/corba/se/impl/orbutil/IIOPOutputStream_1_3.java src/share/classes/com/sun/corba/se/impl/orbutil/IIOPOutputStream_1_3_1.java src/share/classes/com/sun/corba/se/impl/orbutil/RepIdDelegator_1_3.java src/share/classes/com/sun/corba/se/impl/orbutil/RepIdDelegator_1_3_1.java src/share/classes/com/sun/corba/se/impl/orbutil/RepositoryIdCache_1_3.java src/share/classes/com/sun/corba/se/impl/orbutil/RepositoryIdCache_1_3_1.java src/share/classes/com/sun/corba/se/impl/orbutil/RepositoryId_1_3.java src/share/classes/com/sun/corba/se/impl/orbutil/RepositoryId_1_3_1.java src/share/classes/com/sun/corba/se/impl/orbutil/ValueHandlerImpl_1_3.java src/share/classes/com/sun/corba/se/impl/orbutil/ValueHandlerImpl_1_3_1.java |
diffstat | 73 files changed, 1293 insertions(+), 3985 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgtags Wed Jan 09 09:55:11 2013 +0000 +++ b/.hgtags Mon Mar 11 17:35:38 2013 +0100 @@ -162,9 +162,18 @@ d9bf21b76f093abfe451880d5db29e4932b1e72e jdk7u4-b15 bfca64f13d582de179d69b32cf68ed06e6271ad0 jdk7u4-b16 e2a9fe67e0595ea101a2c0b07cd98ab401b3c25e jdk7u4-b17 +8b529de05c544057240cfc91316ef5ab1dcfa9b6 jdk7u5-b01 c2eb741b947d9c31137934b75df12741bbc2c7fc jdk7u4-b18 8bdf527067aca1acf92c7083a9c249e0731ff955 jdk7u4-b19 81a59f2d7ea4e7a880041eaa4fa4e9d2518ed35b jdk7u4-b20 +91cf6d5b184c696382fd50ad76ca1d2bfd962e91 jdk7u4-b30 +b8560e92b68c2409fa46cd784c87e7cb5a043e59 jdk7u4-b21 +1b97d80df5c476ed722c845246b1fd0f32fa20dc jdk7u4-b22 +add54c4e4101557c24b64c4b40509096964d8821 jdk7u4-b31 +acf57a3ee030f31a960bac4fcb6c075007e35685 jdk7u5-b02 +fbafa6b0fda923e8ccb7b76dbbdef2dd2f5e00db jdk7u5-b04 +73691a9e0a24bb08e0d08708061470d5a3e4ce95 jdk7u5-b05 +93a5c38aded35a7bdb902249363d888fceffc00e jdk7u5-b30 6a262c36caebb43972cbae5032cff632ce31d2cc jdk7u6-b01 e3fbf686ef874c635e34ef3419a707ab36f6eabd jdk7u6-b02 f18c50ad8f76ccbb7be021f45c4fe520fef5b9e6 jdk7u6-b03 @@ -180,3 +189,73 @@ 325250aef90af0f5cd04b141f83a81638ae1e478 ppc-aix-port-b01 325250aef90af0f5cd04b141f83a81638ae1e478 ppc-aix-port-b02 325250aef90af0f5cd04b141f83a81638ae1e478 ppc-aix-port-b03 +76bee3576f61d4d96fef118902d5d237a4f3d219 jdk7u6-b13 +731d5dbd7020dca232023f2e6c3e3e22caccccfb jdk7u6-b14 +8da4015f405b0fa267cca4780d20cd012d0a9cb4 jdk7u6-b15 +7674c7ed99a53a8dcf654ab8a6963199ef562a08 jdk7u6-b16 +e4a676826cb3fe2f84e19105a027c15c097f98f1 jdk7u6-b17 +b3d767dbd67f518168c561e078be5e860bc60cfc jdk7u6-b18 +5c046510b9308bf514f078d48fcf0112a376ad41 jdk7u6-b19 +f0c51b691d34b4a06c1e22c7960be71e0d0ee84e jdk7u6-b20 +353c15c4bc371f2f8258344c988d1403477cc140 jdk7u6-b21 +793b80c0316fcafa18668bced26acb41af3be07d jdk7u6-b22 +2a8376123fbb81bc4b2f643ff7cfaf7f87b21c35 jdk7u6-b23 +02512f61591f55d84458d1ea4ce84eecb7324f89 jdk7u6-b24 +8b20875b3faa01ef56331045de88747df278eaeb jdk7u6-b30 +d7fe6c13adf9e06d98c061449d171bc06c2ba0a3 jdk7u6-b31 +d7fe6c13adf9e06d98c061449d171bc06c2ba0a3 jdk7u7-b10 +496baf62d0550c704505b0ff6f390279f6a569e0 jdk7u7-b30 +e57e4274a3575f278115cc8ef03c5bdf3c43a7ed jdk7u7-b11 +06cbc4af754ea8f2e3b7d0b1701d1a69ce9d5075 jdk7u7-b31 +8737f43e092ea52dd85dcf164736eea3b9b364e6 jdk7u7-b01 +ec602836c4e173927911673d253bb8baa1e3d170 jdk7u7-b02 +a163e56c6679d10dc64ec48f35e67c3a5942afba jdk7u9-b03 +0000000000000000000000000000000000000000 jdk7u7-b01 +8737f43e092ea52dd85dcf164736eea3b9b364e6 jdk7u9-b01 +0000000000000000000000000000000000000000 jdk7u7-b02 +ec602836c4e173927911673d253bb8baa1e3d170 jdk7u9-b02 +268470f3f0d0d7e9b04c579c551571097f0b0305 jdk7u9-b04 +a5dced409c4b7f940db80846f6efabac74523b0e jdk7u9-b05 +ba68d4ad02c465a36344a34eba34491466ec17d4 jdk7u10-b10 +a738921b001a92381bf355a2bb1ecd742ecee352 jdk7u10-b11 +e52708ecb2c32b366c251e4083fbb37e22a425c3 jdk7u10-b12 +5cd2ef642635a7d0a79a7c28343b2ddfd0e6aa4a jdk7u10-b13 +2d53a2c7e4b989ceba356abfc8dc2129269a134f jdk7u10-b14 +c488cd628db35eb09d8ef9e10ffd00c9a93d0778 jdk7u10-b15 +64f09d7549d304fbfd3c29b4f148bf44e8e3e979 jdk7u10-b16 +57c3355153d1624fd98618097c1a82ab3ffc66f8 jdk7u10-b17 +f2a347637a55fa4de9542a8dcab72ad6fac44d2b jdk7u10-b18 +22cf8bc2ec47498fe548b308a81be0486dd7e3d0 jdk7u10-b30 +e7952daece16b27d69cb78f6912407c3bbaf8e83 jdk7u11-b20 +dff0f0272891b1d53497d9525567959b73476ff9 jdk7u11-b21 +96a3c68e5741dc9ab5cb0da426511eb15fd29ede jdk7u11-b03 +1413b173730f4796fca42c89eeb804a5935b0264 jdk7u11-b04 +5c49a17bc15f4fd4722746788f5130df132cd038 jdk7u11-b05 +30057c20fbb3caa61857656d05421e56731184f2 jdk7u11-b06 +9d9440d1fa2dd872c2a2b564fc5fa4d3555afab6 jdk7u11-b07 +983fac5b27376839142ac5a8770461e4e48c2dc8 jdk7u11-b08 +b192d148731916e4b1b47b7a3e6b0a1d7ddf3f14 jdk7u13-b09 +b9ab9b203a41469a274419d26be2c04558b57ce8 jdk7u13-b20 +353c15c4bc371f2f8258344c988d1403477cc140 jdk7u8-b01 +d17ca8d088f7cc0dd42230472f534c8d1e415bcb jdk7u8-b02 +7c62cfa17e9613bf69d4f9b2ae74f3724d7a2955 jdk7u8-b03 +86961c802e87688ff264a946ca647d062f538302 jdk7u8-b04 +a274cd0c309b4da766dc73cac644cb44f1c23787 jdk7u8-b05 +292eab1079e7b62db7cf848781eddf1b6fc718e5 jdk7u10-b06 +ff5e33bcfc2bb7c2a69cd20b91490922eb158af2 jdk7u10-b07 +76811225baeccd3ed77a3e2ec7745ba3d42acff5 jdk7u10-b08 +f8e8ef8e0a5eea83938dab38d9a8cf6354f5a92d jdk7u10-b09 +3f309ff1d8ecd0210340ae9cfb40cc9072f66757 jdk7u12-b01 +06a04d95a12f18f07610f5d787324e2ea15e6376 jdk7u12-b02 +665ee21ff3ef309147e7f7872e2d4f446a31b642 jdk7u12-b03 +f89f101d3dfea98b143b693cebccdefc89b691ff jdk7u12-b04 +2516fd4adf4af010c217e073cdb0a1fa9eefd827 jdk7u12-b05 +16287175b517e48da9b24d31a3e9da200b6bc563 jdk7u12-b06 +7969d5f219248de033c296ef75fff7aae7545bbd jdk7u12-b07 +6f4d4c7a254d4aca3a7f2caabb75e6559a290393 jdk7u12-b08 +c8c261b2220c5b966c07784682057a915defb0da jdk7u12-b09 +3877f9ae971eefbfbbcb16f2ff79c72ac10ac4bd jdk7u14-b10 +3bd891cd98773cf841ad65f52f25e3e6fa185cef jdk7u14-b11 +fbb83600db33de6211fc58ba2a2bbb6b356aa9c2 jdk7u14-b12 +cd7aaec5accf3f8fbb693153f8d9be846e0f8a05 jdk7u14-b13 +9e8bde2586a1a7fd95f654c7d0043d1eb18f0793 jdk7u14-b14
--- a/make/com/sun/corba/minclude/com_sun_corba_se_impl_orbutil.jmk Wed Jan 09 09:55:11 2013 +0000 +++ b/make/com/sun/corba/minclude/com_sun_corba_se_impl_orbutil.jmk Mon Mar 11 17:35:38 2013 +0100 @@ -1,5 +1,5 @@ # -# Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -29,10 +29,6 @@ com/sun/corba/se/impl/orbutil/DenseIntMapImpl.java \ com/sun/corba/se/impl/orbutil/GetPropertyAction.java \ com/sun/corba/se/impl/orbutil/HexOutputStream.java \ - com/sun/corba/se/impl/orbutil/IIOPInputStream_1_3.java \ - com/sun/corba/se/impl/orbutil/IIOPInputStream_1_3_1.java \ - com/sun/corba/se/impl/orbutil/IIOPOutputStream_1_3.java \ - com/sun/corba/se/impl/orbutil/IIOPOutputStream_1_3_1.java \ com/sun/corba/se/impl/orbutil/LegacyHookGetFields.java \ com/sun/corba/se/impl/orbutil/LegacyHookPutFields.java \ com/sun/corba/se/impl/orbutil/LogKeywords.java \ @@ -45,19 +41,11 @@ com/sun/corba/se/impl/orbutil/ORBUtility.java \ com/sun/corba/se/impl/orbutil/ORBClassLoader.java \ com/sun/corba/se/impl/orbutil/RepIdDelegator.java \ - com/sun/corba/se/impl/orbutil/RepIdDelegator_1_3.java \ - com/sun/corba/se/impl/orbutil/RepIdDelegator_1_3_1.java \ - com/sun/corba/se/impl/orbutil/RepositoryIdCache_1_3.java \ - com/sun/corba/se/impl/orbutil/RepositoryId_1_3.java \ com/sun/corba/se/impl/orbutil/RepositoryIdFactory.java \ com/sun/corba/se/impl/orbutil/RepositoryIdStrings.java \ com/sun/corba/se/impl/orbutil/RepositoryIdUtility.java \ com/sun/corba/se/impl/orbutil/RepositoryIdInterface.java \ - com/sun/corba/se/impl/orbutil/RepositoryIdCache_1_3_1.java \ - com/sun/corba/se/impl/orbutil/RepositoryId_1_3_1.java \ com/sun/corba/se/impl/orbutil/StackImpl.java \ - com/sun/corba/se/impl/orbutil/ValueHandlerImpl_1_3_1.java \ - com/sun/corba/se/impl/orbutil/ValueHandlerImpl_1_3.java \ com/sun/corba/se/impl/orbutil/closure/Future.java \ com/sun/corba/se/impl/orbutil/closure/Constant.java \ com/sun/corba/se/impl/orbutil/concurrent/Sync.java \
--- a/src/share/classes/com/sun/corba/se/impl/activation/ServerMain.java Wed Jan 09 09:55:11 2013 +0000 +++ b/src/share/classes/com/sun/corba/se/impl/activation/ServerMain.java Mon Mar 11 17:35:38 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2002, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -322,9 +322,9 @@ com.sun.corba.se.spi.activation._ServerImplBase { private ORB orb; - private Method installMethod ; - private Method uninstallMethod ; - private Method shutdownMethod ; + private transient Method installMethod ; + private transient Method uninstallMethod ; + private transient Method shutdownMethod ; private Object methodArgs[] ; ServerCallback(ORB orb, Method installMethod, Method uninstallMethod,
--- a/src/share/classes/com/sun/corba/se/impl/corba/AnyImpl.java Wed Jan 09 09:55:11 2013 +0000 +++ b/src/share/classes/com/sun/corba/se/impl/corba/AnyImpl.java Mon Mar 11 17:35:38 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1218,7 +1218,7 @@ // See bug 4391648 for more info about the tcORB in this // case. RepositoryIdStrings repStrs - = RepositoryIdFactory.getRepIdStringsFactory(tcORB); + = RepositoryIdFactory.getRepIdStringsFactory(); // Assertion: c instanceof Serializable? @@ -1251,7 +1251,7 @@ // Anything else // We know that this is a TypeCodeImpl since it is our ORB classTC = (TypeCodeImpl)ValueUtility.createTypeCodeForClass( - tcORB, c, ORBUtility.createValueHandler(tcORB)); + tcORB, c, ORBUtility.createValueHandler()); // Intruct classTC to store its buffer classTC.setCaching(true); // Update the cache
--- a/src/share/classes/com/sun/corba/se/impl/encoding/CDRInputStream_1_0.java Wed Jan 09 09:55:11 2013 +0000 +++ b/src/share/classes/com/sun/corba/se/impl/encoding/CDRInputStream_1_0.java Mon Mar 11 17:35:38 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -269,8 +269,8 @@ private final void createRepositoryIdHandlers() { - repIdUtil = RepositoryIdFactory.getRepIdUtility(orb); - repIdStrs = RepositoryIdFactory.getRepIdStringsFactory(orb); + repIdUtil = RepositoryIdFactory.getRepIdUtility(); + repIdStrs = RepositoryIdFactory.getRepIdStringsFactory(); } public GIOPVersion getGIOPVersion() { @@ -564,10 +564,7 @@ checkForNegativeLength(len); - if (orb != null && ORBUtility.isLegacyORB((ORB)orb)) - return legacyReadString(len); - else - return internalReadString(len); + return internalReadString(len); } private final String internalReadString(int len) { @@ -588,54 +585,6 @@ return new String(result, 0, getCharConverter().getNumChars()); } - private final String legacyReadString(int len) { - - // - // Workaround for ORBs which send string lengths of - // zero to mean empty string. - // - // - // IMPORTANT: Do not replace 'new String("")' with "", it may result - // in a Serialization bug (See serialization.zerolengthstring) and - // bug id: 4728756 for details - if (len == 0) - return new String(""); - - len--; - char[] c = new char[len]; - - int n = 0; - while (n < len) { - int avail; - int bytes; - int wanted; - - avail = bbwi.buflen - bbwi.position(); - if (avail <= 0) { - grow(1, 1); - avail = bbwi.buflen - bbwi.position(); - } - wanted = len - n; - bytes = (wanted < avail) ? wanted : avail; - // Microbenchmarks are showing a loop of ByteBuffer.get(int) being - // faster than ByteBuffer.get(byte[], int, int). - for (int i=0; i<bytes; i++) { - c[n+i] = (char) (bbwi.byteBuffer.get(bbwi.position()+i) & 0xFF); - } - bbwi.position(bbwi.position() + bytes); - n += bytes; - } - - // - // Skip past terminating null byte - // - if (bbwi.position() + 1 > bbwi.buflen) - alignAndCheck(1, 1); - bbwi.position(bbwi.position() + 1); - - return new String(c); - } - public final String read_string() { return readStringOrIndirection(false); } @@ -1045,7 +994,7 @@ try { if (valueHandler == null) - valueHandler = ORBUtility.createValueHandler(orb); + valueHandler = ORBUtility.createValueHandler(); value = valueHandler.readValue(parent, indirection,
--- a/src/share/classes/com/sun/corba/se/impl/encoding/CDROutputStream_1_0.java Wed Jan 09 09:55:11 2013 +0000 +++ b/src/share/classes/com/sun/corba/se/impl/encoding/CDROutputStream_1_0.java Mon Mar 11 17:35:38 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -189,18 +189,8 @@ private final void createRepositoryIdHandlers() { - if (orb != null) { - // Get the appropriate versions based on the ORB version. The - // ORB versioning info is only in the core ORB. - repIdUtil - = RepositoryIdFactory.getRepIdUtility(orb); - repIdStrs - = RepositoryIdFactory.getRepIdStringsFactory(orb); - } else { - // Get the latest versions - repIdUtil = RepositoryIdFactory.getRepIdUtility(); - repIdStrs = RepositoryIdFactory.getRepIdStringsFactory(); - } + repIdUtil = RepositoryIdFactory.getRepIdUtility(); + repIdStrs = RepositoryIdFactory.getRepIdStringsFactory(); } public BufferManagerWrite getBufferManager() @@ -705,7 +695,7 @@ private void writeArray(Serializable array, Class clazz) { if (valueHandler == null) - valueHandler = ORBUtility.createValueHandler(orb); //d11638 + valueHandler = ORBUtility.createValueHandler(); //d11638 // Write value_tag int indirection = writeValueTag(mustChunk, true, @@ -768,7 +758,7 @@ private void writeRMIIIOPValueType(Serializable object, Class clazz) { if (valueHandler == null) - valueHandler = ORBUtility.createValueHandler(orb); //d11638 + valueHandler = ORBUtility.createValueHandler(); //d11638 Serializable key = object;
--- a/src/share/classes/com/sun/corba/se/impl/encoding/CachedCodeBase.java Wed Jan 09 09:55:11 2013 +0000 +++ b/src/share/classes/com/sun/corba/se/impl/encoding/CachedCodeBase.java Mon Mar 11 17:35:38 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ - package com.sun.corba.se.impl.encoding; import java.util.Hashtable; @@ -32,7 +31,8 @@ import com.sun.org.omg.SendingContext._CodeBaseImplBase; import com.sun.org.omg.SendingContext._CodeBaseStub; import com.sun.corba.se.spi.transport.CorbaConnection; - +import com.sun.corba.se.spi.ior.IOR; +import com.sun.corba.se.spi.orb.ORB; /** * Provides the reading side with a per connection cache of * info obtained via calls to the remote CodeBase. @@ -51,14 +51,24 @@ * * Needs cache management. */ -// REVISIT: revert to package protected after framework merge. public class CachedCodeBase extends _CodeBaseImplBase { private Hashtable implementations, fvds, bases; - private CodeBase delegate; + private volatile CodeBase delegate; private CorbaConnection conn; - private static Hashtable iorToCodeBaseObjMap = new Hashtable(); + private static Object iorMapLock = new Object(); + private static Hashtable<IOR,CodeBase> iorMap = new Hashtable<>(); + + public static synchronized void cleanCache( ORB orb ) { + synchronized (iorMapLock) { + for (IOR ior : iorMap.keySet()) { + if (ior.getORB() == orb) { + iorMap.remove(ior); + } + } + } + } public CachedCodeBase(CorbaConnection connection) { conn = connection; @@ -68,7 +78,7 @@ return null; } - public String implementation (String repId) { + public synchronized String implementation (String repId) { String urlResult = null; if (implementations == null) @@ -86,7 +96,7 @@ return urlResult; } - public String[] implementations (String[] repIds) { + public synchronized String[] implementations (String[] repIds) { String[] urlResults = new String[repIds.length]; for (int i = 0; i < urlResults.length; i++) @@ -95,7 +105,7 @@ return urlResults; } - public FullValueDescription meta (String repId) { + public synchronized FullValueDescription meta (String repId) { FullValueDescription result = null; if (fvds == null) @@ -113,7 +123,7 @@ return result; } - public FullValueDescription[] metas (String[] repIds) { + public synchronized FullValueDescription[] metas (String[] repIds) { FullValueDescription[] results = new FullValueDescription[repIds.length]; @@ -123,7 +133,7 @@ return results; } - public String[] bases (String repId) { + public synchronized String[] bases (String repId) { String[] results = null; @@ -145,7 +155,7 @@ // Ensures that we've used the connection's IOR to create // a valid CodeBase delegate. If this returns false, then // it is not valid to access the delegate. - private boolean connectedCodeBase() { + private synchronized boolean connectedCodeBase() { if (delegate != null) return true; @@ -165,7 +175,7 @@ return false; } - synchronized(this) { + synchronized(iorMapLock) { // Recheck the condition to make sure another // thread didn't already do this while we waited @@ -173,7 +183,8 @@ return true; // Do we have a reference initialized by another connection? - delegate = (CodeBase)CachedCodeBase.iorToCodeBaseObjMap.get(conn.getCodeBaseIOR()); + delegate = CachedCodeBase.iorMap.get(conn.getCodeBaseIOR()); + if (delegate != null) return true; @@ -181,8 +192,7 @@ delegate = CodeBaseHelper.narrow(getObjectFromIOR()); // Save it for the benefit of other connections - CachedCodeBase.iorToCodeBaseObjMap.put(conn.getCodeBaseIOR(), - delegate); + CachedCodeBase.iorMap.put(conn.getCodeBaseIOR(), delegate); } // It's now safe to use the delegate
--- a/src/share/classes/com/sun/corba/se/impl/interceptors/ClientRequestInfoImpl.java Wed Jan 09 09:55:11 2013 +0000 +++ b/src/share/classes/com/sun/corba/se/impl/interceptors/ClientRequestInfoImpl.java Mon Mar 11 17:35:38 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -217,7 +217,7 @@ // ClientRequestInfo validity table (see ptc/00-08-06 table 21-1). // Note: These must be in the same order as specified in contants. - protected static final boolean validCall[][] = { + private static final boolean validCall[][] = { // LEGEND: // s_req = send_request r_rep = receive_reply // s_pol = send_poll r_exc = receive_exception
--- a/src/share/classes/com/sun/corba/se/impl/interceptors/PIHandlerImpl.java Wed Jan 09 09:55:11 2013 +0000 +++ b/src/share/classes/com/sun/corba/se/impl/interceptors/PIHandlerImpl.java Mon Mar 11 17:35:38 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -58,7 +58,7 @@ import org.omg.PortableInterceptor.TRANSPORT_RETRY; import org.omg.PortableInterceptor.USER_EXCEPTION; import org.omg.PortableInterceptor.PolicyFactory; -import org.omg.PortableInterceptor.ObjectReferenceTemplate ; +import org.omg.PortableInterceptor.ObjectReferenceTemplate; import com.sun.corba.se.pept.encoding.OutputObject; @@ -112,10 +112,10 @@ } } - private ORB orb ; - InterceptorsSystemException wrapper ; - ORBUtilSystemException orbutilWrapper ; - OMGSystemException omgWrapper ; + private ORB orb; + InterceptorsSystemException wrapper; + ORBUtilSystemException orbutilWrapper; + OMGSystemException omgWrapper; // A unique id used in ServerRequestInfo. // This does not correspond to the GIOP request id. @@ -178,6 +178,21 @@ } }; + public void close() { + orb = null; + wrapper = null; + orbutilWrapper = null; + omgWrapper = null; + codecFactory = null; + arguments = null; + interceptorList = null; + interceptorInvoker = null; + current = null; + policyFactoryTable = null; + threadLocalClientRequestInfoStack = null; + threadLocalServerRequestInfoStack = null; + } + // Class to contain all ThreadLocal data for ClientRequestInfo // maintenance. //
--- a/src/share/classes/com/sun/corba/se/impl/interceptors/PINoOpHandlerImpl.java Wed Jan 09 09:55:11 2013 +0000 +++ b/src/share/classes/com/sun/corba/se/impl/interceptors/PINoOpHandlerImpl.java Mon Mar 11 17:35:38 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -69,6 +69,9 @@ public PINoOpHandlerImpl( ) { } + public void close() { + } + public void initialize() { }
--- a/src/share/classes/com/sun/corba/se/impl/interceptors/ServerRequestInfoImpl.java Wed Jan 09 09:55:11 2013 +0000 +++ b/src/share/classes/com/sun/corba/se/impl/interceptors/ServerRequestInfoImpl.java Mon Mar 11 17:35:38 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -195,7 +195,7 @@ // ServerRequestInfo validity table (see ptc/00-08-06 table 21-2). // Note: These must be in the same order as specified in contants. - protected static final boolean validCall[][] = { + private static final boolean validCall[][] = { // LEGEND: // r_rsc = receive_request_service_contexts // r_req = receive_request
--- a/src/share/classes/com/sun/corba/se/impl/io/FVDCodeBaseImpl.java Wed Jan 09 09:55:11 2013 +0000 +++ b/src/share/classes/com/sun/corba/se/impl/io/FVDCodeBaseImpl.java Mon Mar 11 17:35:38 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -86,7 +86,7 @@ // default to using the current ORB version in case the // vhandler is not set if (vhandler == null) { - vhandler = new ValueHandlerImpl(false); + vhandler = ValueHandlerImpl.getInstance(false); } // Util.getCodebase may return null which would @@ -120,7 +120,7 @@ // default to using the current ORB version in case the // vhandler is not set if (vhandler == null) { - vhandler = new ValueHandlerImpl(false); + vhandler = ValueHandlerImpl.getInstance(false); } try{ @@ -161,7 +161,7 @@ // default to using the current ORB version in case the // vhandler is not set if (vhandler == null) { - vhandler = new ValueHandlerImpl(false); + vhandler = ValueHandlerImpl.getInstance(false); } Stack repIds = new Stack();
--- a/src/share/classes/com/sun/corba/se/impl/io/ObjectStreamClass.java Wed Jan 09 09:55:11 2013 +0000 +++ b/src/share/classes/com/sun/corba/se/impl/io/ObjectStreamClass.java Mon Mar 11 17:35:38 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ /* * Licensed Materials - Property of IBM * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved + * Copyright IBM Corp. 1998 2012 All Rights Reserved * */ @@ -56,7 +56,8 @@ import java.util.Arrays; import java.util.Comparator; -import java.util.Hashtable; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; import com.sun.corba.se.impl.util.RepositoryId; @@ -83,8 +84,6 @@ private static Object noArgsList[] = {}; private static Class noTypesList[] = {}; - private static Hashtable translatedFields; - /** true if represents enum type */ private boolean isEnum; @@ -384,6 +383,55 @@ */ } + private static final class PersistentFieldsValue { + private final ConcurrentMap map = new ConcurrentHashMap(); + private static final Object NULL_VALUE = + (PersistentFieldsValue.class.getName() + ".NULL_VALUE"); + + PersistentFieldsValue() { } + + ObjectStreamField[] get(Class type) { + Object value = map.get(type); + if (value == null) { + value = computeValue(type); + map.putIfAbsent(type, value); + } + return ((value == NULL_VALUE) ? null : (ObjectStreamField[])value); + } + + private static Object computeValue(Class<?> type) { + try { + Field pf = type.getDeclaredField("serialPersistentFields"); + int mods = pf.getModifiers(); + if (Modifier.isPrivate(mods) && Modifier.isStatic(mods) && + Modifier.isFinal(mods)) { + pf.setAccessible(true); + java.io.ObjectStreamField[] fields = + (java.io.ObjectStreamField[])pf.get(type); + return translateFields(fields); + } + } catch (NoSuchFieldException e1) { + } catch (IllegalAccessException e2) { + } catch (IllegalArgumentException e3) { + } catch (ClassCastException e4) { } + return NULL_VALUE; + } + + private static ObjectStreamField[] translateFields( + java.io.ObjectStreamField[] fields) { + ObjectStreamField[] translation = + new ObjectStreamField[fields.length]; + for (int i = 0; i < fields.length; i++) { + translation[i] = new ObjectStreamField(fields[i].getName(), + fields[i].getType()); + } + return translation; + } + } + + private static final PersistentFieldsValue persistentFieldsValue = + new PersistentFieldsValue(); + /* * Initialize class descriptor. This method is only invoked on class * descriptors created via calls to lookupInternal(). This method is kept @@ -416,35 +464,7 @@ * If it is declared, use the declared serialPersistentFields. * Otherwise, extract the fields from the class itself. */ - try { - Field pf = cl.getDeclaredField("serialPersistentFields"); - // serial bug 7; the serialPersistentFields were not - // being read and stored as Accessible bit was not set - pf.setAccessible(true); - // serial bug 7; need to find if the field is of type - // java.io.ObjectStreamField - java.io.ObjectStreamField[] f = - (java.io.ObjectStreamField[])pf.get(cl); - int mods = pf.getModifiers(); - if ((Modifier.isPrivate(mods)) && - (Modifier.isStatic(mods)) && - (Modifier.isFinal(mods))) - { - fields = (ObjectStreamField[])translateFields((Object[])pf.get(cl)); - } - } catch (NoSuchFieldException e) { - fields = null; - } catch (IllegalAccessException e) { - fields = null; - } catch (IllegalArgumentException e) { - fields = null; - } catch (ClassCastException e) { - /* Thrown if a field serialPersistentField exists - * but it is not of type ObjectStreamField. - */ - fields = null; - } - + fields = persistentFieldsValue.get(cl); if (fields == null) { /* Get all of the declared fields for this @@ -641,44 +661,6 @@ superclass = null; } - private static Object[] translateFields(Object objs[]) - throws NoSuchFieldException { - try{ - java.io.ObjectStreamField fields[] = (java.io.ObjectStreamField[])objs; - Object translation[] = null; - - if (translatedFields == null) - translatedFields = new Hashtable(); - - translation = (Object[])translatedFields.get(fields); - - if (translation != null) - return translation; - else { - Class osfClass = Class.forName("com.sun.corba.se.impl.io.ObjectStreamField"); - translation = (Object[])java.lang.reflect.Array.newInstance(osfClass, objs.length); - Object arg[] = new Object[2]; - Class types[] = {String.class, Class.class}; - Constructor constructor = osfClass.getDeclaredConstructor(types); - for (int i = fields.length -1; i >= 0; i--){ - arg[0] = fields[i].getName(); - arg[1] = fields[i].getType(); - - translation[i] = constructor.newInstance(arg); - } - translatedFields.put(fields, translation); - - } - - return (Object[])translation; - } - catch(Throwable t){ - NoSuchFieldException nsfe = new NoSuchFieldException(); - nsfe.initCause( t ) ; - throw nsfe ; - } - } - /* * Set the class this version descriptor matches. * The base class name and serializable hash must match. @@ -1555,8 +1537,8 @@ private boolean hasExternalizableBlockData; Method writeObjectMethod; Method readObjectMethod; - private Method writeReplaceObjectMethod; - private Method readResolveObjectMethod; + private transient Method writeReplaceObjectMethod; + private transient Method readResolveObjectMethod; private Constructor cons ; /**
--- a/src/share/classes/com/sun/corba/se/impl/io/ValueHandlerImpl.java Wed Jan 09 09:55:11 2013 +0000 +++ b/src/share/classes/com/sun/corba/se/impl/io/ValueHandlerImpl.java Mon Mar 11 17:35:38 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -53,7 +53,7 @@ import com.sun.corba.se.impl.logging.OMGSystemException; import com.sun.corba.se.impl.logging.UtilSystemException; -public class ValueHandlerImpl implements javax.rmi.CORBA.ValueHandlerMultiFormat { +public final class ValueHandlerImpl implements javax.rmi.CORBA.ValueHandlerMultiFormat { // Property to override our maximum stream format version public static final String FORMAT_VERSION_PROPERTY @@ -150,14 +150,22 @@ writeValueWithVersion(out, value, streamFormatVersion); } - public ValueHandlerImpl(){} + private ValueHandlerImpl(){} - public ValueHandlerImpl(boolean isInputStream) { + private ValueHandlerImpl(boolean isInputStream) { this(); useHashtables = false; this.isInputStream = isInputStream; } + static ValueHandlerImpl getInstance() { + return new ValueHandlerImpl(); + } + + static ValueHandlerImpl getInstance(boolean isInputStream) { + return new ValueHandlerImpl(isInputStream); + } + /** * Writes the value to the stream using java semantics. * @param out The stream to write the value to @@ -458,12 +466,7 @@ return ObjectStreamClass.lookup(value.getClass()).writeReplace(value); } - /** - * Encapsulates writing of Java char arrays so that the 1.3 subclass - * can override it without exposing internals across packages. This - * is a fix for bug 4367783. - */ - protected void writeCharArray(org.omg.CORBA_2_3.portable.OutputStream out, + private void writeCharArray(org.omg.CORBA_2_3.portable.OutputStream out, char[] array, int offset, int length) @@ -576,12 +579,7 @@ } } - /** - * Encapsulates reading of Java char arrays so that the 1.3 subclass - * can override it without exposing internals across packages. This - * is a fix for bug 4367783. - */ - protected void readCharArray(org.omg.CORBA_2_3.portable.InputStream in, + private void readCharArray(org.omg.CORBA_2_3.portable.InputStream in, char[] array, int offset, int length) @@ -795,7 +793,7 @@ return RepositoryId.cache.getId(repId).isSequence(); } - protected String getOutputStreamClassName() { + private String getOutputStreamClassName() { return "com.sun.corba.se.impl.io.IIOPOutputStream"; } @@ -843,29 +841,11 @@ private IIOPOutputStream createOutputStreamBuiltInNoPriv( final String name ) throws IOException { - return - name.equals( - IIOPOutputStream - .class.getName() - ) ? - new IIOPOutputStream() : - - name.equals( - com.sun.corba.se.impl.orbutil.IIOPOutputStream_1_3 - .class.getName() - ) ? - new com.sun.corba.se.impl.orbutil.IIOPOutputStream_1_3() : - - name.equals( - com.sun.corba.se.impl.orbutil.IIOPOutputStream_1_3_1 - .class.getName() - ) ? - new com.sun.corba.se.impl.orbutil.IIOPOutputStream_1_3_1() : - - null; + return name.equals(IIOPOutputStream.class.getName()) ? + new IIOPOutputStream() : null; } - protected String getInputStreamClassName() { + private String getInputStreamClassName() { return "com.sun.corba.se.impl.io.IIOPInputStream"; } @@ -913,26 +893,8 @@ private IIOPInputStream createInputStreamBuiltInNoPriv( final String name ) throws IOException { - return - name.equals( - IIOPInputStream - .class.getName() - ) ? - new IIOPInputStream() : - - name.equals( - com.sun.corba.se.impl.orbutil.IIOPInputStream_1_3 - .class.getName() - ) ? - new com.sun.corba.se.impl.orbutil.IIOPInputStream_1_3() : - - name.equals( - com.sun.corba.se.impl.orbutil.IIOPInputStream_1_3_1 - .class.getName() - ) ? - new com.sun.corba.se.impl.orbutil.IIOPInputStream_1_3_1() : - - null; + return name.equals(IIOPInputStream.class.getName()) ? + new IIOPInputStream() : null; } /** @@ -958,12 +920,7 @@ } - /** - * Our JDK 1.3 and JDK 1.3.1 behavior subclasses override this. - * The correct behavior is for a Java char to map to a CORBA wchar, - * but our older code mapped it to a CORBA char. - */ - protected TCKind getJavaCharTCKind() { + TCKind getJavaCharTCKind() { return TCKind.tk_wchar; } }
--- a/src/share/classes/com/sun/corba/se/impl/io/ValueUtility.java Wed Jan 09 09:55:11 2013 +0000 +++ b/src/share/classes/com/sun/corba/se/impl/io/ValueUtility.java Mon Mar 11 17:35:38 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2002, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -93,6 +93,14 @@ null, // tk_abstract_interface 32 }; + static { + sun.corba.SharedSecrets.setJavaCorbaAccess(new sun.corba.JavaCorbaAccess() { + public ValueHandlerImpl newValueHandlerImpl() { + return ValueHandlerImpl.getInstance(); + } + }); + } + public static String getSignature(ValueMember member) throws ClassNotFoundException {
--- a/src/share/classes/com/sun/corba/se/impl/javax/rmi/CORBA/Util.java Wed Jan 09 09:55:11 2013 +0000 +++ b/src/share/classes/com/sun/corba/se/impl/javax/rmi/CORBA/Util.java Mon Mar 11 17:35:38 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -112,6 +112,9 @@ import com.sun.corba.se.impl.orbutil.ORBClassLoader; import com.sun.corba.se.impl.logging.UtilSystemException; import com.sun.corba.se.spi.logging.CORBALogDomains; +import sun.corba.SharedSecrets; +import sun.corba.JavaCorbaAccess; + /** * Provides utility methods that can be used by stubs and ties to @@ -125,15 +128,29 @@ // Maps targets to ties. private static IdentityHashtable exportedServants = new IdentityHashtable(); - private static ValueHandlerImpl valueHandlerSingleton = new ValueHandlerImpl(); + private static final ValueHandlerImpl valueHandlerSingleton = + SharedSecrets.getJavaCorbaAccess().newValueHandlerImpl(); private UtilSystemException utilWrapper = UtilSystemException.get( CORBALogDomains.RPC_ENCODING); - public static Util instance = null; + private static Util instance = null; public Util() { - instance = this; + setInstance(this); + } + + private static void setInstance( Util util ) { + assert instance == null : "Instance already defined"; + instance = util; + } + + public static Util getInstance() { + return instance; + } + + public static boolean isInstanceDefined() { + return instance != null; } // Used by TOAFactory.shutdown to unexport all targets for this
--- a/src/share/classes/com/sun/corba/se/impl/monitoring/MonitoringManagerFactoryImpl.java Wed Jan 09 09:55:11 2013 +0000 +++ b/src/share/classes/com/sun/corba/se/impl/monitoring/MonitoringManagerFactoryImpl.java Mon Mar 11 17:35:38 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,14 +34,18 @@ private HashMap monitoringManagerTable = new HashMap(); public synchronized MonitoringManager createMonitoringManager( - String nameOfTheRoot, String description ) + String nameOfTheRoot, String description) { MonitoringManagerImpl m = null; m = (MonitoringManagerImpl)monitoringManagerTable.get(nameOfTheRoot); if (m == null) { - m = new MonitoringManagerImpl( nameOfTheRoot, description ); + m = new MonitoringManagerImpl(nameOfTheRoot, description); monitoringManagerTable.put(nameOfTheRoot, m); } return m; } + + public synchronized void remove(String nameOfTheRoot) { + monitoringManagerTable.remove(nameOfTheRoot); + } }
--- a/src/share/classes/com/sun/corba/se/impl/monitoring/MonitoringManagerImpl.java Wed Jan 09 09:55:11 2013 +0000 +++ b/src/share/classes/com/sun/corba/se/impl/monitoring/MonitoringManagerImpl.java Mon Mar 11 17:35:38 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,7 @@ package com.sun.corba.se.impl.monitoring; import com.sun.corba.se.spi.monitoring.MonitoringManager; +import com.sun.corba.se.spi.monitoring.MonitoringManagerFactory; import com.sun.corba.se.spi.monitoring.MonitoredObject; import com.sun.corba.se.spi.monitoring.MonitoredObjectFactory; import com.sun.corba.se.spi.monitoring.MonitoringFactories; @@ -33,18 +34,24 @@ public class MonitoringManagerImpl implements MonitoringManager { private final MonitoredObject rootMonitoredObject; - MonitoringManagerImpl( String nameOfTheRoot, String description ) { + MonitoringManagerImpl(String nameOfTheRoot, String description) { MonitoredObjectFactory f = MonitoringFactories.getMonitoredObjectFactory(); rootMonitoredObject = - f.createMonitoredObject( nameOfTheRoot, description ); + f.createMonitoredObject(nameOfTheRoot, description); + } + + public void clearState() { + rootMonitoredObject.clearState(); } - public void clearState( ) { - rootMonitoredObject.clearState( ); + public MonitoredObject getRootMonitoredObject() { + return rootMonitoredObject; } - public MonitoredObject getRootMonitoredObject( ) { - return rootMonitoredObject; + public void close() { + MonitoringManagerFactory f = + MonitoringFactories.getMonitoringManagerFactory(); + f.remove(rootMonitoredObject.getName()); } }
--- a/src/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorBase_R.java Wed Jan 09 09:55:11 2013 +0000 +++ b/src/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorBase_R.java Mon Mar 11 17:35:38 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -93,7 +93,7 @@ activeObjectMap.putServant( servant, entry ) ; - if (Util.instance != null) { + if (Util.isInstanceDefined()) { POAManagerImpl pm = (POAManagerImpl)poa.the_POAManager() ; POAFactory factory = pm.getFactory() ; factory.registerPOAForServant(poa, servant); @@ -129,7 +129,7 @@ activeObjectMap.remove(key); - if (Util.instance != null) { + if (Util.isInstanceDefined()) { POAManagerImpl pm = (POAManagerImpl)poa.the_POAManager() ; POAFactory factory = pm.getFactory() ; factory.unregisterPOAForServant(poa, s);
--- a/src/share/classes/com/sun/corba/se/impl/oa/toa/TOAFactory.java Wed Jan 09 09:55:11 2013 +0000 +++ b/src/share/classes/com/sun/corba/se/impl/oa/toa/TOAFactory.java Mon Mar 11 17:35:38 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -78,8 +78,8 @@ public void shutdown( boolean waitForCompletion ) { - if (Util.instance != null) { - Util.instance.unregisterTargetsForORB(orb); + if (Util.isInstanceDefined()) { + Util.getInstance().unregisterTargetsForORB(orb); } }
--- a/src/share/classes/com/sun/corba/se/impl/orb/ORBImpl.java Wed Jan 09 09:55:11 2013 +0000 +++ b/src/share/classes/com/sun/corba/se/impl/orb/ORBImpl.java Mon Mar 11 17:35:38 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,35 +23,37 @@ * questions. */ -package com.sun.corba.se.impl.orb ; +package com.sun.corba.se.impl.orb; import java.applet.Applet; -import java.io.IOException ; +import java.io.IOException; import java.lang.reflect.Constructor; -import java.lang.reflect.Field ; -import java.lang.reflect.Modifier ; -import java.lang.reflect.InvocationTargetException ; +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; +import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList ; -import java.util.Iterator ; -import java.util.Properties ; -import java.util.Vector ; -import java.util.Hashtable ; -import java.util.Map ; -import java.util.HashMap ; -import java.util.LinkedList ; -import java.util.Collection ; -import java.util.Collections ; -import java.util.StringTokenizer ; -import java.util.Enumeration ; -import java.util.WeakHashMap ; +import java.util.Set; +import java.util.HashSet; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.Properties; +import java.util.Vector; +import java.util.Hashtable; +import java.util.Map; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.Collection; +import java.util.Collections; +import java.util.StringTokenizer; +import java.util.Enumeration; +import java.util.WeakHashMap; -import java.net.InetAddress ; +import java.net.InetAddress; import java.security.PrivilegedAction; -import java.security.AccessController ; +import java.security.AccessController; import javax.rmi.CORBA.Util; import javax.rmi.CORBA.ValueHandler; @@ -82,18 +84,18 @@ import com.sun.org.omg.SendingContext.CodeBase; import com.sun.corba.se.pept.broker.Broker; -import com.sun.corba.se.pept.protocol.ClientInvocationInfo ; +import com.sun.corba.se.pept.protocol.ClientInvocationInfo; import com.sun.corba.se.pept.transport.ContactInfo; import com.sun.corba.se.pept.transport.ConnectionCache; import com.sun.corba.se.pept.transport.TransportManager; import com.sun.corba.se.spi.ior.IOR; -import com.sun.corba.se.spi.ior.IdentifiableFactoryFinder ; +import com.sun.corba.se.spi.ior.IdentifiableFactoryFinder; import com.sun.corba.se.spi.ior.TaggedComponentFactoryFinder; -import com.sun.corba.se.spi.ior.IORFactories ; -import com.sun.corba.se.spi.ior.ObjectKey ; -import com.sun.corba.se.spi.ior.ObjectKeyFactory ; -import com.sun.corba.se.spi.ior.iiop.IIOPFactories ; +import com.sun.corba.se.spi.ior.IORFactories; +import com.sun.corba.se.spi.ior.ObjectKey; +import com.sun.corba.se.spi.ior.ObjectKeyFactory; +import com.sun.corba.se.spi.ior.iiop.IIOPFactories; import com.sun.corba.se.spi.ior.iiop.GIOPVersion; import com.sun.corba.se.spi.oa.OAInvocationInfo; import com.sun.corba.se.spi.oa.ObjectAdapterFactory; @@ -122,10 +124,10 @@ import com.sun.corba.se.spi.transport.CorbaContactInfoListFactory; import com.sun.corba.se.spi.transport.CorbaTransportManager; import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketManager; -import com.sun.corba.se.spi.copyobject.CopierManager ; -import com.sun.corba.se.spi.presentation.rmi.PresentationDefaults ; -import com.sun.corba.se.spi.presentation.rmi.PresentationManager ; -import com.sun.corba.se.spi.presentation.rmi.StubAdapter ; +import com.sun.corba.se.spi.copyobject.CopierManager; +import com.sun.corba.se.spi.presentation.rmi.PresentationDefaults; +import com.sun.corba.se.spi.presentation.rmi.PresentationManager; +import com.sun.corba.se.spi.presentation.rmi.StubAdapter; import com.sun.corba.se.spi.servicecontext.ServiceContextRegistry; import com.sun.corba.se.impl.corba.TypeCodeFactory; @@ -140,6 +142,7 @@ import com.sun.corba.se.impl.corba.RequestImpl; import com.sun.corba.se.impl.dynamicany.DynAnyFactoryImpl; import com.sun.corba.se.impl.encoding.EncapsOutputStream; +import com.sun.corba.se.impl.encoding.CachedCodeBase; import com.sun.corba.se.impl.interceptors.PIHandlerImpl; import com.sun.corba.se.impl.interceptors.PINoOpHandlerImpl; import com.sun.corba.se.impl.ior.TaggedComponentFactoryFinderImpl; @@ -185,6 +188,7 @@ private java.lang.Object runObj = new java.lang.Object(); private java.lang.Object shutdownObj = new java.lang.Object(); + private java.lang.Object waitForCompletionObj = new java.lang.Object(); private static final byte STATUS_OPERATING = 1; private static final byte STATUS_SHUTTING_DOWN = 2; private static final byte STATUS_SHUTDOWN = 3; @@ -193,6 +197,7 @@ // XXX Should we move invocation tracking to the first level server dispatcher? private java.lang.Object invocationObj = new java.lang.Object(); + private int numInvocations = 0; // thread local variable to store a boolean to detect deadlock in // ORB.shutdown(true). @@ -220,8 +225,6 @@ private int transientServerId ; - private ThreadGroup threadGroup ; - private ServiceContextRegistry serviceContextRegistry ; // Needed here to implement connect/disconnect @@ -265,6 +268,7 @@ private final Object urlOperationLock = new java.lang.Object() ; private CorbaServerRequestDispatcher insNamingDelegate ; + // resolverLock must be used for all access to either resolver or // localResolver, since it is possible for the resolver to indirectly // refer to the localResolver. Also used to protect access to @@ -279,6 +283,8 @@ private ObjectKeyFactory objectKeyFactory ; + private boolean orbOwnsThreadPoolManager = false ; + private ThreadPoolManager threadpoolMgr; private void dprint( String msg ) @@ -322,11 +328,17 @@ public ORBVersion getORBVersion() { + synchronized (this) { + checkShutdownState(); + } return (ORBVersion)(orbVersionThreadLocal.get()) ; } public void setORBVersion(ORBVersion verObj) { + synchronized (this) { + checkShutdownState(); + } orbVersionThreadLocal.set(verObj); } @@ -347,46 +359,6 @@ // end of this method. pihandler = new PINoOpHandlerImpl( ); - // See bugs 4916766 and 4936203 - // We intend to create new threads in a reliable thread group. - // This avoids problems if the application/applet - // creates a thread group, makes JavaIDL calls which create a new - // connection and ReaderThread, and then destroys the thread - // group. If our ReaderThreads were to be part of such destroyed thread - // group then it might get killed and cause other invoking threads - // sharing the same connection to get a non-restartable - // CommunicationFailure. We'd like to avoid that. - // - // Our solution is to create all of our threads in the highest thread - // group that we have access to, given our own security clearance. - // - try { - // try to get a thread group that's as high in the threadgroup - // parent-child hierarchy, as we can get to. - // this will prevent an ORB thread created during applet-init from - // being killed when an applet dies. - threadGroup = (ThreadGroup) AccessController.doPrivileged( - new PrivilegedAction() { - public Object run() { - ThreadGroup tg = Thread.currentThread().getThreadGroup() ; - ThreadGroup ptg = tg ; - try { - while (ptg != null) { - tg = ptg; - ptg = tg.getParent(); - } - } catch (SecurityException se) { - // Discontinue going higher on a security exception. - } - return new ThreadGroup(tg, "ORB ThreadGroup"); - } - } - ); - } catch (SecurityException e) { - // something wrong, we go back to the original code - threadGroup = Thread.currentThread().getThreadGroup(); - } - // This is the unique id of this server (JVM). Multiple incarnations // of this server will get different ids. // Compute transientServerId = milliseconds since Jan 1, 1970 @@ -547,6 +519,9 @@ public void set_parameters( Properties props ) { + synchronized (this) { + checkShutdownState(); + } preInit( null, props ) ; DataCollector dataCollector = DataCollectorFactory.create( props, getLocalHostName() ) ; @@ -788,6 +763,9 @@ */ public void notifyORB() { + synchronized (this) { + checkShutdownState(); + } synchronized (this.svResponseReceived) { this.svResponseReceived.set(); this.svResponseReceived.notify(); @@ -854,13 +832,15 @@ // Note that we connect this if we have not already done so. public synchronized IOR getFVDCodeBaseIOR() { + checkShutdownState(); + if (codeBaseIOR != null) // i.e. We are already connected to it return codeBaseIOR; // backward compatability 4365188 CodeBase cb; - ValueHandler vh = ORBUtility.createValueHandler(this); + ValueHandler vh = ORBUtility.createValueHandler(); cb = (CodeBase)vh.getRunTimeCodeBase(); return ORBUtility.connectAndGetIOR( this, cb ) ; @@ -1118,6 +1098,8 @@ public synchronized void setTypeCodeForClass(Class c, TypeCodeImpl tci) { + checkShutdownState(); + if (typeCodeForClassMap == null) typeCodeForClassMap = Collections.synchronizedMap( new WeakHashMap(64)); @@ -1128,6 +1110,8 @@ public synchronized TypeCodeImpl getTypeCodeForClass(Class c) { + checkShutdownState(); + if (typeCodeForClassMap == null) return null; return (TypeCodeImpl)typeCodeForClassMap.get(c); @@ -1210,6 +1194,10 @@ { CorbaServerRequestDispatcher insnd ; + synchronized (this) { + checkShutdownState(); + } + if ((id == null) || (id.length() == 0)) throw new InvalidName() ; @@ -1253,66 +1241,88 @@ } } - public void shutdown(boolean wait_for_completion) - { - // to wait for completion, we would deadlock, so throw a standard - // OMG exception. - if (wait_for_completion && ((Boolean)isProcessingInvocation.get()).booleanValue()) { - throw omgWrapper.shutdownWaitForCompletionDeadlock() ; - } - - boolean doShutdown = false ; + public void shutdown(boolean wait_for_completion) { + boolean wait = false; synchronized (this) { - checkShutdownState() ; + checkShutdownState(); + + // This is to avoid deadlock: don't allow a thread that is + // processing a request to call shutdown( true ), because + // the shutdown would block waiting for the request to complete, + // while the request would block waiting for shutdown to complete. + if (wait_for_completion && + isProcessingInvocation.get() == Boolean.TRUE) { + throw omgWrapper.shutdownWaitForCompletionDeadlock(); + } if (status == STATUS_SHUTTING_DOWN) { - if (!wait_for_completion) - // If we are already shutting down and don't want - // to wait, nothing to do: return. - return ; - } else { - // The ORB status was STATUS_OPERATING, so start the shutdown. - status = STATUS_SHUTTING_DOWN ; - doShutdown = true ; + if (wait_for_completion) { + wait = true; + } else { + return; + } } + + status = STATUS_SHUTTING_DOWN; } - // At this point, status is SHUTTING_DOWN. - // All shutdown calls with wait_for_completion == true must synchronize - // here. Only the first call will be made with doShutdown == true. + // Avoid more than one thread performing shutdown at a time. synchronized (shutdownObj) { - if (doShutdown) { - // shutdownServants will set all POAManagers into the - // INACTIVE state, causing request to be rejected. - // If wait_for_completion is true, this will not return until - // all invocations have completed. + // At this point, the ORB status is certainly STATUS_SHUTTING_DOWN. + // If wait is true, another thread already called shutdown( true ), + // and so we wait for completion + if (wait) { + while (true) { + synchronized (this) { + if (status == STATUS_SHUTDOWN) + break; + } + + try { + shutdownObj.wait(); + } catch (InterruptedException exc) { + // NOP: just loop and wait until state is changed + } + } + } else { + // perform the actual shutdown shutdownServants(wait_for_completion); + if (wait_for_completion) { + synchronized ( waitForCompletionObj ) { + while (numInvocations > 0) { + try { + waitForCompletionObj.wait(); + } catch (InterruptedException ex) {} + } + } + } + synchronized (runObj) { runObj.notifyAll(); } - synchronized (this) { - status = STATUS_SHUTDOWN; - } + status = STATUS_SHUTDOWN; + + shutdownObj.notifyAll(); } } } - /** This method shuts down the ORB and causes orb.run() to return. - * It will cause all POAManagers to be deactivated, which in turn - * will cause all POAs to be deactivated. - */ + // Cause all ObjectAdapaterFactories to clean up all of their internal state, which + // may include activated objects that have associated state and callbacks that must + // complete in order to shutdown. This will cause new request to be rejected. protected void shutdownServants(boolean wait_for_completion) { - Iterator iter = requestDispatcherRegistry.getObjectAdapterFactories().iterator() ; - while (iter.hasNext()) { - ObjectAdapterFactory oaf = (ObjectAdapterFactory)iter.next() ; - oaf.shutdown( wait_for_completion ) ; + Set<ObjectAdapterFactory> oaset; + synchronized (this) { + oaset = new HashSet<>(requestDispatcherRegistry.getObjectAdapterFactories()); } + + for (ObjectAdapterFactory oaf : oaset) + oaf.shutdown(wait_for_completion); } - // REVISIT: was protected - made public for framework // Note that the caller must hold the ORBImpl lock. public void checkShutdownState() { @@ -1327,21 +1337,40 @@ public boolean isDuringDispatch() { + synchronized (this) { + checkShutdownState(); + } Boolean value = (Boolean)(isProcessingInvocation.get()) ; return value.booleanValue() ; } public void startingDispatch() { + synchronized (this) { + checkShutdownState(); + } synchronized (invocationObj) { isProcessingInvocation.set(Boolean.TRUE); + numInvocations++; } } public void finishedDispatch() { + synchronized (this) { + checkShutdownState(); + } synchronized (invocationObj) { - isProcessingInvocation.set(Boolean.FALSE); + numInvocations--; + isProcessingInvocation.set(false); + if (numInvocations == 0) { + synchronized (waitForCompletionObj) { + waitForCompletionObj.notifyAll(); + } + } else if (numInvocations < 0) { + throw wrapper.numInvocationsAlreadyZero( + CompletionStatus.COMPLETED_YES); + } } } @@ -1350,12 +1379,12 @@ * not been shut down, it will start the shutdown process and block until * the ORB has shut down before it destroys the ORB." */ - public synchronized void destroy() + public void destroy() { - boolean shutdownFirst = false ; + boolean shutdownFirst = false; synchronized (this) { - shutdownFirst = (status == STATUS_OPERATING) ; + shutdownFirst = (status == STATUS_OPERATING); } if (shutdownFirst) { @@ -1365,11 +1394,76 @@ synchronized (this) { if (status < STATUS_DESTROYED) { getCorbaTransportManager().close(); - getPIHandler().destroyInterceptors() ; + getPIHandler().destroyInterceptors(); status = STATUS_DESTROYED; } } + synchronized (threadPoolManagerAccessLock) { + if (orbOwnsThreadPoolManager) { + try { + threadpoolMgr.close(); + threadpoolMgr = null; + } catch (IOException exc) { + wrapper.ioExceptionOnClose(exc); + } + } + } + try { + monitoringManager.close(); + monitoringManager = null; + } catch (IOException exc) { + wrapper.ioExceptionOnClose(exc); + } + + CachedCodeBase.cleanCache(this); + try { + pihandler.close(); + } catch (IOException exc) { + wrapper.ioExceptionOnClose(exc); + } + + super.destroy(); + + badServerIdHandlerAccessLock = null; + clientDelegateFactoryAccessorLock = null; + corbaContactInfoListFactoryAccessLock = null; + + objectKeyFactoryAccessLock = null; + legacyServerSocketManagerAccessLock = null; + threadPoolManagerAccessLock = null; + transportManager = null; + legacyServerSocketManager = null; + OAInvocationInfoStack = null; + clientInvocationInfoStack = null; + codeBaseIOR = null; + dynamicRequests = null; + svResponseReceived = null; + runObj = null; + shutdownObj = null; + waitForCompletionObj = null; + invocationObj = null; + isProcessingInvocation = null; + typeCodeForClassMap = null; + valueFactoryCache = null; + orbVersionThreadLocal = null; + requestDispatcherRegistry = null; + copierManager = null; + toaFactory = null; + poaFactory = null; + pihandler = null; + configData = null; + badServerIdHandler = null; + clientDelegateFactory = null; + corbaContactInfoListFactory = null; + resolver = null; + localResolver = null; + insNamingDelegate = null; + urlOperation = null; + taggedComponentFactoryFinder = null; + taggedProfileFactoryFinder = null; + taggedProfileTemplateFactoryFinder = null; + objectKeyFactory = null; } /** @@ -1434,18 +1528,27 @@ public OAInvocationInfo peekInvocationInfo() { + synchronized (this) { + checkShutdownState(); + } StackImpl stack = (StackImpl)(OAInvocationInfoStack.get()) ; return (OAInvocationInfo)(stack.peek()) ; } public void pushInvocationInfo( OAInvocationInfo info ) { + synchronized (this) { + checkShutdownState(); + } StackImpl stack = (StackImpl)(OAInvocationInfoStack.get()) ; stack.push( info ) ; } public OAInvocationInfo popInvocationInfo() { + synchronized (this) { + checkShutdownState(); + } StackImpl stack = (StackImpl)(OAInvocationInfoStack.get()) ; return (OAInvocationInfo)(stack.pop()) ; } @@ -1459,6 +1562,9 @@ public void initBadServerIdHandler() { + synchronized (this) { + checkShutdownState(); + } synchronized (badServerIdHandlerAccessLock) { Class cls = configData.getBadServerIdHandler() ; if (cls != null) { @@ -1477,6 +1583,9 @@ public void setBadServerIdHandler( BadServerIdHandler handler ) { + synchronized (this) { + checkShutdownState(); + } synchronized (badServerIdHandlerAccessLock) { badServerIdHandler = handler; } @@ -1484,6 +1593,9 @@ public void handleBadServerId( ObjectKey okey ) { + synchronized (this) { + checkShutdownState(); + } synchronized (badServerIdHandlerAccessLock) { if (badServerIdHandler == null) throw wrapper.badServerId() ; @@ -1532,6 +1644,9 @@ public int getTransientServerId() { + synchronized (this) { + checkShutdownState(); + } if( configData.getORBServerIdPropertySpecified( ) ) { // ORBServerId is specified then use that value return configData.getPersistentServerId( ); @@ -1541,11 +1656,17 @@ public RequestDispatcherRegistry getRequestDispatcherRegistry() { + synchronized (this) { + checkShutdownState(); + } return requestDispatcherRegistry; } public ServiceContextRegistry getServiceContextRegistry() { + synchronized (this) { + checkShutdownState(); + } return serviceContextRegistry ; } @@ -1563,12 +1684,18 @@ // XXX What about multi-homed host? public boolean isLocalHost( String hostName ) { + synchronized (this) { + checkShutdownState(); + } return hostName.equals( configData.getORBServerHost() ) || hostName.equals( getLocalHostName() ) ; } public boolean isLocalServerId( int subcontractId, int serverId ) { + synchronized (this) { + checkShutdownState(); + } if ((subcontractId < ORBConstants.FIRST_POA_SCID) || (subcontractId > ORBConstants.MAX_POA_SCID)) return serverId == getTransientServerId( ) ; @@ -1659,6 +1786,9 @@ public ClientInvocationInfo createOrIncrementInvocationInfo() { + synchronized (this) { + checkShutdownState(); + } StackImpl invocationInfoStack = (StackImpl) clientInvocationInfoStack.get(); ClientInvocationInfo clientInvocationInfo = null; @@ -1682,10 +1812,13 @@ public void releaseOrDecrementInvocationInfo() { + synchronized (this) { + checkShutdownState(); + } + int entryCount = -1; + ClientInvocationInfo clientInvocationInfo = null; StackImpl invocationInfoStack = (StackImpl)clientInvocationInfoStack.get(); - int entryCount = -1; - ClientInvocationInfo clientInvocationInfo = null; if (!invocationInfoStack.empty()) { clientInvocationInfo = (ClientInvocationInfo)invocationInfoStack.peek(); @@ -1705,6 +1838,9 @@ public ClientInvocationInfo getInvocationInfo() { + synchronized (this) { + checkShutdownState(); + } StackImpl invocationInfoStack = (StackImpl) clientInvocationInfoStack.get(); return (ClientInvocationInfo) invocationInfoStack.peek(); @@ -1719,6 +1855,9 @@ public void setClientDelegateFactory( ClientDelegateFactory factory ) { + synchronized (this) { + checkShutdownState(); + } synchronized (clientDelegateFactoryAccessorLock) { clientDelegateFactory = factory ; } @@ -1726,6 +1865,9 @@ public ClientDelegateFactory getClientDelegateFactory() { + synchronized (this) { + checkShutdownState(); + } synchronized (clientDelegateFactoryAccessorLock) { return clientDelegateFactory ; } @@ -1735,6 +1877,9 @@ public void setCorbaContactInfoListFactory( CorbaContactInfoListFactory factory ) { + synchronized (this) { + checkShutdownState(); + } synchronized (corbaContactInfoListFactoryAccessLock) { corbaContactInfoListFactory = factory ; } @@ -1742,6 +1887,7 @@ public synchronized CorbaContactInfoListFactory getCorbaContactInfoListFactory() { + checkShutdownState(); return corbaContactInfoListFactory ; } @@ -1750,6 +1896,9 @@ */ public void setResolver( Resolver resolver ) { + synchronized (this) { + checkShutdownState(); + } synchronized (resolverLock) { this.resolver = resolver ; } @@ -1760,6 +1909,9 @@ */ public Resolver getResolver() { + synchronized (this) { + checkShutdownState(); + } synchronized (resolverLock) { return resolver ; } @@ -1770,6 +1922,9 @@ */ public void setLocalResolver( LocalResolver resolver ) { + synchronized (this) { + checkShutdownState(); + } synchronized (resolverLock) { this.localResolver = resolver ; } @@ -1780,6 +1935,9 @@ */ public LocalResolver getLocalResolver() { + synchronized (this) { + checkShutdownState(); + } synchronized (resolverLock) { return localResolver ; } @@ -1790,6 +1948,9 @@ */ public void setURLOperation( Operation stringToObject ) { + synchronized (this) { + checkShutdownState(); + } synchronized (urlOperationLock) { urlOperation = stringToObject ; } @@ -1800,6 +1961,9 @@ */ public Operation getURLOperation() { + synchronized (this) { + checkShutdownState(); + } synchronized (urlOperationLock) { return urlOperation ; } @@ -1807,6 +1971,9 @@ public void setINSDelegate( CorbaServerRequestDispatcher sdel ) { + synchronized (this) { + checkShutdownState(); + } synchronized (resolverLock) { insNamingDelegate = sdel ; } @@ -1814,16 +1981,25 @@ public TaggedComponentFactoryFinder getTaggedComponentFactoryFinder() { + synchronized (this) { + checkShutdownState(); + } return taggedComponentFactoryFinder ; } public IdentifiableFactoryFinder getTaggedProfileFactoryFinder() { + synchronized (this) { + checkShutdownState(); + } return taggedProfileFactoryFinder ; } public IdentifiableFactoryFinder getTaggedProfileTemplateFactoryFinder() { + synchronized (this) { + checkShutdownState(); + } return taggedProfileTemplateFactoryFinder ; } @@ -1831,6 +2007,9 @@ public ObjectKeyFactory getObjectKeyFactory() { + synchronized (this) { + checkShutdownState(); + } synchronized (objectKeyFactoryAccessLock) { return objectKeyFactory ; } @@ -1838,6 +2017,9 @@ public void setObjectKeyFactory( ObjectKeyFactory factory ) { + synchronized (this) { + checkShutdownState(); + } synchronized (objectKeyFactoryAccessLock) { objectKeyFactory = factory ; } @@ -1864,6 +2046,9 @@ public LegacyServerSocketManager getLegacyServerSocketManager() { + synchronized (this) { + checkShutdownState(); + } synchronized (legacyServerSocketManagerAccessLock) { if (legacyServerSocketManager == null) { legacyServerSocketManager = new LegacyServerSocketManagerImpl(this); @@ -1876,6 +2061,9 @@ public void setThreadPoolManager(ThreadPoolManager mgr) { + synchronized (this) { + checkShutdownState(); + } synchronized (threadPoolManagerAccessLock) { threadpoolMgr = mgr; } @@ -1883,9 +2071,13 @@ public ThreadPoolManager getThreadPoolManager() { + synchronized (this) { + checkShutdownState(); + } synchronized (threadPoolManagerAccessLock) { if (threadpoolMgr == null) { - threadpoolMgr = new ThreadPoolManagerImpl( threadGroup ); + threadpoolMgr = new ThreadPoolManagerImpl(); + orbOwnsThreadPoolManager = true; } return threadpoolMgr; } @@ -1893,6 +2085,9 @@ public CopierManager getCopierManager() { + synchronized (this) { + checkShutdownState(); + } return copierManager ; } } // Class ORBImpl
--- a/src/share/classes/com/sun/corba/se/impl/orb/ParserTable.java Wed Jan 09 09:55:11 2013 +0000 +++ b/src/share/classes/com/sun/corba/se/impl/orb/ParserTable.java Mon Mar 11 17:35:38 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -106,7 +106,9 @@ public ParserData[] getParserData() { - return parserData ; + ParserData[] parserArray = new ParserData[parserData.length]; + System.arraycopy(parserData, 0, parserArray, 0, parserData.length); + return parserArray; } private ParserTable() {
--- a/src/share/classes/com/sun/corba/se/impl/orbutil/IIOPInputStream_1_3.java Wed Jan 09 09:55:11 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2000, 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.sun.corba.se.impl.orbutil; - -import java.io.*; -import java.util.Hashtable; - -/** - * Implements legacy behavior from before Ladybird to maintain - * backwards compatibility. - */ -public class IIOPInputStream_1_3 extends com.sun.corba.se.impl.io.IIOPInputStream -{ - // The newer version in the io package correctly reads a wstring instead. - // This concerns bug 4379597. - protected String internalReadUTF(org.omg.CORBA.portable.InputStream stream) - { - return stream.read_string(); - } - - /** - * Before JDK 1.3.1_01, the PutField/GetField implementation - * actually sent a Hashtable. - */ - public ObjectInputStream.GetField readFields() - throws IOException, ClassNotFoundException, NotActiveException { - Hashtable fields = (Hashtable)readObject(); - return new LegacyHookGetFields(fields); - } - - public IIOPInputStream_1_3() - throws java.io.IOException { - super(); - } -}
--- a/src/share/classes/com/sun/corba/se/impl/orbutil/IIOPInputStream_1_3_1.java Wed Jan 09 09:55:11 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - */ -package com.sun.corba.se.impl.orbutil; - -import java.io.*; -import java.util.Hashtable; - -/** - * Implements legacy behavior from Ladybird to maintain - * backwards compatibility. - */ -public class IIOPInputStream_1_3_1 extends com.sun.corba.se.impl.io.IIOPInputStream -{ - public IIOPInputStream_1_3_1() - throws java.io.IOException { - super(); - } - - /** - * Before JDK 1.3.1_01, the PutField/GetField implementation - * actually sent a Hashtable. - */ - public ObjectInputStream.GetField readFields() - throws IOException, ClassNotFoundException, NotActiveException { - - Hashtable fields = (Hashtable)readObject(); - return new LegacyHookGetFields(fields); - } -}
--- a/src/share/classes/com/sun/corba/se/impl/orbutil/IIOPOutputStream_1_3.java Wed Jan 09 09:55:11 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2000, 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.sun.corba.se.impl.orbutil; - -import java.io.*; - -/** - * Implements legacy behavior from before Ladybird to maintain - * backwards compatibility. - */ -public class IIOPOutputStream_1_3 extends com.sun.corba.se.impl.io.IIOPOutputStream -{ - // We can't assume that the superclass's putFields - // member will be non-private. We must allow - // the RI to run on JDK 1.3.1 FCS as well as - // the JDK 1.3.1_01 patch. - private ObjectOutputStream.PutField putFields_1_3; - - // The newer version in the io package correctly writes a wstring instead. - // This concerns bug 4379597. - protected void internalWriteUTF(org.omg.CORBA.portable.OutputStream stream, - String data) - { - stream.write_string(data); - } - - public IIOPOutputStream_1_3() - throws java.io.IOException { - super(); - } - - /** - * Before JDK 1.3.1_01, the PutField/GetField implementation - * actually sent a Hashtable. - */ - public ObjectOutputStream.PutField putFields() - throws IOException { - putFields_1_3 = new LegacyHookPutFields(); - return putFields_1_3; - } - - public void writeFields() - throws IOException { - putFields_1_3.write(this); - } -}
--- a/src/share/classes/com/sun/corba/se/impl/orbutil/IIOPOutputStream_1_3_1.java Wed Jan 09 09:55:11 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - */ -package com.sun.corba.se.impl.orbutil; - -import java.io.*; -import java.util.Hashtable; - -/** - * Implements legacy behavior from Ladybird to maintain - * backwards compatibility. - */ -public class IIOPOutputStream_1_3_1 extends com.sun.corba.se.impl.io.IIOPOutputStream -{ - // We can't assume that the superclass's putFields - // member will be non-private. We must allow - // the RI to run on JDK 1.3.1 FCS as well as - // the JDK 1.3.1_01 patch. - private ObjectOutputStream.PutField putFields_1_3_1; - - public IIOPOutputStream_1_3_1() - throws java.io.IOException { - super(); - } - - /** - * Before JDK 1.3.1_01, the PutField/GetField implementation - * actually sent a Hashtable. - */ - public ObjectOutputStream.PutField putFields() - throws IOException { - - putFields_1_3_1 = new LegacyHookPutFields(); - return putFields_1_3_1; - } - - public void writeFields() - throws IOException { - - putFields_1_3_1.write(this); - } -}
--- a/src/share/classes/com/sun/corba/se/impl/orbutil/ORBUtility.java Wed Jan 09 09:55:11 2013 +0000 +++ b/src/share/classes/com/sun/corba/se/impl/orbutil/ORBUtility.java Mon Mar 11 17:35:38 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -160,45 +160,13 @@ } /** - * Creates the correct ValueHandler for the given ORB, - * querying ORBVersion information. If the ORB or - * ORBVersion is null, gets the ValueHandler from - * Util.createValueHandler. + * Return default ValueHandler */ - public static ValueHandler createValueHandler(ORB orb) { - - if (orb == null) - return Util.createValueHandler(); - - ORBVersion version = orb.getORBVersion(); - - if (version == null) - return Util.createValueHandler(); - - if (version.equals(ORBVersionFactory.getOLD())) - return new ValueHandlerImpl_1_3(); - if (version.equals(ORBVersionFactory.getNEW())) - return new ValueHandlerImpl_1_3_1(); - + public static ValueHandler createValueHandler() { return Util.createValueHandler(); } /** - * Returns true if the given ORB could accurately be determined to be a - * Kestrel or earlier ORB. Note: If passed the ORBSingleton, this will return - * false. - */ - public static boolean isLegacyORB(ORB orb) - { - try { - ORBVersion currentORB = orb.getORBVersion(); - return currentORB.equals( ORBVersionFactory.getOLD() ) ; - } catch (SecurityException se) { - return false; - } - } - - /** * Returns true if it was accurately determined that the remote ORB is * a foreign (non-JavaSoft) ORB. Note: If passed the ORBSingleton, this * will return false.
--- a/src/share/classes/com/sun/corba/se/impl/orbutil/ObjectStreamClass_1_3_1.java Wed Jan 09 09:55:11 2013 +0000 +++ b/src/share/classes/com/sun/corba/se/impl/orbutil/ObjectStreamClass_1_3_1.java Mon Mar 11 17:35:38 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1119,8 +1119,8 @@ private boolean hasExternalizableBlockData; Method writeObjectMethod; Method readObjectMethod; - private Method writeReplaceObjectMethod; - private Method readResolveObjectMethod; + private transient Method writeReplaceObjectMethod; + private transient Method readResolveObjectMethod; /* * ObjectStreamClass_1_3_1 that this one was built from.
--- a/src/share/classes/com/sun/corba/se/impl/orbutil/RepIdDelegator_1_3.java Wed Jan 09 09:55:11 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,177 +0,0 @@ -/* - * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.corba.se.impl.orbutil; - -import org.omg.CORBA.ORB; -import java.io.Serializable; -import java.util.Hashtable; -import java.net.MalformedURLException; -import com.sun.corba.se.impl.io.TypeMismatchException; -import com.sun.corba.se.impl.util.RepositoryId; - -/** - * Delegates to the RepositoryId_1_3 implementation in - * com.sun.corba.se.impl.orbutil. This is necessary to - * overcome the fact that many of RepositoryId's methods - * are static. - */ -public final class RepIdDelegator_1_3 - implements RepositoryIdStrings, - RepositoryIdUtility, - RepositoryIdInterface -{ - // RepositoryIdFactory methods - - public String createForAnyType(Class type) { - return RepositoryId_1_3.createForAnyType(type); - } - - public String createForJavaType(Serializable ser) - throws TypeMismatchException - { - return RepositoryId_1_3.createForJavaType(ser); - } - - public String createForJavaType(Class clz) - throws TypeMismatchException - { - return RepositoryId_1_3.createForJavaType(clz); - } - - public String createSequenceRepID(java.lang.Object ser) { - return RepositoryId_1_3.createSequenceRepID(ser); - } - - public String createSequenceRepID(Class clazz) { - return RepositoryId_1_3.createSequenceRepID(clazz); - } - - public RepositoryIdInterface getFromString(String repIdString) { - return new RepIdDelegator_1_3(RepositoryId_1_3.cache.getId(repIdString)); - } - - // RepositoryIdUtility methods - - public boolean isChunkedEncoding(int valueTag) { - return RepositoryId.isChunkedEncoding(valueTag); - } - - public boolean isCodeBasePresent(int valueTag) { - return RepositoryId.isCodeBasePresent(valueTag); - } - - public String getClassDescValueRepId() { - return RepositoryId_1_3.kClassDescValueRepID; - } - - public String getWStringValueRepId() { - return RepositoryId_1_3.kWStringValueRepID; - } - - public int getTypeInfo(int valueTag) { - return RepositoryId.getTypeInfo(valueTag); - } - - public int getStandardRMIChunkedNoRepStrId() { - return RepositoryId.kPreComputed_StandardRMIChunked_NoRep; - } - - public int getCodeBaseRMIChunkedNoRepStrId() { - return RepositoryId.kPreComputed_CodeBaseRMIChunked_NoRep; - } - - public int getStandardRMIChunkedId() { - return RepositoryId.kPreComputed_StandardRMIChunked; - } - - public int getCodeBaseRMIChunkedId() { - return RepositoryId.kPreComputed_CodeBaseRMIChunked; - } - - public int getStandardRMIUnchunkedId() { - return RepositoryId.kPreComputed_StandardRMIUnchunked; - } - - public int getCodeBaseRMIUnchunkedId() { - return RepositoryId.kPreComputed_CodeBaseRMIUnchunked; - } - - public int getStandardRMIUnchunkedNoRepStrId() { - return RepositoryId.kPreComputed_StandardRMIUnchunked_NoRep; - } - - public int getCodeBaseRMIUnchunkedNoRepStrId() { - return RepositoryId.kPreComputed_CodeBaseRMIUnchunked_NoRep; - } - - // RepositoryIdInterface methods - - public Class getClassFromType() throws ClassNotFoundException { - return delegate.getClassFromType(); - } - - public Class getClassFromType(String codebaseURL) - throws ClassNotFoundException, MalformedURLException - { - return delegate.getClassFromType(codebaseURL); - } - - public Class getClassFromType(Class expectedType, - String codebaseURL) - throws ClassNotFoundException, MalformedURLException - { - return delegate.getClassFromType(expectedType, codebaseURL); - } - - public String getClassName() { - return delegate.getClassName(); - } - - // Constructor used for factory/utility cases - public RepIdDelegator_1_3() {} - - // Constructor used by getIdFromString. All non-static - // RepositoryId methods will use the provided delegate. - private RepIdDelegator_1_3(RepositoryId_1_3 _delegate) { - this.delegate = _delegate; - } - - private RepositoryId_1_3 delegate = null; - - public String toString() { - if (delegate != null) - return delegate.toString(); - else - return this.getClass().getName(); - } - - public boolean equals(Object obj) { - if (delegate != null) - return delegate.equals(obj); - else - return super.equals(obj); - } -}
--- a/src/share/classes/com/sun/corba/se/impl/orbutil/RepIdDelegator_1_3_1.java Wed Jan 09 09:55:11 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,177 +0,0 @@ -/* - * Copyright (c) 2001, 2004, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.corba.se.impl.orbutil; - -import org.omg.CORBA.ORB; -import java.io.Serializable; -import java.util.Hashtable; -import java.net.MalformedURLException; -import com.sun.corba.se.impl.io.TypeMismatchException; -import com.sun.corba.se.impl.util.RepositoryId; - -/** - * Delegates to the RepositoryId_1_3_1 implementation in - * com.sun.corba.se.impl.orbutil. This is necessary to - * overcome the fact that many of RepositoryId's methods - * are static. - */ -public final class RepIdDelegator_1_3_1 - implements RepositoryIdStrings, - RepositoryIdUtility, - RepositoryIdInterface -{ - // RepositoryIdFactory methods - - public String createForAnyType(Class type) { - return RepositoryId_1_3_1.createForAnyType(type); - } - - public String createForJavaType(Serializable ser) - throws TypeMismatchException - { - return RepositoryId_1_3_1.createForJavaType(ser); - } - - public String createForJavaType(Class clz) - throws TypeMismatchException - { - return RepositoryId_1_3_1.createForJavaType(clz); - } - - public String createSequenceRepID(java.lang.Object ser) { - return RepositoryId_1_3_1.createSequenceRepID(ser); - } - - public String createSequenceRepID(Class clazz) { - return RepositoryId_1_3_1.createSequenceRepID(clazz); - } - - public RepositoryIdInterface getFromString(String repIdString) { - return new RepIdDelegator_1_3_1(RepositoryId_1_3_1.cache.getId(repIdString)); - } - - // RepositoryIdUtility methods - - public boolean isChunkedEncoding(int valueTag) { - return RepositoryId.isChunkedEncoding(valueTag); - } - - public boolean isCodeBasePresent(int valueTag) { - return RepositoryId.isCodeBasePresent(valueTag); - } - - public String getClassDescValueRepId() { - return RepositoryId_1_3_1.kClassDescValueRepID; - } - - public String getWStringValueRepId() { - return RepositoryId_1_3_1.kWStringValueRepID; - } - - public int getTypeInfo(int valueTag) { - return RepositoryId.getTypeInfo(valueTag); - } - - public int getStandardRMIChunkedNoRepStrId() { - return RepositoryId.kPreComputed_StandardRMIChunked_NoRep; - } - - public int getCodeBaseRMIChunkedNoRepStrId() { - return RepositoryId.kPreComputed_CodeBaseRMIChunked_NoRep; - } - - public int getStandardRMIChunkedId() { - return RepositoryId.kPreComputed_StandardRMIChunked; - } - - public int getCodeBaseRMIChunkedId() { - return RepositoryId.kPreComputed_CodeBaseRMIChunked; - } - - public int getStandardRMIUnchunkedId() { - return RepositoryId.kPreComputed_StandardRMIUnchunked; - } - - public int getCodeBaseRMIUnchunkedId() { - return RepositoryId.kPreComputed_CodeBaseRMIUnchunked; - } - - public int getStandardRMIUnchunkedNoRepStrId() { - return RepositoryId.kPreComputed_StandardRMIUnchunked_NoRep; - } - - public int getCodeBaseRMIUnchunkedNoRepStrId() { - return RepositoryId.kPreComputed_CodeBaseRMIUnchunked_NoRep; - } - - // RepositoryIdInterface methods - - public Class getClassFromType() throws ClassNotFoundException { - return delegate.getClassFromType(); - } - - public Class getClassFromType(String codebaseURL) - throws ClassNotFoundException, MalformedURLException - { - return delegate.getClassFromType(codebaseURL); - } - - public Class getClassFromType(Class expectedType, - String codebaseURL) - throws ClassNotFoundException, MalformedURLException - { - return delegate.getClassFromType(expectedType, codebaseURL); - } - - public String getClassName() { - return delegate.getClassName(); - } - - // Constructor used for factory/utility cases - public RepIdDelegator_1_3_1() {} - - // Constructor used by getIdFromString. All non-static - // RepositoryId methods will use the provided delegate. - private RepIdDelegator_1_3_1(RepositoryId_1_3_1 _delegate) { - this.delegate = _delegate; - } - - private RepositoryId_1_3_1 delegate = null; - - public String toString() { - if (delegate != null) - return delegate.toString(); - else - return this.getClass().getName(); - } - - public boolean equals(Object obj) { - if (delegate != null) - return delegate.equals(obj); - else - return super.equals(obj); - } -}
--- a/src/share/classes/com/sun/corba/se/impl/orbutil/RepositoryIdCache_1_3.java Wed Jan 09 09:55:11 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,108 +0,0 @@ -/* - * Copyright (c) 2000, 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package com.sun.corba.se.impl.orbutil; - -import java.util.Stack; -import java.util.Hashtable; -import java.util.EmptyStackException; -import java.util.Enumeration; - -// Really limited pool - in this case just creating several at a time... -class RepositoryIdPool_1_3 extends Stack { - - private static int MAX_CACHE_SIZE = 4; - private RepositoryIdCache_1_3 cache; - - public final synchronized RepositoryId_1_3 popId() { - - try { - return (RepositoryId_1_3)super.pop(); - } - catch(EmptyStackException e) { - increasePool(5); - return (RepositoryId_1_3)super.pop(); - } - - } - - // Pool management - final void increasePool(int size) { - //if (cache.size() <= MAX_CACHE_SIZE) - for (int i = size; i > 0; i--) - push(new RepositoryId_1_3()); - /* - // _REVISIT_ This will not work w/out either thread tracing or weak references. I am - // betting that thread tracing almost completely negates benefit of reuse. Until either - // 1.2 only inclusion or proof to the contrary, I'll leave it this way... - else { - int numToReclaim = cache.size() / 2; - Enumeration keys = cache.keys(); - Enumeration elements = cache.elements(); - for (int i = numToReclaim; i > 0; i--) { - Object key = keys.nextElement(); - Object element = elements.nextElement(); - - push(element); - cache.remove(key); - } - } - */ - } - - final void setCaches(RepositoryIdCache_1_3 cache) { - this.cache = cache; - } - -} - -public class RepositoryIdCache_1_3 extends Hashtable { - - private RepositoryIdPool_1_3 pool = new RepositoryIdPool_1_3(); - - public RepositoryIdCache_1_3() { - pool.setCaches(this); - } - - public final synchronized RepositoryId_1_3 getId(String key) { - RepositoryId_1_3 repId = (RepositoryId_1_3)super.get(key); - - if (repId != null) - return repId; - else { - //repId = pool.popId().init(key); - repId = new RepositoryId_1_3(key); - put(key, repId); - return repId; - } - - } -}
--- a/src/share/classes/com/sun/corba/se/impl/orbutil/RepositoryIdCache_1_3_1.java Wed Jan 09 09:55:11 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.corba.se.impl.orbutil; - -import java.util.Stack; -import java.util.Hashtable; -import java.util.EmptyStackException; -import java.util.Enumeration; - -// Really limited pool - in this case just creating several at a time... -class RepositoryIdPool_1_3_1 extends Stack { - - private static int MAX_CACHE_SIZE = 4; - private RepositoryIdCache_1_3_1 cache; - - public final synchronized RepositoryId_1_3_1 popId() { - - try { - return (RepositoryId_1_3_1)super.pop(); - } - catch(EmptyStackException e) { - increasePool(5); - return (RepositoryId_1_3_1)super.pop(); - } - - } - - // Pool management - final void increasePool(int size) { - //if (cache.size() <= MAX_CACHE_SIZE) - for (int i = size; i > 0; i--) - push(new RepositoryId_1_3_1()); - /* - // _REVISIT_ This will not work w/out either thread tracing or weak references. I am - // betting that thread tracing almost completely negates benefit of reuse. Until either - // 1.2 only inclusion or proof to the contrary, I'll leave it this way... - else { - int numToReclaim = cache.size() / 2; - Enumeration keys = cache.keys(); - Enumeration elements = cache.elements(); - for (int i = numToReclaim; i > 0; i--) { - Object key = keys.nextElement(); - Object element = elements.nextElement(); - - push(element); - cache.remove(key); - } - } - */ - } - - final void setCaches(RepositoryIdCache_1_3_1 cache) { - this.cache = cache; - } - -} - -public class RepositoryIdCache_1_3_1 extends Hashtable { - - private RepositoryIdPool_1_3_1 pool = new RepositoryIdPool_1_3_1(); - - public RepositoryIdCache_1_3_1() { - pool.setCaches(this); - } - - public final synchronized RepositoryId_1_3_1 getId(String key) { - RepositoryId_1_3_1 repId = (RepositoryId_1_3_1)super.get(key); - - if (repId != null) - return repId; - else { - //repId = pool.popId().init(key); - repId = new RepositoryId_1_3_1(key); - put(key, repId); - return repId; - } - - } -}
--- a/src/share/classes/com/sun/corba/se/impl/orbutil/RepositoryIdFactory.java Wed Jan 09 09:55:11 2013 +0000 +++ b/src/share/classes/com/sun/corba/se/impl/orbutil/RepositoryIdFactory.java Mon Mar 11 17:35:38 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,12 +30,6 @@ public abstract class RepositoryIdFactory { - private static final RepIdDelegator_1_3 legacyDelegator - = new RepIdDelegator_1_3(); - - private static final RepIdDelegator_1_3_1 ladybirdDelegator - = new RepIdDelegator_1_3_1(); - private static final RepIdDelegator currentDelegator = new RepIdDelegator(); @@ -48,29 +42,6 @@ } /** - * Checks the version of the ORB and returns the appropriate - * RepositoryIdStrings instance. - */ - public static RepositoryIdStrings getRepIdStringsFactory(ORB orb) - { - if (orb != null) { - switch (orb.getORBVersion().getORBType()) { - case ORBVersion.NEWER: - case ORBVersion.FOREIGN: - case ORBVersion.JDK1_3_1_01: - return currentDelegator; - case ORBVersion.OLD: - return legacyDelegator; - case ORBVersion.NEW: - return ladybirdDelegator; - default: - return currentDelegator; - } - } else - return currentDelegator; - } - - /** * Returns the latest version RepositoryIdUtility instance */ public static RepositoryIdUtility getRepIdUtility() @@ -78,26 +49,4 @@ return currentDelegator; } - /** - * Checks the version of the ORB and returns the appropriate - * RepositoryIdUtility instance. - */ - public static RepositoryIdUtility getRepIdUtility(ORB orb) - { - if (orb != null) { - switch (orb.getORBVersion().getORBType()) { - case ORBVersion.NEWER: - case ORBVersion.FOREIGN: - case ORBVersion.JDK1_3_1_01: - return currentDelegator; - case ORBVersion.OLD: - return legacyDelegator; - case ORBVersion.NEW: - return ladybirdDelegator; - default: - return currentDelegator; - } - } else - return currentDelegator; - } }
--- a/src/share/classes/com/sun/corba/se/impl/orbutil/RepositoryId_1_3.java Wed Jan 09 09:55:11 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,990 +0,0 @@ -/* - * Copyright (c) 2000, 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package com.sun.corba.se.impl.orbutil; - -import java.util.StringTokenizer; -import java.util.Hashtable; -import java.io.IOException; -import java.lang.reflect.Method; - -// Imports for using codebase URL to load class -import java.net.MalformedURLException; -import org.omg.CORBA.portable.ValueBase; -import org.omg.CORBA.portable.IDLEntity; - -import com.sun.corba.se.impl.util.JDKBridge; -import com.sun.corba.se.impl.util.Utility; -import com.sun.corba.se.impl.util.PackagePrefixChecker; -import com.sun.corba.se.impl.util.IdentityHashtable; -import com.sun.corba.se.impl.io.ObjectStreamClass; - -import javax.rmi.CORBA.Util; - -// keeping the original RepositoryId class that was shipped in -// JDK 1.3. It has interoperability bugs - -public class RepositoryId_1_3 { - - // Legal IDL Identifier characters (1 = legal). Note - // that '.' (2E) is marked as legal even though it is - // not legal in IDL. This allows us to treat a fully - // qualified Java name with '.' package separators - // uniformly, and is safe because that is the only - // legal use of '.' in a Java name. - - public static final RepositoryIdCache_1_3 cache = new RepositoryIdCache_1_3(); - public static final byte[] IDL_IDENTIFIER_CHARS = { - - // 0 1 2 3 4 5 6 7 8 9 a b c d e f - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 00-0f - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 10-1f - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,1,0, // 20-2f - 1,1,1,1, 1,1,1,1, 1,1,0,0, 0,0,0,0, // 30-3f - 0,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // 40-4f - 1,1,1,1, 1,1,1,1, 1,1,1,0, 0,0,0,1, // 50-5f - 0,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // 60-6f - 1,1,1,1, 1,1,1,1, 1,1,1,0, 0,0,0,0, // 70-7f - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 80-8f - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 90-9f - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // a0-af - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // b0-bf - 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // c0-cf - 0,1,1,1, 1,1,1,0, 1,1,1,1, 1,0,0,1, // d0-df - 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // e0-ef - 0,1,1,1, 1,1,1,0, 1,1,1,1, 1,0,0,1, // f0-ff - }; - - private static String defaultServerURL = null; - private static boolean useCodebaseOnly = false; - - static { - if (defaultServerURL == null) - defaultServerURL = (String)JDKBridge.getLocalCodebase(); - useCodebaseOnly = JDKBridge.useCodebaseOnly(); - - } - - private static IdentityHashtable classToRepStr = new IdentityHashtable(); - private static IdentityHashtable classIDLToRepStr = new IdentityHashtable(); - private static IdentityHashtable classSeqToRepStr = new IdentityHashtable(); - - private static IdentityHashtable repStrToByteArray = new IdentityHashtable(); - private static Hashtable repStrToClass = new Hashtable(); - - private String repId = null; - private boolean isSupportedFormat = true; - private String typeString = null; - private String versionString = null; - private boolean isSequence = false; - private boolean isRMIValueType = false; - private boolean isIDLType = false; - private String completeClassName = null; - private String unqualifiedName = null; - private String definedInId = null; - private Class clazz = null; - private String suid = null, actualSuid = null; - private long suidLong = ObjectStreamClass.kDefaultUID, actualSuidLong = ObjectStreamClass.kDefaultUID; - - // Repository ID fragments - private static final String kValuePrefix = "RMI:"; - private static final String kIDLPrefix = "IDL:"; - private static final String kIDLNamePrefix = "omg.org/"; - private static final String kIDLClassnamePrefix = "org.omg."; - private static final String kSequencePrefix = "["; - private static final String kCORBAPrefix = "CORBA/"; - private static final String kArrayPrefix = kValuePrefix + kSequencePrefix + kCORBAPrefix; - private static final int kValuePrefixLength = kValuePrefix.length(); - private static final int kIDLPrefixLength = kIDLPrefix.length(); - private static final int kSequencePrefixLength = kSequencePrefix.length(); - private static final String kInterfaceHashCode = ":0000000000000000"; - private static final String kInterfaceOnlyHashStr = "0000000000000000"; - private static final String kExternalizableHashStr = "0000000000000001"; - - // Value tag utility methods and constants - public static final int kInitialValueTag= 0x7fffff00; - public static final int kNoTypeInfo = 0; - public static final int kSingleRepTypeInfo = 0x02; - public static final int kPartialListTypeInfo = 0x06; - public static final int kChunkedMask = 0x08; - - // Public, well known repository IDs - - // _REVISIT_ : A table structure with a good search routine for all of this - // would be more efficient and easier to maintain... - - // String - public static final String kWStringValueVersion = "1.0"; - public static final String kWStringValueHash = ":"+kWStringValueVersion; - public static final String kWStringStubValue = "WStringValue"; - public static final String kWStringTypeStr = "omg.org/CORBA/"+kWStringStubValue; - public static final String kWStringValueRepID = kIDLPrefix + kWStringTypeStr + kWStringValueHash; - - // Any - public static final String kAnyRepID = kIDLPrefix + "omg.org/CORBA/Any"; - - // Class - public static final String kClassDescValueHash = ":" + Long.toHexString( - ObjectStreamClass.getSerialVersionUID(javax.rmi.CORBA.ClassDesc.class)); - public static final String kClassDescStubValue = "ClassDesc"; - public static final String kClassDescTypeStr = "javax.rmi.CORBA."+kClassDescStubValue; - public static final String kClassDescValueRepID = kValuePrefix + kClassDescTypeStr + kClassDescValueHash; - - // Object - public static final String kObjectValueHash = ":1.0"; - public static final String kObjectStubValue = "Object"; - - // Sequence - public static final String kSequenceValueHash = ":1.0"; - public static final String kPrimitiveSequenceValueHash = ":0000000000000000"; - - // Serializable - public static final String kSerializableValueHash = ":1.0"; - public static final String kSerializableStubValue = "Serializable"; - - // Externalizable - public static final String kExternalizableValueHash = ":1.0"; - public static final String kExternalizableStubValue = "Externalizable"; - - // Remote (The empty string is used for java.rmi.Remote) - public static final String kRemoteValueHash = ""; - public static final String kRemoteStubValue = ""; - public static final String kRemoteTypeStr = ""; - public static final String kRemoteValueRepID = ""; - - public static final Hashtable kSpecialArrayTypeStrings = new Hashtable(); - - static { - kSpecialArrayTypeStrings.put("CORBA.WStringValue", new StringBuffer(java.lang.String.class.getName())); - kSpecialArrayTypeStrings.put("javax.rmi.CORBA.ClassDesc", new StringBuffer(java.lang.Class.class.getName())); - kSpecialArrayTypeStrings.put("CORBA.Object", new StringBuffer(java.rmi.Remote.class.getName())); - - } - - public static final Hashtable kSpecialCasesRepIDs = new Hashtable(); - - static { - kSpecialCasesRepIDs.put(java.lang.String.class, kWStringValueRepID); - kSpecialCasesRepIDs.put(java.lang.Class.class, kClassDescValueRepID); - kSpecialCasesRepIDs.put(java.rmi.Remote.class, kRemoteValueRepID); - } - - public static final Hashtable kSpecialCasesStubValues = new Hashtable(); - - static { - kSpecialCasesStubValues.put(java.lang.String.class, kWStringStubValue); - kSpecialCasesStubValues.put(java.lang.Class.class, kClassDescStubValue); - kSpecialCasesStubValues.put(java.lang.Object.class, kObjectStubValue); - kSpecialCasesStubValues.put(java.io.Serializable.class, kSerializableStubValue); - kSpecialCasesStubValues.put(java.io.Externalizable.class, kExternalizableStubValue); - kSpecialCasesStubValues.put(java.rmi.Remote.class, kRemoteStubValue); - } - - - public static final Hashtable kSpecialCasesVersions = new Hashtable(); - - static { - kSpecialCasesVersions.put(java.lang.String.class, kWStringValueHash); - kSpecialCasesVersions.put(java.lang.Class.class, kClassDescValueHash); - kSpecialCasesVersions.put(java.lang.Object.class, kObjectValueHash); - kSpecialCasesVersions.put(java.io.Serializable.class, kSerializableValueHash); - kSpecialCasesVersions.put(java.io.Externalizable.class, kExternalizableValueHash); - kSpecialCasesVersions.put(java.rmi.Remote.class, kRemoteValueHash); - } - - public static final Hashtable kSpecialCasesClasses = new Hashtable(); - - static { - kSpecialCasesClasses.put(kWStringTypeStr, java.lang.String.class); - kSpecialCasesClasses.put(kClassDescTypeStr, java.lang.Class.class); - kSpecialCasesClasses.put(kRemoteTypeStr, java.rmi.Remote.class); - - kSpecialCasesClasses.put("org.omg.CORBA.WStringValue", java.lang.String.class); - kSpecialCasesClasses.put("javax.rmi.CORBA.ClassDesc", java.lang.Class.class); - //kSpecialCasesClasses.put(kRemoteTypeStr, java.rmi.Remote.class); - } - - public static final Hashtable kSpecialCasesArrayPrefix = new Hashtable(); - - static { - kSpecialCasesArrayPrefix.put(java.lang.String.class, kValuePrefix + kSequencePrefix + kCORBAPrefix); - kSpecialCasesArrayPrefix.put(java.lang.Class.class, kValuePrefix + kSequencePrefix + "javax/rmi/CORBA/"); - kSpecialCasesArrayPrefix.put(java.lang.Object.class, kValuePrefix + kSequencePrefix + "java/lang/"); - kSpecialCasesArrayPrefix.put(java.io.Serializable.class, kValuePrefix + kSequencePrefix + "java/io/"); - kSpecialCasesArrayPrefix.put(java.io.Externalizable.class, kValuePrefix + kSequencePrefix + "java/io/"); - kSpecialCasesArrayPrefix.put(java.rmi.Remote.class, kValuePrefix + kSequencePrefix + kCORBAPrefix); - } - - public static final Hashtable kSpecialPrimitives = new Hashtable(); - - static { - kSpecialPrimitives.put("int","long"); - kSpecialPrimitives.put("long","longlong"); - kSpecialPrimitives.put("byte","octet"); - } - - /** - * Used to convert ascii to hex. - */ - private static final byte ASCII_HEX[] = { - (byte)'0', - (byte)'1', - (byte)'2', - (byte)'3', - (byte)'4', - (byte)'5', - (byte)'6', - (byte)'7', - (byte)'8', - (byte)'9', - (byte)'A', - (byte)'B', - (byte)'C', - (byte)'D', - (byte)'E', - (byte)'F', - }; - - - // Interface Rep ID Strings - public static final String kjava_rmi_Remote = createForAnyType(java.rmi.Remote.class); - public static final String korg_omg_CORBA_Object = createForAnyType(org.omg.CORBA.Object.class); - - // Dummy arguments for getIdFromHelper method - public static final Class kNoParamTypes[] ={}; - public static final Object kNoArgs[] = {}; - - - RepositoryId_1_3(){} - - RepositoryId_1_3(String aRepId){ - init(aRepId); - } - - RepositoryId_1_3 init(String aRepId){ - - this.repId = aRepId; - - // Special case for remote - if (aRepId.length() == 0) { - clazz = java.rmi.Remote.class; - typeString = ""; - isRMIValueType = true; - suid = kInterfaceOnlyHashStr; - return this; - } - else if (aRepId.equals(kWStringValueRepID)) { - clazz = java.lang.String.class; - typeString = kWStringTypeStr; - isIDLType = true; - versionString = kWStringValueVersion; - return this; - } - else { - - String repId = convertFromISOLatin1(aRepId); - - versionString = repId.substring(repId.indexOf(':', repId.indexOf(':')+1)); - if (repId.startsWith(kIDLPrefix)) { - typeString = - repId.substring(kIDLPrefixLength, repId.indexOf(':', kIDLPrefixLength)); - isIDLType = true; - if (typeString.startsWith(kIDLNamePrefix)) - completeClassName = kIDLClassnamePrefix + - typeString.substring(kIDLNamePrefix.length()).replace('/','.'); - else completeClassName = typeString.replace('/','.'); - - } - else if (repId.startsWith(kValuePrefix)) { - typeString = - repId.substring(kValuePrefixLength, repId.indexOf(':', kValuePrefixLength)); - isRMIValueType = true; - - if (versionString.indexOf('.') == -1) { - actualSuid = versionString.substring(1); - suid = actualSuid; // default if not explicitly specified - - if (actualSuid.indexOf(':') != -1){ - // we have a declared hash also - int pos = actualSuid.indexOf(':')+1; - // actualSuid = suid.substring(pos); - // suid = suid.substring(0, pos-1); - suid = actualSuid.substring(pos); - actualSuid = actualSuid.substring(0, pos-1); - } - - } - else { - // _REVISIT_ : Special case version failure ? - } - } - else isSupportedFormat = false; - - if (typeString.startsWith(kSequencePrefix)) { - isSequence = true; - } - - - return this; - } - } - - public final String getUnqualifiedName() { - if (unqualifiedName == null){ - String className = getClassName(); - int index = (className != null) ? className.lastIndexOf('.') : -1; - if (index == -1){ - unqualifiedName = className; - definedInId = "IDL::1.0"; - } - else { - unqualifiedName = className.substring(index); - definedInId = "IDL:" + className.substring(0, index).replace('.','/') + ":1.0"; - } - } - - return unqualifiedName; - } - - public final String getDefinedInId() { - if (definedInId == null){ - getUnqualifiedName(); - } - - return definedInId; - } - - public final String getTypeString() { - return typeString; - } - - public final String getVersionString() { - return versionString; - } - - public final String getSerialVersionUID() { - return suid; - } - - public final String getActualSerialVersionUID() { - return actualSuid; - } - public final long getSerialVersionUIDAsLong() { - return suidLong; - } - - public final long getActualSerialVersionUIDAsLong() { - return actualSuidLong; - } - - public final boolean isRMIValueType() { - return isRMIValueType; - } - - public final boolean isIDLType() { - return isIDLType; - } - - public final String getRepositoryId() { - return repId; - } - - public static byte[] getByteArray(String repStr) { - synchronized (repStrToByteArray){ - return (byte[]) repStrToByteArray.get(repStr); - } - } - - public static void setByteArray(String repStr, byte[] repStrBytes) { - synchronized (repStrToByteArray){ - repStrToByteArray.put(repStr, repStrBytes); - } - } - - public final boolean isSequence() { - return isSequence; - } - - public final boolean isSupportedFormat() { - return isSupportedFormat; - } - - - // This method will return the classname from the typestring OR if the classname turns out to be - // a special class "pseudo" name, then the matching real classname is returned. - public final String getClassName() { - - if (isRMIValueType) - return typeString; - else if (isIDLType) - return completeClassName; - else return null; - - } - - // This method calls getClazzFromType() and falls back to the repStrToClass - // cache if no class was found. It's used where any class matching the - // given repid is an acceptable result. - public final Class getAnyClassFromType() throws ClassNotFoundException { - try { - return getClassFromType(); - } catch (ClassNotFoundException cnfe) { - Class clz = (Class)repStrToClass.get(repId); - if (clz != null) - return clz; - else - throw cnfe; - } - } - - public final Class getClassFromType() - throws ClassNotFoundException { - if (clazz != null) - return clazz; - - Class specialCase = (Class)kSpecialCasesClasses.get(getClassName()); - - if (specialCase != null){ - clazz = specialCase; - return specialCase; - } - else - { - try{ - return Util.loadClass(getClassName(), null, null); - } - catch(ClassNotFoundException cnfe){ - if (defaultServerURL != null) { - try{ - return getClassFromType(defaultServerURL); - } - catch(MalformedURLException mue){ - throw cnfe; - } - } - else throw cnfe; - } - } - - } - - public final Class getClassFromType(Class expectedType, String codebase) - throws ClassNotFoundException { - if (clazz != null) - return clazz; - - Class specialCase = (Class)kSpecialCasesClasses.get(getClassName()); - - if (specialCase != null){ - clazz = specialCase; - return specialCase; - } else { - ClassLoader expectedTypeClassLoader = (expectedType == null ? null : expectedType.getClassLoader()); - return loadClassOfType(getClassName(), - codebase, - expectedTypeClassLoader, - expectedType, - expectedTypeClassLoader); - } - - } - - public final Class getClassFromType(String url) - throws ClassNotFoundException, MalformedURLException { - return Util.loadClass(getClassName(), url, null); - } - - public final String toString() { - return repId; - } - - private static String createHashString(java.io.Serializable ser) { - - return createHashString(ser.getClass()); - } - - private static String createHashString(java.lang.Class clazz) { - - if (clazz.isInterface() || !java.io.Serializable.class.isAssignableFrom(clazz)) - return kInterfaceHashCode; - - - long actualLong = ObjectStreamClassUtil_1_3.computeStructuralUID(false, clazz); - String hash = null; - if (actualLong == 0) - hash = kInterfaceOnlyHashStr; - else if (actualLong == 1) - hash = kExternalizableHashStr; - else - hash = Long.toHexString(actualLong).toUpperCase(); - while(hash.length() < 16){ - hash = "0" + hash; - } - - long declaredLong = ObjectStreamClassUtil_1_3.computeSerialVersionUID(clazz); - String declared = null; - if (declaredLong == 0) - declared = kInterfaceOnlyHashStr; - else if (declaredLong == 1) - declared = kExternalizableHashStr; - else - declared = Long.toHexString(declaredLong).toUpperCase(); - while (declared.length() < 16){ - declared = "0" + declared; - } - hash = hash + ":" + declared; - - return ":" + hash; - } - - /** - * Creates a repository ID for a sequence. This is for expert users only as - * this method assumes the object passed is an array. If passed an object - * that is not an array, it will produce a rep id for a sequence of zero - * length. This would be an error. - * @param ser The Java object to create a repository ID for - **/ - public static String createSequenceRepID(java.lang.Object ser){ - return createSequenceRepID(ser.getClass()); - } - - /** - * Creates a repository ID for a sequence. This is for expert users only as - * this method assumes the object passed is an array. If passed an object - * that is not an array, it will produce a malformed rep id. - * @param clazz The Java class to create a repository ID for - **/ - public static String createSequenceRepID(java.lang.Class clazz){ - synchronized (classSeqToRepStr){ - - String repid = (String)classSeqToRepStr.get(clazz); - if (repid != null) - return repid; - - Class originalClazz = clazz; - - Class type = null; - int numOfDims = 0; - - while ((type = clazz.getComponentType()) != null) { - numOfDims++; - clazz = type; - } - - if (clazz.isPrimitive()) - repid = kValuePrefix + originalClazz.getName() + kPrimitiveSequenceValueHash; - else { - StringBuffer buf = new StringBuffer(); - buf.append(kValuePrefix); - while(numOfDims-- > 0) { - buf.append("["); - } - buf.append("L"); - buf.append(convertToISOLatin1(clazz.getName())); - buf.append(";"); - buf.append(createHashString(clazz)); - repid = buf.toString(); - } - classSeqToRepStr.put(originalClazz,repid); - return repid; - } - - } - - - public static String createForSpecialCase(java.lang.Class clazz){ - if (clazz.isArray()){ - return createSequenceRepID(clazz); - } - else { - return (String)kSpecialCasesRepIDs.get(clazz); - } - } - - public static String createForSpecialCase(java.io.Serializable ser){ - Class clazz = ser.getClass(); - if (clazz.isArray()){ - return createSequenceRepID(ser); - } - else - return createForSpecialCase(clazz); - } - - /** - * Creates a repository ID for a normal Java Type. - * @param ser The Java object to create a repository ID for - * @exception com.sun.corba.se.impl.io.TypeMismatchException if ser implements the - * org.omg.CORBA.portable.IDLEntity interface which indicates it is an IDL Value type. - **/ - public static String createForJavaType(java.io.Serializable ser) - throws com.sun.corba.se.impl.io.TypeMismatchException - { - synchronized (classToRepStr) { - String repid = createForSpecialCase(ser); - if (repid != null) - return repid; - Class clazz = ser.getClass(); - repid = (String)classToRepStr.get(clazz); - - if (repid != null) - return repid; - - repid = kValuePrefix + convertToISOLatin1(clazz.getName()) + - createHashString(clazz); - - classToRepStr.put(clazz, repid); - repStrToClass.put(repid, clazz); - return repid; - } - } - - /** - * Creates a repository ID for a normal Java Type. - * @param clz The Java class to create a repository ID for - * @exception com.sun.corba.se.impl.io.TypeMismatchException if ser implements the - * org.omg.CORBA.portable.IDLEntity interface which indicates it is an IDL Value type. - **/ - public static String createForJavaType(Class clz) - throws com.sun.corba.se.impl.io.TypeMismatchException - { - synchronized (classToRepStr){ - String repid = createForSpecialCase(clz); - if (repid != null) - return repid; - - repid = (String)classToRepStr.get(clz); - if (repid != null) - return repid; - - repid = kValuePrefix + convertToISOLatin1(clz.getName()) + - createHashString(clz); - - classToRepStr.put(clz, repid); - repStrToClass.put(repid, clz); - return repid; - } - } - - /** - * Creates a repository ID for an IDL Java Type. - * @param ser The IDL Value object to create a repository ID for - * @param major The major version number - * @param minor The minor version number - * @exception com.sun.corba.se.impl.io.TypeMismatchException if ser does not implement the - * org.omg.CORBA.portable.IDLEntity interface which indicates it is an IDL Value type. - **/ - public static String createForIDLType(Class ser, int major, int minor) - throws com.sun.corba.se.impl.io.TypeMismatchException - { - synchronized (classIDLToRepStr){ - String repid = (String)classIDLToRepStr.get(ser); - if (repid != null) - return repid; - - repid = kIDLPrefix + convertToISOLatin1(ser.getName()).replace('.','/') + - ":" + major + "." + minor; - classIDLToRepStr.put(ser, repid); - return repid; - } - } - - private static String getIdFromHelper(Class clazz){ - try { - Class helperClazz = Utility.loadClassForClass(clazz.getName()+"Helper", null, - clazz.getClassLoader(), clazz, clazz.getClassLoader()); - Method idMethod = helperClazz.getDeclaredMethod("id", kNoParamTypes); - return (String)idMethod.invoke(null, kNoArgs); - } - catch(java.lang.ClassNotFoundException cnfe) - { - throw new org.omg.CORBA.MARSHAL(cnfe.toString()); - } - catch(java.lang.NoSuchMethodException nsme) - { - throw new org.omg.CORBA.MARSHAL(nsme.toString()); - } - catch(java.lang.reflect.InvocationTargetException ite) - { - throw new org.omg.CORBA.MARSHAL(ite.toString()); - } - catch(java.lang.IllegalAccessException iae) - { - throw new org.omg.CORBA.MARSHAL(iae.toString()); - } - } - - /** - * Createa a repository ID for the type if it is either a java type - * or an IDL type. - * @param type The type to create rep. id for - * @return The rep. id. - **/ - public static String createForAnyType(Class type) { - try{ - if (type.isArray()) - return createSequenceRepID(type); - else if (IDLEntity.class.isAssignableFrom(type)) - { - try{ - return getIdFromHelper(type); - } - catch(Throwable t) { - return createForIDLType(type, 1, 0); - } - } - else return createForJavaType(type); - } - catch(com.sun.corba.se.impl.io.TypeMismatchException e){ - return null; - } - - } - - public static boolean isAbstractBase(Class clazz) { - return (clazz.isInterface() && - IDLEntity.class.isAssignableFrom(clazz) && - (!ValueBase.class.isAssignableFrom(clazz)) && - (!org.omg.CORBA.Object.class.isAssignableFrom(clazz))); - - } - - /** - * Convert strings with illegal IDL identifier characters. - * <p> - * Section 5.5.7 of OBV spec. - */ - private static String convertToISOLatin1 (String name) { - - int length = name.length(); - if (length == 0) { - return name; - } - StringBuffer buffer = null; - - for (int i = 0; i < length; i++) { - - char c = name.charAt(i); - - if (c > 255 || IDL_IDENTIFIER_CHARS[c] == 0) { - - // We gotta convert. Have we already started? - - if (buffer == null) { - - // No, so get set up... - - buffer = new StringBuffer(name.substring(0,i)); - } - - // Convert the character into the IDL escape syntax... - buffer.append( - "\\U" + - (char)ASCII_HEX[(c & 0xF000) >>> 12] + - (char)ASCII_HEX[(c & 0x0F00) >>> 8] + - (char)ASCII_HEX[(c & 0x00F0) >>> 4] + - (char)ASCII_HEX[(c & 0x000F)]); - - } else { - if (buffer != null) { - buffer.append(c); - } - } - } - - if (buffer != null) { - name = buffer.toString(); - } - - return name; - } - - /** - * Convert strings with ISO Latin 1 escape sequences back to original strings. - * <p> - * Section 5.5.7 of OBV spec. - */ - private static String convertFromISOLatin1 (String name) { - - int index = -1; - StringBuffer buf = new StringBuffer(name); - - while ((index = buf.toString().indexOf("\\U")) != -1){ - String str = "0000" + buf.toString().substring(index+2, index+6); - - // Convert Hexadecimal - byte[] buffer = new byte[(str.length() - 4) / 2]; - for (int i=4, j=0; i < str.length(); i +=2, j++) { - buffer[j] = (byte)((ORBUtility.hexOf(str.charAt(i)) << 4) & 0xF0); - buffer[j] |= (byte)((ORBUtility.hexOf(str.charAt(i+1)) << 0) & 0x0F); - } - buf = new StringBuffer(delete(buf.toString(), index, index+6)); - buf.insert(index, (char)buffer[1]); - } - - return buf.toString(); - - - } - - private static String delete(String str, int from, int to) - { - return str.substring(0, from) + str.substring(to, str.length()); - } - - private static String replace(String target, String arg, String source) - { - int i = 0; - i = target.indexOf(arg); - - while(i != -1) - { - String left = target.substring(0, i); - String right = target.substring(i+arg.length()); - target = new String(left+source+right); - i = target.indexOf(arg); - } - return target; - } - - /* - * Load a class and check that it is assignable to a given type. - * @param className the class name. - * @param remoteCodebase the codebase to use. May be null. - * @param loader the class loader of last resort. May be null. - * @param expectedType the expected type. May be null. - * @return the loaded class. - */ - private Class loadClassOfType (String className, - String remoteCodebase, - ClassLoader loader, - Class expectedType, - ClassLoader expectedTypeClassLoader) - throws ClassNotFoundException { - - Class loadedClass = null; - - try { - //Sequence finding of the stubs according to spec - try{ - //If-else is put here for speed up of J2EE. - //According to the OMG spec, the if clause is not dead code. - //It can occur if some compiler has allowed generation - //into org.omg.stub hierarchy for non-offending - //classes. This will encourage people to - //produce non-offending class stubs in their own hierarchy. - if(!PackagePrefixChecker - .hasOffendingPrefix(PackagePrefixChecker - .withoutPackagePrefix(className))){ - loadedClass = Util.loadClass - (PackagePrefixChecker.withoutPackagePrefix(className), - remoteCodebase, - loader); - } else { - loadedClass = Util.loadClass - (className, - remoteCodebase, - loader); - } - } catch (ClassNotFoundException cnfe) { - loadedClass = Util.loadClass - (className, - remoteCodebase, - loader); - } - if (expectedType == null) - return loadedClass; - } catch (ClassNotFoundException cnfe) { - if (expectedType == null) - throw cnfe; - } - - // If no class was not loaded, or if the loaded class is not of the - // correct type, make a further attempt to load the correct class - // using the classloader of the expected type. - // _REVISIT_ Is this step necessary, or should the Util,loadClass - // algorithm always produce a valid class if the setup is correct? - // Does the OMG standard algorithm need to be changed to include - // this step? - if (loadedClass == null || !expectedType.isAssignableFrom(loadedClass)) { - if (expectedType.getClassLoader() != expectedTypeClassLoader) - throw new IllegalArgumentException("expectedTypeClassLoader not class loader of expectedType."); - - if (expectedTypeClassLoader != null) - loadedClass = expectedTypeClassLoader.loadClass(className); - else - loadedClass = ORBClassLoader.loadClass(className); - } - - return loadedClass; - } - - /** - * Checks to see if the FullValueDescription should be retrieved. - * @exception Throws IOException if suids do not match or if the repositoryID - * is not an RMIValueType - */ - public static boolean useFullValueDescription(Class clazz, String repositoryID) - throws IOException{ - - String clazzRepIDStr = createForAnyType(clazz); - - if (clazzRepIDStr.equals(repositoryID)) - return false; - - RepositoryId_1_3 targetRepid; - RepositoryId_1_3 clazzRepid; - - synchronized(cache) { - // to avoid race condition where multiple threads could be - // accessing this method, and their access to the cache may - // be interleaved giving unexpected results - - targetRepid = cache.getId(repositoryID); - clazzRepid = cache.getId(clazzRepIDStr); - } - - if ((targetRepid.isRMIValueType()) && (clazzRepid.isRMIValueType())){ - if (!targetRepid.getSerialVersionUID().equals(clazzRepid.getSerialVersionUID())) { - - String mssg = "Mismatched serialization UIDs : Source (Rep. ID" + - clazzRepid + ") = " + - clazzRepid.getSerialVersionUID() + " whereas Target (Rep. ID " + repositoryID + - ") = " + targetRepid.getSerialVersionUID(); - throw new IOException(mssg); - } else { - return true; - } - } else { - - throw new IOException("The repository ID is not of an RMI value type (Expected ID = " + clazzRepIDStr + "; Received ID = " + repositoryID +")"); - } - } -}
--- a/src/share/classes/com/sun/corba/se/impl/orbutil/RepositoryId_1_3_1.java Wed Jan 09 09:55:11 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1065 +0,0 @@ -/* - * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - */ -package com.sun.corba.se.impl.orbutil; - -import java.util.StringTokenizer; -import java.util.Hashtable; -import java.io.IOException; -import java.lang.reflect.Method; -import java.net.MalformedURLException; -import org.omg.CORBA.portable.ValueBase; -import org.omg.CORBA.portable.IDLEntity; - -//d11638 files in the same package, therefore remove their reference -//import com.sun.corba.se.impl.util.JDKBridge; -//import com.sun.corba.se.impl.util.IdentityHashtable; -import com.sun.corba.se.impl.util.JDKBridge; -import com.sun.corba.se.impl.util.Utility; -import com.sun.corba.se.impl.util.PackagePrefixChecker; -import com.sun.corba.se.impl.util.IdentityHashtable; - -import javax.rmi.CORBA.Util; - -/** - * Because all methods in RepositoryId are static, we have - * to duplicate all of this code, freezing it in its 1.3.1 - * form for backwards compatibility. - * - * For security reasons, we can't expose enough of - * io/ObjectStreamClass, so it has to be duplicated in - * orbutil. - */ -public class RepositoryId_1_3_1 { - - // Legal IDL Identifier characters (1 = legal). Note - // that '.' (2E) is marked as legal even though it is - // not legal in IDL. This allows us to treat a fully - // qualified Java name with '.' package separators - // uniformly, and is safe because that is the only - // legal use of '.' in a Java name. - - public static final byte[] IDL_IDENTIFIER_CHARS = { - - // 0 1 2 3 4 5 6 7 8 9 a b c d e f - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 00-0f - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 10-1f - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,1,0, // 20-2f - 1,1,1,1, 1,1,1,1, 1,1,0,0, 0,0,0,0, // 30-3f - 0,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // 40-4f - 1,1,1,1, 1,1,1,1, 1,1,1,0, 0,0,0,1, // 50-5f - 0,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // 60-6f - 1,1,1,1, 1,1,1,1, 1,1,1,0, 0,0,0,0, // 70-7f - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 80-8f - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 90-9f - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // a0-af - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // b0-bf - 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // c0-cf - 0,1,1,1, 1,1,1,0, 1,1,1,1, 1,0,0,1, // d0-df - 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // e0-ef - 0,1,1,1, 1,1,1,0, 1,1,1,1, 1,0,0,1, // f0-ff - }; - - - private static final long serialVersionUID = 123456789L; - - private static String defaultServerURL = null; - private static boolean useCodebaseOnly = false; - - static { - if (defaultServerURL == null) - defaultServerURL = (String)JDKBridge.getLocalCodebase(); - useCodebaseOnly = JDKBridge.useCodebaseOnly(); - - } - - private static IdentityHashtable classToRepStr = new IdentityHashtable(); - private static IdentityHashtable classIDLToRepStr = new IdentityHashtable(); - private static IdentityHashtable classSeqToRepStr = new IdentityHashtable(); - - private static IdentityHashtable repStrToByteArray = new IdentityHashtable(); - private static Hashtable repStrToClass = new Hashtable(); - - private String repId = null; - private boolean isSupportedFormat = true; - private String typeString = null; - private String versionString = null; - private boolean isSequence = false; - private boolean isRMIValueType = false; - private boolean isIDLType = false; - private String completeClassName = null; - private String unqualifiedName = null; - private String definedInId = null; - private Class clazz = null; - private String suid = null, actualSuid = null; - private long suidLong = ObjectStreamClass_1_3_1.kDefaultUID, actualSuidLong = ObjectStreamClass_1_3_1.kDefaultUID; - - // Repository ID fragments - private static final String kSequenceKeyword = "seq"; - private static final String kValuePrefix = "RMI:"; - private static final String kIDLPrefix = "IDL:"; - private static final String kIDLNamePrefix = "omg.org/"; - private static final String kIDLClassnamePrefix = "org.omg."; - private static final String kSequencePrefix = "["; - private static final String kCORBAPrefix = "CORBA/"; - private static final String kArrayPrefix = kValuePrefix + kSequencePrefix + kCORBAPrefix; - private static final int kValuePrefixLength = kValuePrefix.length(); - private static final int kIDLPrefixLength = kIDLPrefix.length(); - private static final int kSequencePrefixLength = kSequencePrefix.length(); - private static final String kInterfaceHashCode = ":0000000000000000"; - private static final String kInterfaceOnlyHashStr = "0000000000000000"; - private static final String kExternalizableHashStr = "0000000000000001"; - - // Value tag utility methods and constants - public static final int kInitialValueTag= 0x7fffff00; - public static final int kNoTypeInfo = 0; - public static final int kSingleRepTypeInfo = 0x02; - public static final int kPartialListTypeInfo = 0x06; - public static final int kChunkedMask = 0x08; - public static final int kPreComputed_StandardRMIUnchunked = RepositoryId_1_3_1.computeValueTag(false, RepositoryId_1_3_1.kSingleRepTypeInfo, false); - public static final int kPreComputed_CodeBaseRMIUnchunked = RepositoryId_1_3_1.computeValueTag(true, RepositoryId_1_3_1.kSingleRepTypeInfo, false); - public static final int kPreComputed_StandardRMIChunked = RepositoryId_1_3_1.computeValueTag(false, RepositoryId_1_3_1.kSingleRepTypeInfo, true); - public static final int kPreComputed_CodeBaseRMIChunked = RepositoryId_1_3_1.computeValueTag(true, RepositoryId_1_3_1.kSingleRepTypeInfo, true); - - public static final int kPreComputed_StandardRMIUnchunked_NoRep = RepositoryId_1_3_1.computeValueTag(false, RepositoryId_1_3_1.kNoTypeInfo, false); - public static final int kPreComputed_CodeBaseRMIUnchunked_NoRep = RepositoryId_1_3_1.computeValueTag(true, RepositoryId_1_3_1.kNoTypeInfo, false); - public static final int kPreComputed_StandardRMIChunked_NoRep = RepositoryId_1_3_1.computeValueTag(false, RepositoryId_1_3_1.kNoTypeInfo, true); - public static final int kPreComputed_CodeBaseRMIChunked_NoRep = RepositoryId_1_3_1.computeValueTag(true, RepositoryId_1_3_1.kNoTypeInfo, true); - - // Public, well known repository IDs - - // _REVISIT_ : A table structure with a good search routine for all of this - // would be more efficient and easier to maintain... - - // String - public static final String kWStringValueVersion = "1.0"; - public static final String kWStringValueHash = ":"+kWStringValueVersion; - public static final String kWStringStubValue = "WStringValue"; - public static final String kWStringTypeStr = "omg.org/CORBA/"+kWStringStubValue; - public static final String kWStringValueRepID = kIDLPrefix + kWStringTypeStr + kWStringValueHash; - - // Any - public static final String kAnyRepID = kIDLPrefix + "omg.org/CORBA/Any"; - - // Class - // Anita4: convert to uppercase - public static final String kClassDescValueHash = ":" + - Long.toHexString( - ObjectStreamClass_1_3_1.getActualSerialVersionUID(javax.rmi.CORBA.ClassDesc.class)).toUpperCase() + ":" + - Long.toHexString( - ObjectStreamClass_1_3_1.getSerialVersionUID(javax.rmi.CORBA.ClassDesc.class)).toUpperCase(); - public static final String kClassDescStubValue = "ClassDesc"; - public static final String kClassDescTypeStr = "javax.rmi.CORBA."+kClassDescStubValue; - public static final String kClassDescValueRepID = kValuePrefix + kClassDescTypeStr + kClassDescValueHash; - - // Object - public static final String kObjectValueHash = ":1.0"; - public static final String kObjectStubValue = "Object"; - - // Sequence - public static final String kSequenceValueHash = ":1.0"; - public static final String kPrimitiveSequenceValueHash = ":0000000000000000"; - - // Serializable - public static final String kSerializableValueHash = ":1.0"; - public static final String kSerializableStubValue = "Serializable"; - - // Externalizable - public static final String kExternalizableValueHash = ":1.0"; - public static final String kExternalizableStubValue = "Externalizable"; - - // Remote (The empty string is used for java.rmi.Remote) - public static final String kRemoteValueHash = ""; - public static final String kRemoteStubValue = ""; - public static final String kRemoteTypeStr = ""; - public static final String kRemoteValueRepID = ""; - - public static final Hashtable kSpecialArrayTypeStrings = new Hashtable(); - - static { - kSpecialArrayTypeStrings.put("CORBA.WStringValue", new StringBuffer(java.lang.String.class.getName())); - kSpecialArrayTypeStrings.put("javax.rmi.CORBA.ClassDesc", new StringBuffer(java.lang.Class.class.getName())); - kSpecialArrayTypeStrings.put("CORBA.Object", new StringBuffer(java.rmi.Remote.class.getName())); - - } - - public static final Hashtable kSpecialCasesRepIDs = new Hashtable(); - - static { - kSpecialCasesRepIDs.put(java.lang.String.class, kWStringValueRepID); - kSpecialCasesRepIDs.put(java.lang.Class.class, kClassDescValueRepID); - kSpecialCasesRepIDs.put(java.rmi.Remote.class, kRemoteValueRepID); - } - - public static final Hashtable kSpecialCasesStubValues = new Hashtable(); - - static { - kSpecialCasesStubValues.put(java.lang.String.class, kWStringStubValue); - kSpecialCasesStubValues.put(java.lang.Class.class, kClassDescStubValue); - kSpecialCasesStubValues.put(java.lang.Object.class, kObjectStubValue); - kSpecialCasesStubValues.put(java.io.Serializable.class, kSerializableStubValue); - kSpecialCasesStubValues.put(java.io.Externalizable.class, kExternalizableStubValue); - kSpecialCasesStubValues.put(java.rmi.Remote.class, kRemoteStubValue); - } - - - public static final Hashtable kSpecialCasesVersions = new Hashtable(); - - static { - kSpecialCasesVersions.put(java.lang.String.class, kWStringValueHash); - kSpecialCasesVersions.put(java.lang.Class.class, kClassDescValueHash); - kSpecialCasesVersions.put(java.lang.Object.class, kObjectValueHash); - kSpecialCasesVersions.put(java.io.Serializable.class, kSerializableValueHash); - kSpecialCasesVersions.put(java.io.Externalizable.class, kExternalizableValueHash); - kSpecialCasesVersions.put(java.rmi.Remote.class, kRemoteValueHash); - } - - public static final Hashtable kSpecialCasesClasses = new Hashtable(); - - static { - kSpecialCasesClasses.put(kWStringTypeStr, java.lang.String.class); - kSpecialCasesClasses.put(kClassDescTypeStr, java.lang.Class.class); - kSpecialCasesClasses.put(kRemoteTypeStr, java.rmi.Remote.class); - - kSpecialCasesClasses.put("org.omg.CORBA.WStringValue", java.lang.String.class); - kSpecialCasesClasses.put("javax.rmi.CORBA.ClassDesc", java.lang.Class.class); - //kSpecialCasesClasses.put(kRemoteTypeStr, java.rmi.Remote.class); - } - - public static final Hashtable kSpecialCasesArrayPrefix = new Hashtable(); - - static { - kSpecialCasesArrayPrefix.put(java.lang.String.class, kValuePrefix + kSequencePrefix + kCORBAPrefix); - kSpecialCasesArrayPrefix.put(java.lang.Class.class, kValuePrefix + kSequencePrefix + "javax/rmi/CORBA/"); - kSpecialCasesArrayPrefix.put(java.lang.Object.class, kValuePrefix + kSequencePrefix + "java/lang/"); - kSpecialCasesArrayPrefix.put(java.io.Serializable.class, kValuePrefix + kSequencePrefix + "java/io/"); - kSpecialCasesArrayPrefix.put(java.io.Externalizable.class, kValuePrefix + kSequencePrefix + "java/io/"); - kSpecialCasesArrayPrefix.put(java.rmi.Remote.class, kValuePrefix + kSequencePrefix + kCORBAPrefix); - } - - public static final Hashtable kSpecialPrimitives = new Hashtable(); - - static { - kSpecialPrimitives.put("int","long"); - kSpecialPrimitives.put("long","longlong"); - kSpecialPrimitives.put("byte","octet"); - } - - /** - * Used to convert ascii to hex. - */ - private static final byte ASCII_HEX[] = { - (byte)'0', - (byte)'1', - (byte)'2', - (byte)'3', - (byte)'4', - (byte)'5', - (byte)'6', - (byte)'7', - (byte)'8', - (byte)'9', - (byte)'A', - (byte)'B', - (byte)'C', - (byte)'D', - (byte)'E', - (byte)'F', - }; - - - // bug fix for 4328952; to eliminate possibility of overriding this - // in a subclass. - public static final RepositoryIdCache_1_3_1 cache = new RepositoryIdCache_1_3_1(); - - // Interface Rep ID Strings - public static final String kjava_rmi_Remote = createForAnyType(java.rmi.Remote.class); - public static final String korg_omg_CORBA_Object = createForAnyType(org.omg.CORBA.Object.class); - - // Dummy arguments for getIdFromHelper method - public static final Class kNoParamTypes[] ={}; - public static final Object kNoArgs[] = {}; - - - // To create a RepositoryID, use code similar to the following: - // RepositoryId.cache.getId( id ); - - RepositoryId_1_3_1(){} - - RepositoryId_1_3_1(String aRepId){ - init(aRepId); - } - - RepositoryId_1_3_1 init(String aRepId){ - - this.repId = aRepId; - - // Special case for remote - if (aRepId.length() == 0) { - clazz = java.rmi.Remote.class; - typeString = ""; - isRMIValueType = true; - suid = kInterfaceOnlyHashStr; - return this; - } - else if (aRepId.equals(kWStringValueRepID)) { - clazz = java.lang.String.class; - typeString = kWStringTypeStr; - isIDLType = true; - // fix where Attempting to obtain a FullValueDescription - // for an RMI value type with a String field causes an exception. - completeClassName = "java.lang.String"; - versionString = kWStringValueVersion; - return this; - } - else { - - String repId = convertFromISOLatin1(aRepId); - - versionString = repId.substring(repId.indexOf(':', repId.indexOf(':')+1)); - if (repId.startsWith(kIDLPrefix)) { - typeString = - repId.substring(kIDLPrefixLength, repId.indexOf(':', kIDLPrefixLength)); - isIDLType = true; - if (typeString.startsWith(kIDLNamePrefix)) - completeClassName = kIDLClassnamePrefix + - typeString.substring(kIDLNamePrefix.length()).replace('/','.'); - else completeClassName = typeString.replace('/','.'); - - } - else if (repId.startsWith(kValuePrefix)) { - typeString = - repId.substring(kValuePrefixLength, repId.indexOf(':', kValuePrefixLength)); - isRMIValueType = true; - - if (versionString.indexOf('.') == -1) { - actualSuid = versionString.substring(1); - suid = actualSuid; // default if not explicitly specified - - if (actualSuid.indexOf(':') != -1){ - // we have a declared hash also - int pos = actualSuid.indexOf(':')+1; - // actualSuid = suid.substring(pos); - // suid = suid.substring(0, pos-1); - suid = actualSuid.substring(pos); - actualSuid = actualSuid.substring(0, pos-1); - } - - } - else { - // _REVISIT_ : Special case version failure ? - } - } - else isSupportedFormat = false; - - if (typeString.startsWith(kSequencePrefix)) { - isSequence = true; - } - - - return this; - } - } - - public final String getUnqualifiedName() { - if (unqualifiedName == null){ - String className = getClassName(); - int index = className.lastIndexOf('.'); - if (index == -1){ - unqualifiedName = className; - definedInId = "IDL::1.0"; - } - else { - unqualifiedName = className.substring(index); - definedInId = "IDL:" + className.substring(0, index).replace('.','/') + ":1.0"; - } - } - - return unqualifiedName; - } - - public final String getDefinedInId() { - if (definedInId == null){ - getUnqualifiedName(); - } - - return definedInId; - } - - public final String getTypeString() { - return typeString; - } - - public final String getVersionString() { - return versionString; - } - - public final String getSerialVersionUID() { - return suid; - } - - public final String getActualSerialVersionUID() { - return actualSuid; - } - public final long getSerialVersionUIDAsLong() { - return suidLong; - } - - public final long getActualSerialVersionUIDAsLong() { - return actualSuidLong; - } - - public final boolean isRMIValueType() { - return isRMIValueType; - } - - public final boolean isIDLType() { - return isIDLType; - } - - public final String getRepositoryId() { - return repId; - } - - public static byte[] getByteArray(String repStr) { - synchronized (repStrToByteArray){ - return (byte[]) repStrToByteArray.get(repStr); - } - } - - public static void setByteArray(String repStr, byte[] repStrBytes) { - synchronized (repStrToByteArray){ - repStrToByteArray.put(repStr, repStrBytes); - } - } - - public final boolean isSequence() { - return isSequence; - } - - public final boolean isSupportedFormat() { - return isSupportedFormat; - } - - - // This method will return the classname from the typestring OR if the classname turns out to be - // a special class "pseudo" name, then the matching real classname is returned. - public final String getClassName() { - - if (isRMIValueType) - return typeString; - else if (isIDLType) - return completeClassName; - else return null; - - } - - // This method calls getClazzFromType() and falls back to the repStrToClass - // cache if no class was found. It's used where any class matching the - // given repid is an acceptable result. - public final Class getAnyClassFromType() throws ClassNotFoundException { - try { - return getClassFromType(); - } catch (ClassNotFoundException cnfe) { - Class clz = (Class)repStrToClass.get(repId); - if (clz != null) - return clz; - else - throw cnfe; - } - } - - public final Class getClassFromType() - throws ClassNotFoundException { - if (clazz != null) - return clazz; - - Class specialCase = (Class)kSpecialCasesClasses.get(getClassName()); - - if (specialCase != null){ - clazz = specialCase; - return specialCase; - } - else - { - try{ - return Util.loadClass(getClassName(), null, null); - } - catch(ClassNotFoundException cnfe){ - if (defaultServerURL != null) { - try{ - return getClassFromType(defaultServerURL); - } - catch(MalformedURLException mue){ - throw cnfe; - } - } - else throw cnfe; - } - } - - } - - public final Class getClassFromType(Class expectedType, String codebase) - throws ClassNotFoundException { - if (clazz != null) - return clazz; - - Class specialCase = (Class)kSpecialCasesClasses.get(getClassName()); - - if (specialCase != null){ - clazz = specialCase; - return specialCase; - } else { - ClassLoader expectedTypeClassLoader = (expectedType == null ? null : expectedType.getClassLoader()); - return loadClassOfType(getClassName(), - codebase, - expectedTypeClassLoader, - expectedType, - expectedTypeClassLoader); - } - - } - - public final Class getClassFromType(String url) - throws ClassNotFoundException, MalformedURLException { - return Util.loadClass(getClassName(), url, null); - } - - public final String toString() { - return repId; - } - - /** - * Checks to see if the FullValueDescription should be retrieved. - * @exception Throws IOException if suids do not match or if the repositoryID - * is not an RMIValueType - */ - public static boolean useFullValueDescription(Class clazz, String repositoryID) - throws IOException{ - - String clazzRepIDStr = createForAnyType(clazz); - - if (clazzRepIDStr.equals(repositoryID)) - return false; - - RepositoryId_1_3_1 targetRepid; - RepositoryId_1_3_1 clazzRepid; - - synchronized(cache) { - // to avoid race condition where multiple threads could be - // accessing this method, and their access to the cache may - // be interleaved giving unexpected results - - targetRepid = cache.getId(repositoryID); - clazzRepid = cache.getId(clazzRepIDStr); - } - //ObjectStreamClass osc = ObjectStreamClass.lookup(clazz); - - if ((targetRepid.isRMIValueType()) && (clazzRepid.isRMIValueType())){ - if (!targetRepid.getSerialVersionUID().equals(clazzRepid.getSerialVersionUID())) { - - String mssg = "Mismatched serialization UIDs : Source (Rep. ID" + - clazzRepid + ") = " + - clazzRepid.getSerialVersionUID() + " whereas Target (Rep. ID " + repositoryID + - ") = " + targetRepid.getSerialVersionUID(); - //com.sun.corba.se.impl.io.ValueUtility.log("RepositoryId",mssg); - throw new IOException(mssg); - } - else { - return true; - } - } - else { - - throw new IOException("The repository ID is not of an RMI value type (Expected ID = " + clazzRepIDStr + "; Received ID = " + repositoryID +")"); - } - } - - private static String createHashString(java.io.Serializable ser) { - - return createHashString(ser.getClass()); - } - - private static String createHashString(java.lang.Class clazz) { - - if (clazz.isInterface() || !java.io.Serializable.class.isAssignableFrom(clazz)) - return kInterfaceHashCode; - - //ObjectStreamClass osc = ObjectStreamClass.lookup(clazz); - - long actualLong = ObjectStreamClass_1_3_1.getActualSerialVersionUID(clazz); - String hash = null; - if (actualLong == 0) - hash = kInterfaceOnlyHashStr; - else if (actualLong == 1) - hash = kExternalizableHashStr; - else - hash = Long.toHexString(actualLong).toUpperCase(); - while(hash.length() < 16){ - hash = "0" + hash; - } - - long declaredLong = ObjectStreamClass_1_3_1.getSerialVersionUID(clazz); - String declared = null; - if (declaredLong == 0) - declared = kInterfaceOnlyHashStr; - else if (declaredLong == 1) - declared = kExternalizableHashStr; - else - declared = Long.toHexString(declaredLong).toUpperCase(); - while (declared.length() < 16){ - declared = "0" + declared; - } - hash = hash + ":" + declared; - - return ":" + hash; - } - - /** - * Creates a repository ID for a sequence. This is for expert users only as - * this method assumes the object passed is an array. If passed an object - * that is not an array, it will produce a rep id for a sequence of zero - * length. This would be an error. - * @param ser The Java object to create a repository ID for - **/ - public static String createSequenceRepID(java.lang.Object ser){ - return createSequenceRepID(ser.getClass()); - } - - /** - * Creates a repository ID for a sequence. This is for expert users only as - * this method assumes the object passed is an array. If passed an object - * that is not an array, it will produce a malformed rep id. - * @param clazz The Java class to create a repository ID for - **/ - public static String createSequenceRepID(java.lang.Class clazz){ - synchronized (classSeqToRepStr){ - - String repid = (String)classSeqToRepStr.get(clazz); - if (repid != null) - return repid; - - Class originalClazz = clazz; - - Class type = null; - int numOfDims = 0; - - while ((type = clazz.getComponentType()) != null) { - numOfDims++; - clazz = type; - } - - if (clazz.isPrimitive()) - repid = kValuePrefix + originalClazz.getName() + kPrimitiveSequenceValueHash; - else { - StringBuffer buf = new StringBuffer(); - buf.append(kValuePrefix); - while(numOfDims-- > 0) { - buf.append("["); - } - buf.append("L"); - buf.append(convertToISOLatin1(clazz.getName())); - buf.append(";"); - buf.append(createHashString(clazz)); - repid = buf.toString(); - } - classSeqToRepStr.put(originalClazz,repid); - return repid; - } - - } - - - public static String createForSpecialCase(java.lang.Class clazz){ - if (clazz.isArray()){ - return createSequenceRepID(clazz); - } - else { - return (String)kSpecialCasesRepIDs.get(clazz); - } - } - - public static String createForSpecialCase(java.io.Serializable ser){ - Class clazz = ser.getClass(); - if (clazz.isArray()){ - return createSequenceRepID(ser); - } - else - return createForSpecialCase(clazz); - } - - /** - * Creates a repository ID for a normal Java Type. - * @param ser The Java object to create a repository ID for - * @exception com.sun.corba.se.impl.io.TypeMismatchException if ser implements the - * org.omg.CORBA.portable.IDLEntity interface which indicates it is an IDL Value type. - **/ - public static String createForJavaType(java.io.Serializable ser) - throws com.sun.corba.se.impl.io.TypeMismatchException - { - synchronized (classToRepStr) { - String repid = createForSpecialCase(ser); - if (repid != null) - return repid; - Class clazz = ser.getClass(); - repid = (String)classToRepStr.get(clazz); - - if (repid != null) - return repid; - - repid = kValuePrefix + convertToISOLatin1(clazz.getName()) + - createHashString(clazz); - - classToRepStr.put(clazz, repid); - repStrToClass.put(repid, clazz); - return repid; - } - } - - /** - * Creates a repository ID for a normal Java Type. - * @param clz The Java class to create a repository ID for - * @exception com.sun.corba.se.impl.io.TypeMismatchException if ser implements the - * org.omg.CORBA.portable.IDLEntity interface which indicates it is an IDL Value type. - **/ - public static String createForJavaType(Class clz) - throws com.sun.corba.se.impl.io.TypeMismatchException - { - synchronized (classToRepStr){ - String repid = createForSpecialCase(clz); - if (repid != null) - return repid; - - repid = (String)classToRepStr.get(clz); - if (repid != null) - return repid; - - repid = kValuePrefix + convertToISOLatin1(clz.getName()) + - createHashString(clz); - - classToRepStr.put(clz, repid); - repStrToClass.put(repid, clz); - return repid; - } - } - - /** - * Creates a repository ID for an IDL Java Type. - * @param ser The IDL Value object to create a repository ID for - * @param major The major version number - * @param minor The minor version number - * @exception com.sun.corba.se.impl.io.TypeMismatchException if ser does not implement the - * org.omg.CORBA.portable.IDLEntity interface which indicates it is an IDL Value type. - **/ - public static String createForIDLType(Class ser, int major, int minor) - throws com.sun.corba.se.impl.io.TypeMismatchException - { - synchronized (classIDLToRepStr){ - String repid = (String)classIDLToRepStr.get(ser); - if (repid != null) - return repid; - - repid = kIDLPrefix + convertToISOLatin1(ser.getName()).replace('.','/') + - ":" + major + "." + minor; - classIDLToRepStr.put(ser, repid); - return repid; - } - } - - private static String getIdFromHelper(Class clazz){ - try { - Class helperClazz = Utility.loadClassForClass(clazz.getName()+"Helper", null, - clazz.getClassLoader(), clazz, clazz.getClassLoader()); - Method idMethod = helperClazz.getDeclaredMethod("id", kNoParamTypes); - return (String)idMethod.invoke(null, kNoArgs); - } - catch(java.lang.ClassNotFoundException cnfe) - { - throw new org.omg.CORBA.MARSHAL(cnfe.toString()); - } - catch(java.lang.NoSuchMethodException nsme) - { - throw new org.omg.CORBA.MARSHAL(nsme.toString()); - } - catch(java.lang.reflect.InvocationTargetException ite) - { - throw new org.omg.CORBA.MARSHAL(ite.toString()); - } - catch(java.lang.IllegalAccessException iae) - { - throw new org.omg.CORBA.MARSHAL(iae.toString()); - } - } - - /** - * Createa a repository ID for the type if it is either a java type - * or an IDL type. - * @param type The type to create rep. id for - * @return The rep. id. - **/ - public static String createForAnyType(Class type) { - try{ - if (type.isArray()) - return createSequenceRepID(type); - else if (IDLEntity.class.isAssignableFrom(type)) - { - try{ - return getIdFromHelper(type); - } - catch(Throwable t) { - return createForIDLType(type, 1, 0); - } - } - else return createForJavaType(type); - } - catch(com.sun.corba.se.impl.io.TypeMismatchException e){ - return null; - } - - } - - public static boolean isAbstractBase(Class clazz) { - return (clazz.isInterface() && - IDLEntity.class.isAssignableFrom(clazz) && - (!ValueBase.class.isAssignableFrom(clazz)) && - (!org.omg.CORBA.Object.class.isAssignableFrom(clazz))); - - } - - public static boolean isAnyRequired(Class clazz) { - return ((clazz == java.lang.Object.class) || - (clazz == java.io.Serializable.class) || - (clazz == java.io.Externalizable.class)); - } - - public static long fromHex(String hexNumber) { - if (hexNumber.startsWith("0x")) - return Long.valueOf(hexNumber.substring(2), 16).longValue(); - else return Long.valueOf(hexNumber, 16).longValue(); - } - - /** - * Convert strings with illegal IDL identifier characters. - * <p> - * Section 5.5.7 of OBV spec. - */ - private static String convertToISOLatin1 (String name) { - - int length = name.length(); - if (length == 0) { - return name; - } - StringBuffer buffer = null; - - for (int i = 0; i < length; i++) { - - char c = name.charAt(i); - - if (c > 255 || IDL_IDENTIFIER_CHARS[c] == 0) { - - // We gotta convert. Have we already started? - - if (buffer == null) { - - // No, so get set up... - - buffer = new StringBuffer(name.substring(0,i)); - } - - // Convert the character into the IDL escape syntax... - buffer.append( - "\\U" + - (char)ASCII_HEX[(c & 0xF000) >>> 12] + - (char)ASCII_HEX[(c & 0x0F00) >>> 8] + - (char)ASCII_HEX[(c & 0x00F0) >>> 4] + - (char)ASCII_HEX[(c & 0x000F)]); - - } else { - if (buffer != null) { - buffer.append(c); - } - } - } - - if (buffer != null) { - name = buffer.toString(); - } - - return name; - } - - /** - * Convert strings with ISO Latin 1 escape sequences back to original strings. - * <p> - * Section 5.5.7 of OBV spec. - */ - private static String convertFromISOLatin1 (String name) { - - int index = -1; - StringBuffer buf = new StringBuffer(name); - - while ((index = buf.toString().indexOf("\\U")) != -1){ - String str = "0000" + buf.toString().substring(index+2, index+6); - - // Convert Hexadecimal - byte[] buffer = new byte[(str.length() - 4) / 2]; - for (int i=4, j=0; i < str.length(); i +=2, j++) { - buffer[j] = (byte)((ORBUtility.hexOf(str.charAt(i)) << 4) & 0xF0); - buffer[j] |= (byte)((ORBUtility.hexOf(str.charAt(i+1)) << 0) & 0x0F); - } - buf = new StringBuffer(delete(buf.toString(), index, index+6)); - buf.insert(index, (char)buffer[1]); - } - - return buf.toString(); - - - } - - private static String delete(String str, int from, int to) - { - return str.substring(0, from) + str.substring(to, str.length()); - } - - private static String replace(String target, String arg, String source) - { - int i = 0; - i = target.indexOf(arg); - - while(i != -1) - { - String left = target.substring(0, i); - String right = target.substring(i+arg.length()); - target = new String(left+source+right); - i = target.indexOf(arg); - } - return target; - } - - public static int computeValueTag(boolean codeBasePresent, int typeInfo, boolean chunkedEncoding){ - int value_tag = kInitialValueTag; - - if (codeBasePresent) - value_tag = value_tag | 0x00000001; - - value_tag = value_tag | typeInfo; - - if (chunkedEncoding) - value_tag = value_tag | kChunkedMask; - - return value_tag; - } - - public static boolean isCodeBasePresent(int value_tag){ - return ((value_tag & 0x00000001) == 1); - } - - public static int getTypeInfo(int value_tag){ - return (value_tag & 0x00000006); - } - - public static boolean isChunkedEncoding(int value_tag){ - return ((value_tag & kChunkedMask) != 0); - } - - public static String getServerURL(){ - return defaultServerURL; - } - - /* - * Load a class and check that it is assignable to a given type. - * @param className the class name. - * @param remoteCodebase the codebase to use. May be null. - * @param loader the class loader of last resort. May be null. - * @param expectedType the expected type. May be null. - * @return the loaded class. - */ - private Class loadClassOfType (String className, - String remoteCodebase, - ClassLoader loader, - Class expectedType, - ClassLoader expectedTypeClassLoader) - throws ClassNotFoundException { - - Class loadedClass = null; - - try { - //Sequence finding of the stubs according to spec - try{ - //If-else is put here for speed up of J2EE. - //According to the OMG spec, the if clause is not dead code. - //It can occur if some compiler has allowed generation - //into org.omg.stub hierarchy for non-offending - //classes. This will encourage people to - //produce non-offending class stubs in their own hierarchy. - if(!PackagePrefixChecker - .hasOffendingPrefix(PackagePrefixChecker - .withoutPackagePrefix(className))){ - loadedClass = Util.loadClass - (PackagePrefixChecker.withoutPackagePrefix(className), - remoteCodebase, - loader); - } else { - loadedClass = Util.loadClass - (className, - remoteCodebase, - loader); - } - } catch (ClassNotFoundException cnfe) { - loadedClass = Util.loadClass - (className, - remoteCodebase, - loader); - } - if (expectedType == null) - return loadedClass; - } catch (ClassNotFoundException cnfe) { - if (expectedType == null) - throw cnfe; - } - - // If no class was not loaded, or if the loaded class is not of the - // correct type, make a further attempt to load the correct class - // using the classloader of the expected type. - // _REVISIT_ Is this step necessary, or should the Util,loadClass - // algorithm always produce a valid class if the setup is correct? - // Does the OMG standard algorithm need to be changed to include - // this step? - if (loadedClass == null || !expectedType.isAssignableFrom(loadedClass)) { - if (expectedType.getClassLoader() != expectedTypeClassLoader) - throw new IllegalArgumentException("expectedTypeClassLoader not class loader of expectedType."); - - if (expectedTypeClassLoader != null) - loadedClass = expectedTypeClassLoader.loadClass(className); - else - loadedClass = Class.forName(className); - } - - return loadedClass; - } -}
--- a/src/share/classes/com/sun/corba/se/impl/orbutil/ValueHandlerImpl_1_3.java Wed Jan 09 09:55:11 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,251 +0,0 @@ -/* - * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package com.sun.corba.se.impl.orbutil; - -import javax.rmi.CORBA.Util; -import javax.rmi.PortableRemoteObject; - -import java.util.Hashtable; -import java.util.Stack; -import java.io.IOException; -import java.util.EmptyStackException; - -import com.sun.corba.se.impl.util.Utility; -import com.sun.corba.se.impl.io.IIOPInputStream; -import com.sun.corba.se.impl.io.IIOPOutputStream; -import com.sun.corba.se.impl.util.RepositoryId; -import com.sun.corba.se.impl.util.Utility; - -import org.omg.CORBA.TCKind; -import org.omg.CORBA.MARSHAL; -import org.omg.CORBA.CompletionStatus; -import org.omg.CORBA.portable.IndirectionException; -import com.sun.org.omg.SendingContext.CodeBase; - -import java.security.AccessController; -import java.security.PrivilegedAction; - -/** - * This class overrides behavior of our current ValueHandlerImpl to - * provide backwards compatibility with JDK 1.3.0. - */ -public class ValueHandlerImpl_1_3 extends com.sun.corba.se.impl.io.ValueHandlerImpl { - - public ValueHandlerImpl_1_3(){ - super(); - } - - public ValueHandlerImpl_1_3(boolean isInputStream) { - super(isInputStream); - } - - /** - * Writes the value to the stream using java semantics. - * @param out The stream to write the value to - * @param value The value to be written to the stream - **/ - public void writeValue(org.omg.CORBA.portable.OutputStream _out, java.io.Serializable value) { - super.writeValue(_out, value); - } - - /** - * Reads a value from the stream using java semantics. - * @param in The stream to read the value from - * @param clazz The type of the value to be read in - * @param sender The sending context runtime - **/ - public java.io.Serializable readValue(org.omg.CORBA.portable.InputStream _in, - int offset, - java.lang.Class clazz, - String repositoryID, - org.omg.SendingContext.RunTime _sender) - { - return super.readValue(_in, offset, clazz, repositoryID, _sender); - } - - /** - * Returns the repository ID for the given RMI value Class. - * @param clz The class to return a repository ID for. - * @return the repository ID of the Class. - **/ - public java.lang.String getRMIRepositoryID(java.lang.Class clz) { - return RepositoryId_1_3.createForJavaType(clz); - } - - /** - * Indicates whether the given Class performs custom or - * default marshaling. - * @param clz The class to test for custom marshaling. - * @return True if the class performs custom marshaling, false - * if it does not. - **/ - public boolean isCustomMarshaled(java.lang.Class clz) { - return super.isCustomMarshaled(clz); - } - - /** - * Returns the CodeBase for this ValueHandler. This is used by - * the ORB runtime. The server sends the service context containing - * the IOR for this CodeBase on the first GIOP reply. The clients - * do the same on the first GIOP request. - * @return the SendingContext.CodeBase of this ValueHandler. - **/ - public org.omg.SendingContext.RunTime getRunTimeCodeBase() { - return super.getRunTimeCodeBase(); - } - - /** - * If the value contains a writeReplace method then the result - * is returned. Otherwise, the value itself is returned. - * @return the true value to marshal on the wire. - **/ - public java.io.Serializable writeReplace(java.io.Serializable value) { - return super.writeReplace(value); - } - - // methods supported for backward compatability so that the appropriate - // Rep-id calculations take place based on the ORB version - - /** - * Returns a boolean of whether or not RepositoryId indicates - * FullValueDescriptor. - * used for backward compatability - */ - - public boolean useFullValueDescription(Class clazz, String repositoryID) - throws IOException - - { - return RepositoryId_1_3.useFullValueDescription(clazz, repositoryID); - } - - public String getClassName(String id) - { - RepositoryId_1_3 repID = RepositoryId_1_3.cache.getId(id); - return repID.getClassName(); - } - - public Class getClassFromType(String id) - throws ClassNotFoundException - { - RepositoryId_1_3 repId = RepositoryId_1_3.cache.getId(id); - return repId.getClassFromType(); - } - - public Class getAnyClassFromType(String id) - throws ClassNotFoundException - { - RepositoryId_1_3 repId = RepositoryId_1_3.cache.getId(id); - return repId.getAnyClassFromType(); - } - - public String createForAnyType(Class cl) - { - return RepositoryId_1_3.createForAnyType(cl); - } - - public String getDefinedInId(String id) - { - RepositoryId_1_3 repId = RepositoryId_1_3.cache.getId(id); - return repId.getDefinedInId(); - } - - public String getUnqualifiedName(String id) - { - RepositoryId_1_3 repId = RepositoryId_1_3.cache.getId(id); - return repId.getUnqualifiedName(); - } - - public String getSerialVersionUID(String id) - { - RepositoryId_1_3 repId = RepositoryId_1_3.cache.getId(id); - return repId.getSerialVersionUID(); - } - - public boolean isAbstractBase(Class clazz) - { - return RepositoryId_1_3.isAbstractBase(clazz); - } - - public boolean isSequence(String id) - { - RepositoryId_1_3 repId = RepositoryId_1_3.cache.getId(id); - return repId.isSequence(); - } - - /** - * Preserves the incorrect 1.3 behavior which truncates Java chars in - * arrays to 8-bit CORBA chars. Bug 4367783. This enables us to - * continue interoperating with our legacy ORBs. If this goes into - * Ladybird, then Ladybird and Kestrel will interoperate as long as - * people don't use chars greater than 8-bits. - */ - protected void writeCharArray(org.omg.CORBA_2_3.portable.OutputStream out, - char[] array, - int offset, - int length) - { - out.write_char_array(array, offset, length); - } - - /** - * Preserves the incorrect 1.3 behavior which truncates Java chars in - * arrays to 8-bit CORBA chars. Bug 4367783. This enables us to - * continue interoperating with our legacy ORBs. If this goes into - * Ladybird, then Ladybird and Kestrel will interoperate as long as - * people don't use chars greater than 8-bits. - */ - protected void readCharArray(org.omg.CORBA_2_3.portable.InputStream in, - char[] array, - int offset, - int length) - { - in.read_char_array(array, offset, length); - } - - protected final String getOutputStreamClassName() { - return "com.sun.corba.se.impl.orbutil.IIOPOutputStream_1_3"; - } - - protected final String getInputStreamClassName() { - return "com.sun.corba.se.impl.orbutil.IIOPInputStream_1_3"; - } - - /** - * Our JDK 1.3 and JDK 1.3.1 behavior subclasses override this. - * The correct behavior is for a Java char to map to a CORBA wchar, - * but our older code mapped it to a CORBA char. - */ - protected TCKind getJavaCharTCKind() { - return TCKind.tk_char; - } -}
--- a/src/share/classes/com/sun/corba/se/impl/orbutil/ValueHandlerImpl_1_3_1.java Wed Jan 09 09:55:11 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.sun.corba.se.impl.orbutil; - -import org.omg.CORBA.TCKind; - -/** - * This class overrides behavior of our current ValueHandlerImpl to - * provide backwards compatibility with JDK 1.3.1. - */ -public class ValueHandlerImpl_1_3_1 - extends com.sun.corba.se.impl.io.ValueHandlerImpl -{ - public ValueHandlerImpl_1_3_1() {} - - public ValueHandlerImpl_1_3_1(boolean isInputStream) { - super(isInputStream); - } - - /** - * Our JDK 1.3 and JDK 1.3.1 behavior subclasses override this. - * The correct behavior is for a Java char to map to a CORBA wchar, - * but our older code mapped it to a CORBA char. - */ - protected TCKind getJavaCharTCKind() { - return TCKind.tk_char; - } - - /** - * RepositoryId_1_3_1 performs an incorrect repId calculation - * when using serialPersistentFields and one of the fields no longer - * exists on the class itself. - */ - public boolean useFullValueDescription(Class clazz, String repositoryID) - throws java.io.IOException - { - return RepositoryId_1_3_1.useFullValueDescription(clazz, repositoryID); - } - - /** - * Installs the legacy IIOPOutputStream_1_3_1 which does - * PutFields/GetFields incorrectly. Bug 4407244. - */ - protected final String getOutputStreamClassName() { - return "com.sun.corba.se.impl.orbutil.IIOPOutputStream_1_3_1"; - } - - /** - * Installs the legacy IIOPInputStream_1_3_1 which does - * PutFields/GetFields incorrectly. Bug 4407244. - */ - protected final String getInputStreamClassName() { - return "com.sun.corba.se.impl.orbutil.IIOPInputStream_1_3_1"; - } -}
--- a/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_de.properties Wed Jan 09 09:55:11 2013 +0000 +++ b/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_de.properties Mon Mar 11 17:35:38 2013 +0100 @@ -1,5 +1,5 @@ # -# Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it
--- a/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_es.properties Wed Jan 09 09:55:11 2013 +0000 +++ b/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_es.properties Mon Mar 11 17:35:38 2013 +0100 @@ -1,5 +1,5 @@ # -# Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it
--- a/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_fr.properties Wed Jan 09 09:55:11 2013 +0000 +++ b/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_fr.properties Mon Mar 11 17:35:38 2013 +0100 @@ -1,5 +1,5 @@ # -# Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it
--- a/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_it.properties Wed Jan 09 09:55:11 2013 +0000 +++ b/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_it.properties Mon Mar 11 17:35:38 2013 +0100 @@ -1,5 +1,5 @@ # -# Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -23,9 +23,9 @@ # questions. # -orbd.usage=Utilizzo: {0} <opzioni> \n\ndove <opzioni> include:\n -port Porta di attivazione da cui avviare ORBD, valore predefinito 1049 (opzionale)\n -defaultdb Directory per i file ORBD, valore predefinito "./orb.db" (opzionale)\n -serverid ID server per ORBD, valore predefinito 1 (opzionale)\n -ORBInitialPort Porta iniziale (richiesta)\n -ORBInitialHost HostName iniziale (richiesto)\n +orbd.usage=Uso: {0} <opzioni> \n\ndove <opzioni> include:\n -port Porta di attivazione da cui avviare ORBD, valore predefinito 1049 (opzionale)\n -defaultdb Directory per i file ORBD, valore predefinito "./orb.db" (opzionale)\n -serverid ID server per ORBD, valore predefinito 1 (opzionale)\n -ORBInitialPort Porta iniziale (richiesta)\n -ORBInitialHost HostName iniziale (richiesto)\n -servertool.usage=Utilizzo: {0} <opzioni> \n\ndove <opzioni> include:\n -ORBInitialPort Porta iniziale (richiesta)\n -ORBInitialHost HostName iniziale (richiesto)\n +servertool.usage=Uso: {0} <opzioni> \n\ndove <opzioni> include:\n -ORBInitialPort Porta iniziale (richiesta)\n -ORBInitialHost HostName iniziale (richiesto)\n servertool.banner=\n\nBenvenuti in Java IDL Server Tool \nimmettere i comandi quando richiesto \n servertool.shorthelp=\n\n\tComandi disponibili:\n\t-------------------- \n servertool.baddef=Definizione server errata: {0} @@ -82,13 +82,13 @@ servertool.help=\thelp\n\tOR\n\thelp <nome comando>\n servertool.help1=Guida -servertool.orbidmap=\tUtilizzo: orblist [ -serverid <id server> | -applicationName <nome> ]\n +servertool.orbidmap=\tUso: orblist [ -serverid <id server> | -applicationName <nome> ]\n servertool.orbidmap1=lista nomi orb e relativa mappatura servertool.orbidmap2=\n\tId ORB\t\tNome ORB\n\t------\t\t--------\n pnameserv.success=NameServer persistente avviato correttamente -bootstrap.usage=Utilizzo: {0} <opzioni> \n\ndove <opzioni> include:\n -ORBInitialPort Porta iniziale (richiesta)\n -InitialServicesFile File contenente la lista dei servizi iniziali (richiesto)\n +bootstrap.usage=Uso: {0} <opzioni> \n\ndove <opzioni> include:\n -ORBInitialPort Porta iniziale (richiesta)\n -InitialServicesFile File contenente la lista dei servizi iniziali (richiesto)\n bootstrap.success=impostazione porta su {0} e lettura servizi da {1} in corso bootstrap.filenotreadable=il file {0} non \u00E8 leggibile bootstrap.filenotfound=impossibile trovare il file {0}
--- a/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_ja.properties Wed Jan 09 09:55:11 2013 +0000 +++ b/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_ja.properties Mon Mar 11 17:35:38 2013 +0100 @@ -1,5 +1,5 @@ # -# Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it
--- a/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_ko.properties Wed Jan 09 09:55:11 2013 +0000 +++ b/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_ko.properties Mon Mar 11 17:35:38 2013 +0100 @@ -1,5 +1,5 @@ # -# Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it
--- a/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_pt_BR.properties Wed Jan 09 09:55:11 2013 +0000 +++ b/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_pt_BR.properties Mon Mar 11 17:35:38 2013 +0100 @@ -1,5 +1,5 @@ # -# Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it
--- a/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_sv.properties Wed Jan 09 09:55:11 2013 +0000 +++ b/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_sv.properties Mon Mar 11 17:35:38 2013 +0100 @@ -1,5 +1,5 @@ # -# Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it
--- a/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_CN.properties Wed Jan 09 09:55:11 2013 +0000 +++ b/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_CN.properties Mon Mar 11 17:35:38 2013 +0100 @@ -1,5 +1,5 @@ # -# Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it
--- a/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_TW.properties Wed Jan 09 09:55:11 2013 +0000 +++ b/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_TW.properties Mon Mar 11 17:35:38 2013 +0100 @@ -1,5 +1,5 @@ # -# Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it
--- a/src/share/classes/com/sun/corba/se/impl/orbutil/threadpool/ThreadPoolImpl.java Wed Jan 09 09:55:11 2013 +0000 +++ b/src/share/classes/com/sun/corba/se/impl/orbutil/threadpool/ThreadPoolImpl.java Mon Mar 11 17:35:38 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,18 @@ package com.sun.corba.se.impl.orbutil.threadpool; +import java.io.IOException; +import java.io.Closeable; + +import java.security.AccessController; +import java.security.PrivilegedAction; + +import java.util.List; +import java.util.ArrayList; + +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicLong; + import com.sun.corba.se.spi.orbutil.threadpool.NoSuchWorkQueueException; import com.sun.corba.se.spi.orbutil.threadpool.ThreadPool; import com.sun.corba.se.spi.orbutil.threadpool.Work; @@ -36,12 +48,27 @@ import com.sun.corba.se.spi.monitoring.MonitoringConstants; import com.sun.corba.se.spi.monitoring.MonitoredObject; import com.sun.corba.se.spi.monitoring.MonitoringFactories; +import com.sun.corba.se.spi.orb.ORB; import com.sun.corba.se.spi.monitoring.LongMonitoredAttributeBase; +import com.sun.corba.se.impl.logging.ORBUtilSystemException; +import com.sun.corba.se.impl.orbutil.ORBConstants; +import com.sun.corba.se.spi.logging.CORBALogDomains; + public class ThreadPoolImpl implements ThreadPool { - private static int threadCounter = 0; // serial counter useful for debugging + // serial counter useful for debugging + private static AtomicInteger threadCounter = new AtomicInteger(0); + private static final ORBUtilSystemException wrapper = + ORBUtilSystemException.get(CORBALogDomains.RPC_TRANSPORT); + + // Any time currentThreadCount and/or availableWorkerThreads is updated + // or accessed this ThreadPool's WorkQueue must be locked. And, it is + // expected that this ThreadPool's WorkQueue is the only object that + // updates and accesses these values directly and indirectly though a + // call to a method in this ThreadPool. If any call to update or access + // those values must synchronized on this ThreadPool's WorkQueue. private WorkQueue workQueue; // Stores the number of available worker threads @@ -65,14 +92,11 @@ // Running count of the work items processed // Set the value to 1 so that divide by zero is avoided in // averageWorkCompletionTime() - private long processedCount = 1; + private AtomicLong processedCount = new AtomicLong(1); // Running aggregate of the time taken in millis to execute work items // processed by the threads in the threadpool - private long totalTimeTaken = 0; - - // Lock for protecting state when required - private Object lock = new Object(); + private AtomicLong totalTimeTaken = new AtomicLong(0); // Name of the ThreadPool private String name; @@ -81,7 +105,10 @@ private MonitoredObject threadpoolMonitoredObject; // ThreadGroup in which threads should be created - private ThreadGroup threadGroup ; + private ThreadGroup threadGroup; + + Object workersLock = new Object(); + List<WorkerThread> workers = new ArrayList<>(); /** * This constructor is used to create an unbounded threadpool @@ -90,7 +117,7 @@ inactivityTimeout = ORBConstants.DEFAULT_INACTIVITY_TIMEOUT; maxWorkerThreads = Integer.MAX_VALUE; workQueue = new WorkQueueImpl(this); - threadGroup = tg ; + threadGroup = tg; name = threadpoolName; initializeMonitoring(); } @@ -121,6 +148,30 @@ initializeMonitoring(); } + // Note that this method should not return until AFTER all threads have died. + public void close() throws IOException { + + // Copy to avoid concurrent modification problems. + List<WorkerThread> copy = null; + synchronized (workersLock) { + copy = new ArrayList<>(workers); + } + + for (WorkerThread wt : copy) { + wt.close(); + while (wt.getState() != Thread.State.TERMINATED) { + try { + wt.join(); + } catch (InterruptedException exc) { + wrapper.interruptedJoinCallWhileClosingThreadPool(exc, wt, this); + } + } + } + + threadGroup = null; + } + + // Setup monitoring for this threadpool private void initializeMonitoring() { // Get root monitored object @@ -217,8 +268,8 @@ * or notify waiting threads on the queue for available work */ void notifyForAvailableWork(WorkQueue aWorkQueue) { - synchronized (lock) { - if (availableWorkerThreads == 0) { + synchronized (aWorkQueue) { + if (availableWorkerThreads < aWorkQueue.workItemsInQueue()) { createWorkerThread(); } else { aWorkQueue.notify(); @@ -227,120 +278,145 @@ } + private Thread createWorkerThreadHelper( String name ) { + // Thread creation needs to be in a doPrivileged block + // if there is a non-null security manager for two reasons: + // 1. The creation of a thread in a specific ThreadGroup + // is a privileged operation. Lack of a doPrivileged + // block here causes an AccessControlException + // (see bug 6268145). + // 2. We want to make sure that the permissions associated + // with this thread do NOT include the permissions of + // the current thread that is calling this method. + // This leads to problems in the app server where + // some threads in the ThreadPool randomly get + // bad permissions, leading to unpredictable + // permission errors (see bug 6021011). + // + // A Java thread contains a stack of call frames, + // one for each method called that has not yet returned. + // Each method comes from a particular class. The class + // was loaded by a ClassLoader which has an associated + // CodeSource, and this determines the Permissions + // for all methods in that class. The current + // Permissions for the thread are the intersection of + // all Permissions for the methods on the stack. + // This is part of the Security Context of the thread. + // + // When a thread creates a new thread, the new thread + // inherits the security context of the old thread. + // This is bad in a ThreadPool, because different + // creators of threads may have different security contexts. + // This leads to occasional unpredictable errors when + // a thread is re-used in a different security context. + // + // Avoiding this problem is simple: just do the thread + // creation in a doPrivileged block. This sets the + // inherited security context to that of the code source + // for the ORB code itself, which contains all permissions + // in either Java SE or Java EE. + WorkerThread thread = new WorkerThread(threadGroup, name); + synchronized (workersLock) { + workers.add(thread); + } + + // The thread must be set to a daemon thread so the + // VM can exit if the only threads left are PooledThreads + // or other daemons. We don't want to rely on the + // calling thread always being a daemon. + // Note that no exception is possible here since we + // are inside the doPrivileged block. + thread.setDaemon(true); + + wrapper.workerThreadCreated(thread, thread.getContextClassLoader()); + + thread.start(); + return null; + } + + /** * To be called from the workqueue to create worker threads when none * available. */ void createWorkerThread() { - WorkerThread thread; - - synchronized (lock) { - if (boundedThreadPool) { - if (currentThreadCount < maxWorkerThreads) { - thread = new WorkerThread(threadGroup, getName()); - currentThreadCount++; + final String name = getName(); + synchronized (workQueue) { + try { + if (System.getSecurityManager() == null) { + createWorkerThreadHelper(name); } else { - // REVIST - Need to create a thread to monitor the - // the state for deadlock i.e. all threads waiting for - // something which can be got from the item in the - // workqueue, but there is no thread available to - // process that work item - DEADLOCK !! - return; + // If we get here, we need to create a thread. + AccessController.doPrivileged( + new PrivilegedAction() { + public Object run() { + return createWorkerThreadHelper(name); + } + } + ); } - } else { - thread = new WorkerThread(threadGroup, getName()); - currentThreadCount++; + } catch (Throwable t) { + // Decrementing the count of current worker threads. + // But, it will be increased in the finally block. + decrementCurrentNumberOfThreads(); + wrapper.workerThreadCreationFailure(t); + } finally { + incrementCurrentNumberOfThreads(); } } - - // The thread must be set to a daemon thread so the - // VM can exit if the only threads left are PooledThreads - // or other daemons. We don't want to rely on the - // calling thread always being a daemon. - - // Catch exceptions since setDaemon can cause a - // security exception to be thrown under netscape - // in the Applet mode - try { - thread.setDaemon(true); - } catch (Exception e) { - // REVISIT - need to do some logging here - } - - thread.start(); } - /** - * This method will return the minimum number of threads maintained - * by the threadpool. - */ public int minimumNumberOfThreads() { return minWorkerThreads; } - /** - * This method will return the maximum number of threads in the - * threadpool at any point in time, for the life of the threadpool - */ public int maximumNumberOfThreads() { return maxWorkerThreads; } - /** - * This method will return the time in milliseconds when idle - * threads in the threadpool are removed. - */ public long idleTimeoutForThreads() { return inactivityTimeout; } - /** - * This method will return the total number of threads currently in the - * threadpool. This method returns a value which is not synchronized. - */ public int currentNumberOfThreads() { - synchronized (lock) { + synchronized (workQueue) { return currentThreadCount; } } - /** - * This method will return the number of available threads in the - * threadpool which are waiting for work. This method returns a - * value which is not synchronized. - */ + void decrementCurrentNumberOfThreads() { + synchronized (workQueue) { + currentThreadCount--; + } + } + + void incrementCurrentNumberOfThreads() { + synchronized (workQueue) { + currentThreadCount++; + } + } + public int numberOfAvailableThreads() { - synchronized (lock) { + synchronized (workQueue) { return availableWorkerThreads; } } - /** - * This method will return the number of busy threads in the threadpool - * This method returns a value which is not synchronized. - */ public int numberOfBusyThreads() { - synchronized (lock) { + synchronized (workQueue) { return (currentThreadCount - availableWorkerThreads); } } - /** - * This method returns the average elapsed time taken to complete a Work - * item in milliseconds. - */ public long averageWorkCompletionTime() { - synchronized (lock) { - return (totalTimeTaken / processedCount); + synchronized (workQueue) { + return (totalTimeTaken.get() / processedCount.get()); } } - /** - * This method returns the number of Work items processed by the threadpool - */ public long currentProcessedCount() { - synchronized (lock) { - return processedCount; + synchronized (workQueue) { + return processedCount.get(); } } @@ -357,15 +433,37 @@ private static synchronized int getUniqueThreadId() { - return ThreadPoolImpl.threadCounter++; + return ThreadPoolImpl.threadCounter.incrementAndGet(); + } + + /** + * This method will decrement the number of available threads + * in the threadpool which are waiting for work. Called from + * WorkQueueImpl.requestWork() + */ + void decrementNumberOfAvailableThreads() { + synchronized (workQueue) { + availableWorkerThreads--; + } + } + + /** + * This method will increment the number of available threads + * in the threadpool which are waiting for work. Called from + * WorkQueueImpl.requestWork() + */ + void incrementNumberOfAvailableThreads() { + synchronized (workQueue) { + availableWorkerThreads++; + } } - private class WorkerThread extends Thread + private class WorkerThread extends Thread implements Closeable { private Work currentWork; private int threadId = 0; // unique id for the thread - // thread pool this WorkerThread belongs too + private volatile boolean closeCalled = false; private String threadPoolName; // name seen by Thread.getName() private StringBuffer workerThreadName = new StringBuffer(); @@ -377,100 +475,61 @@ setName(composeWorkerThreadName(threadPoolName, "Idle")); } - public void run() { - while (true) { - try { + public synchronized void close() { + closeCalled = true; + interrupt(); + } - synchronized (lock) { - availableWorkerThreads++; - } + private void resetClassLoader() { - // Get some work to do - currentWork = ((WorkQueueImpl)workQueue).requestWork(inactivityTimeout); + } - synchronized (lock) { - availableWorkerThreads--; - // It is possible in notifyForAvailableWork that the - // check for availableWorkerThreads = 0 may return - // false, because the availableWorkerThreads has not been - // decremented to zero before the producer thread added - // work to the queue. This may create a deadlock, if the - // executing thread needs information which is in the work - // item queued in the workqueue, but has no thread to work - // on it since none was created because availableWorkerThreads = 0 - // returned false. - // The following code will ensure that a thread is always available - // in those situations - if ((availableWorkerThreads == 0) && - (workQueue.workItemsInQueue() > 0)) { - createWorkerThread(); - } - } + private void performWork() { + long start = System.currentTimeMillis(); + try { + currentWork.doWork(); + } catch (Throwable t) { + wrapper.workerThreadDoWorkThrowable(this, t); + } + long elapsedTime = System.currentTimeMillis() - start; + totalTimeTaken.addAndGet(elapsedTime); + processedCount.incrementAndGet(); + } - // Set the thread name for debugging. - setName(composeWorkerThreadName(threadPoolName, - Integer.toString(this.threadId))); - - long start = System.currentTimeMillis(); + public void run() { + try { + while (!closeCalled) { + try { + currentWork = ((WorkQueueImpl)workQueue).requestWork( + inactivityTimeout); + if (currentWork == null) + continue; + } catch (InterruptedException exc) { + wrapper.workQueueThreadInterrupted( exc, getName(), + Boolean.valueOf(closeCalled)); - try { - // Do the work - currentWork.doWork(); + continue ; } catch (Throwable t) { - // Ignore all errors. - ; + wrapper.workerThreadThrowableFromRequestWork(this, t, + workQueue.getName()); + + continue; } - long end = System.currentTimeMillis(); - - - synchronized (lock) { - totalTimeTaken += (end - start); - processedCount++; - } + performWork(); // set currentWork to null so that the work item can be - // garbage collected + // garbage collected without waiting for the next work item. currentWork = null; - setName(composeWorkerThreadName(threadPoolName, "Idle")); - - } catch (TimeoutException e) { - // This thread timed out waiting for something to do. - - synchronized (lock) { - availableWorkerThreads--; - - // This should for both bounded and unbounded case - if (currentThreadCount > minWorkerThreads) { - currentThreadCount--; - // This thread can exit. - return; - } else { - // Go back to waiting on workQueue - continue; - } - } - } catch (InterruptedException ie) { - // InterruptedExceptions are - // caught here. Thus, threads can be forced out of - // requestWork and so they have to reacquire the lock. - // Other options include ignoring or - // letting this thread die. - // Ignoring for now. REVISIT - synchronized (lock) { - availableWorkerThreads--; - } - - } catch (Throwable e) { - - // Ignore any exceptions that currentWork.process - // accidently lets through, but let Errors pass. - // Add debugging output? REVISIT - synchronized (lock) { - availableWorkerThreads--; - } - + resetClassLoader(); + } + } catch (Throwable e) { + // This should not be possible + wrapper.workerThreadCaughtUnexpectedThrowable(this,e); + } finally { + synchronized (workersLock) { + workers.remove(this); } } }
--- a/src/share/classes/com/sun/corba/se/impl/orbutil/threadpool/ThreadPoolManagerImpl.java Wed Jan 09 09:55:11 2013 +0000 +++ b/src/share/classes/com/sun/corba/se/impl/orbutil/threadpool/ThreadPoolManagerImpl.java Mon Mar 11 17:35:38 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,15 @@ package com.sun.corba.se.impl.orbutil.threadpool; +import java.io.IOException; + +import java.security.PrivilegedAction; +import java.security.AccessController; + +import java.util.concurrent.atomic.AtomicInteger; + +import com.sun.corba.se.spi.orb.ORB; + import com.sun.corba.se.spi.orbutil.threadpool.NoSuchThreadPoolException; import com.sun.corba.se.spi.orbutil.threadpool.ThreadPool; import com.sun.corba.se.spi.orbutil.threadpool.ThreadPoolManager; @@ -33,21 +42,102 @@ import com.sun.corba.se.impl.orbutil.threadpool.ThreadPoolImpl; import com.sun.corba.se.impl.orbutil.ORBConstants; +import com.sun.corba.se.impl.logging.ORBUtilSystemException; +import com.sun.corba.se.impl.orbutil.ORBConstants; +import com.sun.corba.se.spi.logging.CORBALogDomains; + + public class ThreadPoolManagerImpl implements ThreadPoolManager { - private ThreadPool threadPool ; + private ThreadPool threadPool; + private ThreadGroup threadGroup; + + private static final ORBUtilSystemException wrapper = + ORBUtilSystemException.get(CORBALogDomains.RPC_TRANSPORT); + + public ThreadPoolManagerImpl() { + threadGroup = getThreadGroup(); + threadPool = new ThreadPoolImpl(threadGroup, + ORBConstants.THREADPOOL_DEFAULT_NAME); + } + + private static AtomicInteger tgCount = new AtomicInteger(); + + + private ThreadGroup getThreadGroup() { + ThreadGroup tg; - public ThreadPoolManagerImpl( ThreadGroup tg ) - { - // Use unbounded threadpool in J2SE ORB - // ThreadPoolManager from s1as appserver code base can be set in the - // ORB. ThreadPools in the appserver are bounded. In that situation - // the ThreadPool in this ThreadPoolManager will have its threads - // die after the idle timeout. - // XXX Should there be cleanup when ORB.shutdown is called if the - // ORB owns the ThreadPool? - threadPool = new ThreadPoolImpl( tg, - ORBConstants.THREADPOOL_DEFAULT_NAME ) ; + // See bugs 4916766 and 4936203 + // We intend to create new threads in a reliable thread group. + // This avoids problems if the application/applet + // creates a thread group, makes JavaIDL calls which create a new + // connection and ReaderThread, and then destroys the thread + // group. If our ReaderThreads were to be part of such destroyed thread + // group then it might get killed and cause other invoking threads + // sharing the same connection to get a non-restartable + // CommunicationFailure. We'd like to avoid that. + // + // Our solution is to create all of our threads in the highest thread + // group that we have access to, given our own security clearance. + // + try { + // try to get a thread group that's as high in the threadgroup + // parent-child hierarchy, as we can get to. + // this will prevent an ORB thread created during applet-init from + // being killed when an applet dies. + tg = AccessController.doPrivileged( + new PrivilegedAction<ThreadGroup>() { + public ThreadGroup run() { + ThreadGroup tg = Thread.currentThread().getThreadGroup(); + ThreadGroup ptg = tg; + try { + while (ptg != null) { + tg = ptg; + ptg = tg.getParent(); + } + } catch (SecurityException se) { + // Discontinue going higher on a security exception. + } + return new ThreadGroup(tg, "ORB ThreadGroup " + tgCount.getAndIncrement()); + } + } + ); + } catch (SecurityException e) { + // something wrong, we go back to the original code + tg = Thread.currentThread().getThreadGroup(); + } + + return tg; + } + + public void close() { + try { + threadPool.close(); + } catch (IOException exc) { + wrapper.threadPoolCloseError(); + } + + try { + boolean isDestroyed = threadGroup.isDestroyed(); + int numThreads = threadGroup.activeCount(); + int numGroups = threadGroup.activeGroupCount(); + + if (isDestroyed) { + wrapper.threadGroupIsDestroyed(threadGroup); + } else { + if (numThreads > 0) + wrapper.threadGroupHasActiveThreadsInClose(threadGroup, numThreads); + + if (numGroups > 0) + wrapper.threadGroupHasSubGroupsInClose(threadGroup, numGroups); + + threadGroup.destroy(); + } + } catch (IllegalThreadStateException exc) { + wrapper.threadGroupDestroyFailed(exc, threadGroup); + } + + threadGroup = null; } /**
--- a/src/share/classes/com/sun/corba/se/impl/orbutil/threadpool/WorkQueueImpl.java Wed Jan 09 09:55:11 2013 +0000 +++ b/src/share/classes/com/sun/corba/se/impl/orbutil/threadpool/WorkQueueImpl.java Mon Mar 11 17:35:38 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -111,24 +111,23 @@ return workqueueMonitoredObject; } - public void addWork(Work work) { - synchronized (this) { + public synchronized void addWork(Work work) { workItemsAdded++; work.setEnqueueTime(System.currentTimeMillis()); theWorkQueue.addLast(work); ((ThreadPoolImpl)workerThreadPool).notifyForAvailableWork(this); - } } - Work requestWork(long waitTime) - throws TimeoutException, InterruptedException + synchronized Work requestWork(long waitTime) throws TimeoutException, InterruptedException { Work workItem; - synchronized (this) { + ((ThreadPoolImpl)workerThreadPool).incrementNumberOfAvailableThreads(); + if (theWorkQueue.size() != 0) { workItem = (Work)theWorkQueue.removeFirst(); totalTimeInQueue += System.currentTimeMillis() - workItem.getEnqueueTime(); workItemsDequeued++; + ((ThreadPoolImpl)workerThreadPool).decrementNumberOfAvailableThreads(); return workItem; } @@ -145,6 +144,7 @@ workItem = (Work)theWorkQueue.removeFirst(); totalTimeInQueue += System.currentTimeMillis() - workItem.getEnqueueTime(); workItemsDequeued++; + ((ThreadPoolImpl)workerThreadPool).decrementNumberOfAvailableThreads(); return workItem; } @@ -152,12 +152,13 @@ } while (remainingWaitTime > 0); + ((ThreadPoolImpl)workerThreadPool).decrementNumberOfAvailableThreads(); throw new TimeoutException(); } catch (InterruptedException ie) { + ((ThreadPoolImpl)workerThreadPool).decrementNumberOfAvailableThreads(); throw ie; } - } } public void setThreadPool(ThreadPool workerThreadPool) {
--- a/src/share/classes/com/sun/corba/se/impl/protocol/CorbaMessageMediatorImpl.java Wed Jan 09 09:55:11 2013 +0000 +++ b/src/share/classes/com/sun/corba/se/impl/protocol/CorbaMessageMediatorImpl.java Mon Mar 11 17:35:38 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1666,7 +1666,9 @@ ((CDRInputObject)messageMediator.getInputObject()).unmarshalHeader(); ORB orb = (ORB)messageMediator.getBroker(); - orb.checkShutdownState(); + synchronized (orb) { + orb.checkShutdownState(); + } ObjectKey okey = messageMediator.getObjectKey(); if (orb.subcontractDebugFlag) {
--- a/src/share/classes/com/sun/corba/se/impl/protocol/LocalClientRequestDispatcherBase.java Wed Jan 09 09:55:11 2013 +0000 +++ b/src/share/classes/com/sun/corba/se/impl/protocol/LocalClientRequestDispatcherBase.java Mon Mar 11 17:35:38 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -52,7 +52,7 @@ // If isNextIsLocalValid.get() == Boolean.TRUE, // the next call to isLocal should be valid - protected static ThreadLocal isNextCallValid = new ThreadLocal() { + private static final ThreadLocal isNextCallValid = new ThreadLocal() { protected synchronized Object initialValue() { return Boolean.TRUE; }
--- a/src/share/classes/com/sun/corba/se/impl/transport/CorbaResponseWaitingRoomImpl.java Wed Jan 09 09:55:11 2013 +0000 +++ b/src/share/classes/com/sun/corba/se/impl/transport/CorbaResponseWaitingRoomImpl.java Mon Mar 11 17:35:38 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,10 @@ package com.sun.corba.se.impl.transport; -import java.util.Hashtable; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; import org.omg.CORBA.CompletionStatus; import org.omg.CORBA.SystemException; @@ -68,7 +71,7 @@ private CorbaConnection connection; // Maps requestId to an OutCallDesc. - private Hashtable out_calls = null; // REVISIT - use int hastable/map + final private Map<Integer, OutCallDesc> out_calls; public CorbaResponseWaitingRoomImpl(ORB orb, CorbaConnection connection) { @@ -76,7 +79,8 @@ wrapper = ORBUtilSystemException.get( orb, CORBALogDomains.RPC_TRANSPORT ) ; this.connection = connection; - out_calls = new Hashtable(); + out_calls = + Collections.synchronizedMap(new HashMap<Integer, OutCallDesc>()); } //////////////////////////////////////////////////// @@ -139,7 +143,7 @@ return null; } - OutCallDesc call = (OutCallDesc)out_calls.get(requestId); + OutCallDesc call = out_calls.get(requestId); if (call == null) { throw wrapper.nullOutCall(CompletionStatus.COMPLETED_MAYBE); } @@ -197,7 +201,7 @@ LocateReplyOrReplyMessage header = (LocateReplyOrReplyMessage) inputObject.getMessageHeader(); Integer requestId = new Integer(header.getRequestId()); - OutCallDesc call = (OutCallDesc) out_calls.get(requestId); + OutCallDesc call = out_calls.get(requestId); if (orb.transportDebugFlag) { dprint(".responseReceived: id/" @@ -248,7 +252,6 @@ public int numberRegistered() { - // Note: Hashtable.size() is not synchronized return out_calls.size(); } @@ -264,29 +267,41 @@ dprint(".signalExceptionToAllWaiters: " + systemException); } - OutCallDesc call; - java.util.Enumeration e = out_calls.elements(); - while(e.hasMoreElements()) { - call = (OutCallDesc) e.nextElement(); + synchronized (out_calls) { + if (orb.transportDebugFlag) { + dprint(".signalExceptionToAllWaiters: out_calls size :" + + out_calls.size()); + } - synchronized(call.done){ - // anything waiting for BufferManagerRead's fragment queue - // needs to be cancelled - CorbaMessageMediator corbaMsgMediator = - (CorbaMessageMediator)call.messageMediator; - CDRInputObject inputObject = - (CDRInputObject)corbaMsgMediator.getInputObject(); - // IMPORTANT: If inputObject is null, then no need to tell - // BufferManagerRead to cancel request processing. - if (inputObject != null) { - BufferManagerReadStream bufferManager = - (BufferManagerReadStream)inputObject.getBufferManager(); - int requestId = corbaMsgMediator.getRequestId(); - bufferManager.cancelProcessing(requestId); + for (OutCallDesc call : out_calls.values()) { + if (orb.transportDebugFlag) { + dprint(".signalExceptionToAllWaiters: signaling " + + call); } - call.inputObject = null; - call.exception = systemException; - call.done.notify(); + synchronized(call.done) { + try { + // anything waiting for BufferManagerRead's fragment queue + // needs to be cancelled + CorbaMessageMediator corbaMsgMediator = + (CorbaMessageMediator)call.messageMediator; + CDRInputObject inputObject = + (CDRInputObject)corbaMsgMediator.getInputObject(); + // IMPORTANT: If inputObject is null, then no need to tell + // BufferManagerRead to cancel request processing. + if (inputObject != null) { + BufferManagerReadStream bufferManager = + (BufferManagerReadStream)inputObject.getBufferManager(); + int requestId = corbaMsgMediator.getRequestId(); + bufferManager.cancelProcessing(requestId); + } + } catch (Exception e) { + } finally { + // attempt to wake up waiting threads in all cases + call.inputObject = null; + call.exception = systemException; + call.done.notifyAll(); + } + } } } } @@ -294,7 +309,7 @@ public MessageMediator getMessageMediator(int requestId) { Integer id = new Integer(requestId); - OutCallDesc call = (OutCallDesc) out_calls.get(id); + OutCallDesc call = out_calls.get(id); if (call == null) { // This can happen when getting early reply fragments for a // request which has completed (e.g., client marshaling error).
--- a/src/share/classes/com/sun/corba/se/impl/transport/SelectorImpl.java Wed Jan 09 09:55:11 2013 +0000 +++ b/src/share/classes/com/sun/corba/se/impl/transport/SelectorImpl.java Mon Mar 11 17:35:38 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -69,8 +69,8 @@ private HashMap listenerThreads; private Map readerThreads; private boolean selectorStarted; - private boolean closed; - private ORBUtilSystemException wrapper ; + private volatile boolean closed; + private ORBUtilSystemException wrapper; public SelectorImpl(ORB orb)
--- a/src/share/classes/com/sun/corba/se/impl/transport/SocketOrChannelConnectionImpl.java Wed Jan 09 09:55:11 2013 +0000 +++ b/src/share/classes/com/sun/corba/se/impl/transport/SocketOrChannelConnectionImpl.java Mon Mar 11 17:35:38 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1521,7 +1521,7 @@ // connection and give them the SystemException; responseWaitingRoom.signalExceptionToAllWaiters(systemException); - + } finally { if (contactInfo != null) { ((OutboundConnectionCache)getConnectionCache()).remove(contactInfo); } else if (acceptor != null) { @@ -1542,7 +1542,6 @@ writeUnlock(); - } finally { if (orb.transportDebugFlag) { dprint(".purgeCalls<-: " + minor_code + "/" + die + "/" + lockHeld
--- a/src/share/classes/com/sun/corba/se/impl/util/RepositoryId.java Wed Jan 09 09:55:11 2013 +0000 +++ b/src/share/classes/com/sun/corba/se/impl/util/RepositoryId.java Mon Mar 11 17:35:38 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -57,7 +57,7 @@ // uniformly, and is safe because that is the only // legal use of '.' in a Java name. - public static final byte[] IDL_IDENTIFIER_CHARS = { + private static final byte[] IDL_IDENTIFIER_CHARS = { // 0 1 2 3 4 5 6 7 8 9 a b c d e f 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 00-0f @@ -95,7 +95,7 @@ private static IdentityHashtable classIDLToRepStr = new IdentityHashtable(); private static IdentityHashtable classSeqToRepStr = new IdentityHashtable(); - private static IdentityHashtable repStrToByteArray = new IdentityHashtable(); + private static final IdentityHashtable repStrToByteArray = new IdentityHashtable(); private static Hashtable repStrToClass = new Hashtable(); private String repId = null; @@ -192,7 +192,7 @@ public static final String kRemoteTypeStr = ""; public static final String kRemoteValueRepID = ""; - public static final Hashtable kSpecialArrayTypeStrings = new Hashtable(); + private static final Hashtable kSpecialArrayTypeStrings = new Hashtable(); static { kSpecialArrayTypeStrings.put("CORBA.WStringValue", new StringBuffer(java.lang.String.class.getName())); @@ -201,7 +201,7 @@ } - public static final Hashtable kSpecialCasesRepIDs = new Hashtable(); + private static final Hashtable kSpecialCasesRepIDs = new Hashtable(); static { kSpecialCasesRepIDs.put(java.lang.String.class, kWStringValueRepID); @@ -209,7 +209,7 @@ kSpecialCasesRepIDs.put(java.rmi.Remote.class, kRemoteValueRepID); } - public static final Hashtable kSpecialCasesStubValues = new Hashtable(); + private static final Hashtable kSpecialCasesStubValues = new Hashtable(); static { kSpecialCasesStubValues.put(java.lang.String.class, kWStringStubValue); @@ -221,7 +221,7 @@ } - public static final Hashtable kSpecialCasesVersions = new Hashtable(); + private static final Hashtable kSpecialCasesVersions = new Hashtable(); static { kSpecialCasesVersions.put(java.lang.String.class, kWStringValueHash); @@ -232,7 +232,7 @@ kSpecialCasesVersions.put(java.rmi.Remote.class, kRemoteValueHash); } - public static final Hashtable kSpecialCasesClasses = new Hashtable(); + private static final Hashtable kSpecialCasesClasses = new Hashtable(); static { kSpecialCasesClasses.put(kWStringTypeStr, java.lang.String.class); @@ -244,7 +244,7 @@ //kSpecialCasesClasses.put(kRemoteTypeStr, java.rmi.Remote.class); } - public static final Hashtable kSpecialCasesArrayPrefix = new Hashtable(); + private static final Hashtable kSpecialCasesArrayPrefix = new Hashtable(); static { kSpecialCasesArrayPrefix.put(java.lang.String.class, kValuePrefix + kSequencePrefix + kCORBAPrefix); @@ -255,7 +255,7 @@ kSpecialCasesArrayPrefix.put(java.rmi.Remote.class, kValuePrefix + kSequencePrefix + kCORBAPrefix); } - public static final Hashtable kSpecialPrimitives = new Hashtable(); + private static final Hashtable kSpecialPrimitives = new Hashtable(); static { kSpecialPrimitives.put("int","long");
--- a/src/share/classes/com/sun/corba/se/spi/logging/CORBALogDomains.java Wed Jan 09 09:55:11 2013 +0000 +++ b/src/share/classes/com/sun/corba/se/spi/logging/CORBALogDomains.java Mon Mar 11 17:35:38 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -58,7 +58,7 @@ private CORBALogDomains() {} // Top level log domain for CORBA - public static String TOP_LEVEL_DOMAIN = "javax.enterprise.resource.corba"; + public static final String TOP_LEVEL_DOMAIN = "javax.enterprise.resource.corba"; public static final String RPC = "rpc" ;
--- a/src/share/classes/com/sun/corba/se/spi/logging/data/ORBUtil.mc Wed Jan 09 09:55:11 2013 +0000 +++ b/src/share/classes/com/sun/corba/se/spi/logging/data/ORBUtil.mc Mon Mar 11 17:35:38 2013 +0100 @@ -1,6 +1,6 @@ ; -; Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. +; Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. ; DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. ; ; This code is free software; you can redistribute it and/or modify it @@ -62,6 +62,7 @@ (IS_LOCAL_REQUIRES_STUB 43 WARNING "Call to StubAdapter.isLocal did not pass a stub") (REQUEST_REQUIRES_STUB 44 WARNING "Call to StubAdapter.request did not pass a stub") (BAD_ACTIVATE_TIE_CALL 45 WARNING "Call to StubAdapter.activateTie did not pass a valid Tie") + (IO_EXCEPTION_ON_CLOSE 46 FINE "Useless exception on call to Closeable.close()") ) (BAD_PARAM (NULL_PARAM 1 WARNING "Null parameter") @@ -291,7 +292,31 @@ (JAVA_STREAM_INIT_FAILED 95 WARNING "Java stream initialization failed") (DUPLICATE_ORB_VERSION_SERVICE_CONTEXT 96 WARNING "An ORBVersionServiceContext was already in the service context list") (DUPLICATE_SENDING_CONTEXT_SERVICE_CONTEXT 97 WARNING "A SendingContextServiceContext was already in the service context list") + (WORK_QUEUE_THREAD_INTERRUPTED 98 FINE "Worker Thread from thread pool {0} was interrupted: closeCalled is {1}.") + (WORKER_THREAD_CREATED + 104 FINE "Worker thread {0} has been created with ClassLoader {1}") + (WORKER_THREAD_THROWABLE_FROM_REQUEST_WORK + 109 FINE "Worker thread {0} caught throwable {1} when requesting work from work queue {2}.") + (WORKER_THREAD_NOT_NEEDED + 110 FINE "Worker thread {0} will exit; current thread count, {1}, greater than minunum worker threads needed, {2}.") + (WORKER_THREAD_DO_WORK_THROWABLE + 111 FINE "Worker thread {0} caught throwable {1} while executing work.") + (WORKER_THREAD_CAUGHT_UNEXPECTED_THROWABLE + 112 WARNING "Worker thread {0} caught unexpected throwable {1}.") + (WORKER_THREAD_CREATION_FAILURE + 113 SEVERE "Worker thread creation failure; cause {0}.") + (WORKER_THREAD_SET_NAME_FAILURE + 114 WARNING "Unable to set worker thread {0} name to {1}; cause {2}.") + (WORK_QUEUE_REQUEST_WORK_NO_WORK_FOUND + 116 WARNING "Ignoring unexpected {0} when retrieving of work from work queue, {1}.") + (THREAD_POOL_CLOSE_ERROR 126 WARNING "Error in closing ThreadPool") + (THREAD_GROUP_IS_DESTROYED 127 WARNING "ThreadGroup {0} is already destroyed: can't destroy it") + (THREAD_GROUP_HAS_ACTIVE_THREADS_IN_CLOSE 128 WARNING "ThreadGroup {0} has {1} active threads: destroy may cause exception") + (THREAD_GROUP_HAS_SUB_GROUPS_IN_CLOSE 129 WARNING "ThreadGroup {0} has {1} sub-thread groups: destroy may cause exception") + (THREAD_GROUP_DESTROY_FAILED 130 WARNING "ThreadGroup {0} could not be destroyed") + (INTERRUPTED_JOIN_CALL_WHILE_CLOSING_THREAD_POOL 131 WARNING "Join was interrupted on thread {0} while closing ThreadPool {1}") ) + (MARSHAL (CHUNK_OVERFLOW 1 WARNING "Data read past end of chunk without closing the chunk") (UNEXPECTED_EOF 2 WARNING "Grow buffer strategy called underflow handler")
--- a/src/share/classes/com/sun/corba/se/spi/monitoring/MonitoringManager.java Wed Jan 09 09:55:11 2013 +0000 +++ b/src/share/classes/com/sun/corba/se/spi/monitoring/MonitoringManager.java Mon Mar 11 17:35:38 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,6 +24,7 @@ */ package com.sun.corba.se.spi.monitoring; +import java.io.Closeable; import com.sun.corba.se.spi.orb.ORB; import com.sun.corba.se.spi.monitoring.MonitoredObject; import java.util.*; @@ -39,7 +40,7 @@ * @author Hemanth Puttaswamy * </p> */ -public interface MonitoringManager { +public interface MonitoringManager extends Closeable { /////////////////////////////////////// // operations
--- a/src/share/classes/com/sun/corba/se/spi/monitoring/MonitoringManagerFactory.java Wed Jan 09 09:55:11 2013 +0000 +++ b/src/share/classes/com/sun/corba/se/spi/monitoring/MonitoringManagerFactory.java Mon Mar 11 17:35:38 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,4 +40,6 @@ */ MonitoringManager createMonitoringManager( String nameOfTheRoot, String description ); + + void remove(String nameOfTheRoot); }
--- a/src/share/classes/com/sun/corba/se/spi/orb/ORB.java Wed Jan 09 09:55:11 2013 +0000 +++ b/src/share/classes/com/sun/corba/se/spi/orb/ORB.java Mon Mar 11 17:35:38 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -98,6 +98,7 @@ import com.sun.corba.se.impl.presentation.rmi.PresentationManagerImpl ; import com.sun.corba.se.impl.orbutil.ORBClassLoader ; +import sun.awt.AppContext; public abstract class ORB extends com.sun.corba.se.org.omg.CORBA.ORB implements Broker, TypeCodeFactory @@ -171,16 +172,9 @@ private static Map staticWrapperMap = new ConcurrentHashMap(); - private MonitoringManager monitoringManager; + protected MonitoringManager monitoringManager; - // There is only one instance of the PresentationManager - // that is shared between all ORBs. This is necessary - // because RMI-IIOP requires the PresentationManager in - // places where no ORB is available, so the PresentationManager - // must be global. It is initialized here as well. - protected static PresentationManager globalPM = null ; - - static { + private static PresentationManager setupPresentationManager() { staticWrapper = ORBUtilSystemException.get( CORBALogDomains.RPC_PRESENTATION ) ; @@ -218,19 +212,36 @@ return sff ; } } - ) ; + ); - globalPM = new PresentationManagerImpl( useDynamicStub ) ; - globalPM.setStubFactoryFactory( false, + PresentationManager pm = new PresentationManagerImpl( useDynamicStub ) ; + pm.setStubFactoryFactory( false, PresentationDefaults.getStaticStubFactoryFactory() ) ; - globalPM.setStubFactoryFactory( true, dynamicStubFactoryFactory ) ; + pm.setStubFactoryFactory( true, dynamicStubFactoryFactory ) ; + return pm; } - /** Get the single instance of the PresentationManager + public void destroy() { + wrapper = null; + omgWrapper = null; + typeCodeMap = null; + primitiveTypeCodeConstants = null; + byteBufferPool = null; + } + + /** + * Returns the Presentation Manager for the current thread group, using the ThreadGroup-specific + * AppContext to hold it. Creates and records one if needed. */ public static PresentationManager getPresentationManager() { - return globalPM ; + AppContext ac = AppContext.getAppContext(); + PresentationManager pm = (PresentationManager) ac.get(PresentationManager.class); + if (pm == null) { + pm = setupPresentationManager(); + ac.put(PresentationManager.class, pm); + } + return pm; } /** Get the appropriate StubFactoryFactory. This @@ -240,8 +251,9 @@ public static PresentationManager.StubFactoryFactory getStubFactoryFactory() { - boolean useDynamicStubs = globalPM.useDynamicStubs() ; - return globalPM.getStubFactoryFactory( useDynamicStubs ) ; + PresentationManager gPM = getPresentationManager(); + boolean useDynamicStubs = gPM.useDynamicStubs() ; + return gPM.getStubFactoryFactory( useDynamicStubs ) ; } protected ORB() @@ -302,6 +314,9 @@ // Typecode support: needed in both ORBImpl and ORBSingleton public TypeCodeImpl get_primitive_tc(int kind) { + synchronized (this) { + checkShutdownState(); + } try { return primitiveTypeCodeConstants[kind] ; } catch (Throwable t) { @@ -311,15 +326,20 @@ public synchronized void setTypeCode(String id, TypeCodeImpl code) { + checkShutdownState(); typeCodeMap.put(id, code); } public synchronized TypeCodeImpl getTypeCode(String id) { + checkShutdownState(); return (TypeCodeImpl)typeCodeMap.get(id); } public MonitoringManager getMonitoringManager( ) { + synchronized (this) { + checkShutdownState(); + } return monitoringManager; } @@ -434,6 +454,9 @@ */ public Logger getLogger( String domain ) { + synchronized (this) { + checkShutdownState(); + } ORBData odata = getORBData() ; // Determine the correct ORBId. There are 3 cases: @@ -510,6 +533,9 @@ // This method must also be inherited by both ORB and ORBSingleton. public ByteBufferPool getByteBufferPool() { + synchronized (this) { + checkShutdownState(); + } if (byteBufferPool == null) byteBufferPool = new ByteBufferPoolImpl(this); @@ -521,6 +547,7 @@ public abstract ThreadPoolManager getThreadPoolManager(); public abstract CopierManager getCopierManager() ; + } // End of file.
--- a/src/share/classes/com/sun/corba/se/spi/orbutil/threadpool/ThreadPool.java Wed Jan 09 09:55:11 2013 +0000 +++ b/src/share/classes/com/sun/corba/se/spi/orbutil/threadpool/ThreadPool.java Mon Mar 11 17:35:38 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,9 +25,15 @@ package com.sun.corba.se.spi.orbutil.threadpool; +import java.io.Closeable; -public interface ThreadPool +/** This interface defines a thread pool execution service. The ORB uses this + * interface, which preceeds the JDK 5 ExecutorService. Note that the close + * method must be called in order to reclaim thread resources. + */ +public interface ThreadPool extends Closeable { + /** * This method will return any instance of the WorkQueue. If the ThreadPool * instance only services one WorkQueue then that WorkQueue instance will
--- a/src/share/classes/com/sun/corba/se/spi/orbutil/threadpool/ThreadPoolManager.java Wed Jan 09 09:55:11 2013 +0000 +++ b/src/share/classes/com/sun/corba/se/spi/orbutil/threadpool/ThreadPoolManager.java Mon Mar 11 17:35:38 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,9 @@ package com.sun.corba.se.spi.orbutil.threadpool; -public interface ThreadPoolManager +import java.io.Closeable; + +public interface ThreadPoolManager extends Closeable { /** * This method will return an instance of the threadpool given a threadpoolId,
--- a/src/share/classes/com/sun/corba/se/spi/protocol/PIHandler.java Wed Jan 09 09:55:11 2013 +0000 +++ b/src/share/classes/com/sun/corba/se/spi/protocol/PIHandler.java Mon Mar 11 17:35:38 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,8 @@ package com.sun.corba.se.spi.protocol; +import java.io.Closeable; + import org.omg.PortableInterceptor.ObjectReferenceTemplate ; import org.omg.PortableInterceptor.Interceptor ; import org.omg.PortableInterceptor.Current ; @@ -51,7 +53,7 @@ /** This interface defines the PI interface that is used to interface the rest of the * ORB to the PI implementation. */ -public interface PIHandler { +public interface PIHandler extends Closeable { /** Complete the initialization of the PIHandler. This will execute the methods * on the ORBInitializers, if any are defined. This must be done here so that * the ORB can obtain the PIHandler BEFORE the ORBInitializers run, since they
--- a/src/share/classes/com/sun/corba/se/spi/protocol/RequestDispatcherRegistry.java Wed Jan 09 09:55:11 2013 +0000 +++ b/src/share/classes/com/sun/corba/se/spi/protocol/RequestDispatcherRegistry.java Mon Mar 11 17:35:38 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -37,33 +37,59 @@ * This is a registry of all subcontract ID dependent objects. This includes: * LocalClientRequestDispatcherFactory, ClientRequestDispatcher, ServerRequestDispatcher, and * ObjectAdapterFactory. - * XXX Should the registerXXX methods take an scid or not? I think we - * want to do this so that the same instance can be shared across multiple - * scids (and this is already true for ObjectAdapterFactory and LocalClientRequestDispatcherFactory), - * but this will require some changes for ClientRequestDispatcher and ServerRequestDispatcher. */ public interface RequestDispatcherRegistry { - // XXX needs javadocs! + /** Register a ClientRequestDispatcher for a particular subcontract ID. + * The subcontract ID appears in the ObjectKey of an object reference, and is used + * to control how a remote method invocation is processed by the ORB for a + * particular kind of object reference. + */ void registerClientRequestDispatcher( ClientRequestDispatcher csc, int scid) ; + /** Get the ClientRequestDispatcher for subcontract ID scid. + */ ClientRequestDispatcher getClientRequestDispatcher( int scid ) ; + /** Register a LocalClientRequestDispatcher for a particular subcontract ID. + * The subcontract ID appears in the ObjectKey of an object reference, and is used + * to control how a particular kind of colocated request is processed. + */ void registerLocalClientRequestDispatcherFactory( LocalClientRequestDispatcherFactory csc, int scid) ; + /** Get the LocalClientRequestDispatcher for subcontract ID scid. + */ LocalClientRequestDispatcherFactory getLocalClientRequestDispatcherFactory( int scid ) ; + /** Register a CorbaServerRequestDispatcher for a particular subcontract ID. + * The subcontract ID appears in the ObjectKey of an object reference, and is used + * to control how a particular kind of request is processed when received by the ORB. + */ void registerServerRequestDispatcher( CorbaServerRequestDispatcher ssc, int scid) ; + /** Get the CorbaServerRequestDispatcher for subcontract ID scid. + */ CorbaServerRequestDispatcher getServerRequestDispatcher(int scid) ; + /** Register a CorbaServerRequestDispatcher for handling an explicit object key name. + * This is used for non-standard invocations such as INS and the bootstrap name service. + */ void registerServerRequestDispatcher( CorbaServerRequestDispatcher ssc, String name ) ; + /** Get the CorbaServerRequestDispatcher for a particular object key. + */ CorbaServerRequestDispatcher getServerRequestDispatcher( String name ) ; + /** Register an ObjectAdapterFactory for a particular subcontract ID. + * This controls how Object references are created and managed. + */ void registerObjectAdapterFactory( ObjectAdapterFactory oaf, int scid) ; + /** Get the ObjectAdapterFactory for a particular subcontract ID scid. + */ ObjectAdapterFactory getObjectAdapterFactory( int scid ) ; - Set getObjectAdapterFactories() ; + /** Return the set of all ObjectAdapterFactory instances that are registered. + */ + Set<ObjectAdapterFactory> getObjectAdapterFactories(); }
--- a/src/share/classes/com/sun/tools/corba/se/idl/idl_ja.prp Wed Jan 09 09:55:11 2013 +0000 +++ b/src/share/classes/com/sun/tools/corba/se/idl/idl_ja.prp Mon Mar 11 17:35:38 2013 +0100 @@ -68,7 +68,7 @@ Compile.parseDone=\u5B8C\u4E86 - %0 Compile.generating=%0\u306E\u751F\u6210\u4E2D Compile.genDone=\u5B8C\u4E86 - %0 -Deprecated.keyword=\u8B66\u544A: \u30AD\u30FC\u30EF\u30FC\u30C9`%0'\u306F\u63A8\u5968\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002 +Deprecated.keyword=\u8B66\u544A: \u30AD\u30FC\u30EF\u30FC\u30C9`%0'\u306F\u975E\u63A8\u5968\u3067\u3059\u3002 EvaluationException.1=%0\u6F14\u7B97\u5B50\u306E\u30AA\u30DA\u30E9\u30F3\u30C9\u306B\u4E00\u8CAB\u6027\u304C\u3042\u308A\u307E\u305B\u3093: %1\u304A\u3088\u3073%2\u3002 EvaluationException.2=%0\u6F14\u7B97\u5B50\u306E\u30AA\u30DA\u30E9\u30F3\u30C9\u306F\u3001%1\u3067\u306F\u306A\u304F\u6570\u5024\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002 EvaluationException.or=\u30D3\u30C3\u30C8\u5358\u4F4D\u306EOR\u6F14\u7B97 @@ -173,5 +173,5 @@ # -i, -d, -keep, -emitAll, -noWarn, -v, -verbose, -version, #define # Do not translate the string "java com.sun.tools.corba.se.idl.Compile" -usage=\u30B3\u30F3\u30D1\u30A4\u30E9\u306E\u4F7F\u7528\u65B9\u6CD5:\n\ java com.sun.tools.corba.se.idl.Compile [options] <idl file>\n<idl file>\u306FIDL\u5B9A\u7FA9\u3092\u542B\u3080\u30D5\u30A1\u30A4\u30EB\u306E\u540D\u524D\u3067\u3001\n[options]\u306F\u6B21\u306B\u30EA\u30B9\u30C8\u3059\u308B\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u7D44\u5408\u305B\u3067\u3059\u3002\u30AA\u30D7\u30B7\u30E7\u30F3\u306F\n\u7701\u7565\u53EF\u80FD\u3067\u3001\u4EFB\u610F\u306E\u9806\u5E8F\u3067\u8868\u793A\u3055\u308C\u307E\u3059\u3002<idl file>\u306F\u5FC5\u9808\u3067\u3001\n\u6700\u5F8C\u306B\u8868\u793A\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n\ \n\u30AA\u30D7\u30B7\u30E7\u30F3:\n-d <symbol> IDL\u30D5\u30A1\u30A4\u30EB\u306E\u6B21\u306E\u884C\u3068\n\ \u540C\u3058\u3067\u3059: #define <symbol>\n-emitAll #included\u30D5\u30A1\u30A4\u30EB\u3067\u898B\u3064\u304B\u3063\u305F\u30BF\u30A4\u30D7\u3092\u542B\u3080\u3001\u3059\u3079\u3066\u306E\u30BF\u30A4\u30D7\u3092\n\ \u767A\u884C\u3057\u307E\u3059\u3002\n-i <include path> \u30C7\u30D5\u30A9\u30EB\u30C8\u3067\u306F\u3001\u73FE\u5728\u306E\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E\u30A4\u30F3\u30AF\u30EB\u30FC\u30C9\u3055\u308C\u305F\u30D5\u30A1\u30A4\u30EB\u304C\n\ \u30B9\u30AD\u30E3\u30F3\u3055\u308C\u307E\u3059\u3002\u3053\u306E\u30AA\u30D7\u30B7\u30E7\u30F3\u306F\u5225\u306E\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3092\u8FFD\u52A0\u3057\u307E\u3059\u3002\n-keep \u751F\u6210\u3055\u308C\u308B\u30D5\u30A1\u30A4\u30EB\u304C\u3059\u3067\u306B\u5B58\u5728\u3059\u308B\u5834\u5408\u306F\u3001\u4E0A\u66F8\u304D\n\ \u3057\u307E\u305B\u3093\u3002\u30C7\u30D5\u30A9\u30EB\u30C8\u3067\u306F\u4E0A\u66F8\u304D\u3055\u308C\u307E\u3059\u3002\n-noWarn \u8B66\u544A\u3092\u51FA\u3055\u306A\u3044\u3088\u3046\u306B\u3057\u307E\u3059\u3002\n-v, -verbose \u8A73\u7D30\u30E2\u30FC\u30C9\u3002\n-version \u30D0\u30FC\u30B8\u30E7\u30F3\u756A\u53F7\u3092\u8868\u793A\u3057\u307E\u3059\u3002\n +usage=\u30B3\u30F3\u30D1\u30A4\u30E9\u306E\u4F7F\u7528\u65B9\u6CD5:\n java com.sun.tools.corba.se.idl.Compile [options] <idl file>\n<idl file>\u306FIDL\u5B9A\u7FA9\u3092\u542B\u3080\u30D5\u30A1\u30A4\u30EB\u306E\u540D\u524D\u3067\u3001\n[options]\u306F\u6B21\u306B\u30EA\u30B9\u30C8\u3059\u308B\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u7D44\u5408\u305B\u3067\u3059\u3002\u30AA\u30D7\u30B7\u30E7\u30F3\u306F\n\u7701\u7565\u53EF\u80FD\u3067\u3001\u4EFB\u610F\u306E\u9806\u5E8F\u3067\u8868\u793A\u3055\u308C\u307E\u3059\u3002<idl file>\u306F\u5FC5\u9808\u3067\u3001\n\u6700\u5F8C\u306B\u8868\u793A\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n \n\u30AA\u30D7\u30B7\u30E7\u30F3:\n-d <symbol> IDL\u30D5\u30A1\u30A4\u30EB\u306E\u6B21\u306E\u884C\u3068\n \u540C\u3058\u3067\u3059: #define <symbol>\n-emitAll #included\u30D5\u30A1\u30A4\u30EB\u3067\u898B\u3064\u304B\u3063\u305F\u30BF\u30A4\u30D7\u3092\u542B\u3080\u3001\u3059\u3079\u3066\u306E\u30BF\u30A4\u30D7\u3092\n \u767A\u884C\u3057\u307E\u3059\u3002\n-i <include path> \u30C7\u30D5\u30A9\u30EB\u30C8\u3067\u306F\u3001\u73FE\u5728\u306E\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E\u30A4\u30F3\u30AF\u30EB\u30FC\u30C9\u3055\u308C\u305F\u30D5\u30A1\u30A4\u30EB\u304C\n \u30B9\u30AD\u30E3\u30F3\u3055\u308C\u307E\u3059\u3002\u3053\u306E\u30AA\u30D7\u30B7\u30E7\u30F3\u306F\u5225\u306E\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3092\u8FFD\u52A0\u3057\u307E\u3059\u3002\n-keep \u751F\u6210\u3055\u308C\u308B\u30D5\u30A1\u30A4\u30EB\u304C\u3059\u3067\u306B\u5B58\u5728\u3059\u308B\u5834\u5408\u306F\u3001\u4E0A\u66F8\u304D\n \u3057\u307E\u305B\u3093\u3002\u30C7\u30D5\u30A9\u30EB\u30C8\u3067\u306F\u4E0A\u66F8\u304D\u3055\u308C\u307E\u3059\u3002\n-noWarn \u8B66\u544A\u3092\u51FA\u3055\u306A\u3044\u3088\u3046\u306B\u3057\u307E\u3059\u3002\n-v, -verbose \u8A73\u7D30\u30E2\u30FC\u30C9\u3002\n-version \u30D0\u30FC\u30B8\u30E7\u30F3\u756A\u53F7\u3092\u8868\u793A\u3057\u307E\u3059\u3002\n
--- a/src/share/classes/com/sun/tools/corba/se/idl/idl_zh_CN.prp Wed Jan 09 09:55:11 2013 +0000 +++ b/src/share/classes/com/sun/tools/corba/se/idl/idl_zh_CN.prp Mon Mar 11 17:35:38 2013 +0100 @@ -173,5 +173,5 @@ # -i, -d, -keep, -emitAll, -noWarn, -v, -verbose, -version, #define # Do not translate the string "java com.sun.tools.corba.se.idl.Compile" -usage=\u7F16\u8BD1\u5668\u7528\u6CD5:\n\ java com.sun.tools.corba.se.idl.Compile [\u9009\u9879] <idl \u6587\u4EF6>\n\u5176\u4E2D, <idl \u6587\u4EF6> \u662F\u5305\u542B IDL \u5B9A\u4E49\u7684\u6587\u4EF6\u7684\u540D\u79F0, \u800C\n[\u9009\u9879] \u662F\u4E0B\u5217\u9009\u9879\u7684\u4EFB\u610F\u7EC4\u5408\u3002\u8FD9\u4E9B\u9009\u9879\n\u662F\u53EF\u9009\u7684, \u5E76\u4E14\u663E\u793A\u987A\u5E8F\u5E76\u4E0D\u56FA\u5B9A; <idl \u6587\u4EF6> \u662F\u5FC5\u9700\u7684\n\u5E76\u4E14\u5FC5\u987B\u663E\u793A\u5728\u6700\u540E\u3002\n\ \n\u9009\u9879:\n-d <\u7B26\u53F7> \u8FD9\u7B49\u540C\u4E8E IDL \u6587\u4EF6\u4E2D\u7684\n\ \u4E0B\u9762\u4E00\u884C: #define <\u7B26\u53F7>\n-emitAll \u53D1\u51FA\u6240\u6709\u7C7B\u578B, \u5305\u62EC\u5728 #included\n\ \u6587\u4EF6\u4E2D\u627E\u5230\u7684\u7C7B\u578B\u3002\n-i <\u5305\u542B\u8DEF\u5F84> \u9ED8\u8BA4\u60C5\u51B5\u4E0B, \u5C06\u5728\u5F53\u524D\u76EE\u5F55\u4E2D\u626B\u63CF\n\ \u5305\u542B\u7684\u6587\u4EF6\u3002\u6B64\u9009\u9879\u5C06\u6DFB\u52A0\u53E6\u4E00\u4E2A\u76EE\u5F55\u3002\n-keep \u5982\u679C\u8981\u751F\u6210\u7684\u6587\u4EF6\u5DF2\u5B58\u5728, \u8BF7\u4E0D\u8981\n\ \u8986\u76D6\u5B83\u3002\u9ED8\u8BA4\u60C5\u51B5\u4E0B\u4F1A\u8986\u76D6\u5B83\u3002\n-noWarn \u9690\u85CF\u8B66\u544A\u3002\n-v, -verbose \u8BE6\u7EC6\u6A21\u5F0F\u3002\n-version \u663E\u793A\u7248\u672C\u53F7\u3002\n +usage=\u7F16\u8BD1\u5668\u7528\u6CD5:\n java com.sun.tools.corba.se.idl.Compile [\u9009\u9879] <idl \u6587\u4EF6>\n\u5176\u4E2D, <idl \u6587\u4EF6> \u662F\u5305\u542B IDL \u5B9A\u4E49\u7684\u6587\u4EF6\u7684\u540D\u79F0, \u800C\n[\u9009\u9879] \u662F\u4E0B\u5217\u9009\u9879\u7684\u4EFB\u610F\u7EC4\u5408\u3002\u8FD9\u4E9B\u9009\u9879\n\u662F\u53EF\u9009\u7684, \u5E76\u4E14\u663E\u793A\u987A\u5E8F\u5E76\u4E0D\u56FA\u5B9A; <idl \u6587\u4EF6> \u662F\u5FC5\u9700\u7684\n\u5E76\u4E14\u5FC5\u987B\u663E\u793A\u5728\u6700\u540E\u3002\n \n\u9009\u9879:\n-d <\u7B26\u53F7> \u8FD9\u7B49\u540C\u4E8E IDL \u6587\u4EF6\u4E2D\u7684\n \u4E0B\u9762\u4E00\u884C: #define <\u7B26\u53F7>\n-emitAll \u53D1\u51FA\u6240\u6709\u7C7B\u578B, \u5305\u62EC\u5728 #included\n \u6587\u4EF6\u4E2D\u627E\u5230\u7684\u7C7B\u578B\u3002\n-i <\u5305\u542B\u8DEF\u5F84> \u9ED8\u8BA4\u60C5\u51B5\u4E0B, \u5C06\u5728\u5F53\u524D\u76EE\u5F55\u4E2D\u626B\u63CF\n \u5305\u542B\u7684\u6587\u4EF6\u3002\u6B64\u9009\u9879\u5C06\u6DFB\u52A0\u53E6\u4E00\u4E2A\u76EE\u5F55\u3002\n-keep \u5982\u679C\u8981\u751F\u6210\u7684\u6587\u4EF6\u5DF2\u5B58\u5728, \u8BF7\u4E0D\u8981\n \u8986\u76D6\u5B83\u3002\u9ED8\u8BA4\u60C5\u51B5\u4E0B\u4F1A\u8986\u76D6\u5B83\u3002\n-noWarn \u9690\u85CF\u8B66\u544A\u3002\n-v, -verbose \u8BE6\u7EC6\u6A21\u5F0F\u3002\n-version \u663E\u793A\u7248\u672C\u53F7\u3002\n
--- a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/toJavaPortable_ja.prp Wed Jan 09 09:55:11 2013 +0000 +++ b/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/toJavaPortable_ja.prp Mon Mar 11 17:35:38 2013 +0100 @@ -65,4 +65,4 @@ # -d, -emitAll, -f, -i, -keep, -m, -sep, -pkgPrefix, -td, -v, -verbose, -version, -implbase # Do not translate the string "java com.sun.tools.corba.se.idl.toJavaPortable.Compile" # -usage=\u30B3\u30F3\u30D1\u30A4\u30E9\u306E\u4F7F\u7528\u65B9\u6CD5:\n\n\ java com.sun.tools.corba.se.idl.toJavaPortable.Compile [options] <idl file>\n\n<idl file>\u306FIDL\u5B9A\u7FA9\u3092\u542B\u3080\u30D5\u30A1\u30A4\u30EB\u306E\u540D\u524D\u3067\u3001\n[options]\u306F\u6B21\u306B\u30EA\u30B9\u30C8\u3059\u308B\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u7D44\u5408\u305B\u3067\u3059\u3002\u30AA\u30D7\u30B7\u30E7\u30F3\u306F\n\u7701\u7565\u53EF\u80FD\u3067\u3001\u4EFB\u610F\u306E\u9806\u5E8F\u3067\u8868\u793A\u3055\u308C\u307E\u3059\u3002<idl file>\u306F\u5FC5\u9808\u3067\u3001\n\u6700\u5F8C\u306B\u8868\u793A\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n\ \n\u30AA\u30D7\u30B7\u30E7\u30F3:\n-d <symbol> IDL\u30D5\u30A1\u30A4\u30EB\u306E\u6B21\u306E\u884C\u3068\n\ \u540C\u3058\u3067\u3059: #define <symbol>\n-emitAll #included\u30D5\u30A1\u30A4\u30EB\u3067\u898B\u3064\u304B\u3063\u305F\u30BF\u30A4\u30D7\u3092\u542B\u3080\u3001\u3059\u3079\u3066\u306E\u30BF\u30A4\u30D7\u3092\u767A\u884C\u3057\u307E\u3059\u3002\n-f<side> \u767A\u884C\u3059\u308B\u30D0\u30A4\u30F3\u30C7\u30A3\u30F3\u30B0\u3092\u5B9A\u7FA9\u3057\u307E\u3059\u3002<side>\u306Fclient\u3001\n\ server\u3001all\u3001serverTIE\u3001allTIE\u306E\u3044\u305A\u308C\u304B\u3067\u3059\u3002serverTIE\u3068allTIE\u306F\n\ \u59D4\u4EFB\u30E2\u30C7\u30EB\u30FB\u30B9\u30B1\u30EB\u30C8\u30F3\u3092\u767A\u884C\u3057\u307E\u3059\u3002\u3053\u306E\u30D5\u30E9\u30B0\u3092\n\ \u4F7F\u7528\u3057\u306A\u3044\u5834\u5408\u306F\u3001-fclient\u3068\u307F\u306A\u3055\u308C\u307E\u3059\u3002\n-i <include path> \u30C7\u30D5\u30A9\u30EB\u30C8\u3067\u306F\u3001\u73FE\u5728\u306E\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E\u30A4\u30F3\u30AF\u30EB\u30FC\u30C9\u3055\u308C\u305F\u30D5\u30A1\u30A4\u30EB\u304C\n\ \u30B9\u30AD\u30E3\u30F3\u3055\u308C\u307E\u3059\u3002\u3053\u306E\u30AA\u30D7\u30B7\u30E7\u30F3\u306F\u5225\u306E\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3092\u8FFD\u52A0\u3057\u307E\u3059\u3002\n-keep \u751F\u6210\u3055\u308C\u308B\u30D5\u30A1\u30A4\u30EB\u304C\u3059\u3067\u306B\u5B58\u5728\u3059\u308B\u5834\u5408\u306F\u3001\u4E0A\u66F8\u304D\n\ \u3057\u307E\u305B\u3093\u3002\u30C7\u30D5\u30A9\u30EB\u30C8\u3067\u306F\u4E0A\u66F8\u304D\u3055\u308C\u307E\u3059\u3002\n-noWarn \u8B66\u544A\u3092\u51FA\u3055\u306A\u3044\u3088\u3046\u306B\u3057\u307E\u3059\u3002\n-oldImplBase \u53E4\u3044(1.4\u4EE5\u524D) JDK ORB\u3068\u4E92\u63DB\u6027\u306E\u3042\u308B\u30B9\u30B1\u30EB\u30C8\u30F3\u3092\u751F\u6210\u3057\u307E\u3059\u3002\n-pkgPrefix <t> <prefix> \u30D5\u30A1\u30A4\u30EB\u30FB\u30B9\u30B3\u30FC\u30D7\u3067\u30BF\u30A4\u30D7\u307E\u305F\u306F\u30E2\u30B8\u30E5\u30FC\u30EB\u540D<t>\u304C\u691C\u51FA\u3055\u308C\u305F\u5834\u5408\u3001\n\ <t>\u306B\u5BFE\u3057\u3066\u751F\u6210\u3055\u308C\u305F\u3059\u3079\u3066\u306E\u30D5\u30A1\u30A4\u30EB\u306EJava\u30D1\u30C3\u30B1\u30FC\u30B8\u540D\u3092\n\ <prefix>\u3067\u59CB\u3081\u307E\u3059\u3002\n-pkgTranslate <t> <pkg> \u30BF\u30A4\u30D7\u307E\u305F\u306F\u30E2\u30B8\u30E5\u30FC\u30EB\u540D<t>\u304C\u691C\u51FA\u3055\u308C\u305F\u5834\u5408\u3001\n\ \u751F\u6210\u3055\u308C\u305FJava\u30D1\u30C3\u30B1\u30FC\u30B8\u5185\u3067<pkg>\u306B\u7F6E\u63DB\u3055\u308C\u307E\u3059\u3002pkgPrefix\u306E\n\ \u5909\u66F4\u304C\u5148\u306B\u884C\u308F\u308C\u308B\u3053\u3068\u306B\u6CE8\u610F\u3057\u3066\u304F\u3060\u3055\u3044\u3002<t>\u306F\u30D1\u30C3\u30B1\u30FC\u30B8\u306E\n\ \u6B63\u5F0F\u540D\u3068\u5B8C\u5168\u306B\u4E00\u81F4\u3057\u3066\u3044\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\u307E\u305F\u3001<t>\u3092\n\ org\u3001org.omg\u307E\u305F\u306Forg.omg\u306E\u30B5\u30D6\u30D1\u30C3\u30B1\u30FC\u30B8\u306B\u3057\u306A\u3044\u3067\u304F\u3060\u3055\u3044\u3002\n-skeletonName <xxx%yyy> \u30D1\u30BF\u30FC\u30F3\u306B\u5F93\u3063\u3066\u30B9\u30B1\u30EB\u30C8\u30F3\u306B\u540D\u524D\u3092\u4ED8\u3051\u307E\u3059\u3002\n\ \u30C7\u30D5\u30A9\u30EB\u30C8\u306F\u6B21\u306E\u3068\u304A\u308A\u3067\u3059:\n\ POA\u30D9\u30FC\u30B9\u30FB\u30AF\u30E9\u30B9\u306E\u5834\u5408\u306F%POA (-fserver\u307E\u305F\u306F-fall) \n\ oldImplBase\u30D9\u30FC\u30B9\u30FB\u30AF\u30E9\u30B9\u306E\u5834\u5408\u306F_%ImplBase\n\ (-oldImplBase\u304A\u3088\u3073(-fserver\u307E\u305F\u306F-fall))\u3002\n-td <dir> \u51FA\u529B\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306B\u306F\u3001\u73FE\u5728\u306E\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E\u304B\u308F\u308A\u306B<dir>\u3092\n\ \u4F7F\u7528\u3057\u307E\u3059\u3002\n-tieName <xxx%yyy> \u30D1\u30BF\u30FC\u30F3\u306B\u5F93\u3063\u3066tie\u306B\u540D\u524D\u3092\u4ED8\u3051\u307E\u3059\u3002\u30C7\u30D5\u30A9\u30EB\u30C8\u306F\u6B21\u306E\u3068\u304A\u308A\u3067\u3059:\n\ POA tie\u306E\u5834\u5408\u306F%POATie (-fserverTie\u307E\u305F\u306F-fallTie) \n\ oldImplBase tie\u306E\u5834\u5408\u306F%_Tie\n\ (-oldImplBase\u304A\u3088\u3073(-fserverTie\u307E\u305F\u306F-fallTie))\u3002\n-v, -verbose \u8A73\u7D30\u30E2\u30FC\u30C9\u3002\n-version \u30D0\u30FC\u30B8\u30E7\u30F3\u756A\u53F7\u3092\u8868\u793A\u3057\u3066\u7D42\u4E86\u3057\u307E\u3059\u3002\n +usage=\u30B3\u30F3\u30D1\u30A4\u30E9\u306E\u4F7F\u7528\u65B9\u6CD5:\n\n java com.sun.tools.corba.se.idl.toJavaPortable.Compile [options] <idl file>\n\n<idl file>\u306FIDL\u5B9A\u7FA9\u3092\u542B\u3080\u30D5\u30A1\u30A4\u30EB\u306E\u540D\u524D\u3067\u3001\n[options]\u306F\u6B21\u306B\u30EA\u30B9\u30C8\u3059\u308B\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u7D44\u5408\u305B\u3067\u3059\u3002\u30AA\u30D7\u30B7\u30E7\u30F3\u306F\n\u7701\u7565\u53EF\u80FD\u3067\u3001\u4EFB\u610F\u306E\u9806\u5E8F\u3067\u8868\u793A\u3055\u308C\u307E\u3059\u3002<idl file>\u306F\u5FC5\u9808\u3067\u3001\n\u6700\u5F8C\u306B\u8868\u793A\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n \n\u30AA\u30D7\u30B7\u30E7\u30F3:\n-d <symbol> IDL\u30D5\u30A1\u30A4\u30EB\u306E\u6B21\u306E\u884C\u3068\n \u540C\u3058\u3067\u3059: #define <symbol>\n-emitAll #included\u30D5\u30A1\u30A4\u30EB\u3067\u898B\u3064\u304B\u3063\u305F\u30BF\u30A4\u30D7\u3092\u542B\u3080\u3001\u3059\u3079\u3066\u306E\u30BF\u30A4\u30D7\u3092\u767A\u884C\u3057\u307E\u3059\u3002\n-f<side> \u767A\u884C\u3059\u308B\u30D0\u30A4\u30F3\u30C7\u30A3\u30F3\u30B0\u3092\u5B9A\u7FA9\u3057\u307E\u3059\u3002<side>\u306Fclient\u3001\n server\u3001all\u3001serverTIE\u3001allTIE\u306E\u3044\u305A\u308C\u304B\u3067\u3059\u3002serverTIE\u3068allTIE\u306F\n \u59D4\u4EFB\u30E2\u30C7\u30EB\u30FB\u30B9\u30B1\u30EB\u30C8\u30F3\u3092\u767A\u884C\u3057\u307E\u3059\u3002\u3053\u306E\u30D5\u30E9\u30B0\u3092\n \u4F7F\u7528\u3057\u306A\u3044\u5834\u5408\u306F\u3001-fclient\u3068\u307F\u306A\u3055\u308C\u307E\u3059\u3002\n-i <include path> \u30C7\u30D5\u30A9\u30EB\u30C8\u3067\u306F\u3001\u73FE\u5728\u306E\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E\u30A4\u30F3\u30AF\u30EB\u30FC\u30C9\u3055\u308C\u305F\u30D5\u30A1\u30A4\u30EB\u304C\n \u30B9\u30AD\u30E3\u30F3\u3055\u308C\u307E\u3059\u3002\u3053\u306E\u30AA\u30D7\u30B7\u30E7\u30F3\u306F\u5225\u306E\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3092\u8FFD\u52A0\u3057\u307E\u3059\u3002\n-keep \u751F\u6210\u3055\u308C\u308B\u30D5\u30A1\u30A4\u30EB\u304C\u3059\u3067\u306B\u5B58\u5728\u3059\u308B\u5834\u5408\u306F\u3001\u4E0A\u66F8\u304D\n \u3057\u307E\u305B\u3093\u3002\u30C7\u30D5\u30A9\u30EB\u30C8\u3067\u306F\u4E0A\u66F8\u304D\u3055\u308C\u307E\u3059\u3002\n-noWarn \u8B66\u544A\u3092\u51FA\u3055\u306A\u3044\u3088\u3046\u306B\u3057\u307E\u3059\u3002\n-oldImplBase \u53E4\u3044(1.4\u4EE5\u524D) JDK ORB\u3068\u4E92\u63DB\u6027\u306E\u3042\u308B\u30B9\u30B1\u30EB\u30C8\u30F3\u3092\u751F\u6210\u3057\u307E\u3059\u3002\n-pkgPrefix <t> <prefix> \u30D5\u30A1\u30A4\u30EB\u30FB\u30B9\u30B3\u30FC\u30D7\u3067\u30BF\u30A4\u30D7\u307E\u305F\u306F\u30E2\u30B8\u30E5\u30FC\u30EB\u540D<t>\u304C\u691C\u51FA\u3055\u308C\u305F\u5834\u5408\u3001\n <t>\u306B\u5BFE\u3057\u3066\u751F\u6210\u3055\u308C\u305F\u3059\u3079\u3066\u306E\u30D5\u30A1\u30A4\u30EB\u306EJava\u30D1\u30C3\u30B1\u30FC\u30B8\u540D\u3092\n <prefix>\u3067\u59CB\u3081\u307E\u3059\u3002\n-pkgTranslate <t> <pkg> \u30BF\u30A4\u30D7\u307E\u305F\u306F\u30E2\u30B8\u30E5\u30FC\u30EB\u540D<t>\u304C\u691C\u51FA\u3055\u308C\u305F\u5834\u5408\u3001\n \u751F\u6210\u3055\u308C\u305FJava\u30D1\u30C3\u30B1\u30FC\u30B8\u5185\u3067<pkg>\u306B\u7F6E\u63DB\u3055\u308C\u307E\u3059\u3002pkgPrefix\u306E\n \u5909\u66F4\u304C\u5148\u306B\u884C\u308F\u308C\u308B\u3053\u3068\u306B\u6CE8\u610F\u3057\u3066\u304F\u3060\u3055\u3044\u3002<t>\u306F\u30D1\u30C3\u30B1\u30FC\u30B8\u306E\n \u6B63\u5F0F\u540D\u3068\u5B8C\u5168\u306B\u4E00\u81F4\u3057\u3066\u3044\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\u307E\u305F\u3001<t>\u3092\n org\u3001org.omg\u307E\u305F\u306Forg.omg\u306E\u30B5\u30D6\u30D1\u30C3\u30B1\u30FC\u30B8\u306B\u3057\u306A\u3044\u3067\u304F\u3060\u3055\u3044\u3002\n-skeletonName <xxx%yyy> \u30D1\u30BF\u30FC\u30F3\u306B\u5F93\u3063\u3066\u30B9\u30B1\u30EB\u30C8\u30F3\u306B\u540D\u524D\u3092\u4ED8\u3051\u307E\u3059\u3002\n \u30C7\u30D5\u30A9\u30EB\u30C8\u306F\u6B21\u306E\u3068\u304A\u308A\u3067\u3059:\n POA\u30D9\u30FC\u30B9\u30FB\u30AF\u30E9\u30B9\u306E\u5834\u5408\u306F%POA (-fserver\u307E\u305F\u306F-fall) \n oldImplBase\u30D9\u30FC\u30B9\u30FB\u30AF\u30E9\u30B9\u306E\u5834\u5408\u306F_%ImplBase\n (-oldImplBase\u304A\u3088\u3073(-fserver\u307E\u305F\u306F-fall))\u3002\n-td <dir> \u51FA\u529B\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306B\u306F\u3001\u73FE\u5728\u306E\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E\u304B\u308F\u308A\u306B<dir>\u3092\n \u4F7F\u7528\u3057\u307E\u3059\u3002\n-tieName <xxx%yyy> \u30D1\u30BF\u30FC\u30F3\u306B\u5F93\u3063\u3066tie\u306B\u540D\u524D\u3092\u4ED8\u3051\u307E\u3059\u3002\u30C7\u30D5\u30A9\u30EB\u30C8\u306F\u6B21\u306E\u3068\u304A\u308A\u3067\u3059:\n POA tie\u306E\u5834\u5408\u306F%POATie (-fserverTie\u307E\u305F\u306F-fallTie) \n oldImplBase tie\u306E\u5834\u5408\u306F%_Tie\n (-oldImplBase\u304A\u3088\u3073(-fserverTie\u307E\u305F\u306F-fallTie))\u3002\n-v, -verbose \u8A73\u7D30\u30E2\u30FC\u30C9\u3002\n-version \u30D0\u30FC\u30B8\u30E7\u30F3\u756A\u53F7\u3092\u8868\u793A\u3057\u3066\u7D42\u4E86\u3057\u307E\u3059\u3002\n
--- a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/toJavaPortable_zh_CN.prp Wed Jan 09 09:55:11 2013 +0000 +++ b/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/toJavaPortable_zh_CN.prp Mon Mar 11 17:35:38 2013 +0100 @@ -65,4 +65,4 @@ # -d, -emitAll, -f, -i, -keep, -m, -sep, -pkgPrefix, -td, -v, -verbose, -version, -implbase # Do not translate the string "java com.sun.tools.corba.se.idl.toJavaPortable.Compile" # -usage=\u7F16\u8BD1\u5668\u7528\u6CD5:\n\n\ java com.sun.tools.corba.se.idl.toJavaPortable.Compile [\u9009\u9879] <idl \u6587\u4EF6>\n\n\u5176\u4E2D, <idl \u6587\u4EF6> \u662F\u5305\u542B IDL \u5B9A\u4E49\u7684\u6587\u4EF6\u7684\u540D\u79F0, \u800C\n[\u9009\u9879] \u662F\u4E0B\u5217\u9009\u9879\u7684\u4EFB\u610F\u7EC4\u5408\u3002\u9009\u9879\n\u662F\u53EF\u9009\u7684, \u5E76\u4E14\u663E\u793A\u987A\u5E8F\u5E76\u4E0D\u56FA\u5B9A; <idl \u6587\u4EF6> \u662F\u5FC5\u9700\u7684,\n\u5E76\u4E14\u5FC5\u987B\u663E\u793A\u5728\u6700\u540E\u3002\n\ \n\u9009\u9879:\n-d <\u7B26\u53F7> \u8FD9\u7B49\u540C\u4E8E IDL \u6587\u4EF6\u4E2D\u7684\n\ \u4E0B\u9762\u4E00\u884C: #define <\u7B26\u53F7>\n-emitAll \u53D1\u51FA\u6240\u6709\u7C7B\u578B, \u5305\u62EC\u5728 #included \u6587\u4EF6\u4E2D\u627E\u5230\u7684\u7C7B\u578B\u3002\n-f<side> \u5B9A\u4E49\u8981\u53D1\u51FA\u54EA\u4E9B\u7ED1\u5B9A\u3002<side> \u662F client,\n\ server, all, serverTIE, allTIE \u4E4B\u4E00\u3002serverTIE \u548C allTIE\n\ \u5BFC\u81F4\u53D1\u51FA\u59D4\u6D3E\u6A21\u578B\u9AA8\u67B6\u3002\u5982\u679C\u672A\u4F7F\u7528\n\ \u6B64\u6807\u8BB0, \u5C06\u5047\u5B9A\u4E3A -fclient\u3002\n-i <\u5305\u542B\u8DEF\u5F84> \u9ED8\u8BA4\u60C5\u51B5\u4E0B, \u5C06\u5728\u5F53\u524D\u76EE\u5F55\u4E2D\u626B\u63CF\n\ \u5305\u542B\u7684\u6587\u4EF6\u3002\u6B64\u9009\u9879\u5C06\u6DFB\u52A0\u53E6\u4E00\u4E2A\u76EE\u5F55\u3002\n-keep \u5982\u679C\u8981\u751F\u6210\u7684\u6587\u4EF6\u5DF2\u5B58\u5728, \u8BF7\u4E0D\u8981\n\ \u8986\u76D6\u5B83\u3002\u9ED8\u8BA4\u60C5\u51B5\u4E0B\u4F1A\u8986\u76D6\u5B83\u3002\n-noWarn \u9690\u85CF\u8B66\u544A\u3002\n-oldImplBase \u751F\u6210\u4E0E\u65E7\u7248 (1.4 \u7248\u4E4B\u524D) JDK ORB \u517C\u5BB9\u7684\u9AA8\u67B6\u3002\n-pkgPrefix <t> <\u524D\u7F00> \u5F53\u5728\u6587\u4EF6\u8303\u56F4\u5185\u9047\u5230\u7C7B\u578B\u6216\u6A21\u5757\u540D <t> \u65F6,\n\ \u5728\u4E3A <t> \u751F\u6210\u7684\u6240\u6709\u6587\u4EF6\u7684 Java \u7A0B\u5E8F\u5305\u540D\u524D\n\ \u6DFB\u52A0 <\u524D\u7F00>\u3002\n-pkgTranslate <t> <pkg> \u5F53\u9047\u5230\u7C7B\u578B\u6216\u6A21\u5757\u540D <t> \u65F6, \u5728\n\ \u751F\u6210\u7684 Java \u7A0B\u5E8F\u5305\u4E2D\u5C06\u5176\u66FF\u6362\u4E3A <pkg>\u3002\u8BF7\u6CE8\u610F, \n\ \u5C06\u9996\u5148\u8FDB\u884C pkgPrefix \u66F4\u6539\u3002<t> \u5FC5\u987B\u4E0E\n\ \u5B8C\u6574\u7A0B\u5E8F\u5305\u540D\u5B8C\u5168\u5339\u914D\u3002\u53E6\u5916, <t> \u4E0D\u80FD\u4E3A\n\ org, org.omg \u6216 org.omg \u7684\u4EFB\u4F55\u5B50\u7A0B\u5E8F\u5305\u3002\n-skeletonName <xxx%yyy> \u6839\u636E\u6A21\u5F0F\u547D\u540D\u9AA8\u67B6\u3002\n\ \u9ED8\u8BA4\u503C\u4E3A:\n\ %POA \u8868\u793A POA \u57FA\u7C7B (-fserver \u6216 -fall) \n\ _%ImplBase \u8868\u793A oldImplBase \u57FA\u7C7B\n\ (-oldImplBase \u548C (-fserver \u6216 -fall))\u3002\n-td <dir> \u4F7F\u7528 <dir> \u8868\u793A\u8F93\u51FA\u76EE\u5F55\u4EE5\u4EE3\u66FF\n\ \u5F53\u524D\u76EE\u5F55\u3002\n-tieName <xxx%yyy> \u6839\u636E\u6A21\u5F0F\u547D\u540D tie\u3002\u9ED8\u8BA4\u503C\u4E3A:\n\ %POATie \u8868\u793A POA tie (-fserverTie \u6216 -fallTie) \n\ %_Tie \u8868\u793A oldImplBase tie\n\ (-oldImplBase \u548C (-fserverTie \u6216 -fallTie))\u3002\n-v, -verbose \u8BE6\u7EC6\u6A21\u5F0F\u3002\n-version \u663E\u793A\u7248\u672C\u53F7\u5E76\u9000\u51FA\u3002\n +usage=\u7F16\u8BD1\u5668\u7528\u6CD5:\n\n java com.sun.tools.corba.se.idl.toJavaPortable.Compile [\u9009\u9879] <idl \u6587\u4EF6>\n\n\u5176\u4E2D, <idl \u6587\u4EF6> \u662F\u5305\u542B IDL \u5B9A\u4E49\u7684\u6587\u4EF6\u7684\u540D\u79F0, \u800C\n[\u9009\u9879] \u662F\u4E0B\u5217\u9009\u9879\u7684\u4EFB\u610F\u7EC4\u5408\u3002\u9009\u9879\n\u662F\u53EF\u9009\u7684, \u5E76\u4E14\u663E\u793A\u987A\u5E8F\u5E76\u4E0D\u56FA\u5B9A; <idl \u6587\u4EF6> \u662F\u5FC5\u9700\u7684,\n\u5E76\u4E14\u5FC5\u987B\u663E\u793A\u5728\u6700\u540E\u3002\n \n\u9009\u9879:\n-d <\u7B26\u53F7> \u8FD9\u7B49\u540C\u4E8E IDL \u6587\u4EF6\u4E2D\u7684\n \u4E0B\u9762\u4E00\u884C: #define <\u7B26\u53F7>\n-emitAll \u53D1\u51FA\u6240\u6709\u7C7B\u578B, \u5305\u62EC\u5728 #included \u6587\u4EF6\u4E2D\u627E\u5230\u7684\u7C7B\u578B\u3002\n-f<side> \u5B9A\u4E49\u8981\u53D1\u51FA\u54EA\u4E9B\u7ED1\u5B9A\u3002<side> \u662F client,\n server, all, serverTIE, allTIE \u4E4B\u4E00\u3002serverTIE \u548C allTIE\n \u5BFC\u81F4\u53D1\u51FA\u59D4\u6D3E\u6A21\u578B\u9AA8\u67B6\u3002\u5982\u679C\u672A\u4F7F\u7528\n \u6B64\u6807\u8BB0, \u5C06\u5047\u5B9A\u4E3A -fclient\u3002\n-i <\u5305\u542B\u8DEF\u5F84> \u9ED8\u8BA4\u60C5\u51B5\u4E0B, \u5C06\u5728\u5F53\u524D\u76EE\u5F55\u4E2D\u626B\u63CF\n \u5305\u542B\u7684\u6587\u4EF6\u3002\u6B64\u9009\u9879\u5C06\u6DFB\u52A0\u53E6\u4E00\u4E2A\u76EE\u5F55\u3002\n-keep \u5982\u679C\u8981\u751F\u6210\u7684\u6587\u4EF6\u5DF2\u5B58\u5728, \u8BF7\u4E0D\u8981\n \u8986\u76D6\u5B83\u3002\u9ED8\u8BA4\u60C5\u51B5\u4E0B\u4F1A\u8986\u76D6\u5B83\u3002\n-noWarn \u9690\u85CF\u8B66\u544A\u3002\n-oldImplBase \u751F\u6210\u4E0E\u65E7\u7248 (1.4 \u7248\u4E4B\u524D) JDK ORB \u517C\u5BB9\u7684\u9AA8\u67B6\u3002\n-pkgPrefix <t> <\u524D\u7F00> \u5F53\u5728\u6587\u4EF6\u8303\u56F4\u5185\u9047\u5230\u7C7B\u578B\u6216\u6A21\u5757\u540D <t> \u65F6,\n \u5728\u4E3A <t> \u751F\u6210\u7684\u6240\u6709\u6587\u4EF6\u7684 Java \u7A0B\u5E8F\u5305\u540D\u524D\n \u6DFB\u52A0 <\u524D\u7F00>\u3002\n-pkgTranslate <t> <pkg> \u5F53\u9047\u5230\u7C7B\u578B\u6216\u6A21\u5757\u540D <t> \u65F6, \u5728\n \u751F\u6210\u7684 Java \u7A0B\u5E8F\u5305\u4E2D\u5C06\u5176\u66FF\u6362\u4E3A <pkg>\u3002\u8BF7\u6CE8\u610F, \n \u5C06\u9996\u5148\u8FDB\u884C pkgPrefix \u66F4\u6539\u3002<t> \u5FC5\u987B\u4E0E\n \u5B8C\u6574\u7A0B\u5E8F\u5305\u540D\u5B8C\u5168\u5339\u914D\u3002\u53E6\u5916, <t> \u4E0D\u80FD\u4E3A\n org, org.omg \u6216 org.omg \u7684\u4EFB\u4F55\u5B50\u7A0B\u5E8F\u5305\u3002\n-skeletonName <xxx%yyy> \u6839\u636E\u6A21\u5F0F\u547D\u540D\u9AA8\u67B6\u3002\n \u9ED8\u8BA4\u503C\u4E3A:\n %POA \u8868\u793A POA \u57FA\u7C7B (-fserver \u6216 -fall) \n _%ImplBase \u8868\u793A oldImplBase \u57FA\u7C7B\n (-oldImplBase \u548C (-fserver \u6216 -fall))\u3002\n-td <dir> \u4F7F\u7528 <dir> \u8868\u793A\u8F93\u51FA\u76EE\u5F55\u4EE5\u4EE3\u66FF\n \u5F53\u524D\u76EE\u5F55\u3002\n-tieName <xxx%yyy> \u6839\u636E\u6A21\u5F0F\u547D\u540D tie\u3002\u9ED8\u8BA4\u503C\u4E3A:\n %POATie \u8868\u793A POA tie (-fserverTie \u6216 -fallTie) \n %_Tie \u8868\u793A oldImplBase tie\n (-oldImplBase \u548C (-fserverTie \u6216 -fallTie))\u3002\n-v, -verbose \u8BE6\u7EC6\u6A21\u5F0F\u3002\n-version \u663E\u793A\u7248\u672C\u53F7\u5E76\u9000\u51FA\u3002\n
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/classes/sun/corba/JavaCorbaAccess.java Mon Mar 11 17:35:38 2013 +0100 @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package sun.corba; + +import com.sun.corba.se.impl.io.ValueHandlerImpl; + +public interface JavaCorbaAccess { + public ValueHandlerImpl newValueHandlerImpl(); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/classes/sun/corba/SharedSecrets.java Mon Mar 11 17:35:38 2013 +0100 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package sun.corba; + +import com.sun.corba.se.impl.io.ValueUtility; +import sun.misc.Unsafe; + +import java.security.AccessController; + +/** A repository of "shared secrets", which are a mechanism for + calling implementation-private methods in another package without + using reflection. A package-private class implements a public + interface and provides the ability to call package-private methods + within that package; the object implementing that interface is + provided through a third package to which access is restricted. + This framework avoids the primary disadvantage of using reflection + for this purpose, namely the loss of compile-time checking. */ + +// SharedSecrets cloned in corba repo to avoid build issues +public class SharedSecrets { + private static final Unsafe unsafe = Unsafe.getUnsafe(); + private static JavaCorbaAccess javaCorbaAccess; + + public static JavaCorbaAccess getJavaCorbaAccess() { + if (javaCorbaAccess == null) { + // Ensure ValueUtility is initialized; we know that that class + // provides the shared secret + unsafe.ensureClassInitialized(ValueUtility.class); + } + return javaCorbaAccess; + } + + public static void setJavaCorbaAccess(JavaCorbaAccess access) { + javaCorbaAccess = access; + } + +}
--- a/src/share/classes/sun/rmi/rmic/iiop/IDLNames.java Wed Jan 09 09:55:11 2013 +0000 +++ b/src/share/classes/sun/rmi/rmic/iiop/IDLNames.java Mon Mar 11 17:35:38 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -71,6 +71,34 @@ (byte)'F', }; + // Legal IDL Identifier characters (1 = legal). Note + // that '.' (2E) is marked as legal even though it is + // not legal in IDL. This allows us to treat a fully + // qualified Java name with '.' package separators + // uniformly, and is safe because that is the only + // legal use of '.' in a Java name. + + private static final byte[] IDL_IDENTIFIER_CHARS = { + + // 0 1 2 3 4 5 6 7 8 9 a b c d e f + 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 00-0f + 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 10-1f + 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,1,0, // 20-2f + 1,1,1,1, 1,1,1,1, 1,1,0,0, 0,0,0,0, // 30-3f + 0,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // 40-4f + 1,1,1,1, 1,1,1,1, 1,1,1,0, 0,0,0,1, // 50-5f + 0,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // 60-6f + 1,1,1,1, 1,1,1,1, 1,1,1,0, 0,0,0,0, // 70-7f + 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 80-8f + 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 90-9f + 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // a0-af + 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // b0-bf + 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // c0-cf + 0,1,1,1, 1,1,1,0, 1,1,1,1, 1,0,0,1, // d0-df + 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // e0-ef + 0,1,1,1, 1,1,1,0, 1,1,1,1, 1,0,0,1, // f0-ff + }; + //_____________________________________________________________________ // Public Interfaces //_____________________________________________________________________ @@ -139,7 +167,7 @@ result = replace(result,"x\\U","U"); // Now see if we have any remaining illegal characters (see - // RepositoryId.IDL_IDENTIFIER_CHARS array)... + // IDL_IDENTIFIER_CHARS array)... int length = result.length(); StringBuffer buffer = null; @@ -148,7 +176,7 @@ char c = result.charAt(i); - if (c > 255 || RepositoryId.IDL_IDENTIFIER_CHARS[c] == 0) { + if (c > 255 || IDL_IDENTIFIER_CHARS[c] == 0) { // We gotta convert. Have we already started?
--- a/src/share/classes/sun/rmi/rmic/iiop/StubGenerator.java Wed Jan 09 09:55:11 2013 +0000 +++ b/src/share/classes/sun/rmi/rmic/iiop/StubGenerator.java Mon Mar 11 17:35:38 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -425,7 +425,7 @@ // Write the _ids() method... p.plnI("public String[] _ids() { "); - p.pln("return _type_ids;"); + p.pln("return (String[]) _type_ids.clone();"); p.pOln("}"); // Get all the methods and write each stub method... @@ -1860,11 +1860,11 @@ { if(POATie){ p.plnI("public String[] _all_interfaces(org.omg.PortableServer.POA poa, byte[] objectId){"); - p.pln("return _type_ids;"); + p.pln("return (String[]) _type_ids.clone();"); p.pOln("}"); } else { p.plnI("public String[] _ids() { "); - p.pln("return _type_ids;"); + p.pln("return (String[]) _type_ids.clone();"); p.pOln("}"); } }