Thu, 15 Aug 2013 21:33:19 +0100
Merge
1.1 --- a/.hgtags Fri Aug 09 14:24:17 2013 +0100 1.2 +++ b/.hgtags Thu Aug 15 21:33:19 2013 +0100 1.3 @@ -224,3 +224,4 @@ 1.4 8d492f1dfd1b131a4c7886ee6b59528609f7e4fe jdk8-b100 1.5 a013024b07475782f1fa8e196e950b34b4077663 jdk8-b101 1.6 528c7e76eaeee022817ee085668459bc97cf5665 jdk8-b102 1.7 +49c4a777fdfd648d4c3fffc940fdb97a23108ca8 jdk8-b103
2.1 --- a/src/share/classes/com/sun/corba/se/impl/copyobject/JavaInputStream.sjava Fri Aug 09 14:24:17 2013 +0100 2.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 2.3 @@ -1,528 +0,0 @@ 2.4 -/* 2.5 - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. 2.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 2.7 - * 2.8 - * This code is free software; you can redistribute it and/or modify it 2.9 - * under the terms of the GNU General Public License version 2 only, as 2.10 - * published by the Free Software Foundation. Oracle designates this 2.11 - * particular file as subject to the "Classpath" exception as provided 2.12 - * by Oracle in the LICENSE file that accompanied this code. 2.13 - * 2.14 - * This code is distributed in the hope that it will be useful, but WITHOUT 2.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 2.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 2.17 - * version 2 for more details (a copy is included in the LICENSE file that 2.18 - * accompanied this code). 2.19 - * 2.20 - * You should have received a copy of the GNU General Public License version 2.21 - * 2 along with this work; if not, write to the Free Software Foundation, 2.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2.23 - * 2.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2.25 - * or visit www.oracle.com if you need additional information or have any 2.26 - * questions. 2.27 - */ 2.28 -package com.sun.corba.se.impl.encoding; 2.29 - 2.30 -import java.io.IOException; 2.31 -import java.io.Serializable; 2.32 -import java.math.BigDecimal; 2.33 -import java.nio.ByteBuffer; 2.34 - 2.35 -import org.omg.CORBA.TypeCode; 2.36 -import org.omg.CORBA.Principal; 2.37 -import org.omg.CORBA.Any; 2.38 - 2.39 -import com.sun.org.omg.SendingContext.CodeBase; 2.40 - 2.41 -import com.sun.corba.se.pept.protocol.MessageMediator; 2.42 - 2.43 -import com.sun.corba.se.spi.logging.CORBALogDomains; 2.44 -import com.sun.corba.se.spi.orb.ORB; 2.45 -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; 2.46 -import com.sun.corba.se.spi.protocol.CorbaMessageMediator; 2.47 - 2.48 -import com.sun.corba.se.impl.logging.ORBUtilSystemException; 2.49 -import com.sun.corba.se.impl.encoding.CodeSetConversion; 2.50 -import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry; 2.51 - 2.52 -/** 2.53 - * This is delegates to the real implementation. 2.54 - * 2.55 - * NOTE: 2.56 - * 2.57 - * Before using the stream for valuetype unmarshaling, one must call 2.58 - * performORBVersionSpecificInit(). 2.59 - */ 2.60 -public abstract class CDRInputStream 2.61 - extends org.omg.CORBA_2_3.portable.InputStream 2.62 - implements com.sun.corba.se.impl.encoding.MarshalInputStream, 2.63 - org.omg.CORBA.DataInputStream, org.omg.CORBA.portable.ValueInputStream 2.64 -{ 2.65 - protected CorbaMessageMediator messageMediator; 2.66 - private CDRInputStreamBase impl; 2.67 - 2.68 - // We can move this out somewhere later. For now, it serves its purpose 2.69 - // to create a concrete CDR delegate based on the GIOP version. 2.70 - private static class InputStreamFactory { 2.71 - 2.72 - public static CDRInputStreamBase newInputStream(ORB orb, GIOPVersion version) 2.73 - { 2.74 - switch(version.intValue()) { 2.75 - case GIOPVersion.VERSION_1_0: 2.76 - return new CDRInputStream_1_0(); 2.77 - case GIOPVersion.VERSION_1_1: 2.78 - return new CDRInputStream_1_1(); 2.79 - case GIOPVersion.VERSION_1_2: 2.80 - return new CDRInputStream_1_2(); 2.81 - default: 2.82 - ORBUtilSystemException wrapper = ORBUtilSystemException.get( orb, 2.83 - CORBALogDomains.RPC_ENCODING ) ; 2.84 - throw wrapper.unsupportedGiopVersion( version ) ; 2.85 - } 2.86 - } 2.87 - } 2.88 - 2.89 - // Required for the case when a ClientResponseImpl is 2.90 - // created with a SystemException due to a dead server/closed 2.91 - // connection with no warning. Note that the stream will 2.92 - // not be initialized in this case. 2.93 - // 2.94 - // Probably also required by ServerRequestImpl. 2.95 - // 2.96 - // REVISIT. 2.97 - public CDRInputStream() { 2.98 - } 2.99 - 2.100 - public CDRInputStream(CDRInputStream is) { 2.101 - impl = is.impl.dup(); 2.102 - impl.setParent(this); 2.103 - } 2.104 - 2.105 - public CDRInputStream(org.omg.CORBA.ORB orb, 2.106 - ByteBuffer byteBuffer, 2.107 - int size, 2.108 - boolean littleEndian, 2.109 - GIOPVersion version, 2.110 - BufferManagerRead bufMgr) 2.111 - { 2.112 - impl = InputStreamFactory.newInputStream( (ORB)orb, version); 2.113 - 2.114 - impl.init(orb, byteBuffer, size, littleEndian, bufMgr); 2.115 - 2.116 - impl.setParent(this); 2.117 - } 2.118 - 2.119 - // org.omg.CORBA.portable.InputStream 2.120 - public final boolean read_boolean() { 2.121 - return impl.read_boolean(); 2.122 - } 2.123 - 2.124 - public final char read_char() { 2.125 - return impl.read_char(); 2.126 - } 2.127 - 2.128 - public final char read_wchar() { 2.129 - return impl.read_wchar(); 2.130 - } 2.131 - 2.132 - public final byte read_octet() { 2.133 - return impl.read_octet(); 2.134 - } 2.135 - 2.136 - public final short read_short() { 2.137 - return impl.read_short(); 2.138 - } 2.139 - 2.140 - public final short read_ushort() { 2.141 - return impl.read_ushort(); 2.142 - } 2.143 - 2.144 - public final int read_long() { 2.145 - return impl.read_long(); 2.146 - } 2.147 - 2.148 - public final int read_ulong() { 2.149 - return impl.read_ulong(); 2.150 - } 2.151 - 2.152 - public final long read_longlong() { 2.153 - return impl.read_longlong(); 2.154 - } 2.155 - 2.156 - public final long read_ulonglong() { 2.157 - return impl.read_ulonglong(); 2.158 - } 2.159 - 2.160 - public final float read_float() { 2.161 - return impl.read_float(); 2.162 - } 2.163 - 2.164 - public final double read_double() { 2.165 - return impl.read_double(); 2.166 - } 2.167 - 2.168 - public final String read_string() { 2.169 - return impl.read_string(); 2.170 - } 2.171 - 2.172 - public final String read_wstring() { 2.173 - return impl.read_wstring(); 2.174 - } 2.175 - 2.176 - public final void read_boolean_array(boolean[] value, int offset, int length) { 2.177 - impl.read_boolean_array(value, offset, length); 2.178 - } 2.179 - 2.180 - public final void read_char_array(char[] value, int offset, int length) { 2.181 - impl.read_char_array(value, offset, length); 2.182 - } 2.183 - 2.184 - public final void read_wchar_array(char[] value, int offset, int length) { 2.185 - impl.read_wchar_array(value, offset, length); 2.186 - } 2.187 - 2.188 - public final void read_octet_array(byte[] value, int offset, int length) { 2.189 - impl.read_octet_array(value, offset, length); 2.190 - } 2.191 - 2.192 - public final void read_short_array(short[] value, int offset, int length) { 2.193 - impl.read_short_array(value, offset, length); 2.194 - } 2.195 - 2.196 - public final void read_ushort_array(short[] value, int offset, int length) { 2.197 - impl.read_ushort_array(value, offset, length); 2.198 - } 2.199 - 2.200 - public final void read_long_array(int[] value, int offset, int length) { 2.201 - impl.read_long_array(value, offset, length); 2.202 - } 2.203 - 2.204 - public final void read_ulong_array(int[] value, int offset, int length) { 2.205 - impl.read_ulong_array(value, offset, length); 2.206 - } 2.207 - 2.208 - public final void read_longlong_array(long[] value, int offset, int length) { 2.209 - impl.read_longlong_array(value, offset, length); 2.210 - } 2.211 - 2.212 - public final void read_ulonglong_array(long[] value, int offset, int length) { 2.213 - impl.read_ulonglong_array(value, offset, length); 2.214 - } 2.215 - 2.216 - public final void read_float_array(float[] value, int offset, int length) { 2.217 - impl.read_float_array(value, offset, length); 2.218 - } 2.219 - 2.220 - public final void read_double_array(double[] value, int offset, int length) { 2.221 - impl.read_double_array(value, offset, length); 2.222 - } 2.223 - 2.224 - public final org.omg.CORBA.Object read_Object() { 2.225 - return impl.read_Object(); 2.226 - } 2.227 - 2.228 - public final TypeCode read_TypeCode() { 2.229 - return impl.read_TypeCode(); 2.230 - } 2.231 - public final Any read_any() { 2.232 - return impl.read_any(); 2.233 - } 2.234 - 2.235 - public final Principal read_Principal() { 2.236 - return impl.read_Principal(); 2.237 - } 2.238 - 2.239 - public final int read() throws java.io.IOException { 2.240 - return impl.read(); 2.241 - } 2.242 - 2.243 - public final java.math.BigDecimal read_fixed() { 2.244 - return impl.read_fixed(); 2.245 - } 2.246 - 2.247 - public final org.omg.CORBA.Context read_Context() { 2.248 - return impl.read_Context(); 2.249 - } 2.250 - 2.251 - public final org.omg.CORBA.Object read_Object(java.lang.Class clz) { 2.252 - return impl.read_Object(clz); 2.253 - } 2.254 - 2.255 - public final org.omg.CORBA.ORB orb() { 2.256 - return impl.orb(); 2.257 - } 2.258 - 2.259 - // org.omg.CORBA_2_3.portable.InputStream 2.260 - public final java.io.Serializable read_value() { 2.261 - return impl.read_value(); 2.262 - } 2.263 - 2.264 - public final java.io.Serializable read_value(java.lang.Class clz) { 2.265 - return impl.read_value(clz); 2.266 - } 2.267 - 2.268 - public final java.io.Serializable read_value(org.omg.CORBA.portable.BoxedValueHelper factory) { 2.269 - return impl.read_value(factory); 2.270 - } 2.271 - 2.272 - public final java.io.Serializable read_value(java.lang.String rep_id) { 2.273 - return impl.read_value(rep_id); 2.274 - } 2.275 - 2.276 - public final java.io.Serializable read_value(java.io.Serializable value) { 2.277 - return impl.read_value(value); 2.278 - } 2.279 - 2.280 - public final java.lang.Object read_abstract_interface() { 2.281 - return impl.read_abstract_interface(); 2.282 - } 2.283 - 2.284 - public final java.lang.Object read_abstract_interface(java.lang.Class clz) { 2.285 - return impl.read_abstract_interface(clz); 2.286 - } 2.287 - // com.sun.corba.se.impl.encoding.MarshalInputStream 2.288 - 2.289 - public final void consumeEndian() { 2.290 - impl.consumeEndian(); 2.291 - } 2.292 - 2.293 - public final int getPosition() { 2.294 - return impl.getPosition(); 2.295 - } 2.296 - 2.297 - // org.omg.CORBA.DataInputStream 2.298 - 2.299 - public final java.lang.Object read_Abstract () { 2.300 - return impl.read_Abstract(); 2.301 - } 2.302 - 2.303 - public final java.io.Serializable read_Value () { 2.304 - return impl.read_Value(); 2.305 - } 2.306 - 2.307 - public final void read_any_array (org.omg.CORBA.AnySeqHolder seq, int offset, int length) { 2.308 - impl.read_any_array(seq, offset, length); 2.309 - } 2.310 - 2.311 - public final void read_boolean_array (org.omg.CORBA.BooleanSeqHolder seq, int offset, int length) { 2.312 - impl.read_boolean_array(seq, offset, length); 2.313 - } 2.314 - 2.315 - public final void read_char_array (org.omg.CORBA.CharSeqHolder seq, int offset, int length) { 2.316 - impl.read_char_array(seq, offset, length); 2.317 - } 2.318 - 2.319 - public final void read_wchar_array (org.omg.CORBA.WCharSeqHolder seq, int offset, int length) { 2.320 - impl.read_wchar_array(seq, offset, length); 2.321 - } 2.322 - 2.323 - public final void read_octet_array (org.omg.CORBA.OctetSeqHolder seq, int offset, int length) { 2.324 - impl.read_octet_array(seq, offset, length); 2.325 - } 2.326 - 2.327 - public final void read_short_array (org.omg.CORBA.ShortSeqHolder seq, int offset, int length) { 2.328 - impl.read_short_array(seq, offset, length); 2.329 - } 2.330 - 2.331 - public final void read_ushort_array (org.omg.CORBA.UShortSeqHolder seq, int offset, int length) { 2.332 - impl.read_ushort_array(seq, offset, length); 2.333 - } 2.334 - 2.335 - public final void read_long_array (org.omg.CORBA.LongSeqHolder seq, int offset, int length) { 2.336 - impl.read_long_array(seq, offset, length); 2.337 - } 2.338 - 2.339 - public final void read_ulong_array (org.omg.CORBA.ULongSeqHolder seq, int offset, int length) { 2.340 - impl.read_ulong_array(seq, offset, length); 2.341 - } 2.342 - 2.343 - public final void read_ulonglong_array (org.omg.CORBA.ULongLongSeqHolder seq, int offset, int length) { 2.344 - impl.read_ulonglong_array(seq, offset, length); 2.345 - } 2.346 - 2.347 - public final void read_longlong_array (org.omg.CORBA.LongLongSeqHolder seq, int offset, int length) { 2.348 - impl.read_longlong_array(seq, offset, length); 2.349 - } 2.350 - 2.351 - public final void read_float_array (org.omg.CORBA.FloatSeqHolder seq, int offset, int length) { 2.352 - impl.read_float_array(seq, offset, length); 2.353 - } 2.354 - 2.355 - public final void read_double_array (org.omg.CORBA.DoubleSeqHolder seq, int offset, int length) { 2.356 - impl.read_double_array(seq, offset, length); 2.357 - } 2.358 - 2.359 - // org.omg.CORBA.portable.ValueBase 2.360 - public final String[] _truncatable_ids() { 2.361 - return impl._truncatable_ids(); 2.362 - } 2.363 - 2.364 - // java.io.InputStream 2.365 - public final int read(byte b[]) throws IOException { 2.366 - return impl.read(b); 2.367 - } 2.368 - 2.369 - public final int read(byte b[], int off, int len) throws IOException { 2.370 - return impl.read(b, off, len); 2.371 - } 2.372 - 2.373 - public final long skip(long n) throws IOException { 2.374 - return impl.skip(n); 2.375 - } 2.376 - 2.377 - public final int available() throws IOException { 2.378 - return impl.available(); 2.379 - } 2.380 - 2.381 - public final void close() throws IOException { 2.382 - impl.close(); 2.383 - } 2.384 - 2.385 - public final void mark(int readlimit) { 2.386 - impl.mark(readlimit); 2.387 - } 2.388 - 2.389 - public final void reset() { 2.390 - impl.reset(); 2.391 - } 2.392 - 2.393 - public final boolean markSupported() { 2.394 - return impl.markSupported(); 2.395 - } 2.396 - 2.397 - public abstract CDRInputStream dup(); 2.398 - 2.399 - // Needed by TCUtility 2.400 - public final java.math.BigDecimal read_fixed(short digits, short scale) { 2.401 - return impl.read_fixed(digits, scale); 2.402 - } 2.403 - 2.404 - public final boolean isLittleEndian() { 2.405 - return impl.isLittleEndian(); 2.406 - } 2.407 - 2.408 - protected final ByteBuffer getByteBuffer() { 2.409 - return impl.getByteBuffer(); 2.410 - } 2.411 - 2.412 - protected final void setByteBuffer(ByteBuffer byteBuffer) { 2.413 - impl.setByteBuffer(byteBuffer); 2.414 - } 2.415 - 2.416 - protected final void setByteBufferWithInfo(ByteBufferWithInfo bbwi) { 2.417 - impl.setByteBufferWithInfo(bbwi); 2.418 - } 2.419 - 2.420 - public final int getBufferLength() { 2.421 - return impl.getBufferLength(); 2.422 - } 2.423 - 2.424 - protected final void setBufferLength(int value) { 2.425 - impl.setBufferLength(value); 2.426 - } 2.427 - 2.428 - protected final int getIndex() { 2.429 - return impl.getIndex(); 2.430 - } 2.431 - 2.432 - protected final void setIndex(int value) { 2.433 - impl.setIndex(value); 2.434 - } 2.435 - 2.436 - public final void orb(org.omg.CORBA.ORB orb) { 2.437 - impl.orb(orb); 2.438 - } 2.439 - 2.440 - public final GIOPVersion getGIOPVersion() { 2.441 - return impl.getGIOPVersion(); 2.442 - } 2.443 - 2.444 - public final BufferManagerRead getBufferManager() { 2.445 - return impl.getBufferManager(); 2.446 - } 2.447 - 2.448 - // This should be overridden by any stream (ex: IIOPInputStream) 2.449 - // which wants to read values. Thus, TypeCodeInputStream doesn't 2.450 - // have to do this. 2.451 - public CodeBase getCodeBase() { 2.452 - return null; 2.453 - } 2.454 - 2.455 - // Use Latin-1 for GIOP 1.0 or when code set negotiation was not 2.456 - // performed. 2.457 - protected CodeSetConversion.BTCConverter createCharBTCConverter() { 2.458 - return CodeSetConversion.impl().getBTCConverter(OSFCodeSetRegistry.ISO_8859_1, 2.459 - impl.isLittleEndian()); 2.460 - } 2.461 - 2.462 - // Subclasses must decide what to do here. It's inconvenient to 2.463 - // make the class and this method abstract because of dup(). 2.464 - protected abstract CodeSetConversion.BTCConverter createWCharBTCConverter(); 2.465 - 2.466 - // Prints the current buffer in a human readable form 2.467 - void printBuffer() { 2.468 - impl.printBuffer(); 2.469 - } 2.470 - 2.471 - /** 2.472 - * Aligns the current position on the given octet boundary 2.473 - * if there are enough bytes available to do so. Otherwise, 2.474 - * it just returns. This is used for some (but not all) 2.475 - * GIOP 1.2 message headers. 2.476 - */ 2.477 - public void alignOnBoundary(int octetBoundary) { 2.478 - impl.alignOnBoundary(octetBoundary); 2.479 - } 2.480 - 2.481 - // Needed by request and reply messages for GIOP versions >= 1.2 only. 2.482 - public void setHeaderPadding(boolean headerPadding) { 2.483 - impl.setHeaderPadding(headerPadding); 2.484 - } 2.485 - 2.486 - /** 2.487 - * This must be called after determining the proper ORB version, 2.488 - * and setting it on the stream's ORB instance. It can be called 2.489 - * after reading the service contexts, since that is the only place 2.490 - * we can get the ORB version info. 2.491 - * 2.492 - * Trying to unmarshal things requiring repository IDs before calling 2.493 - * this will result in NullPtrExceptions. 2.494 - */ 2.495 - public void performORBVersionSpecificInit() { 2.496 - // In the case of SystemExceptions, a stream is created 2.497 - // with its default constructor (and thus no impl is set). 2.498 - if (impl != null) 2.499 - impl.performORBVersionSpecificInit(); 2.500 - } 2.501 - 2.502 - /** 2.503 - * Resets any internal references to code set converters. 2.504 - * This is useful for forcing the CDR stream to reacquire 2.505 - * converters (probably from its subclasses) when state 2.506 - * has changed. 2.507 - */ 2.508 - public void resetCodeSetConverters() { 2.509 - impl.resetCodeSetConverters(); 2.510 - } 2.511 - 2.512 - public void setMessageMediator(MessageMediator messageMediator) 2.513 - { 2.514 - this.messageMediator = (CorbaMessageMediator) messageMediator; 2.515 - } 2.516 - 2.517 - public MessageMediator getMessageMediator() 2.518 - { 2.519 - return messageMediator; 2.520 - } 2.521 - 2.522 - // ValueInputStream ----------------------------- 2.523 - 2.524 - public void start_value() { 2.525 - impl.start_value(); 2.526 - } 2.527 - 2.528 - public void end_value() { 2.529 - impl.end_value(); 2.530 - } 2.531 -}
3.1 --- a/src/share/classes/com/sun/corba/se/impl/copyobject/JavaOutputStream.sjava Fri Aug 09 14:24:17 2013 +0100 3.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 3.3 @@ -1,435 +0,0 @@ 3.4 -/* 3.5 - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. 3.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3.7 - * 3.8 - * This code is free software; you can redistribute it and/or modify it 3.9 - * under the terms of the GNU General Public License version 2 only, as 3.10 - * published by the Free Software Foundation. Oracle designates this 3.11 - * particular file as subject to the "Classpath" exception as provided 3.12 - * by Oracle in the LICENSE file that accompanied this code. 3.13 - * 3.14 - * This code is distributed in the hope that it will be useful, but WITHOUT 3.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 3.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 3.17 - * version 2 for more details (a copy is included in the LICENSE file that 3.18 - * accompanied this code). 3.19 - * 3.20 - * You should have received a copy of the GNU General Public License version 3.21 - * 2 along with this work; if not, write to the Free Software Foundation, 3.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 3.23 - * 3.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 3.25 - * or visit www.oracle.com if you need additional information or have any 3.26 - * questions. 3.27 - */ 3.28 -package com.sun.corba.se.impl.encoding; 3.29 - 3.30 -import java.io.IOException; 3.31 -import java.io.Serializable; 3.32 -import java.math.BigDecimal; 3.33 -import java.nio.ByteBuffer; 3.34 - 3.35 -import org.omg.CORBA.TypeCode; 3.36 -import org.omg.CORBA.Principal; 3.37 -import org.omg.CORBA.Any; 3.38 - 3.39 -import com.sun.corba.se.pept.protocol.MessageMediator; 3.40 - 3.41 -import com.sun.corba.se.spi.orb.ORB; 3.42 -import com.sun.corba.se.spi.logging.CORBALogDomains; 3.43 -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; 3.44 -import com.sun.corba.se.spi.protocol.CorbaMessageMediator; 3.45 - 3.46 -import com.sun.corba.se.impl.encoding.CodeSetConversion; 3.47 -import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry; 3.48 -import com.sun.corba.se.impl.orbutil.ORBConstants; 3.49 -import com.sun.corba.se.impl.logging.ORBUtilSystemException; 3.50 - 3.51 -/** 3.52 - * This is delegates to the real implementation. 3.53 - */ 3.54 -public abstract class CDROutputStream 3.55 - extends org.omg.CORBA_2_3.portable.OutputStream 3.56 - implements com.sun.corba.se.impl.encoding.MarshalOutputStream, 3.57 - org.omg.CORBA.DataOutputStream, org.omg.CORBA.portable.ValueOutputStream 3.58 -{ 3.59 -/* 3.60 - private CDROutputStreamBase impl; 3.61 - protected ORB orb ; 3.62 - protected ORBUtilSystemException wrapper ; 3.63 - protected CorbaMessageMediator corbaMessageMediator; 3.64 - 3.65 - 3.66 - // We can move this out somewhere later. For now, it serves its purpose 3.67 - // to create a concrete CDR delegate based on the GIOP version. 3.68 - private static class OutputStreamFactory { 3.69 - 3.70 - public static CDROutputStreamBase newOutputStream(ORB orb, GIOPVersion version) 3.71 - { 3.72 - switch(version.intValue()) { 3.73 - case GIOPVersion.VERSION_1_0: 3.74 - return new CDROutputStream_1_0(); 3.75 - case GIOPVersion.VERSION_1_1: 3.76 - return new CDROutputStream_1_1(); 3.77 - case GIOPVersion.VERSION_1_2: 3.78 - return new CDROutputStream_1_2(); 3.79 - default: 3.80 - ORBUtilSystemException wrapper = ORBUtilSystemException.get( orb, 3.81 - CORBALogDomains.RPC_ENCODING ) ; 3.82 - // REVISIT - what is appropriate? INTERNAL exceptions 3.83 - // are really hard to track later. 3.84 - throw wrapper.unsupportedGiopVersion( version ) ; 3.85 - } 3.86 - } 3.87 - } 3.88 - 3.89 - // REVISIT - These two constructors should be re-factored to better hide 3.90 - // the fact that someone extending this class 'can' construct a CDROutputStream 3.91 - // that does not use pooled ByteBuffers. Right now, only EncapsOutputStream 3.92 - // does _not_ use pooled ByteBuffers, see EncapsOutputStream. 3.93 - 3.94 - // NOTE: When a stream is constructed for non-channel-backed sockets 3.95 - // it notifies the constructor not to use pooled (i.e, direct) 3.96 - // ByteBuffers. 3.97 - 3.98 - public CDROutputStream(ORB orb, 3.99 - GIOPVersion version, 3.100 - boolean littleEndian, 3.101 - BufferManagerWrite bufferManager, 3.102 - byte streamFormatVersion, 3.103 - boolean usePooledByteBuffers) 3.104 - { 3.105 - impl = OutputStreamFactory.newOutputStream(orb, version); 3.106 - impl.init(orb, littleEndian, bufferManager, streamFormatVersion, usePooledByteBuffers); 3.107 - 3.108 - impl.setParent(this); 3.109 - this.orb = orb ; 3.110 - this.wrapper = ORBUtilSystemException.get( orb, 3.111 - CORBALogDomains.RPC_ENCODING ) ; 3.112 - } 3.113 - 3.114 - public CDROutputStream(ORB orb, 3.115 - GIOPVersion version, 3.116 - boolean littleEndian, 3.117 - BufferManagerWrite bufferManager, 3.118 - byte streamFormatVersion) 3.119 - { 3.120 - this(orb, version, littleEndian, bufferManager, streamFormatVersion, true); 3.121 - } 3.122 -*/ 3.123 - 3.124 - private ByteArrayOutputStream bos ; 3.125 - private ObjectOutputStream oos ; 3.126 - 3.127 - public JavaOutputStream() 3.128 - { 3.129 - bos = new ByteArrayOutputStream() ; 3.130 - oos = new ObjectOutputStream( bos ) ; 3.131 - } 3.132 - 3.133 - // Provided by IIOPOutputStream and EncapsOutputStream 3.134 - public org.omg.CORBA.portable.InputStream create_input_stream() 3.135 - { 3.136 - ObjectInputStream ois = new ByteArrayInputStream( bos.toByteArray() ) ; 3.137 - 3.138 - return new JavaInputStream( ois ) ; 3.139 - } 3.140 - 3.141 - public final void write_boolean(boolean value) { 3.142 - impl.write_boolean(value); 3.143 - } 3.144 - public final void write_char(char value) { 3.145 - impl.write_char(value); 3.146 - } 3.147 - public final void write_wchar(char value) { 3.148 - impl.write_wchar(value); 3.149 - } 3.150 - public final void write_octet(byte value) { 3.151 - impl.write_octet(value); 3.152 - } 3.153 - public final void write_short(short value) { 3.154 - impl.write_short(value); 3.155 - } 3.156 - public final void write_ushort(short value) { 3.157 - impl.write_ushort(value); 3.158 - } 3.159 - public final void write_long(int value) { 3.160 - impl.write_long(value); 3.161 - } 3.162 - public final void write_ulong(int value) { 3.163 - impl.write_ulong(value); 3.164 - } 3.165 - public final void write_longlong(long value) { 3.166 - impl.write_longlong(value); 3.167 - } 3.168 - public final void write_ulonglong(long value) { 3.169 - impl.write_ulonglong(value); 3.170 - } 3.171 - public final void write_float(float value) { 3.172 - impl.write_float(value); 3.173 - } 3.174 - public final void write_double(double value) { 3.175 - impl.write_double(value); 3.176 - } 3.177 - public final void write_string(String value) { 3.178 - impl.write_string(value); 3.179 - } 3.180 - public final void write_wstring(String value) { 3.181 - impl.write_wstring(value); 3.182 - } 3.183 - 3.184 - public final void write_boolean_array(boolean[] value, int offset, int length) { 3.185 - impl.write_boolean_array(value, offset, length); 3.186 - } 3.187 - public final void write_char_array(char[] value, int offset, int length) { 3.188 - impl.write_char_array(value, offset, length); 3.189 - } 3.190 - public final void write_wchar_array(char[] value, int offset, int length) { 3.191 - impl.write_wchar_array(value, offset, length); 3.192 - } 3.193 - public final void write_octet_array(byte[] value, int offset, int length) { 3.194 - impl.write_octet_array(value, offset, length); 3.195 - } 3.196 - public final void write_short_array(short[] value, int offset, int length) { 3.197 - impl.write_short_array(value, offset, length); 3.198 - } 3.199 - public final void write_ushort_array(short[] value, int offset, int length){ 3.200 - impl.write_ushort_array(value, offset, length); 3.201 - } 3.202 - public final void write_long_array(int[] value, int offset, int length) { 3.203 - impl.write_long_array(value, offset, length); 3.204 - } 3.205 - public final void write_ulong_array(int[] value, int offset, int length) { 3.206 - impl.write_ulong_array(value, offset, length); 3.207 - } 3.208 - public final void write_longlong_array(long[] value, int offset, int length) { 3.209 - impl.write_longlong_array(value, offset, length); 3.210 - } 3.211 - public final void write_ulonglong_array(long[] value, int offset,int length) { 3.212 - impl.write_ulonglong_array(value, offset, length); 3.213 - } 3.214 - public final void write_float_array(float[] value, int offset, int length) { 3.215 - impl.write_float_array(value, offset, length); 3.216 - } 3.217 - public final void write_double_array(double[] value, int offset, int length) { 3.218 - impl.write_double_array(value, offset, length); 3.219 - } 3.220 - public final void write_Object(org.omg.CORBA.Object value) { 3.221 - impl.write_Object(value); 3.222 - } 3.223 - public final void write_TypeCode(TypeCode value) { 3.224 - impl.write_TypeCode(value); 3.225 - } 3.226 - public final void write_any(Any value) { 3.227 - impl.write_any(value); 3.228 - } 3.229 - 3.230 - public final void write_Principal(Principal value) { 3.231 - impl.write_Principal(value); 3.232 - } 3.233 - 3.234 - public final void write(int b) throws java.io.IOException { 3.235 - impl.write(b); 3.236 - } 3.237 - 3.238 - public final void write_fixed(java.math.BigDecimal value) { 3.239 - impl.write_fixed(value); 3.240 - } 3.241 - 3.242 - public final void write_Context(org.omg.CORBA.Context ctx, 3.243 - org.omg.CORBA.ContextList contexts) { 3.244 - impl.write_Context(ctx, contexts); 3.245 - } 3.246 - 3.247 - public final org.omg.CORBA.ORB orb() { 3.248 - return impl.orb(); 3.249 - } 3.250 - 3.251 - // org.omg.CORBA_2_3.portable.OutputStream 3.252 - public final void write_value(java.io.Serializable value) { 3.253 - impl.write_value(value); 3.254 - } 3.255 - 3.256 - public final void write_value(java.io.Serializable value, java.lang.Class clz) { 3.257 - impl.write_value(value, clz); 3.258 - } 3.259 - 3.260 - public final void write_value(java.io.Serializable value, String repository_id) { 3.261 - impl.write_value(value, repository_id); 3.262 - } 3.263 - 3.264 - public final void write_value(java.io.Serializable value, 3.265 - org.omg.CORBA.portable.BoxedValueHelper factory) { 3.266 - impl.write_value(value, factory); 3.267 - } 3.268 - 3.269 - public final void write_abstract_interface(java.lang.Object obj) { 3.270 - impl.write_abstract_interface(obj); 3.271 - } 3.272 - 3.273 - // java.io.OutputStream 3.274 - public final void write(byte b[]) throws IOException { 3.275 - impl.write(b); 3.276 - } 3.277 - 3.278 - public final void write(byte b[], int off, int len) throws IOException { 3.279 - impl.write(b, off, len); 3.280 - } 3.281 - 3.282 - public final void flush() throws IOException { 3.283 - impl.flush(); 3.284 - } 3.285 - 3.286 - public final void close() throws IOException { 3.287 - impl.close(); 3.288 - } 3.289 - 3.290 - // com.sun.corba.se.impl.encoding.MarshalOutputStream 3.291 - public final void start_block() { 3.292 - impl.start_block(); 3.293 - } 3.294 - 3.295 - public final void end_block() { 3.296 - impl.end_block(); 3.297 - } 3.298 - 3.299 - public final void putEndian() { 3.300 - impl.putEndian(); 3.301 - } 3.302 - 3.303 - public void writeTo(java.io.OutputStream s) 3.304 - throws IOException 3.305 - { 3.306 - impl.writeTo(s); 3.307 - } 3.308 - 3.309 - public final byte[] toByteArray() { 3.310 - return impl.toByteArray(); 3.311 - } 3.312 - 3.313 - // org.omg.CORBA.DataOutputStream 3.314 - public final void write_Abstract (java.lang.Object value) { 3.315 - impl.write_Abstract(value); 3.316 - } 3.317 - 3.318 - public final void write_Value (java.io.Serializable value) { 3.319 - impl.write_Value(value); 3.320 - } 3.321 - 3.322 - public final void write_any_array(org.omg.CORBA.Any[] seq, int offset, int length) { 3.323 - impl.write_any_array(seq, offset, length); 3.324 - } 3.325 - 3.326 - public void setMessageMediator(MessageMediator messageMediator) 3.327 - { 3.328 - this.corbaMessageMediator = (CorbaMessageMediator) messageMediator; 3.329 - } 3.330 - 3.331 - public MessageMediator getMessageMediator() 3.332 - { 3.333 - return corbaMessageMediator; 3.334 - } 3.335 - 3.336 - // org.omg.CORBA.portable.ValueBase 3.337 - public final String[] _truncatable_ids() { 3.338 - return impl._truncatable_ids(); 3.339 - } 3.340 - 3.341 - // Other 3.342 - protected final int getSize() { 3.343 - return impl.getSize(); 3.344 - } 3.345 - 3.346 - protected final int getIndex() { 3.347 - return impl.getIndex(); 3.348 - } 3.349 - 3.350 - protected int getRealIndex(int index) { 3.351 - // Used in indirections. Overridden by TypeCodeOutputStream. 3.352 - return index; 3.353 - } 3.354 - 3.355 - protected final void setIndex(int value) { 3.356 - impl.setIndex(value); 3.357 - } 3.358 - 3.359 - protected final ByteBuffer getByteBuffer() { 3.360 - return impl.getByteBuffer(); 3.361 - } 3.362 - 3.363 - protected final void setByteBuffer(ByteBuffer byteBuffer) { 3.364 - impl.setByteBuffer(byteBuffer); 3.365 - } 3.366 - 3.367 - public final boolean isLittleEndian() { 3.368 - return impl.isLittleEndian(); 3.369 - } 3.370 - 3.371 - // XREVISIT - return to final if possible 3.372 - // REVISIT - was protected - need access from msgtypes test. 3.373 - public ByteBufferWithInfo getByteBufferWithInfo() { 3.374 - return impl.getByteBufferWithInfo(); 3.375 - } 3.376 - 3.377 - protected void setByteBufferWithInfo(ByteBufferWithInfo bbwi) { 3.378 - impl.setByteBufferWithInfo(bbwi); 3.379 - } 3.380 - 3.381 - // REVISIT: was protected - but need to access from xgiop. 3.382 - public final BufferManagerWrite getBufferManager() { 3.383 - return impl.getBufferManager(); 3.384 - } 3.385 - 3.386 - public final void write_fixed(java.math.BigDecimal bigDecimal, short digits, short scale) { 3.387 - impl.write_fixed(bigDecimal, digits, scale); 3.388 - } 3.389 - 3.390 - public final void writeOctetSequenceTo(org.omg.CORBA.portable.OutputStream s) { 3.391 - impl.writeOctetSequenceTo(s); 3.392 - } 3.393 - 3.394 - public final GIOPVersion getGIOPVersion() { 3.395 - return impl.getGIOPVersion(); 3.396 - } 3.397 - 3.398 - public final void writeIndirection(int tag, int posIndirectedTo) { 3.399 - impl.writeIndirection(tag, posIndirectedTo); 3.400 - } 3.401 - 3.402 - // Use Latin-1 for GIOP 1.0 or when code set negotiation was not 3.403 - // performed. 3.404 - protected CodeSetConversion.CTBConverter createCharCTBConverter() { 3.405 - return CodeSetConversion.impl().getCTBConverter(OSFCodeSetRegistry.ISO_8859_1); 3.406 - } 3.407 - 3.408 - // Subclasses must decide what to do here. It's inconvenient to 3.409 - // make the class and this method abstract because of dup(). 3.410 - protected abstract CodeSetConversion.CTBConverter createWCharCTBConverter(); 3.411 - 3.412 - protected final void freeInternalCaches() { 3.413 - impl.freeInternalCaches(); 3.414 - } 3.415 - 3.416 - void printBuffer() { 3.417 - impl.printBuffer(); 3.418 - } 3.419 - 3.420 - public void alignOnBoundary(int octetBoundary) { 3.421 - impl.alignOnBoundary(octetBoundary); 3.422 - } 3.423 - 3.424 - // Needed by request and reply messages for GIOP versions >= 1.2 only. 3.425 - public void setHeaderPadding(boolean headerPadding) { 3.426 - impl.setHeaderPadding(headerPadding); 3.427 - } 3.428 - 3.429 - // ValueOutputStream ----------------------------- 3.430 - 3.431 - public void start_value(String rep_id) { 3.432 - impl.start_value(rep_id); 3.433 - } 3.434 - 3.435 - public void end_value() { 3.436 - impl.end_value(); 3.437 - } 3.438 -}
4.1 --- a/src/share/classes/com/sun/corba/se/impl/interceptors/ThreadCurrentStack.sjava Fri Aug 09 14:24:17 2013 +0100 4.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 4.3 @@ -1,164 +0,0 @@ 4.4 -/* 4.5 - * Copyright (c) 2000, 2002, Oracle and/or its affiliates. All rights reserved. 4.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4.7 - * 4.8 - * This code is free software; you can redistribute it and/or modify it 4.9 - * under the terms of the GNU General Public License version 2 only, as 4.10 - * published by the Free Software Foundation. Oracle designates this 4.11 - * particular file as subject to the "Classpath" exception as provided 4.12 - * by Oracle in the LICENSE file that accompanied this code. 4.13 - * 4.14 - * This code is distributed in the hope that it will be useful, but WITHOUT 4.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 4.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 4.17 - * version 2 for more details (a copy is included in the LICENSE file that 4.18 - * accompanied this code). 4.19 - * 4.20 - * You should have received a copy of the GNU General Public License version 4.21 - * 2 along with this work; if not, write to the Free Software Foundation, 4.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 4.23 - * 4.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 4.25 - * or visit www.oracle.com if you need additional information or have any 4.26 - * questions. 4.27 - */ 4.28 - 4.29 -package com.sun.corba.se.impl.interceptors; 4.30 - 4.31 -import com.sun.corba.se.impl.corba.AnyImpl; 4.32 -import org.omg.PortableInterceptor.Current; 4.33 -import org.omg.PortableInterceptor.InvalidSlot; 4.34 - 4.35 -import com.sun.corba.se.impl.util.MinorCodes; 4.36 -import com.sun.corba.se.impl.core.ORB; 4.37 - 4.38 -/** 4.39 - * ThreadCurrentStack is the container of PICurrent instances for each thread 4.40 - */ 4.41 -public class ThreadCurrentStack 4.42 -{ 4.43 - // PICurrentPool is the container for reusable PICurrents 4.44 - private class PICurrentPool { 4.45 - 4.46 - // Contains a list of reusable PICurrents 4.47 - private java.util.ArrayList pool; 4.48 - 4.49 - // High water mark for the pool 4.50 - // If the pool size reaches this limit then putPICurrent will 4.51 - // not put PICurrent to the pool. 4.52 - private static final int HIGH_WATER_MARK = 5; 4.53 - 4.54 - // currentIndex points to the last PICurrent in the list 4.55 - private int currentIndex; 4.56 - 4.57 - PICurrentPool( ) { 4.58 - pool = new java.util.ArrayList( HIGH_WATER_MARK ); 4.59 - currentIndex = 0; 4.60 - } 4.61 - 4.62 - /** 4.63 - * Puts PICurrent to the re-usable pool. 4.64 - */ 4.65 - void putPICurrent( PICurrent current ) { 4.66 - // If there are enough PICurrents in the pool, then don't add 4.67 - // this current to the pool. 4.68 - if( currentIndex >= HIGH_WATER_MARK ) { 4.69 - return; 4.70 - } 4.71 - pool.add(currentIndex , current); 4.72 - currentIndex++; 4.73 - } 4.74 - 4.75 - /** 4.76 - * Gets PICurrent from the re-usable pool. 4.77 - */ 4.78 - PICurrent getPICurrent( ) { 4.79 - // If there are no entries in the pool then return null 4.80 - if( currentIndex == 0 ) { 4.81 - return null; 4.82 - } 4.83 - // Works like a stack, Gets the last one added first 4.84 - currentIndex--; 4.85 - return (PICurrent) pool.get(currentIndex); 4.86 - } 4.87 - } 4.88 - 4.89 - // Contains all the active PICurrents for each thread. 4.90 - // The ArrayList is made to behave like a stack. 4.91 - private java.util.ArrayList currentContainer; 4.92 - 4.93 - // Keeps track of number of PICurrents in the stack. 4.94 - private int currentIndex; 4.95 - 4.96 - // For Every Thread there will be a pool of re-usable ThreadCurrent's 4.97 - // stored in PICurrentPool 4.98 - private PICurrentPool currentPool; 4.99 - 4.100 - // The orb associated with this ThreadCurrentStack 4.101 - private ORB piOrb; 4.102 - 4.103 - /** 4.104 - * Constructs the stack and and PICurrentPool 4.105 - */ 4.106 - ThreadCurrentStack( ORB piOrb, PICurrent current ) { 4.107 - this.piOrb = piOrb; 4.108 - currentIndex = 0; 4.109 - currentContainer = new java.util.ArrayList( ); 4.110 - currentPool = new PICurrentPool( ); 4.111 - currentContainer.add( currentIndex, current ); 4.112 - currentIndex++; 4.113 - } 4.114 - 4.115 - 4.116 - /** 4.117 - * pushPICurrent goes through the following steps 4.118 - * 1: Checks to see if there is any PICurrent in PICurrentPool 4.119 - * If present then use that instance to push into the ThreadCurrentStack 4.120 - * 4.121 - * 2:If there is no PICurrent in the pool, then creates a new one and pushes 4.122 - * that into the ThreadCurrentStack 4.123 - */ 4.124 - void pushPICurrent( ) { 4.125 - PICurrent current = currentPool.getPICurrent( ); 4.126 - if( current == null ) { 4.127 - // get an existing PICurrent to get the slotSize 4.128 - PICurrent currentTemp = peekPICurrent(); 4.129 - current = new PICurrent( piOrb, currentTemp.getSlotSize( )); 4.130 - } 4.131 - currentContainer.add( currentIndex, current ); 4.132 - currentIndex++; 4.133 - } 4.134 - 4.135 - /** 4.136 - * popPICurrent does the following 4.137 - * 1: pops the top PICurrent in the ThreadCurrentStack 4.138 - * 4.139 - * 2: resets the slots in the PICurrent which resets the slotvalues to 4.140 - * null if there are any previous sets. 4.141 - * 4.142 - * 3: pushes the reset PICurrent into the PICurrentPool to reuse 4.143 - */ 4.144 - void popPICurrent( ) { 4.145 - // Do not pop the PICurrent, If there is only one. 4.146 - // This should not happen, But an extra check for safety. 4.147 - if( currentIndex <= 1 ) { 4.148 - throw new org.omg.CORBA.INTERNAL( 4.149 - "Cannot pop the only PICurrent in the stack", 4.150 - MinorCodes.CANT_POP_ONLY_CURRENT_2, 4.151 - CompletionStatus.COMPLETED_NO ); 4.152 - } 4.153 - currentIndex--; 4.154 - PICurrent current = (PICurrent)currentContainer.get( currentIndex ); 4.155 - current.resetSlots( ); 4.156 - currentPool.putPICurrent( current ); 4.157 - } 4.158 - 4.159 - /** 4.160 - * peekPICurrent gets the top PICurrent in the ThreadCurrentStack without 4.161 - * popping. 4.162 - */ 4.163 - PICurrent peekPICurrent( ) { 4.164 - return (PICurrent) currentContainer.get( currentIndex - 1); 4.165 - } 4.166 - 4.167 -}
5.1 --- a/src/share/classes/com/sun/corba/se/impl/orbutil/DefineWrapper.sjava Fri Aug 09 14:24:17 2013 +0100 5.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 5.3 @@ -1,145 +0,0 @@ 5.4 -/* 5.5 - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. 5.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5.7 - * 5.8 - * This code is free software; you can redistribute it and/or modify it 5.9 - * under the terms of the GNU General Public License version 2 only, as 5.10 - * published by the Free Software Foundation. Oracle designates this 5.11 - * particular file as subject to the "Classpath" exception as provided 5.12 - * by Oracle in the LICENSE file that accompanied this code. 5.13 - * 5.14 - * This code is distributed in the hope that it will be useful, but WITHOUT 5.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 5.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 5.17 - * version 2 for more details (a copy is included in the LICENSE file that 5.18 - * accompanied this code). 5.19 - * 5.20 - * You should have received a copy of the GNU General Public License version 5.21 - * 2 along with this work; if not, write to the Free Software Foundation, 5.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 5.23 - * 5.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 5.25 - * or visit www.oracle.com if you need additional information or have any 5.26 - * questions. 5.27 - */ 5.28 - 5.29 -package com.sun.corba.se.impl.orbutil ; 5.30 - 5.31 -import java.lang.reflect.Method; 5.32 -import java.lang.reflect.Modifier; 5.33 - 5.34 -/** This class provides just a main method. Its purpose is to allow -D arguments to 5.35 -* set up the system properties when starting programs with tools like OptimizeIt that 5.36 -* make this difficult or impossible. 5.37 -* 5.38 -* Invocation: {java launcher of some kind} DefineClass -Dxxx=yyy -Dxxx=yyy ... {class name} arg0, arg1, ... 5.39 -* Result: updates system properties with -D args, then uses reflection to invoke {class name}.main with the args 5.40 -*/ 5.41 - 5.42 -class DefineWrapper { 5.43 - public static void main( String[] args ) 5.44 - { 5.45 - int numberDefines = args.length ; 5.46 - String className = null ; 5.47 - 5.48 - for (int ctr=0; ctr<args.length; ctr++ ) { 5.49 - String arg = args[ctr] ; 5.50 - 5.51 - if ((arg.charAt(0) == '-') && (arg.charAt(1) == 'D')) { 5.52 - int eqIndex = arg.indexOf( '=' ) ; 5.53 - if (eqIndex < 0) 5.54 - throw new Exception( arg + " is not a valid property assignment" ) ; 5.55 - 5.56 - final String key = arg.subString( 2, eqIndex ) ; 5.57 - final String value = arg.subStrung( eqIndex + 1 ) ; 5.58 - 5.59 - AccessController.doPrivileged( new PrivilegedAction() { 5.60 - public Object run() { 5.61 - System.setProperty( key, value ) ; 5.62 - return null ; 5.63 - } 5.64 - } ) ; 5.65 - } else { 5.66 - numberDefines = ctr ; 5.67 - className = arg ; 5.68 - break ; 5.69 - } 5.70 - } 5.71 - 5.72 - if (numberDefines < args.length) { 5.73 - Class cls = getMainClass( className ) ; 5.74 - Method mainMethod = getMainMethod( cls ) ; 5.75 - 5.76 - String[] newArgs = new String[ args.length - numberDefines ] ; 5.77 - for (int ctr = numberDefines+1; ctr<args.length; ctr++ ) { 5.78 - newArgs[ ctr-numberDefines-1 ] = args[ ctr ] ; 5.79 - } 5.80 - 5.81 - // build args to the main and call it 5.82 - Object params [] = new Object [1]; 5.83 - params[0] = newArgs; 5.84 - mainMethod.invoke(null, params); 5.85 - } else { 5.86 - throw new Exception( "No class name given" ) ; 5.87 - } 5.88 - } 5.89 - 5.90 - private static Class getMainClass( String name ) 5.91 - { 5.92 - // determine the class loader to be used for loading the class 5.93 - // since ServerMain is going to be in JDK and we need to have this 5.94 - // class to load application classes, this is required here. 5.95 - ClassLoader cl = Thread.currentThread().getContextClassLoader(); 5.96 - 5.97 - if (cl == null) 5.98 - cl = ClassLoader.getSystemClassLoader(); 5.99 - 5.100 - try { 5.101 - // determine the main class, try loading with current class loader 5.102 - cls = Class.forName( className ) ; 5.103 - } catch (ClassNotFoundException ex) { 5.104 - // eat the exception and try to load using SystemClassLoader 5.105 - cls = Class.forName( className, true, cl); 5.106 - } 5.107 - } 5.108 - 5.109 - private static Method getMainMethod( Class serverClass ) 5.110 - { 5.111 - Class argTypes[] = new Class[] { String[].class } ; 5.112 - Method method = null ; 5.113 - 5.114 - try { 5.115 - method = serverClass.getDeclaredMethod( "main", argTypes ) ; 5.116 - } catch (Exception exc) { 5.117 - throw new Exception( "Could not get main() method: " + exc ) ; 5.118 - } 5.119 - 5.120 - if (!isPublicStaticVoid( method )) 5.121 - throw new Exception( "Main method is not public static void" ) ; 5.122 - 5.123 - return method ; 5.124 - } 5.125 - 5.126 - private static boolean isPublicStaticVoid( Method method ) 5.127 - { 5.128 - // check modifiers: public static 5.129 - int modifiers = method.getModifiers (); 5.130 - if (!Modifier.isPublic (modifiers) || !Modifier.isStatic (modifiers)) { 5.131 - logError( method.getName() + " is not public static" ) ; 5.132 - return false ; 5.133 - } 5.134 - 5.135 - // check return type and exceptions 5.136 - if (method.getExceptionTypes ().length != 0) { 5.137 - logError( method.getName() + " declares exceptions" ) ; 5.138 - return false ; 5.139 - } 5.140 - 5.141 - if (!method.getReturnType().equals (Void.TYPE)) { 5.142 - logError( method.getName() + " does not have a void return type" ) ; 5.143 - return false ; 5.144 - } 5.145 - 5.146 - return true ; 5.147 - } 5.148 -}
6.1 --- a/src/share/classes/com/sun/corba/se/impl/presentation/rmi/IDLNameTranslatorImpl_save.sjava Fri Aug 09 14:24:17 2013 +0100 6.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 6.3 @@ -1,909 +0,0 @@ 6.4 -/* 6.5 - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. 6.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6.7 - * 6.8 - * This code is free software; you can redistribute it and/or modify it 6.9 - * under the terms of the GNU General Public License version 2 only, as 6.10 - * published by the Free Software Foundation. Oracle designates this 6.11 - * particular file as subject to the "Classpath" exception as provided 6.12 - * by Oracle in the LICENSE file that accompanied this code. 6.13 - * 6.14 - * This code is distributed in the hope that it will be useful, but WITHOUT 6.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 6.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 6.17 - * version 2 for more details (a copy is included in the LICENSE file that 6.18 - * accompanied this code). 6.19 - * 6.20 - * You should have received a copy of the GNU General Public License version 6.21 - * 2 along with this work; if not, write to the Free Software Foundation, 6.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 6.23 - * 6.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 6.25 - * or visit www.oracle.com if you need additional information or have any 6.26 - * questions. 6.27 - */ 6.28 - 6.29 -package com.sun.corba.se.impl.presentation.rmi ; 6.30 - 6.31 -import java.lang.reflect.Method; 6.32 - 6.33 -import java.math.BigInteger; 6.34 - 6.35 -import java.util.Map; 6.36 -import java.util.Set; 6.37 -import java.util.HashSet; 6.38 -import java.util.Iterator; 6.39 -import java.util.HashMap; 6.40 -import java.util.StringTokenizer; 6.41 - 6.42 -import com.sun.corba.se.spi.presentation.rmi.IDLNameTranslator ; 6.43 - 6.44 -import com.sun.corba.se.impl.presentation.rmi.IDLType ; 6.45 -import com.sun.corba.se.impl.presentation.rmi.IDLTypeException ; 6.46 -import com.sun.corba.se.impl.presentation.rmi.IDLTypesUtil ; 6.47 -import com.sun.corba.se.impl.orbutil.ObjectUtility ; 6.48 - 6.49 -/** 6.50 - * Bidirectional translator between RMI-IIOP interface methods and 6.51 - * and IDL Names. 6.52 - */ 6.53 -public class IDLNameTranslatorImpl implements IDLNameTranslator { 6.54 - 6.55 - // From CORBA Spec, Table 6 Keywords. 6.56 - // Note that since all IDL identifiers are case 6.57 - // insensitive, java identifier comparisons to these 6.58 - // will be case insensitive also. 6.59 - private static String[] IDL_KEYWORDS = { 6.60 - 6.61 - "abstract", "any", "attribute", "boolean", "case", "char", 6.62 - "const", "context", "custom", "default", "double", "enum", 6.63 - "exception", "factory", "FALSE", "fixed", "float", "in", "inout", 6.64 - "interface", "long", "module", "native", "Object", "octet", 6.65 - "oneway", "out", "private", "public", "raises", "readonly", "sequence", 6.66 - "short", "string", "struct", "supports", "switch", "TRUE", "truncatable", 6.67 - "typedef", "unsigned", "union", "ValueBase", "valuetype", "void", 6.68 - "wchar", "wstring" 6.69 - 6.70 - }; 6.71 - 6.72 - private static char[] HEX_DIGITS = { 6.73 - '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 6.74 - 'A', 'B', 'C', 'D', 'E', 'F' 6.75 - }; 6.76 - 6.77 - private static final String UNDERSCORE = "_"; 6.78 - 6.79 - // used to mangle java inner class names 6.80 - private static final String INNER_CLASS_SEPARATOR = 6.81 - UNDERSCORE + UNDERSCORE; 6.82 - 6.83 - // used to form IDL array type names 6.84 - private static final String[] BASE_IDL_ARRAY_MODULE_TYPE= 6.85 - new String[] { "org", "omg", "boxedRMI" } ; 6.86 - 6.87 - private static final String BASE_IDL_ARRAY_ELEMENT_TYPE = "seq"; 6.88 - 6.89 - // used to mangling java identifiers that have a leading underscore 6.90 - private static final String LEADING_UNDERSCORE_CHAR = "J"; 6.91 - private static final String ID_CONTAINER_CLASH_CHAR = UNDERSCORE; 6.92 - 6.93 - // separator used between types in a mangled overloaded method name 6.94 - private static final String OVERLOADED_TYPE_SEPARATOR = 6.95 - UNDERSCORE + UNDERSCORE; 6.96 - 6.97 - // string appended to attribute if it clashes with a method name 6.98 - private static final String ATTRIBUTE_METHOD_CLASH_MANGLE_CHARS = 6.99 - UNDERSCORE + UNDERSCORE; 6.100 - 6.101 - private static Set idlKeywords_; 6.102 - 6.103 - static { 6.104 - 6.105 - idlKeywords_ = new HashSet(); 6.106 - for(int i = 0; i < IDL_KEYWORDS.length; i++) { 6.107 - String next = (String) IDL_KEYWORDS[i]; 6.108 - // Convert keyword to all caps to ease equality 6.109 - // check. 6.110 - String keywordAllCaps = next.toUpperCase(); 6.111 - idlKeywords_.add(keywordAllCaps); 6.112 - } 6.113 - 6.114 - } 6.115 - 6.116 - // 6.117 - // Instance state 6.118 - // 6.119 - 6.120 - // Remote interface for name translation. 6.121 - private Class[] interf_; 6.122 - 6.123 - // Maps used to hold name translations. These do not need to be 6.124 - // synchronized since the translation is never modified after 6.125 - // initialization. 6.126 - private Map methodToIDLNameMap_; 6.127 - private Map IDLNameToMethodMap_; 6.128 - private Method[] methods_; 6.129 - 6.130 - /** 6.131 - * Return an IDLNameTranslator for the given interface. 6.132 - * 6.133 - * @throws IllegalStateException if given class is not a valid 6.134 - * RMI/IIOP Remote Interface 6.135 - */ 6.136 - public static IDLNameTranslator get( Class interf ) 6.137 - { 6.138 - 6.139 - return new IDLNameTranslatorImpl(new Class[] { interf } ); 6.140 - 6.141 - } 6.142 - 6.143 - /** 6.144 - * Return an IDLNameTranslator for the given interfacex. 6.145 - * 6.146 - * @throws IllegalStateException if given classes are not valid 6.147 - * RMI/IIOP Remote Interfaces 6.148 - */ 6.149 - public static IDLNameTranslator get( Class[] interfaces ) 6.150 - { 6.151 - 6.152 - return new IDLNameTranslatorImpl(interfaces ); 6.153 - 6.154 - } 6.155 - 6.156 - public static String getExceptionId( Class cls ) 6.157 - { 6.158 - // Requirements for this method: 6.159 - // 1. cls must be an exception but not a RemoteException. 6.160 - // 2. If cls has an IDL keyword name, an underscore is prepended (1.3.2.2). 6.161 - // 3. If cls jas a leading underscore, J is prepended (1.3.2.3). 6.162 - // 4. If cls has an illegal IDL ident char, it is mapped to UXXXX where 6.163 - // XXXX is the unicode value in hex of the char (1.3.2.4). 6.164 - // 5. double underscore for inner class (1.3.2.5). 6.165 - // 6. The ID is "IDL:" + name with / separators + ":1.0". 6.166 - IDLType itype = classToIDLType( cls ) ; 6.167 - return itype.getExceptionName() ; 6.168 - } 6.169 - 6.170 - public Class[] getInterfaces() 6.171 - { 6.172 - return interf_; 6.173 - } 6.174 - 6.175 - public Method[] getMethods() 6.176 - { 6.177 - return methods_ ; 6.178 - } 6.179 - 6.180 - public Method getMethod( String idlName ) 6.181 - { 6.182 - return (Method) IDLNameToMethodMap_.get(idlName); 6.183 - } 6.184 - 6.185 - public String getIDLName( Method method ) 6.186 - { 6.187 - return (String) methodToIDLNameMap_.get(method); 6.188 - } 6.189 - 6.190 - /** 6.191 - * Initialize an IDLNameTranslator for the given interface. 6.192 - * 6.193 - * @throws IllegalStateException if given class is not a valid 6.194 - * RMI/IIOP Remote Interface 6.195 - */ 6.196 - private IDLNameTranslatorImpl(Class[] interfaces) 6.197 - { 6.198 - 6.199 - try { 6.200 - IDLTypesUtil idlTypesUtil = new IDLTypesUtil(); 6.201 - for (int ctr=0; ctr<interfaces.length; ctr++) 6.202 - idlTypesUtil.validateRemoteInterface(interfaces[ctr]); 6.203 - interf_ = interfaces; 6.204 - buildNameTranslation(); 6.205 - } catch( IDLTypeException ite) { 6.206 - String msg = ite.getMessage(); 6.207 - IllegalStateException ise = new IllegalStateException(msg); 6.208 - ise.initCause(ite); 6.209 - throw ise; 6.210 - } 6.211 - } 6.212 - 6.213 - private void buildNameTranslation() 6.214 - { 6.215 - // holds method info, keyed by method 6.216 - Map allMethodInfo = new HashMap() ; 6.217 - 6.218 - for (int ctr=0; ctr<interf_.length; ctr++) { 6.219 - Class interf = interf_[ctr] ; 6.220 - 6.221 - IDLTypesUtil idlTypesUtil = new IDLTypesUtil(); 6.222 - Method[] methods = interf.getMethods(); 6.223 - 6.224 - // Take an initial pass through all the methods and create some 6.225 - // information that will be used to track the IDL name 6.226 - // transformation. 6.227 - for(int i = 0; i < methods.length; i++) { 6.228 - 6.229 - Method nextMethod = methods[i]; 6.230 - 6.231 - IDLMethodInfo methodInfo = new IDLMethodInfo(); 6.232 - 6.233 - methodInfo.method = nextMethod; 6.234 - 6.235 - methodInfo.propertyType = 6.236 - idlTypesUtil.propertyAccessorMethodType( 6.237 - nextMethod, interf ) ; 6.238 - 6.239 - if (methodInfo.propertyType != null) { 6.240 - String attributeName = idlTypesUtil. 6.241 - getAttributeNameForProperty(nextMethod.getName()); 6.242 - methodInfo.originalName = attributeName; 6.243 - methodInfo.mangledName = attributeName; 6.244 - } else { 6.245 - methodInfo.originalName = nextMethod.getName(); 6.246 - methodInfo.mangledName = nextMethod.getName(); 6.247 - } 6.248 - 6.249 - allMethodInfo.put(nextMethod, methodInfo); 6.250 - } 6.251 - } 6.252 - 6.253 - // Check for having both is<NAME> and get<NAME> methods. 6.254 - 6.255 - 6.256 - // 6.257 - // Perform case sensitivity test first. This applies to all 6.258 - // method names AND attributes. Compare each method name and 6.259 - // attribute to all other method names and attributes. If names 6.260 - // differ only in case, apply mangling as defined in section 1.3.2.7 6.261 - // of Java2IDL spec. Note that we compare using the original names. 6.262 - // 6.263 - for(Iterator outerIter=allMethodInfo.values().iterator(); 6.264 - outerIter.hasNext();) { 6.265 - IDLMethodInfo outer = (IDLMethodInfo) outerIter.next(); 6.266 - for(Iterator innerIter = allMethodInfo.values().iterator(); 6.267 - innerIter.hasNext();) { 6.268 - IDLMethodInfo inner = (IDLMethodInfo) innerIter.next(); 6.269 - 6.270 - if( (outer != inner) && 6.271 - (!outer.originalName.equals(inner.originalName)) && 6.272 - outer.originalName.equalsIgnoreCase(inner.originalName) ) { 6.273 - outer.mangledName = 6.274 - mangleCaseSensitiveCollision(outer.originalName); 6.275 - break; 6.276 - } 6.277 - 6.278 - } 6.279 - } 6.280 - 6.281 - for(Iterator iter = allMethodInfo.values().iterator(); 6.282 - iter.hasNext();) { 6.283 - IDLMethodInfo next = (IDLMethodcurrentInfo) iter.next(); 6.284 - next.mangledName = 6.285 - mangleIdentifier(next.mangledName, 6.286 - next.propertyType != null); 6.287 - } 6.288 - 6.289 - // 6.290 - // Now check for overloaded method names and apply 1.3.2.6. 6.291 - // 6.292 - for(Iterator outerIter=allMethodInfo.values().iterator(); 6.293 - outerIter.hasNext();) { 6.294 - IDLMethodInfo outer = (IDLMethodInfo) outerIter.next(); 6.295 - if (outer.propertyType != null) { 6.296 - continue; 6.297 - } 6.298 - for(Iterator innerIter = allMethodInfo.values().iterator(); 6.299 - innerIter.hasNext();) { 6.300 - IDLMethodInfo inner = (IDLMethodInfo) innerIter.next(); 6.301 - 6.302 - if( (outer != inner) && 6.303 - (inner.propertyType == null) && 6.304 - outer.originalName.equals(inner.originalName) ) { 6.305 - outer.mangledName = mangleOverloadedMethod 6.306 - (outer.mangledName, outer.method); 6.307 - break; 6.308 - } 6.309 - } 6.310 - } 6.311 - 6.312 - // 6.313 - // Now mangle any properties that clash with method names. 6.314 - // 6.315 - for(Iterator outerIter=allMethodInfo.values().iterator(); 6.316 - outerIter.hasNext();) { 6.317 - IDLMethodInfo outer = (IDLMethodInfo) outerIter.next(); 6.318 - if(outer.propertyType == null) { 6.319 - continue; 6.320 - } 6.321 - for(Iterator innerIter = allMethodInfo.values().iterator(); 6.322 - innerIter.hasNext();) { 6.323 - IDLMethodInfo inner = (IDLMethodInfo) innerIter.next(); 6.324 - if( (outer != inner) && 6.325 - (inner.propertyType == null) && 6.326 - outer.mangledName.equals(inner.mangledName) ) { 6.327 - outer.mangledName = outer.mangledName + 6.328 - ATTRIBUTE_METHOD_CLASH_MANGLE_CHARS; 6.329 - break; 6.330 - } 6.331 - } 6.332 - } 6.333 - 6.334 - // 6.335 - // Ensure that no mapped method names clash with mapped name 6.336 - // of container(1.3.2.9). This is a case insensitive comparison. 6.337 - // 6.338 - for (int ctr=0; ctr<interf_.length; ctr++ ) { 6.339 - Class interf = interf_[ctr] ; 6.340 - String mappedContainerName = getMappedContainerName(interf); 6.341 - for(Iterator iter = allMethodInfo.values().iterator(); 6.342 - iter.hasNext();) { 6.343 - IDLMethodInfo next = (IDLMethodInfo) iter.next(); 6.344 - if( (next.propertyType == null) && 6.345 - identifierClashesWithContainer(mappedContainerName, 6.346 - next.mangledName)) { 6.347 - next.mangledName = mangleContainerClash(next.mangledName); 6.348 - } 6.349 - } 6.350 - } 6.351 - 6.352 - // 6.353 - // Populate name translation maps. 6.354 - // 6.355 - methodToIDLNameMap_ = new HashMap(); 6.356 - IDLNameToMethodMap_ = new HashMap(); 6.357 - methods_ = (Method[])allMethodInfo.keySet().toArray( 6.358 - new Method[0] ) ; 6.359 - 6.360 - for(Iterator iter = allMethodInfo.values().iterator(); 6.361 - iter.hasNext();) { 6.362 - IDLMethodInfo next = (IDLMethodInfo) iter.next(); 6.363 - String idlName = next.mangledName; 6.364 - if (next.propertyType != null) { 6.365 - idlName = javaPropertyPrefixToIDL( next.propertyType ) + 6.366 - next.mangledName ; 6.367 - } 6.368 - 6.369 - methodToIDLNameMap_.put(next.method, idlName); 6.370 - 6.371 - // Final check to see if there are any clashes after all the 6.372 - // manglings have been applied. If so, this is treated as an 6.373 - // invalid interface. Currently, we do a CASE-SENSITIVE 6.374 - // comparison since that matches the rmic behavior. 6.375 - // @@@ Shouldn't this be a case-insensitive check? 6.376 - // If there is a collision between is<TYPE> and get<TYPE>, 6.377 - // map only is<TYPE> to an attribute, and leave the 6.378 - // get<TYPE> method alone. 6.379 - if( IDLNameToMethodMap_.containsKey(idlName) ) { 6.380 - // @@@ I18N 6.381 - Method clash = (Method) IDLNameToMethodMap_.get(idlName); 6.382 - MethodInfo clashMethodInfo = 6.383 - (MethodInfo)allMethodInfo.get( clash ) ; 6.384 - if (clashMethodInfo.isBooleanProperty() && 6.385 - next.isReadProperty()) { 6.386 - // fix idlName 6.387 - } else if (clashMethodInfo.isReadProperty() && 6.388 - next.isBooleanProperty()) { 6.389 - // Remove entry under idlName 6.390 - // put entry into table under correct name 6.391 - } else { 6.392 - throw new IllegalStateException("Error : methods " + 6.393 - clash + " and " + next.method + 6.394 - " both result in IDL name '" + idlName + "'"); 6.395 - } 6.396 - } 6.397 - 6.398 - IDLNameToMethodMap_.put(idlName, next.method); 6.399 - } 6.400 - 6.401 - return; 6.402 - 6.403 - } 6.404 - 6.405 - 6.406 - /** 6.407 - * Perform all necessary stand-alone identifier mangling operations 6.408 - * on a java identifier that is being transformed into an IDL name. 6.409 - * That is, mangling operations that don't require looking at anything 6.410 - * else but the identifier itself. This covers sections 1.3.2.2, 1.3.2.3, 6.411 - * and 1.3.2.4 of the Java2IDL spec. Method overloading and 6.412 - * case-sensitivity checks are handled elsewhere. 6.413 - */ 6.414 - 6.415 - private static String mangleIdentifier(String identifier) { 6.416 - return mangleIdentifier(identifier, false); 6.417 - } 6.418 - 6.419 - private static String mangleIdentifier(String identifier, boolean attribute) { 6.420 - 6.421 - String mangledName = identifier; 6.422 - 6.423 - // 6.424 - // Apply leading underscore test (1.3.2.3) 6.425 - // This should be done before IDL Keyword clash test, since clashing 6.426 - // IDL keywords are mangled by adding a leading underscore. 6.427 - // 6.428 - if( hasLeadingUnderscore(mangledName) ) { 6.429 - mangledName = mangleLeadingUnderscore(mangledName); 6.430 - } 6.431 - 6.432 - // 6.433 - // Apply IDL keyword clash test (1.3.2.2). 6.434 - // This is not needed for attributes since when the full property 6.435 - // name is composed it cannot clash with an IDL keyword. 6.436 - // (Also, rmic doesn't do it.) 6.437 - // 6.438 - 6.439 - if( !attribute && isIDLKeyword(mangledName) ) { 6.440 - mangledName = mangleIDLKeywordClash(mangledName); 6.441 - } 6.442 - 6.443 - // 6.444 - // Replace illegal IDL identifier characters (1.3.2.4) 6.445 - // for all method names and attributes. 6.446 - // 6.447 - if( !isIDLIdentifier(mangledName) ) { 6.448 - mangledName = mangleUnicodeChars(mangledName); 6.449 - } 6.450 - 6.451 - return mangledName; 6.452 - } 6.453 - 6.454 - /** 6.455 - * Checks whether a java identifier clashes with an 6.456 - * IDL keyword. Note that this is a case-insensitive 6.457 - * comparison. 6.458 - * 6.459 - * Used to implement section 1.3.2.2 of Java2IDL spec. 6.460 - */ 6.461 - private static boolean isIDLKeyword(String identifier) { 6.462 - 6.463 - String identifierAllCaps = identifier.toUpperCase(); 6.464 - 6.465 - return idlKeywords_.contains(identifierAllCaps); 6.466 - } 6.467 - 6.468 - private static String mangleIDLKeywordClash(String identifier) { 6.469 - return UNDERSCORE + identifier; 6.470 - } 6.471 - 6.472 - private static String mangleLeadingUnderscore(String identifier) { 6.473 - return LEADING_UNDERSCORE_CHAR + identifier; 6.474 - } 6.475 - 6.476 - /** 6.477 - * Checks whether a java identifier starts with an underscore. 6.478 - * Used to implement section 1.3.2.3 of Java2IDL spec. 6.479 - */ 6.480 - private static boolean hasLeadingUnderscore(String identifier) { 6.481 - return identifier.startsWith(UNDERSCORE); 6.482 - } 6.483 - 6.484 - /** 6.485 - * Implements Section 1.3.2.4 of Java2IDL Mapping. 6.486 - * All non-IDL identifier characters must be replaced 6.487 - * with their Unicode representation. 6.488 - */ 6.489 - static String mangleUnicodeChars(String identifier) { 6.490 - StringBuffer mangledIdentifier = new StringBuffer(); 6.491 - 6.492 - for(int i = 0; i < identifier.length(); i++) { 6.493 - char nextChar = identifier.charAt(i); 6.494 - if( isIDLIdentifierChar(nextChar) ) { 6.495 - mangledIdentifier.append(nextChar); 6.496 - } else { 6.497 - String unicode = charToUnicodeRepresentation(nextChar); 6.498 - mangledIdentifier.append(unicode); 6.499 - } 6.500 - } 6.501 - 6.502 - return mangledIdentifier.toString(); 6.503 - } 6.504 - 6.505 - /** 6.506 - * Implements mangling portion of Section 1.3.2.7 of Java2IDL spec. 6.507 - * This method only deals with the actual mangling. Decision about 6.508 - * whether case-sensitive collision mangling is required is made 6.509 - * elsewhere. 6.510 - * 6.511 - * 6.512 - * "...a mangled name is generated consisting of the original name 6.513 - * followed by an underscore separated list of decimal indices 6.514 - * into the string, where the indices identify all the upper case 6.515 - * characters in the original string. Indices are zero based." 6.516 - * 6.517 - */ 6.518 - String mangleCaseSensitiveCollision(String identifier) { 6.519 - 6.520 - StringBuffer mangledIdentifier = new StringBuffer(identifier); 6.521 - 6.522 - // There is always at least one trailing underscore, whether or 6.523 - // not the identifier has uppercase letters. 6.524 - mangledIdentifier.append(UNDERSCORE); 6.525 - 6.526 - boolean needUnderscore = false; 6.527 - for(int i = 0; i < identifier.length(); i++) { 6.528 - char next = identifier.charAt(i); 6.529 - if( Character.isUpperCase(next) ) { 6.530 - // This bit of logic is needed to ensure that we have 6.531 - // an underscore separated list of indices but no 6.532 - // trailing underscores. Basically, after we have at least 6.533 - // one uppercase letter, we always put an undercore before 6.534 - // printing the next one. 6.535 - if( needUnderscore ) { 6.536 - mangledIdentifier.append(UNDERSCORE); 6.537 - } 6.538 - mangledIdentifier.append(i); 6.539 - needUnderscore = true; 6.540 - } 6.541 - } 6.542 - 6.543 - return mangledIdentifier.toString(); 6.544 - } 6.545 - 6.546 - private static String mangleContainerClash(String identifier) { 6.547 - return identifier + ID_CONTAINER_CLASH_CHAR; 6.548 - } 6.549 - 6.550 - /** 6.551 - * Implements Section 1.3.2.9 of Java2IDL Mapping. Container in this 6.552 - * context means the name of the java Class(excluding package) in which 6.553 - * the identifier is defined. Comparison is case-insensitive. 6.554 - */ 6.555 - private static boolean identifierClashesWithContainer 6.556 - (String mappedContainerName, String identifier) { 6.557 - 6.558 - return identifier.equalsIgnoreCase(mappedContainerName); 6.559 - } 6.560 - 6.561 - /** 6.562 - * Returns Unicode mangling as defined in Section 1.3.2.4 of 6.563 - * Java2IDL spec. 6.564 - * 6.565 - * "For Java identifiers that contain illegal OMG IDL identifier 6.566 - * characters such as '$' or Unicode characters outside of ISO Latin 1, 6.567 - * any such illegal characters are replaced by "U" followed by the 6.568 - * 4 hexadecimal characters(in upper case) representing the Unicode 6.569 - * value. So, the Java name a$b is mapped to aU0024b and 6.570 - * x\u03bCy is mapped to xU03BCy." 6.571 - */ 6.572 - public static String charToUnicodeRepresentation(char c) { 6.573 - 6.574 - int orig = (int) c; 6.575 - StringBuffer hexString = new StringBuffer(); 6.576 - 6.577 - int value = orig; 6.578 - 6.579 - while( value > 0 ) { 6.580 - int div = value / 16; 6.581 - int mod = value % 16; 6.582 - hexString.insert(0, HEX_DIGITS[mod]); 6.583 - value = div; 6.584 - } 6.585 - 6.586 - int numZerosToAdd = 4 - hexString.length(); 6.587 - for(int i = 0; i < numZerosToAdd; i++) { 6.588 - hexString.insert(0, "0"); 6.589 - } 6.590 - 6.591 - hexString.insert(0, "U"); 6.592 - return hexString.toString(); 6.593 - } 6.594 - 6.595 - private static boolean isIDLIdentifier(String identifier) { 6.596 - 6.597 - boolean isIdentifier = true; 6.598 - 6.599 - for(int i = 0; i < identifier.length(); i++) { 6.600 - char nextChar = identifier.charAt(i); 6.601 - // 1st char must be alphbetic. 6.602 - isIdentifier = (i == 0) ? 6.603 - isIDLAlphabeticChar(nextChar) : 6.604 - isIDLIdentifierChar(nextChar); 6.605 - if( !isIdentifier ) { 6.606 - break; 6.607 - } 6.608 - } 6.609 - 6.610 - return isIdentifier; 6.611 - 6.612 - } 6.613 - 6.614 - private static boolean isIDLIdentifierChar(char c) { 6.615 - return (isIDLAlphabeticChar(c) || 6.616 - isIDLDecimalDigit(c) || 6.617 - isUnderscore(c)); 6.618 - } 6.619 - 6.620 - /** 6.621 - * True if character is one of 114 Alphabetic characters as 6.622 - * specified in Table 2 of Chapter 3 in CORBA spec. 6.623 - */ 6.624 - private static boolean isIDLAlphabeticChar(char c) { 6.625 - 6.626 - // NOTE that we can't use the java.lang.Character 6.627 - // isUpperCase, isLowerCase, etc. methods since they 6.628 - // include many characters other than the Alphabetic list in 6.629 - // the CORBA spec. Instead, we test for inclusion in the 6.630 - // Unicode value ranges for the corresponding legal characters. 6.631 - 6.632 - boolean alphaChar = 6.633 - ( 6.634 - // A - Z 6.635 - ((c >= 0x0041) && (c <= 0x005A)) 6.636 - 6.637 - || 6.638 - 6.639 - // a - z 6.640 - ((c >= 0x0061) && (c <= 0x007A)) 6.641 - 6.642 - || 6.643 - 6.644 - // other letter uppercase, other letter lowercase, which is 6.645 - // the entire upper half of C1 Controls except X and / 6.646 - ((c >= 0x00C0) && (c <= 0x00FF) 6.647 - && (c != 0x00D7) && (c != 0x00F7))); 6.648 - 6.649 - return alphaChar; 6.650 - } 6.651 - 6.652 - /** 6.653 - * True if character is one of 10 Decimal Digits 6.654 - * specified in Table 3 of Chapter 3 in CORBA spec. 6.655 - */ 6.656 - private static boolean isIDLDecimalDigit(char c) { 6.657 - return ( (c >= 0x0030) && (c <= 0x0039) ); 6.658 - } 6.659 - 6.660 - private static boolean isUnderscore(char c) { 6.661 - return ( c == 0x005F ); 6.662 - } 6.663 - 6.664 - /** 6.665 - * Mangle an overloaded method name as defined in Section 1.3.2.6 of 6.666 - * Java2IDL spec. Current value of method name is passed in as argument. 6.667 - * We can't start from original method name since the name might have 6.668 - * been partially mangled as a result of the other rules. 6.669 - */ 6.670 - private static String mangleOverloadedMethod(String mangledName, Method m) { 6.671 - 6.672 - IDLTypesUtil idlTypesUtil = new IDLTypesUtil(); 6.673 - 6.674 - // Start by appending the separator string 6.675 - String newMangledName = mangledName + OVERLOADED_TYPE_SEPARATOR; 6.676 - 6.677 - Class[] parameterTypes = m.getParameterTypes(); 6.678 - 6.679 - for(int i = 0; i < parameterTypes.length; i++) { 6.680 - Class nextParamType = parameterTypes[i]; 6.681 - 6.682 - if( i > 0 ) { 6.683 - newMangledName = newMangledName + OVERLOADED_TYPE_SEPARATOR; 6.684 - } 6.685 - IDLType idlType = classToIDLType(nextParamType); 6.686 - 6.687 - String moduleName = idlType.getModuleName(); 6.688 - String memberName = idlType.getMemberName(); 6.689 - 6.690 - String typeName = (moduleName.length() > 0) ? 6.691 - moduleName + UNDERSCORE + memberName : memberName; 6.692 - 6.693 - if( !idlTypesUtil.isPrimitive(nextParamType) && 6.694 - (idlTypesUtil.getSpecialCaseIDLTypeMapping(nextParamType) 6.695 - == null) && 6.696 - isIDLKeyword(typeName) ) { 6.697 - typeName = mangleIDLKeywordClash(typeName); 6.698 - } 6.699 - 6.700 - typeName = mangleUnicodeChars(typeName); 6.701 - 6.702 - newMangledName = newMangledName + typeName; 6.703 - } 6.704 - 6.705 - return newMangledName; 6.706 - } 6.707 - 6.708 - 6.709 - private static IDLType classToIDLType(Class c) { 6.710 - 6.711 - IDLType idlType = null; 6.712 - IDLTypesUtil idlTypesUtil = new IDLTypesUtil(); 6.713 - 6.714 - if( idlTypesUtil.isPrimitive(c) ) { 6.715 - 6.716 - idlType = idlTypesUtil.getPrimitiveIDLTypeMapping(c); 6.717 - 6.718 - } else if( c.isArray() ) { 6.719 - 6.720 - // Calculate array depth, as well as base element type. 6.721 - Class componentType = c.getComponentType(); 6.722 - int numArrayDimensions = 1; 6.723 - while(componentType.isArray()) { 6.724 - componentType = componentType.getComponentType(); 6.725 - numArrayDimensions++; 6.726 - } 6.727 - IDLType componentIdlType = classToIDLType(componentType); 6.728 - 6.729 - String[] modules = BASE_IDL_ARRAY_MODULE_TYPE; 6.730 - if( componentIdlType.hasModule() ) { 6.731 - modules = (String[])ObjectUtility.concatenateArrays( modules, 6.732 - componentIdlType.getModules() ) ; 6.733 - } 6.734 - 6.735 - String memberName = BASE_IDL_ARRAY_ELEMENT_TYPE + 6.736 - numArrayDimensions + UNDERSCORE + 6.737 - componentIdlType.getMemberName(); 6.738 - 6.739 - idlType = new IDLType(c, modules, memberName); 6.740 - 6.741 - } else { 6.742 - idlType = idlTypesUtil.getSpecialCaseIDLTypeMapping(c); 6.743 - 6.744 - if (idlType == null) { 6.745 - // Section 1.3.2.5 of Java2IDL spec defines mangling rules for 6.746 - // inner classes. 6.747 - String memberName = getUnmappedContainerName(c); 6.748 - 6.749 - // replace inner class separator with double underscore 6.750 - memberName = memberName.replaceAll("\\$", 6.751 - INNER_CLASS_SEPARATOR); 6.752 - 6.753 - if( hasLeadingUnderscore(memberName) ) { 6.754 - memberName = mangleLeadingUnderscore(memberName); 6.755 - } 6.756 - 6.757 - // Get raw package name. If there is a package, it 6.758 - // will still have the "." separators and none of the 6.759 - // mangling rules will have been applied. 6.760 - String packageName = getPackageName(c); 6.761 - 6.762 - if (packageName == null) { 6.763 - idlType = new IDLType( c, memberName ) ; 6.764 - } else { 6.765 - // If this is a generated IDL Entity Type we need to 6.766 - // prepend org_omg_boxedIDL per sections 1.3.5 and 1.3.9 6.767 - if (idlTypesUtil.isEntity(c)) { 6.768 - packageName = "org.omg.boxedIDL." + packageName ; 6.769 - } 6.770 - 6.771 - // Section 1.3.2.1 and 1.3.2.6 of Java2IDL spec defines 6.772 - // rules for mapping java packages to IDL modules and for 6.773 - // mangling module name portion of type name. NOTE that 6.774 - // of the individual identifier mangling rules, 6.775 - // only the leading underscore test is done here. 6.776 - // The other two(IDL Keyword, Illegal Unicode chars) are 6.777 - // done in mangleOverloadedMethodName. 6.778 - StringTokenizer tokenizer = 6.779 - new StringTokenizer(packageName, "."); 6.780 - 6.781 - String[] modules = new String[ tokenizer.countTokens() ] ; 6.782 - int index = 0 ; 6.783 - while (tokenizer.hasMoreElements()) { 6.784 - String next = tokenizer.nextToken(); 6.785 - String nextMangled = hasLeadingUnderscore(next) ? 6.786 - mangleLeadingUnderscore(next) : next; 6.787 - 6.788 - modules[index++] = nextMangled ; 6.789 - } 6.790 - 6.791 - idlType = new IDLType(c, modules, memberName); 6.792 - } 6.793 - } 6.794 - } 6.795 - 6.796 - return idlType; 6.797 - } 6.798 - 6.799 - /** 6.800 - * Return Class' package name or null if there is no package. 6.801 - */ 6.802 - private static String getPackageName(Class c) { 6.803 - Package thePackage = c.getPackage(); 6.804 - String packageName = null; 6.805 - 6.806 - // Try to get package name by introspection. Some classloaders might 6.807 - // not provide this information, so check for null. 6.808 - if( thePackage != null ) { 6.809 - packageName = thePackage.getName(); 6.810 - } else { 6.811 - // brute force method 6.812 - String fullyQualifiedClassName = c.getName(); 6.813 - int lastDot = fullyQualifiedClassName.indexOf('.'); 6.814 - packageName = (lastDot == -1) ? null : 6.815 - fullyQualifiedClassName.substring(0, lastDot); 6.816 - } 6.817 - return packageName; 6.818 - } 6.819 - 6.820 - private static String getMappedContainerName(Class c) { 6.821 - String unmappedName = getUnmappedContainerName(c); 6.822 - 6.823 - return mangleIdentifier(unmappedName); 6.824 - } 6.825 - 6.826 - /** 6.827 - * Return portion of class name excluding package name. 6.828 - */ 6.829 - private static String getUnmappedContainerName(Class c) { 6.830 - 6.831 - String memberName = null; 6.832 - String packageName = getPackageName(c); 6.833 - 6.834 - String fullyQualifiedClassName = c.getName(); 6.835 - 6.836 - if( packageName != null ) { 6.837 - int packageLength = packageName.length(); 6.838 - memberName = fullyQualifiedClassName.substring(packageLength + 1); 6.839 - } else { 6.840 - memberName = fullyQualifiedClassName; 6.841 - 6.842 - } 6.843 - 6.844 - return memberName; 6.845 - } 6.846 - 6.847 - /** 6.848 - * Internal helper class for tracking information related to each 6.849 - * interface method while we're building the name translation table. 6.850 - */ 6.851 - private static class IDLMethodInfo 6.852 - { 6.853 - public Method method; 6.854 - public String propertyType; 6.855 - 6.856 - // If this is a property, originalName holds the original 6.857 - // attribute name. Otherwise, it holds the original method name. 6.858 - public String originalName; 6.859 - 6.860 - // If this is a property, mangledName holds the mangled attribute 6.861 - // name. Otherwise, it holds the mangled method name. 6.862 - public String mangledName; 6.863 - 6.864 - } 6.865 - 6.866 - public String toString() { 6.867 - 6.868 - StringBuffer contents = new StringBuffer(); 6.869 - contents.append("IDLNameTranslator[" ); 6.870 - for( int ctr=0; ctr<interf_.length; ctr++) { 6.871 - if (ctr != 0) 6.872 - contents.append( " " ) ; 6.873 - contents.append( interf_[ctr].getName() ) ; 6.874 - } 6.875 - contents.append("]\n"); 6.876 - for(Iterator iter = methodToIDLNameMap_.keySet().iterator(); 6.877 - iter.hasNext();) { 6.878 - 6.879 - Method method = (Method) iter.next(); 6.880 - String idlName = (String) methodToIDLNameMap_.get(method); 6.881 - 6.882 - contents.append(idlName + ":" + method + "\n"); 6.883 - 6.884 - } 6.885 - 6.886 - return contents.toString(); 6.887 - } 6.888 - 6.889 - public static void main(String[] args) { 6.890 - 6.891 - Class remoteInterface = java.rmi.Remote.class; 6.892 - 6.893 - if( args.length > 0 ) { 6.894 - String className = args[0]; 6.895 - try { 6.896 - remoteInterface = Class.forName(className); 6.897 - } catch(Exception e) { 6.898 - e.printStackTrace(); 6.899 - System.exit(-1); 6.900 - } 6.901 - } 6.902 - 6.903 - System.out.println("Building name translation for " + remoteInterface); 6.904 - try { 6.905 - IDLNameTranslator nameTranslator = 6.906 - IDLNameTranslatorImpl.get(remoteInterface); 6.907 - System.out.println(nameTranslator); 6.908 - } catch(IllegalStateException ise) { 6.909 - ise.printStackTrace(); 6.910 - } 6.911 - } 6.912 -}
7.1 --- a/src/share/classes/com/sun/corba/se/impl/presentation/rmi/IDLTypesUtil_save.sjava Fri Aug 09 14:24:17 2013 +0100 7.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 7.3 @@ -1,544 +0,0 @@ 7.4 -/* 7.5 - * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. 7.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 7.7 - * 7.8 - * This code is free software; you can redistribute it and/or modify it 7.9 - * under the terms of the GNU General Public License version 2 only, as 7.10 - * published by the Free Software Foundation. Oracle designates this 7.11 - * particular file as subject to the "Classpath" exception as provided 7.12 - * by Oracle in the LICENSE file that accompanied this code. 7.13 - * 7.14 - * This code is distributed in the hope that it will be useful, but WITHOUT 7.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 7.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 7.17 - * version 2 for more details (a copy is included in the LICENSE file that 7.18 - * accompanied this code). 7.19 - * 7.20 - * You should have received a copy of the GNU General Public License version 7.21 - * 2 along with this work; if not, write to the Free Software Foundation, 7.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 7.23 - * 7.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 7.25 - * or visit www.oracle.com if you need additional information or have any 7.26 - * questions. 7.27 - */ 7.28 - 7.29 -package com.sun.corba.se.impl.presentation.rmi ; 7.30 - 7.31 -import java.lang.reflect.Method; 7.32 -import java.lang.reflect.Field; 7.33 -import java.util.Set; 7.34 -import java.util.HashSet; 7.35 -import java.util.Iterator; 7.36 - 7.37 -/** 7.38 - * Utility class for testing RMI/IDL Types as defined in 7.39 - * Section 1.2 of The Java Language to IDL Mapping. Note that 7.40 - * these are static checks only. Runtime checks, such as those 7.41 - * described in Section 1.2.3, #3, are not covered. 7.42 - */ 7.43 -public class IDLTypesUtil { 7.44 - 7.45 - public static final String JAVA_GET_PROPERTY_PREFIX = "get"; 7.46 - public static final String JAVA_SET_PROPERTY_PREFIX = "set"; 7.47 - public static final String JAVA_IS_PROPERTY_PREFIX = "is"; 7.48 - 7.49 - public static final int VALID_TYPE = 0; 7.50 - public static final int INVALID_TYPE = 1; 7.51 - 7.52 - /** 7.53 - * Validate a class to ensure it conforms to the rules for a 7.54 - * Java RMI/IIOP interface. 7.55 - * 7.56 - * @throws IDLTypeException if not a valid RMI/IIOP interface. 7.57 - */ 7.58 - public void validateRemoteInterface(Class c) throws IDLTypeException 7.59 - { 7.60 - if( c == null ) { 7.61 - throw new IllegalArgumentException(); 7.62 - } 7.63 - 7.64 - if( !c.isInterface() ) { 7.65 - String msg = "Class " + c + " must be a java interface."; 7.66 - throw new IDLTypeException(msg); 7.67 - } 7.68 - 7.69 - if( !java.rmi.Remote.class.isAssignableFrom(c) ) { 7.70 - String msg = "Class " + c + " must extend java.rmi.Remote, " + 7.71 - "either directly or indirectly."; 7.72 - throw new IDLTypeException(msg); 7.73 - } 7.74 - 7.75 - // Get all methods, including super-interface methods. 7.76 - Method[] methods = c.getMethods(); 7.77 - 7.78 - for(int i = 0; i < methods.length; i++) { 7.79 - Method next = methods[i]; 7.80 - validateExceptions(next); 7.81 - } 7.82 - 7.83 - // Removed because of bug 4989053 7.84 - // validateDirectInterfaces(c); 7.85 - validateConstants(c); 7.86 - 7.87 - return; 7.88 - } 7.89 - 7.90 - public boolean isRemoteInterface(Class c) 7.91 - { 7.92 - boolean remoteInterface = true; 7.93 - try { 7.94 - validateRemoteInterface(c); 7.95 - } catch(IDLTypeException ite) { 7.96 - remoteInterface = false; 7.97 - } 7.98 - 7.99 - return remoteInterface; 7.100 - } 7.101 - 7.102 - /** 7.103 - * Section 1.2.2 Primitive Types 7.104 - */ 7.105 - public boolean isPrimitive(Class c) 7.106 - { 7.107 - if( c == null ) { 7.108 - throw new IllegalArgumentException(); 7.109 - } 7.110 - 7.111 - return c.isPrimitive(); 7.112 - } 7.113 - 7.114 - /** 7.115 - * Section 1.2.4 7.116 - */ 7.117 - public boolean isValue(Class c) 7.118 - { 7.119 - if( c == null ) { 7.120 - throw new IllegalArgumentException(); 7.121 - } 7.122 - 7.123 - return 7.124 - (!c.isInterface() && 7.125 - java.io.Serializable.class.isAssignableFrom(c) && 7.126 - !java.rmi.Remote.class.isAssignableFrom(c)); 7.127 - } 7.128 - 7.129 - /** 7.130 - * Section 1.2.5 7.131 - */ 7.132 - public boolean isArray(Class c) 7.133 - { 7.134 - boolean arrayType = false; 7.135 - 7.136 - if( c == null ) { 7.137 - throw new IllegalArgumentException(); 7.138 - } 7.139 - 7.140 - if( c.isArray() ) { 7.141 - Class componentType = c.getComponentType(); 7.142 - arrayType = 7.143 - (isPrimitive(componentType) || isRemoteInterface(componentType) || 7.144 - isEntity(componentType) || isException(componentType) || 7.145 - isValue(componentType) || isObjectReference(componentType) ); 7.146 - } 7.147 - 7.148 - return arrayType; 7.149 - } 7.150 - 7.151 - /** 7.152 - * Section 1.2.6 7.153 - */ 7.154 - public boolean isException(Class c) 7.155 - { 7.156 - if( c == null ) { 7.157 - throw new IllegalArgumentException(); 7.158 - } 7.159 - 7.160 - // Must be a checked exception, not including RemoteException or 7.161 - // its subclasses. 7.162 - return isCheckedException(c) && !isRemoteException(c) && isValue(c); 7.163 - } 7.164 - 7.165 - public boolean isRemoteException(Class c) 7.166 - { 7.167 - if( c == null ) { 7.168 - throw new IllegalArgumentException(); 7.169 - } 7.170 - 7.171 - return java.rmi.RemoteException.class.isAssignableFrom(c) ; 7.172 - } 7.173 - 7.174 - public boolean isCheckedException(Class c) 7.175 - { 7.176 - if( c == null ) { 7.177 - throw new IllegalArgumentException(); 7.178 - } 7.179 - 7.180 - return Throwable.class.isAssignableFrom(c) && 7.181 - !RuntimeException.class.isAssignableFrom(c) && 7.182 - !Error.class.isAssignableFrom(c) ; 7.183 - } 7.184 - 7.185 - /** 7.186 - * Section 1.2.7 7.187 - */ 7.188 - public boolean isObjectReference(Class c) 7.189 - { 7.190 - if( c == null ) { 7.191 - throw new IllegalArgumentException(); 7.192 - } 7.193 - 7.194 - return (c.isInterface() && 7.195 - org.omg.CORBA.Object.class.isAssignableFrom(c)); 7.196 - } 7.197 - 7.198 - /** 7.199 - * Section 1.2.8 7.200 - */ 7.201 - public boolean isEntity(Class c) 7.202 - { 7.203 - if( c == null ) { 7.204 - throw new IllegalArgumentException(); 7.205 - } 7.206 - 7.207 - Class superClass = c.getSuperclass(); 7.208 - return (!c.isInterface() && 7.209 - (superClass != null) && 7.210 - (org.omg.CORBA.portable.IDLEntity.class.isAssignableFrom(c))); 7.211 - } 7.212 - 7.213 - public String javaPropertyPrefixToIDL( String javaPrefix ) 7.214 - { 7.215 - return "_" + javaPrefix + "_" ; 7.216 - } 7.217 - 7.218 - /** 7.219 - * Return the property type if given method is legal property accessor as defined in 7.220 - * Section 1.3.4.3 of Java2IDL spec. Result is one of: JAVA_GET_PROPERTY_PREFIX, 7.221 - * JAVA_SET_PROPERTY_PREFIX, JAVA_IS_PROPERTY_PREFIX. 7.222 - */ 7.223 - public String propertyAccessorMethodType(Method m, Class c) { 7.224 - 7.225 - String methodName = m.getName(); 7.226 - Class returnType = m.getReturnType(); 7.227 - Class[] parameters = m.getParameterTypes(); 7.228 - Class[] exceptionTypes = m.getExceptionTypes(); 7.229 - String propertyType = null; 7.230 - 7.231 - if( methodName.startsWith(JAVA_GET_PROPERTY_PREFIX) ) { 7.232 - 7.233 - if((parameters.length == 0) && (returnType != Void.TYPE) && 7.234 - !hasCorrespondingReadProperty(m, c, JAVA_IS_PROPERTY_PREFIX) { 7.235 - propertyType = JAVA_GET_PROPERTY_PREFIX; 7.236 - } 7.237 - 7.238 - } else if( methodName.startsWith(JAVA_SET_PROPERTY_PREFIX) ) { 7.239 - 7.240 - if((returnType == Void.TYPE) && (parameters.length == 1)) { 7.241 - if (hasCorrespondingReadProperty(m, c, JAVA_GET_PROPERTY_PREFIX) || 7.242 - hasCorrespondingReadProperty(m, c, JAVA_IS_PROPERTY_PREFIX)) { 7.243 - propertyType = JAVA_SET_PROPERTY_PREFIX; 7.244 - } 7.245 - } 7.246 - 7.247 - } else if( methodName.startsWith(JAVA_IS_PROPERTY_PREFIX) ) { 7.248 - if((parameters.length == 0) && (returnType == Boolean.TYPE)) { 7.249 - propertyType = JAVA_IS_PROPERTY_PREFIX; 7.250 - } 7.251 - } 7.252 - 7.253 - // Some final checks that apply to all properties. 7.254 - if( propertyType != null ) { 7.255 - if(!validPropertyExceptions(m) || 7.256 - (methodName.length() <= propertyType.length())) { 7.257 - propertyType = null; 7.258 - } 7.259 - } 7.260 - 7.261 - return propertyType ; 7.262 - } 7.263 - 7.264 - private boolean hasCorrespondingReadProperty 7.265 - (Method writeProperty, Class c, String readPropertyPrefix) { 7.266 - 7.267 - String writePropertyMethodName = writeProperty.getName(); 7.268 - Class[] writePropertyParameters = writeProperty.getParameterTypes(); 7.269 - boolean foundReadProperty = false; 7.270 - 7.271 - try { 7.272 - // Look for a valid corresponding Read property 7.273 - String readPropertyMethodName = 7.274 - writePropertyMethodName.replaceFirst 7.275 - (JAVA_SET_PROPERTY_PREFIX, readPropertyPrefix); 7.276 - Method readPropertyMethod = c.getMethod(readPropertyMethodName, 7.277 - new Class[] {}); 7.278 - foundReadProperty = 7.279 - ((propertyAccessorMethodType(readPropertyMethod, c) != null) && 7.280 - (readPropertyMethod.getReturnType() == 7.281 - writePropertyParameters[0])); 7.282 - } catch(Exception e) { 7.283 - // ignore. this means we didn't find a corresponding get property. 7.284 - } 7.285 - 7.286 - return foundReadProperty; 7.287 - } 7.288 - 7.289 - public String getAttributeNameForProperty(String propertyName) { 7.290 - String attributeName = null; 7.291 - String prefix = null; 7.292 - 7.293 - if( propertyName.startsWith(JAVA_GET_PROPERTY_PREFIX) ) { 7.294 - prefix = JAVA_GET_PROPERTY_PREFIX; 7.295 - } else if( propertyName.startsWith(JAVA_SET_PROPERTY_PREFIX) ) { 7.296 - prefix = JAVA_SET_PROPERTY_PREFIX; 7.297 - } else if( propertyName.startsWith(JAVA_IS_PROPERTY_PREFIX) ) { 7.298 - prefix = JAVA_IS_PROPERTY_PREFIX; 7.299 - } 7.300 - 7.301 - if( (prefix != null) && (prefix.length() < propertyName.length()) ) { 7.302 - String remainder = propertyName.substring(prefix.length()); 7.303 - if( (remainder.length() >= 2) && 7.304 - Character.isUpperCase(remainder.charAt(0)) && 7.305 - Character.isUpperCase(remainder.charAt(1)) ) { 7.306 - // don't set the first letter to lower-case if the 7.307 - // first two are upper-case 7.308 - attributeName = remainder; 7.309 - } else { 7.310 - attributeName = Character.toLowerCase(remainder.charAt(0)) + 7.311 - remainder.substring(1); 7.312 - } 7.313 - } 7.314 - 7.315 - return attributeName; 7.316 - } 7.317 - 7.318 - /** 7.319 - * Return IDL Type name for primitive types as defined in 7.320 - * Section 1.3.3 of Java2IDL spec or null if not a primitive type. 7.321 - */ 7.322 - public IDLType getPrimitiveIDLTypeMapping(Class c) { 7.323 - 7.324 - if( c == null ) { 7.325 - throw new IllegalArgumentException(); 7.326 - } 7.327 - 7.328 - if( c.isPrimitive() ) { 7.329 - if( c == Void.TYPE ) { 7.330 - return new IDLType( c, "void" ) ; 7.331 - } else if( c == Boolean.TYPE ) { 7.332 - return new IDLType( c, "boolean" ) ; 7.333 - } else if( c == Character.TYPE ) { 7.334 - return new IDLType( c, "wchar" ) ; 7.335 - } else if( c == Byte.TYPE ) { 7.336 - return new IDLType( c, "octet" ) ; 7.337 - } else if( c == Short.TYPE ) { 7.338 - return new IDLType( c, "short" ) ; 7.339 - } else if( c == Integer.TYPE ) { 7.340 - return new IDLType( c, "long" ) ; 7.341 - } else if( c == Long.TYPE ) { 7.342 - return new IDLType( c, "long_long" ) ; 7.343 - } else if( c == Float.TYPE ) { 7.344 - return new IDLType( c, "float" ) ; 7.345 - } else if( c == Double.TYPE ) { 7.346 - return new IDLType( c, "double" ) ; 7.347 - } 7.348 - } 7.349 - 7.350 - return null; 7.351 - } 7.352 - 7.353 - /** 7.354 - * Return IDL Type name for special case type mappings as defined in 7.355 - * Table 1-1 of Java2IDL spec or null if given class is not a special 7.356 - * type. 7.357 - */ 7.358 - public IDLType getSpecialCaseIDLTypeMapping(Class c) { 7.359 - 7.360 - if( c == null ) { 7.361 - throw new IllegalArgumentException(); 7.362 - } 7.363 - 7.364 - if( c == java.lang.Object.class ) { 7.365 - return new IDLType( c, new String[] { "java", "lang" }, 7.366 - "Object" ) ; 7.367 - } else if( c == java.lang.String.class ) { 7.368 - return new IDLType( c, new String[] { "CORBA" }, 7.369 - "WStringValue" ) ; 7.370 - } else if( c == java.lang.Class.class ) { 7.371 - return new IDLType( c, new String[] { "javax", "rmi", "CORBA" }, 7.372 - "ClassDesc" ) ; 7.373 - } else if( c == java.io.Serializable.class ) { 7.374 - return new IDLType( c, new String[] { "java", "io" }, 7.375 - "Serializable" ) ; 7.376 - } else if( c == java.io.Externalizable.class ) { 7.377 - return new IDLType( c, new String[] { "java", "io" }, 7.378 - "Externalizable" ) ; 7.379 - } else if( c == java.rmi.Remote.class ) { 7.380 - return new IDLType( c, new String[] { "java", "rmi" }, 7.381 - "Remote" ) ; 7.382 - } else if( c == org.omg.CORBA.Object.class ) { 7.383 - return new IDLType( c, "Object" ) ; 7.384 - } else { 7.385 - return null; 7.386 - } 7.387 - } 7.388 - 7.389 - /** 7.390 - * Implements 1.2.3 #2 and #4 7.391 - */ 7.392 - private void validateExceptions(Method method) throws IDLTypeException { 7.393 - 7.394 - Class[] exceptions = method.getExceptionTypes(); 7.395 - 7.396 - boolean declaresRemoteExceptionOrSuperClass = false; 7.397 - 7.398 - // Section 1.2.3, #2 7.399 - for(int eIndex = 0; eIndex < exceptions.length; eIndex++) { 7.400 - Class exception = exceptions[eIndex]; 7.401 - if( isRemoteExceptionOrSuperClass(exception) ) { 7.402 - declaresRemoteExceptionOrSuperClass = true; 7.403 - break; 7.404 - } 7.405 - } 7.406 - 7.407 - if( !declaresRemoteExceptionOrSuperClass ) { 7.408 - String msg = "Method '" + method + "' must throw at least one " + 7.409 - "exception of type java.rmi.RemoteException or one of its " + 7.410 - "super-classes"; 7.411 - throw new IDLTypeException(msg); 7.412 - } 7.413 - 7.414 - // Section 1.2.3, #4 7.415 - // See also bug 4972402 7.416 - // For all exceptions E in exceptions, 7.417 - // (isCheckedException(E) => (isValue(E) || RemoteException.isAssignableFrom( E ) ) 7.418 - for(int eIndex = 0; eIndex < exceptions.length; eIndex++) { 7.419 - Class exception = exceptions[eIndex]; 7.420 - 7.421 - if (isCheckedException(exception) && !isValue(exception) && 7.422 - !isRemoteException(exception)) 7.423 - { 7.424 - String msg = "Exception '" + exception + "' on method '" + 7.425 - method + "' is not a allowed RMI/IIOP exception type"; 7.426 - throw new IDLTypeException(msg); 7.427 - } 7.428 - } 7.429 - 7.430 - return; 7.431 - } 7.432 - 7.433 - /** 7.434 - * Returns true if the method's throw clause conforms to the exception 7.435 - * restrictions for properties as defined in Section 1.3.4.3 of 7.436 - * Java2IDL spec. This means that for all exceptions E declared on the 7.437 - * method, E isChecked => RemoteException.isAssignableFrom( E ). 7.438 - */ 7.439 - private boolean validPropertyExceptions(Method method) 7.440 - { 7.441 - Class[] exceptions = method.getExceptionTypes(); 7.442 - 7.443 - for(int eIndex = 0; eIndex < exceptions.length; eIndex++) { 7.444 - Class exception = exceptions[eIndex]; 7.445 - 7.446 - if (isCheckedException(exception) && !isRemoteException(exception)) 7.447 - return false ; 7.448 - } 7.449 - 7.450 - return true; 7.451 - } 7.452 - 7.453 - /** 7.454 - * Implements Section 1.2.3, #2. 7.455 - */ 7.456 - private boolean isRemoteExceptionOrSuperClass(Class c) { 7.457 - return 7.458 - ((c == java.rmi.RemoteException.class) || 7.459 - (c == java.io.IOException.class) || 7.460 - (c == java.lang.Exception.class) || 7.461 - (c == java.lang.Throwable.class)); 7.462 - } 7.463 - 7.464 - /** 7.465 - * Implements Section 1.2.3, #5. 7.466 - */ 7.467 - private void validateDirectInterfaces(Class c) throws IDLTypeException { 7.468 - 7.469 - Class[] directInterfaces = c.getInterfaces(); 7.470 - 7.471 - if( directInterfaces.length < 2 ) { 7.472 - return; 7.473 - } 7.474 - 7.475 - Set allMethodNames = new HashSet(); 7.476 - Set currentMethodNames = new HashSet(); 7.477 - 7.478 - for(int i = 0; i < directInterfaces.length; i++) { 7.479 - Class next = directInterfaces[i]; 7.480 - Method[] methods = next.getMethods(); 7.481 - 7.482 - // Comparison is based on method names only. First collect 7.483 - // all methods from current interface, eliminating duplicate 7.484 - // names. 7.485 - currentMethodNames.clear(); 7.486 - for(int m = 0; m < methods.length; m++) { 7.487 - currentMethodNames.add(methods[m].getName()); 7.488 - } 7.489 - 7.490 - // Now check each method against list of all unique method 7.491 - // names processed so far. 7.492 - for(Iterator iter=currentMethodNames.iterator(); iter.hasNext();) { 7.493 - String methodName = (String) iter.next(); 7.494 - if( allMethodNames.contains(methodName) ) { 7.495 - String msg = "Class " + c + " inherits method " + 7.496 - methodName + " from multiple direct interfaces."; 7.497 - throw new IDLTypeException(msg); 7.498 - } else { 7.499 - allMethodNames.add(methodName); 7.500 - } 7.501 - } 7.502 - } 7.503 - 7.504 - return; 7.505 - } 7.506 - 7.507 - /** 7.508 - * Implements 1.2.3 #6 7.509 - */ 7.510 - private void validateConstants(final Class c) 7.511 - throws IDLTypeException { 7.512 - 7.513 - Field[] fields = null; 7.514 - 7.515 - try { 7.516 - fields = (Field[]) 7.517 - java.security.AccessController.doPrivileged 7.518 - (new java.security.PrivilegedExceptionAction() { 7.519 - public java.lang.Object run() throws Exception { 7.520 - return c.getFields(); 7.521 - } 7.522 - }); 7.523 - } catch(java.security.PrivilegedActionException pae) { 7.524 - IDLTypeException ite = new IDLTypeException(); 7.525 - ite.initCause(pae); 7.526 - throw ite; 7.527 - } 7.528 - 7.529 - for(int i = 0; i < fields.length; i++) { 7.530 - Field next = fields[i]; 7.531 - Class fieldType = next.getType(); 7.532 - if( (fieldType != java.lang.String.class) && 7.533 - !isPrimitive(fieldType) ) { 7.534 - String msg = "Constant field '" + next.getName() + 7.535 - "' in class '" + next.getDeclaringClass().getName() + 7.536 - "' has invalid type' " + next.getType() + "'. Constants" + 7.537 - " in RMI/IIOP interfaces can only have primitive" + 7.538 - " types and java.lang.String types."; 7.539 - throw new IDLTypeException(msg); 7.540 - } 7.541 - } 7.542 - 7.543 - 7.544 - return; 7.545 - } 7.546 - 7.547 -}
8.1 --- a/src/share/classes/com/sun/corba/se/impl/protocol/oldlocal/LocalClientRequestImpl.sjava Fri Aug 09 14:24:17 2013 +0100 8.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 8.3 @@ -1,138 +0,0 @@ 8.4 -/* 8.5 - * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved. 8.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 8.7 - * 8.8 - * This code is free software; you can redistribute it and/or modify it 8.9 - * under the terms of the GNU General Public License version 2 only, as 8.10 - * published by the Free Software Foundation. Oracle designates this 8.11 - * particular file as subject to the "Classpath" exception as provided 8.12 - * by Oracle in the LICENSE file that accompanied this code. 8.13 - * 8.14 - * This code is distributed in the hope that it will be useful, but WITHOUT 8.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 8.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 8.17 - * version 2 for more details (a copy is included in the LICENSE file that 8.18 - * accompanied this code). 8.19 - * 8.20 - * You should have received a copy of the GNU General Public License version 8.21 - * 2 along with this work; if not, write to the Free Software Foundation, 8.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 8.23 - * 8.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 8.25 - * or visit www.oracle.com if you need additional information or have any 8.26 - * questions. 8.27 - */ 8.28 - 8.29 -package com.sun.corba.se.impl.iiop; 8.30 - 8.31 -import com.sun.corba.se.impl.protocol.Request; 8.32 -import com.sun.corba.se.impl.core.ClientRequest; 8.33 -import com.sun.corba.se.impl.core.ServiceContext; 8.34 -import com.sun.corba.se.impl.core.ServiceContexts; 8.35 -import com.sun.corba.se.impl.core.ClientResponse; 8.36 -import com.sun.corba.se.impl.core.ServerRequest; 8.37 -import com.sun.corba.se.impl.core.ServerResponse; 8.38 -import com.sun.corba.se.impl.corba.IOR; 8.39 -import com.sun.corba.se.impl.corba.GIOPVersion; 8.40 -import com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase; 8.41 -import com.sun.corba.se.impl.protocol.giopmsgheaders.RequestMessage; 8.42 -import com.sun.corba.se.impl.orbutil.ORBConstants; 8.43 -import com.sun.corba.se.impl.core.ORBVersion; 8.44 -import com.sun.corba.se.impl.core.ORB; 8.45 -import com.sun.corba.se.impl.orbutil.ORBUtility; 8.46 -import com.sun.corba.se.impl.ior.ObjectKeyFactory ; 8.47 -import com.sun.corba.se.impl.ior.ObjectKey ; 8.48 -import com.sun.corba.se.impl.ior.ObjectKeyTemplate ; 8.49 -import com.sun.corba.se.impl.ior.IIOPProfile; 8.50 - 8.51 -public class LocalClientRequestImpl extends IIOPOutputStream 8.52 - implements ClientRequest 8.53 -{ 8.54 - public LocalClientRequestImpl( GIOPVersion gv, 8.55 - ORB orb, IOR ior, short addrDisposition, 8.56 - String operationName, boolean oneway, ServiceContexts svc, 8.57 - int requestId, byte streamFormatVersion) 8.58 - { 8.59 - super(gv, 8.60 - orb, 8.61 - null, 8.62 - BufferManagerFactory.newBufferManagerWrite(BufferManagerFactory.GROW), 8.63 - streamFormatVersion); 8.64 - 8.65 - this.isOneway = oneway; 8.66 - boolean responseExpected = !isOneway; 8.67 - 8.68 - IIOPProfile iop = ior.getProfile(); 8.69 - ObjectKey okey = iop.getObjectKey(); 8.70 - ObjectKeyTemplate oktemp = okey.getTemplate() ; 8.71 - ORBVersion version = oktemp.getORBVersion() ; 8.72 - orb.setORBVersion( version ) ; 8.73 - 8.74 - this.request = MessageBase.createRequest(orb, gv, requestId, 8.75 - responseExpected, ior, addrDisposition, operationName, svc, null); 8.76 - setMessage(request); 8.77 - request.write(this); 8.78 - 8.79 - // mark beginning of msg body for possible later use 8.80 - bodyBegin = getSize(); 8.81 - } 8.82 - 8.83 - public int getRequestId() { 8.84 - return request.getRequestId(); 8.85 - } 8.86 - 8.87 - public boolean isOneWay() { 8.88 - return isOneway; 8.89 - } 8.90 - 8.91 - public ServiceContexts getServiceContexts() { 8.92 - return request.getServiceContexts(); 8.93 - } 8.94 - 8.95 - public String getOperationName() { 8.96 - return request.getOperation(); 8.97 - } 8.98 - 8.99 - public ObjectKey getObjectKey() { 8.100 - return request.getObjectKey(); 8.101 - } 8.102 - 8.103 - public ServerRequest getServerRequest() 8.104 - { 8.105 - // Set the size of the marshalled data in the message header. 8.106 - getMessage().setSize( getByteBuffer(), getSize() ) ; 8.107 - 8.108 - // Construct a new ServerRequest out of the buffer in this ClientRequest 8.109 - LocalServerRequestImpl serverRequest = new LocalServerRequestImpl( 8.110 - (ORB)orb(), toByteArray(), request ) ; 8.111 - 8.112 - // Skip over all of the GIOP header information. This positions 8.113 - // the offset in the buffer so that the skeleton can correctly read 8.114 - // the marshalled arguments. 8.115 - serverRequest.setIndex( bodyBegin ) ; 8.116 - 8.117 - return serverRequest ; 8.118 - } 8.119 - 8.120 - public ClientResponse invoke() 8.121 - { 8.122 - ORB myORB = (ORB)orb() ; 8.123 - 8.124 - ServerResponse serverResponse = myORB.process( getServerRequest() ) ; 8.125 - 8.126 - LocalServerResponseImpl lsr = (LocalServerResponseImpl)serverResponse ; 8.127 - 8.128 - return lsr.getClientResponse() ; 8.129 - } 8.130 - 8.131 - /** 8.132 - * Check to see if the request is local. 8.133 - */ 8.134 - public boolean isLocal(){ 8.135 - return true; 8.136 - } 8.137 - 8.138 - private RequestMessage request; 8.139 - private int bodyBegin; 8.140 - private boolean isOneway; 8.141 -}
9.1 --- a/src/share/classes/com/sun/corba/se/impl/protocol/oldlocal/LocalClientResponseImpl.sjava Fri Aug 09 14:24:17 2013 +0100 9.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 9.3 @@ -1,162 +0,0 @@ 9.4 -/* 9.5 - * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved. 9.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 9.7 - * 9.8 - * This code is free software; you can redistribute it and/or modify it 9.9 - * under the terms of the GNU General Public License version 2 only, as 9.10 - * published by the Free Software Foundation. Oracle designates this 9.11 - * particular file as subject to the "Classpath" exception as provided 9.12 - * by Oracle in the LICENSE file that accompanied this code. 9.13 - * 9.14 - * This code is distributed in the hope that it will be useful, but WITHOUT 9.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 9.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 9.17 - * version 2 for more details (a copy is included in the LICENSE file that 9.18 - * accompanied this code). 9.19 - * 9.20 - * You should have received a copy of the GNU General Public License version 9.21 - * 2 along with this work; if not, write to the Free Software Foundation, 9.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 9.23 - * 9.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 9.25 - * or visit www.oracle.com if you need additional information or have any 9.26 - * questions. 9.27 - */ 9.28 - 9.29 -package com.sun.corba.se.impl.iiop; 9.30 - 9.31 -import java.io.IOException; 9.32 - 9.33 -import org.omg.CORBA.SystemException; 9.34 -import org.omg.CORBA.CompletionStatus; 9.35 - 9.36 -import com.sun.corba.se.impl.core.Response; 9.37 -import com.sun.corba.se.impl.core.ClientResponse; 9.38 -import com.sun.corba.se.impl.corba.IOR; 9.39 -import com.sun.corba.se.impl.core.ORB; 9.40 -import com.sun.corba.se.impl.core.ServiceContext; 9.41 -import com.sun.corba.se.impl.core.ServiceContexts; 9.42 -import com.sun.corba.se.impl.protocol.giopmsgheaders.Message; 9.43 -import com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage; 9.44 -import com.sun.corba.se.impl.orbutil.MinorCodes; 9.45 - 9.46 -class LocalClientResponseImpl extends IIOPInputStream implements ClientResponse 9.47 -{ 9.48 - LocalClientResponseImpl(ORB orb, byte[] buf, ReplyMessage header) 9.49 - { 9.50 - super(orb, buf, header.getSize(), header.isLittleEndian(), header, null); 9.51 - 9.52 - this.reply = header; 9.53 - 9.54 - // NOTE (Ram J) (06/02/2000) if we set result.setIndex(bodyBegin) 9.55 - // in LocalServerResponse.getClientResponse(), then we do not need 9.56 - // to read the headers (done below) anymore. 9.57 - // This will be an optimisation which is can be done to speed up the 9.58 - // local invocation by avoiding reading the headers in the local cases. 9.59 - 9.60 - // BUGFIX(Ram Jeyaraman) This has been moved from 9.61 - // LocalServerResponse.getClientResponse() 9.62 - // Skip over all of the GIOP header information. This positions 9.63 - // the offset in the buffer so that the skeleton can correctly read 9.64 - // the marshalled arguments. 9.65 - this.setIndex(Message.GIOPMessageHeaderLength); 9.66 - 9.67 - // BUGFIX(Ram Jeyaraman) For local invocations, the reply mesg fields 9.68 - // needs to be set, by reading the response buffer contents 9.69 - // to correctly set the exception type and other info. 9.70 - this.reply.read(this); 9.71 - } 9.72 - 9.73 - LocalClientResponseImpl(SystemException ex) 9.74 - { 9.75 - this.systemException = ex; 9.76 - } 9.77 - 9.78 - public boolean isSystemException() { 9.79 - if ( reply != null ) 9.80 - return reply.getReplyStatus() == ReplyMessage.SYSTEM_EXCEPTION; 9.81 - else 9.82 - return (systemException != null); 9.83 - } 9.84 - 9.85 - public boolean isUserException() { 9.86 - if ( reply != null ) 9.87 - return reply.getReplyStatus() == ReplyMessage.USER_EXCEPTION; 9.88 - else 9.89 - return false; 9.90 - } 9.91 - 9.92 - public boolean isLocationForward() { 9.93 - if ( reply != null ) { 9.94 - return ( (reply.getReplyStatus() == ReplyMessage.LOCATION_FORWARD) || 9.95 - (reply.getReplyStatus() == ReplyMessage.LOCATION_FORWARD_PERM) ); 9.96 - //return reply.getReplyStatus() == ReplyMessage.LOCATION_FORWARD; 9.97 - } else { 9.98 - return false; 9.99 - } 9.100 - } 9.101 - 9.102 - public boolean isDifferentAddrDispositionRequested() { 9.103 - if (reply != null) { 9.104 - return reply.getReplyStatus() == ReplyMessage.NEEDS_ADDRESSING_MODE; 9.105 - } 9.106 - 9.107 - return false; 9.108 - } 9.109 - 9.110 - public short getAddrDisposition() { 9.111 - if (reply != null) { 9.112 - return reply.getAddrDisposition(); 9.113 - } 9.114 - 9.115 - throw new org.omg.CORBA.INTERNAL( 9.116 - "Null reply in getAddrDisposition", 9.117 - MinorCodes.NULL_REPLY_IN_GET_ADDR_DISPOSITION, 9.118 - CompletionStatus.COMPLETED_MAYBE); 9.119 - } 9.120 - 9.121 - public IOR getForwardedIOR() { 9.122 - if ( reply != null ) 9.123 - return reply.getIOR(); 9.124 - else 9.125 - return null; 9.126 - } 9.127 - 9.128 - public int getRequestId() { 9.129 - if ( reply != null ) 9.130 - return reply.getRequestId(); 9.131 - else 9.132 - throw new org.omg.CORBA.INTERNAL("Error in getRequestId"); 9.133 - } 9.134 - 9.135 - public ServiceContexts getServiceContexts() { 9.136 - if ( reply != null ) 9.137 - return reply.getServiceContexts(); 9.138 - else 9.139 - return null; 9.140 - } 9.141 - 9.142 - public SystemException getSystemException() { 9.143 - if ( reply != null ) 9.144 - return reply.getSystemException(); 9.145 - else 9.146 - return systemException; 9.147 - } 9.148 - 9.149 - public java.lang.String peekUserExceptionId() { 9.150 - mark(Integer.MAX_VALUE); 9.151 - String result = read_string(); 9.152 - reset(); 9.153 - return result; 9.154 - } 9.155 - 9.156 - /** 9.157 - * Check to see if the response is local. 9.158 - */ 9.159 - public boolean isLocal(){ 9.160 - return true; 9.161 - } 9.162 - 9.163 - private ReplyMessage reply; 9.164 - private SystemException systemException; 9.165 -}
10.1 --- a/src/share/classes/com/sun/corba/se/impl/protocol/oldlocal/LocalServerRequestImpl.sjava Fri Aug 09 14:24:17 2013 +0100 10.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 10.3 @@ -1,208 +0,0 @@ 10.4 -/* 10.5 - * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved. 10.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 10.7 - * 10.8 - * This code is free software; you can redistribute it and/or modify it 10.9 - * under the terms of the GNU General Public License version 2 only, as 10.10 - * published by the Free Software Foundation. Oracle designates this 10.11 - * particular file as subject to the "Classpath" exception as provided 10.12 - * by Oracle in the LICENSE file that accompanied this code. 10.13 - * 10.14 - * This code is distributed in the hope that it will be useful, but WITHOUT 10.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 10.17 - * version 2 for more details (a copy is included in the LICENSE file that 10.18 - * accompanied this code). 10.19 - * 10.20 - * You should have received a copy of the GNU General Public License version 10.21 - * 2 along with this work; if not, write to the Free Software Foundation, 10.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 10.23 - * 10.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 10.25 - * or visit www.oracle.com if you need additional information or have any 10.26 - * questions. 10.27 - */ 10.28 - 10.29 -package com.sun.corba.se.impl.iiop; 10.30 - 10.31 -import org.omg.CORBA.SystemException; 10.32 - 10.33 -import com.sun.corba.se.impl.core.ServerRequest; 10.34 -import com.sun.corba.se.impl.core.ServiceContext; 10.35 -import com.sun.corba.se.impl.core.DuplicateServiceContext; 10.36 -import com.sun.corba.se.impl.core.UEInfoServiceContext; 10.37 -import com.sun.corba.se.impl.core.ServiceContexts; 10.38 -import com.sun.corba.se.impl.core.ServerResponse; 10.39 -import com.sun.corba.se.impl.corba.IOR; 10.40 -import com.sun.corba.se.impl.core.ORB; 10.41 -import com.sun.corba.se.impl.orbutil.ORBUtility; //d11638 10.42 -import org.omg.CORBA.portable.UnknownException; 10.43 -import org.omg.CORBA.UNKNOWN; 10.44 -import org.omg.CORBA.CompletionStatus; 10.45 -import com.sun.corba.se.impl.ior.ObjectKey; 10.46 -import com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase; 10.47 -import com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage; 10.48 -import com.sun.corba.se.impl.protocol.giopmsgheaders.RequestMessage; 10.49 - 10.50 -class LocalServerRequestImpl extends IIOPInputStream implements ServerRequest { 10.51 - org.omg.CORBA.portable.OutputStream replyStream; 10.52 - org.omg.CORBA.portable.OutputStream exceptionReplyStream; 10.53 - 10.54 - LocalServerRequestImpl(ORB orb, byte[] buf, RequestMessage header) 10.55 - { 10.56 - super(orb, buf, header.getSize(), header.isLittleEndian(), header, null ); 10.57 - 10.58 - this.request = header; 10.59 - } 10.60 - 10.61 - public int getRequestId() { 10.62 - return request.getRequestId(); 10.63 - } 10.64 - 10.65 - public boolean isOneWay() { 10.66 - return !request.isResponseExpected(); 10.67 - } 10.68 - 10.69 - public ServiceContexts getServiceContexts() { 10.70 - return request.getServiceContexts(); 10.71 - } 10.72 - 10.73 - public String getOperationName() { 10.74 - return request.getOperation(); 10.75 - } 10.76 - 10.77 - public ObjectKey getObjectKey() { 10.78 - return request.getObjectKey(); 10.79 - } 10.80 - 10.81 - public ServerResponse createResponse(ServiceContexts svc) 10.82 - { 10.83 - return new LocalServerResponseImpl(this, svc); 10.84 - } 10.85 - 10.86 - public org.omg.CORBA.portable.OutputStream createReply() { 10.87 - if (replyStream == null) { 10.88 - replyStream = (org.omg.CORBA.portable.OutputStream) 10.89 - createResponse(null); 10.90 - } 10.91 - return replyStream; 10.92 - } 10.93 - 10.94 - public org.omg.CORBA.portable.OutputStream createExceptionReply() { 10.95 - if (exceptionReplyStream == null) { 10.96 - exceptionReplyStream = (org.omg.CORBA.portable.OutputStream) 10.97 - createUserExceptionResponse(null); 10.98 - } 10.99 - return exceptionReplyStream; 10.100 - } 10.101 - 10.102 - public ServerResponse createUserExceptionResponse( 10.103 - ServiceContexts svc) 10.104 - { 10.105 - return new LocalServerResponseImpl(this, svc, true); 10.106 - } 10.107 - 10.108 - public ServerResponse createUnknownExceptionResponse( 10.109 - UnknownException ex) { 10.110 - ServiceContexts contexts = null; 10.111 - SystemException sys = new UNKNOWN( 0, 10.112 - CompletionStatus.COMPLETED_MAYBE); 10.113 - 10.114 - try { 10.115 - contexts = new ServiceContexts( (ORB)orb() ); 10.116 - UEInfoServiceContext uei = new UEInfoServiceContext(sys); 10.117 - contexts.put(uei) ; 10.118 - } catch (DuplicateServiceContext d) { 10.119 - // can't happen 10.120 - } 10.121 - 10.122 - return createSystemExceptionResponse(sys,contexts); 10.123 - } 10.124 - 10.125 - public ServerResponse createSystemExceptionResponse( 10.126 - SystemException ex, ServiceContexts svc) { 10.127 - 10.128 - // Only do this if interceptors have been initialized on this request 10.129 - // and have not completed their lifecycle (otherwise the info stack 10.130 - // may be empty or have a different request's entry on top). 10.131 - if (executePIInResponseConstructor()) { 10.132 - // Inform Portable Interceptors of the SystemException. This is 10.133 - // required to be done here because the ending interception point 10.134 - // is called in the ServerResponseImpl constructor called below 10.135 - // but we do not currently write the SystemException into the 10.136 - // response until after the ending point is called. 10.137 - ORB orb = (ORB)orb(); 10.138 - orb.getPIHandler().setServerPIInfo( ex ); 10.139 - } 10.140 - 10.141 - if (orb() != null && ((ORB)orb()).subcontractDebugFlag && ex != null) 10.142 - ORBUtility.dprint(this, "Sending SystemException:", ex); 10.143 - 10.144 - LocalServerResponseImpl response = 10.145 - new LocalServerResponseImpl(this, svc, false); 10.146 - ORBUtility.writeSystemException(ex, response); 10.147 - return response; 10.148 - } 10.149 - 10.150 - public ServerResponse createLocationForward( 10.151 - IOR ior, ServiceContexts svc) { 10.152 - ReplyMessage reply = MessageBase.createReply( (ORB)orb(), 10.153 - request.getGIOPVersion(), request.getRequestId(), 10.154 - ReplyMessage.LOCATION_FORWARD, svc, ior); 10.155 - LocalServerResponseImpl response = 10.156 - new LocalServerResponseImpl(this, reply, ior); 10.157 - 10.158 - return response; 10.159 - } 10.160 - 10.161 - private RequestMessage request; 10.162 - 10.163 - /** 10.164 - * Check to see if the request is local. 10.165 - */ 10.166 - public boolean isLocal(){ 10.167 - return true; 10.168 - } 10.169 - 10.170 - private boolean _executeReturnServantInResponseConstructor = false; 10.171 - 10.172 - public boolean executeReturnServantInResponseConstructor() 10.173 - { 10.174 - return _executeReturnServantInResponseConstructor; 10.175 - } 10.176 - 10.177 - public void setExecuteReturnServantInResponseConstructor(boolean b) 10.178 - { 10.179 - _executeReturnServantInResponseConstructor = b; 10.180 - } 10.181 - 10.182 - 10.183 - private boolean _executeRemoveThreadInfoInResponseConstructor = false; 10.184 - 10.185 - public boolean executeRemoveThreadInfoInResponseConstructor() 10.186 - { 10.187 - return _executeRemoveThreadInfoInResponseConstructor; 10.188 - } 10.189 - 10.190 - public void setExecuteRemoveThreadInfoInResponseConstructor(boolean b) 10.191 - { 10.192 - _executeRemoveThreadInfoInResponseConstructor = b; 10.193 - } 10.194 - 10.195 - 10.196 - private boolean _executePIInResponseConstructor = false; 10.197 - 10.198 - public boolean executePIInResponseConstructor() { 10.199 - return _executePIInResponseConstructor; 10.200 - } 10.201 - 10.202 - public void setExecutePIInResponseConstructor( boolean b ) { 10.203 - _executePIInResponseConstructor = b; 10.204 - } 10.205 - 10.206 - // We know that we're talking to the same ValueHandler, so 10.207 - // use the maximum version it supports. 10.208 - public byte getStreamFormatVersionForReply() { 10.209 - return ORBUtility.getMaxStreamFormatVersion(); 10.210 - } 10.211 -}
11.1 --- a/src/share/classes/com/sun/corba/se/impl/protocol/oldlocal/LocalServerResponseImpl.sjava Fri Aug 09 14:24:17 2013 +0100 11.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 11.3 @@ -1,192 +0,0 @@ 11.4 -/* 11.5 - * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved. 11.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 11.7 - * 11.8 - * This code is free software; you can redistribute it and/or modify it 11.9 - * under the terms of the GNU General Public License version 2 only, as 11.10 - * published by the Free Software Foundation. Oracle designates this 11.11 - * particular file as subject to the "Classpath" exception as provided 11.12 - * by Oracle in the LICENSE file that accompanied this code. 11.13 - * 11.14 - * This code is distributed in the hope that it will be useful, but WITHOUT 11.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 11.17 - * version 2 for more details (a copy is included in the LICENSE file that 11.18 - * accompanied this code). 11.19 - * 11.20 - * You should have received a copy of the GNU General Public License version 11.21 - * 2 along with this work; if not, write to the Free Software Foundation, 11.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 11.23 - * 11.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 11.25 - * or visit www.oracle.com if you need additional information or have any 11.26 - * questions. 11.27 - */ 11.28 - 11.29 -package com.sun.corba.se.impl.iiop; 11.30 - 11.31 -import org.omg.CORBA.SystemException; 11.32 - 11.33 -import com.sun.corba.se.impl.core.ServerResponse; 11.34 -import com.sun.corba.se.impl.core.ORB; 11.35 -import com.sun.corba.se.impl.corba.IOR; 11.36 -import com.sun.corba.se.impl.core.ServiceContext; 11.37 -import com.sun.corba.se.impl.core.ServiceContexts; 11.38 -import com.sun.corba.se.impl.core.ClientResponse; 11.39 -import com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase; 11.40 -import com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage; 11.41 - 11.42 -class LocalServerResponseImpl 11.43 - extends IIOPOutputStream 11.44 - implements ServerResponse 11.45 -{ 11.46 - LocalServerResponseImpl(LocalServerRequestImpl request, ServiceContexts svc) 11.47 - { 11.48 - this(request, 11.49 - MessageBase.createReply( 11.50 - (ORB)request.orb(), 11.51 - request.getGIOPVersion(), 11.52 - request.getRequestId(), ReplyMessage.NO_EXCEPTION, 11.53 - svc, null), 11.54 - null); 11.55 - } 11.56 - 11.57 - LocalServerResponseImpl(LocalServerRequestImpl request, ServiceContexts svc, 11.58 - boolean user) 11.59 - { 11.60 - this(request, 11.61 - MessageBase.createReply( 11.62 - (ORB)request.orb(), 11.63 - request.getGIOPVersion(), request.getRequestId(), 11.64 - user ? ReplyMessage.USER_EXCEPTION : 11.65 - ReplyMessage.SYSTEM_EXCEPTION, 11.66 - svc, null), 11.67 - null); 11.68 - } 11.69 - 11.70 - LocalServerResponseImpl( LocalServerRequestImpl request, ReplyMessage reply, 11.71 - IOR ior) 11.72 - { 11.73 - super(request.getGIOPVersion(), 11.74 - (ORB)request.orb(), 11.75 - null, 11.76 - BufferManagerFactory.newBufferManagerWrite(BufferManagerFactory.GROW), 11.77 - request.getStreamFormatVersionForReply()); 11.78 - 11.79 - setMessage(reply); 11.80 - 11.81 - ORB orb = (ORB)request.orb(); 11.82 - 11.83 - ServerResponseImpl.runServantPostInvoke(orb, request); 11.84 - 11.85 - if( request.executePIInResponseConstructor() ) { 11.86 - // Invoke server request ending interception points (send_*): 11.87 - // Note: this may end up with a SystemException or an internal 11.88 - // Runtime ForwardRequest. 11.89 - orb.getPIHandler().invokeServerPIEndingPoint( reply ); 11.90 - 11.91 - // Note this will be executed even if a ForwardRequest or 11.92 - // SystemException is thrown by a Portable Interceptors ending 11.93 - // point since we end up in this constructor again anyway. 11.94 - orb.getPIHandler().cleanupServerPIRequest(); 11.95 - 11.96 - // See (Local)ServerRequestImpl.createSystemExceptionResponse 11.97 - // for why this is necesary. 11.98 - request.setExecutePIInResponseConstructor(false); 11.99 - } 11.100 - 11.101 - // Once you get here then the final reply is available (i.e., 11.102 - // postinvoke and interceptors have completed. 11.103 - if (request.executeRemoveThreadInfoInResponseConstructor()) { 11.104 - ServerResponseImpl.removeThreadInfo(orb, request); 11.105 - } 11.106 - 11.107 - reply.write(this); 11.108 - if (reply.getIOR() != null) 11.109 - reply.getIOR().write(this); 11.110 - 11.111 - this.reply = reply; 11.112 - this.ior = reply.getIOR(); 11.113 - } 11.114 - 11.115 - public boolean isSystemException() { 11.116 - if (reply != null) 11.117 - return reply.getReplyStatus() == ReplyMessage.SYSTEM_EXCEPTION; 11.118 - return false; 11.119 - } 11.120 - 11.121 - public boolean isUserException() { 11.122 - if (reply != null) 11.123 - return reply.getReplyStatus() == ReplyMessage.USER_EXCEPTION; 11.124 - return false; 11.125 - } 11.126 - 11.127 - public boolean isLocationForward() { 11.128 - if (ior != null) 11.129 - return true; 11.130 - return false; 11.131 - } 11.132 - 11.133 - public IOR getForwardedIOR() { 11.134 - return ior; 11.135 - } 11.136 - 11.137 - public int getRequestId() { 11.138 - if (reply != null) 11.139 - return reply.getRequestId(); 11.140 - return -1; 11.141 - } 11.142 - 11.143 - public ServiceContexts getServiceContexts() { 11.144 - if (reply != null) 11.145 - return reply.getServiceContexts(); 11.146 - return null; 11.147 - } 11.148 - 11.149 - public SystemException getSystemException() { 11.150 - if (reply != null) 11.151 - return reply.getSystemException(); 11.152 - return null; 11.153 - } 11.154 - 11.155 - public ReplyMessage getReply() 11.156 - { 11.157 - return reply ; 11.158 - } 11.159 - 11.160 - public ClientResponse getClientResponse() 11.161 - { 11.162 - // set the size of the marshalled data in the message header 11.163 - getMessage().setSize(getByteBuffer(), getSize()); 11.164 - 11.165 - // Construct a new ClientResponse out of the buffer in this ClientRequest 11.166 - LocalClientResponseImpl result = 11.167 - new LocalClientResponseImpl( (ORB)orb(), toByteArray(), reply); 11.168 - 11.169 - // NOTE (Ram J) (06/02/2000) if we set result.setIndex(bodyBegin) here 11.170 - // then the LocalClientResponse does not need to read the headers anymore. 11.171 - // This will be an optimisation which is can be done to speed up the 11.172 - // local invocation by avoiding reading the headers in the local cases. 11.173 - 11.174 - // BUGFIX(Ram Jeyaraman) result.setOffset is now done in 11.175 - // LocalClientResponseImpl constructor. 11.176 - /* 11.177 - // Skip over all of the GIOP header information. This positions 11.178 - // the offset in the buffer so that the skeleton can correctly read 11.179 - // the marshalled arguments. 11.180 - result.setOffset( bodyBegin ) ; 11.181 - */ 11.182 - 11.183 - return result ; 11.184 - } 11.185 - 11.186 - /** 11.187 - * Check to see if the response is local. 11.188 - */ 11.189 - public boolean isLocal(){ 11.190 - return true; 11.191 - } 11.192 - 11.193 - private ReplyMessage reply; 11.194 - private IOR ior; // forwarded IOR 11.195 -}
12.1 --- a/src/share/classes/com/sun/corba/se/impl/transport/BufferConnectionImpl.sjava Fri Aug 09 14:24:17 2013 +0100 12.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 12.3 @@ -1,710 +0,0 @@ 12.4 -/* 12.5 - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. 12.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 12.7 - * 12.8 - * This code is free software; you can redistribute it and/or modify it 12.9 - * under the terms of the GNU General Public License version 2 only, as 12.10 - * published by the Free Software Foundation. Oracle designates this 12.11 - * particular file as subject to the "Classpath" exception as provided 12.12 - * by Oracle in the LICENSE file that accompanied this code. 12.13 - * 12.14 - * This code is distributed in the hope that it will be useful, but WITHOUT 12.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12.17 - * version 2 for more details (a copy is included in the LICENSE file that 12.18 - * accompanied this code). 12.19 - * 12.20 - * You should have received a copy of the GNU General Public License version 12.21 - * 2 along with this work; if not, write to the Free Software Foundation, 12.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 12.23 - * 12.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 12.25 - * or visit www.oracle.com if you need additional information or have any 12.26 - * questions. 12.27 - */ 12.28 - 12.29 -package com.sun.corba.se.impl.transport; 12.30 - 12.31 -import java.io.IOException; 12.32 -import java.net.InetSocketAddress; 12.33 -import java.net.Socket; 12.34 -import java.nio.ByteBuffer; 12.35 -import java.nio.channels.SelectableChannel; 12.36 -import java.nio.channels.SelectionKey; 12.37 -import java.nio.channels.SocketChannel; 12.38 -import java.security.AccessController; 12.39 -import java.security.PrivilegedAction; 12.40 -import java.util.Collections; 12.41 -import java.util.Hashtable; 12.42 -import java.util.HashMap; 12.43 -import java.util.Map; 12.44 - 12.45 -import org.omg.CORBA.COMM_FAILURE; 12.46 -import org.omg.CORBA.CompletionStatus; 12.47 -import org.omg.CORBA.DATA_CONVERSION; 12.48 -import org.omg.CORBA.INTERNAL; 12.49 -import org.omg.CORBA.MARSHAL; 12.50 -import org.omg.CORBA.OBJECT_NOT_EXIST; 12.51 -import org.omg.CORBA.SystemException; 12.52 - 12.53 -import com.sun.org.omg.SendingContext.CodeBase; 12.54 - 12.55 -import com.sun.corba.se.pept.broker.Broker; 12.56 -import com.sun.corba.se.pept.encoding.InputObject; 12.57 -import com.sun.corba.se.pept.encoding.OutputObject; 12.58 -import com.sun.corba.se.pept.protocol.MessageMediator; 12.59 -import com.sun.corba.se.pept.transport.Acceptor; 12.60 -import com.sun.corba.se.pept.transport.Connection; 12.61 -import com.sun.corba.se.pept.transport.ConnectionCache; 12.62 -import com.sun.corba.se.pept.transport.ContactInfo; 12.63 -import com.sun.corba.se.pept.transport.EventHandler; 12.64 -import com.sun.corba.se.pept.transport.InboundConnectionCache; 12.65 -import com.sun.corba.se.pept.transport.OutboundConnectionCache; 12.66 -import com.sun.corba.se.pept.transport.ResponseWaitingRoom; 12.67 -import com.sun.corba.se.pept.transport.Selector; 12.68 - 12.69 -import com.sun.corba.se.spi.ior.IOR; 12.70 -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; 12.71 -import com.sun.corba.se.spi.logging.CORBALogDomains; 12.72 -import com.sun.corba.se.spi.orb.ORB ; 12.73 -import com.sun.corba.se.spi.orbutil.threadpool.Work; 12.74 -import com.sun.corba.se.spi.protocol.CorbaMessageMediator; 12.75 -import com.sun.corba.se.spi.transport.CorbaContactInfo; 12.76 -import com.sun.corba.se.spi.transport.CorbaConnection; 12.77 -import com.sun.corba.se.spi.transport.CorbaResponseWaitingRoom; 12.78 - 12.79 -import com.sun.corba.se.impl.encoding.CachedCodeBase; 12.80 -import com.sun.corba.se.impl.encoding.CDRInputStream_1_0; 12.81 -import com.sun.corba.se.impl.encoding.CDROutputObject; 12.82 -import com.sun.corba.se.impl.encoding.CDROutputStream_1_0; 12.83 -import com.sun.corba.se.impl.encoding.CodeSetComponentInfo; 12.84 -import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry; 12.85 -import com.sun.corba.se.impl.logging.ORBUtilSystemException; 12.86 -import com.sun.corba.se.impl.orbutil.ORBConstants; 12.87 -import com.sun.corba.se.impl.orbutil.ORBUtility; 12.88 -import com.sun.corba.se.impl.protocol.giopmsgheaders.Message; 12.89 -import com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase; 12.90 -import com.sun.corba.se.impl.transport.CorbaResponseWaitingRoomImpl; 12.91 - 12.92 -/** 12.93 - * @author Ken Cavanaugh 12.94 - */ 12.95 -public class BufferConnectionImpl 12.96 - extends 12.97 - EventHandlerBase 12.98 - implements 12.99 - CorbaConnection, 12.100 - Work 12.101 -{ 12.102 - // 12.103 - // New transport. 12.104 - // 12.105 - 12.106 - protected long enqueueTime; 12.107 - 12.108 - public SocketChannel getSocketChannel() 12.109 - { 12.110 - return null; 12.111 - } 12.112 - 12.113 - // REVISIT: 12.114 - // protected for test: genericRPCMSGFramework.IIOPConnection constructor. 12.115 - 12.116 - // 12.117 - // From iiop.Connection.java 12.118 - // 12.119 - 12.120 - protected long timeStamp = 0; 12.121 - protected boolean isServer = false; 12.122 - 12.123 - // Start at some value other than zero since this is a magic 12.124 - // value in some protocols. 12.125 - protected int requestId = 5; 12.126 - protected CorbaResponseWaitingRoom responseWaitingRoom; 12.127 - protected int state; 12.128 - protected java.lang.Object stateEvent = new java.lang.Object(); 12.129 - protected java.lang.Object writeEvent = new java.lang.Object(); 12.130 - protected boolean writeLocked; 12.131 - protected int serverRequestCount = 0; 12.132 - 12.133 - // Server request map: used on the server side of Connection 12.134 - // Maps request ID to IIOPInputStream. 12.135 - Map serverRequestMap = new HashMap() ; 12.136 - 12.137 - // This is a flag associated per connection telling us if the 12.138 - // initial set of sending contexts were sent to the receiver 12.139 - // already... 12.140 - protected boolean postInitialContexts = false; 12.141 - 12.142 - // Remote reference to CodeBase server (supplies 12.143 - // FullValueDescription, among other things) 12.144 - protected IOR codeBaseServerIOR; 12.145 - 12.146 - // CodeBase cache for this connection. This will cache remote operations, 12.147 - // handle connecting, and ensure we don't do any remote operations until 12.148 - // necessary. 12.149 - protected CachedCodeBase cachedCodeBase = new CachedCodeBase(this); 12.150 - 12.151 - protected ORBUtilSystemException wrapper ; 12.152 - 12.153 - List buffers ; 12.154 - 12.155 - public BufferConnectionImpl(ORB orb, byte[][] data ) 12.156 - { 12.157 - this.orb = orb; 12.158 - wrapper = ORBUtilSystemException.get( orb, 12.159 - CORBALogDomains.RPC_TRANSPORT ) ; 12.160 - buffers = new ArrayList() ; 12.161 - } 12.162 - 12.163 - //////////////////////////////////////////////////// 12.164 - // 12.165 - // framework.transport.Connection 12.166 - // 12.167 - 12.168 - public boolean shouldRegisterReadEvent() 12.169 - { 12.170 - return false; 12.171 - } 12.172 - 12.173 - public boolean shouldRegisterServerReadEvent() 12.174 - { 12.175 - return false; 12.176 - } 12.177 - 12.178 - public boolean read() 12.179 - { 12.180 - return true ; 12.181 - } 12.182 - 12.183 - protected CorbaMessageMediator readBits() 12.184 - { 12.185 - return null ; 12.186 - } 12.187 - 12.188 - protected boolean dispatch(CorbaMessageMediator messageMediator) 12.189 - { 12.190 - } 12.191 - 12.192 - public boolean shouldUseDirectByteBuffers() 12.193 - { 12.194 - return false ; 12.195 - } 12.196 - 12.197 - // Only called from readGIOPMessage with (12, 0, 12) as arguments 12.198 - // size is size of buffer to create 12.199 - // offset is offset from start of message in buffer 12.200 - // length is length to read 12.201 - public ByteBuffer read(int size, int offset, int length) 12.202 - throws IOException 12.203 - { 12.204 - byte[] buf = new byte[size]; 12.205 - readFully( buf, offset, length); 12.206 - ByteBuffer byteBuffer = ByteBuffer.wrap(buf); 12.207 - byteBuffer.limit(size); 12.208 - return byteBuffer; 12.209 - } 12.210 - 12.211 - // Only called as read( buf, 12, msgsize-12 ) in readGIOPMessage 12.212 - // We can ignore the byteBuffer parameter 12.213 - // offset is the starting position to place data in the result 12.214 - // length is the length of the data to read 12.215 - public ByteBuffer read(ByteBuffer byteBuffer, int offset, int length) 12.216 - throws IOException 12.217 - { 12.218 - int size = offset + length; 12.219 - byte[] buf = new byte[size]; 12.220 - readFully(buf, offset, length); 12.221 - return ByteBuffer.wrap(buf); 12.222 - } 12.223 - 12.224 - // Read size bytes from buffer list and place the data 12.225 - // starting at offset in buf. 12.226 - public void readFully(byte[] buf, int offset, int size) 12.227 - throws IOException 12.228 - { 12.229 - int remaining = size ; 12.230 - int position = offset ; 12.231 - while (remaining > 0) { 12.232 - ByteBuffer buff = (ByteBuffer)buffers.get(0) ; 12.233 - int dataSize = buff.remaining() ; 12.234 - int xferSize = dataSize ; 12.235 - if (dataSize >= remaining) : 12.236 - xferSize = remaining ; 12.237 - buffers.remove(0) ; 12.238 - } 12.239 - 12.240 - buff.get( buf, offset, xferSize ) ; 12.241 - 12.242 - offset += xferSize ; 12.243 - remaining -= xferSize ; 12.244 - } 12.245 - } 12.246 - 12.247 - public void write(ByteBuffer byteBuffer) 12.248 - throws IOException 12.249 - { 12.250 - buffers.add( byteBuffer ) ; 12.251 - } 12.252 - 12.253 - /** 12.254 - * Note:it is possible for this to be called more than once 12.255 - */ 12.256 - public synchronized void close() 12.257 - { 12.258 - } 12.259 - 12.260 - public Acceptor getAcceptor() 12.261 - { 12.262 - return null; 12.263 - } 12.264 - 12.265 - public ContactInfo getContactInfo() 12.266 - { 12.267 - return null; 12.268 - } 12.269 - 12.270 - public EventHandler getEventHandler() 12.271 - { 12.272 - return this; 12.273 - } 12.274 - 12.275 - public OutputObject createOutputObject(MessageMediator messageMediator) 12.276 - { 12.277 - // REVISIT - remove this method from Connection and all it subclasses. 12.278 - throw new RuntimeException("*****SocketOrChannelConnectionImpl.createOutputObject - should not be called."); 12.279 - } 12.280 - 12.281 - // This is used by the GIOPOutputObject in order to 12.282 - // throw the correct error when handling code sets. 12.283 - // Can we determine if we are on the server side by 12.284 - // other means? XREVISIT 12.285 - public boolean isServer() 12.286 - { 12.287 - return isServer; 12.288 - } 12.289 - 12.290 - public boolean isBusy() 12.291 - { 12.292 - return false ; 12.293 - } 12.294 - 12.295 - public long getTimeStamp() 12.296 - { 12.297 - return timeStamp; 12.298 - } 12.299 - 12.300 - public void setTimeStamp(long time) 12.301 - { 12.302 - timeStamp = time; 12.303 - } 12.304 - 12.305 - public void setState(String stateString) 12.306 - { 12.307 - synchronized (stateEvent) { 12.308 - if (stateString.equals("ESTABLISHED")) { 12.309 - state = ESTABLISHED; 12.310 - stateEvent.notifyAll(); 12.311 - } else { 12.312 - // REVISIT: ASSERT 12.313 - } 12.314 - } 12.315 - } 12.316 - 12.317 - public void writeLock() 12.318 - { 12.319 - } 12.320 - 12.321 - public void writeUnlock() 12.322 - { 12.323 - } 12.324 - 12.325 - public void sendWithoutLock(OutputObject outputObject) 12.326 - { 12.327 - } 12.328 - 12.329 - public void registerWaiter(MessageMediator messageMediator) 12.330 - { 12.331 - } 12.332 - 12.333 - public void unregisterWaiter(MessageMediator messageMediator) 12.334 - { 12.335 - } 12.336 - 12.337 - public InputObject waitForResponse(MessageMediator messageMediator) 12.338 - { 12.339 - return null ; 12.340 - } 12.341 - 12.342 - public void setConnectionCache(ConnectionCache connectionCache) 12.343 - { 12.344 - } 12.345 - 12.346 - public ConnectionCache getConnectionCache() 12.347 - { 12.348 - return null; 12.349 - } 12.350 - 12.351 - //////////////////////////////////////////////////// 12.352 - // 12.353 - // EventHandler methods 12.354 - // 12.355 - 12.356 - public SelectableChannel getChannel() 12.357 - { 12.358 - return null; 12.359 - } 12.360 - 12.361 - public int getInterestOps() 12.362 - { 12.363 - return null; 12.364 - } 12.365 - 12.366 - // public Acceptor getAcceptor() - already defined above. 12.367 - 12.368 - public Connection getConnection() 12.369 - { 12.370 - return this; 12.371 - } 12.372 - 12.373 - //////////////////////////////////////////////////// 12.374 - // 12.375 - // Work methods. 12.376 - // 12.377 - 12.378 - public String getName() 12.379 - { 12.380 - return this.toString(); 12.381 - } 12.382 - 12.383 - public void doWork() 12.384 - { 12.385 - } 12.386 - 12.387 - public void setEnqueueTime(long timeInMillis) 12.388 - { 12.389 - enqueueTime = timeInMillis; 12.390 - } 12.391 - 12.392 - public long getEnqueueTime() 12.393 - { 12.394 - return enqueueTime; 12.395 - } 12.396 - 12.397 - //////////////////////////////////////////////////// 12.398 - // 12.399 - // spi.transport.CorbaConnection. 12.400 - // 12.401 - 12.402 - public ResponseWaitingRoom getResponseWaitingRoom() 12.403 - { 12.404 - return null ; 12.405 - } 12.406 - 12.407 - // REVISIT - inteface defines isServer but already defined in 12.408 - // higher interface. 12.409 - 12.410 - 12.411 - public void serverRequestMapPut(int requestId, 12.412 - CorbaMessageMediator messageMediator) 12.413 - { 12.414 - serverRequestMap.put(new Integer(requestId), messageMediator); 12.415 - } 12.416 - 12.417 - public CorbaMessageMediator serverRequestMapGet(int requestId) 12.418 - { 12.419 - return (CorbaMessageMediator) 12.420 - serverRequestMap.get(new Integer(requestId)); 12.421 - } 12.422 - 12.423 - public void serverRequestMapRemove(int requestId) 12.424 - { 12.425 - serverRequestMap.remove(new Integer(requestId)); 12.426 - } 12.427 - 12.428 - 12.429 - // REVISIT: this is also defined in: 12.430 - // com.sun.corba.se.spi.legacy.connection.Connection 12.431 - public java.net.Socket getSocket() 12.432 - { 12.433 - return null; 12.434 - } 12.435 - 12.436 - /** It is possible for a Close Connection to have been 12.437 - ** sent here, but we will not check for this. A "lazy" 12.438 - ** Exception will be thrown in the Worker thread after the 12.439 - ** incoming request has been processed even though the connection 12.440 - ** is closed before the request is processed. This is o.k because 12.441 - ** it is a boundary condition. To prevent it we would have to add 12.442 - ** more locks which would reduce performance in the normal case. 12.443 - **/ 12.444 - public synchronized void serverRequestProcessingBegins() 12.445 - { 12.446 - serverRequestCount++; 12.447 - } 12.448 - 12.449 - public synchronized void serverRequestProcessingEnds() 12.450 - { 12.451 - serverRequestCount--; 12.452 - } 12.453 - 12.454 - // 12.455 - // 12.456 - // 12.457 - 12.458 - public synchronized int getNextRequestId() 12.459 - { 12.460 - return requestId++; 12.461 - } 12.462 - 12.463 - // Negotiated code sets for char and wchar data 12.464 - protected CodeSetComponentInfo.CodeSetContext codeSetContext = null; 12.465 - 12.466 - public ORB getBroker() 12.467 - { 12.468 - return orb; 12.469 - } 12.470 - 12.471 - public CodeSetComponentInfo.CodeSetContext getCodeSetContext() 12.472 - { 12.473 - // Needs to be synchronized for the following case when the client 12.474 - // doesn't send the code set context twice, and we have two threads 12.475 - // in ServerRequestDispatcher processCodeSetContext. 12.476 - // 12.477 - // Thread A checks to see if there is a context, there is none, so 12.478 - // it calls setCodeSetContext, getting the synch lock. 12.479 - // Thread B checks to see if there is a context. If we didn't synch, 12.480 - // it might decide to outlaw wchar/wstring. 12.481 - if (codeSetContext == null) { 12.482 - synchronized(this) { 12.483 - return codeSetContext; 12.484 - } 12.485 - } 12.486 - 12.487 - return codeSetContext; 12.488 - } 12.489 - 12.490 - public synchronized void setCodeSetContext(CodeSetComponentInfo.CodeSetContext csc) { 12.491 - // Double check whether or not we need to do this 12.492 - if (codeSetContext == null) { 12.493 - 12.494 - if (OSFCodeSetRegistry.lookupEntry(csc.getCharCodeSet()) == null || 12.495 - OSFCodeSetRegistry.lookupEntry(csc.getWCharCodeSet()) == null) { 12.496 - // If the client says it's negotiated a code set that 12.497 - // isn't a fallback and we never said we support, then 12.498 - // it has a bug. 12.499 - throw wrapper.badCodesetsFromClient() ; 12.500 - } 12.501 - 12.502 - codeSetContext = csc; 12.503 - } 12.504 - } 12.505 - 12.506 - // 12.507 - // from iiop.IIOPConnection.java 12.508 - // 12.509 - 12.510 - // Map request ID to an InputObject. 12.511 - // This is so the client thread can start unmarshaling 12.512 - // the reply and remove it from the out_calls map while the 12.513 - // ReaderThread can still obtain the input stream to give 12.514 - // new fragments. Only the ReaderThread touches the clientReplyMap, 12.515 - // so it doesn't incur synchronization overhead. 12.516 - 12.517 - public MessageMediator clientRequestMapGet(int requestId) 12.518 - { 12.519 - return null ; 12.520 - } 12.521 - 12.522 - protected MessageMediator clientReply_1_1; 12.523 - 12.524 - public void clientReply_1_1_Put(MessageMediator x) 12.525 - { 12.526 - clientReply_1_1 = x; 12.527 - } 12.528 - 12.529 - public MessageMediator clientReply_1_1_Get() 12.530 - { 12.531 - return clientReply_1_1; 12.532 - } 12.533 - 12.534 - public void clientReply_1_1_Remove() 12.535 - { 12.536 - clientReply_1_1 = null; 12.537 - } 12.538 - 12.539 - protected MessageMediator serverRequest_1_1; 12.540 - 12.541 - public void serverRequest_1_1_Put(MessageMediator x) 12.542 - { 12.543 - serverRequest_1_1 = x; 12.544 - } 12.545 - 12.546 - public MessageMediator serverRequest_1_1_Get() 12.547 - { 12.548 - return serverRequest_1_1; 12.549 - } 12.550 - 12.551 - public void serverRequest_1_1_Remove() 12.552 - { 12.553 - serverRequest_1_1 = null; 12.554 - } 12.555 - 12.556 - protected String getStateString( int state ) 12.557 - { 12.558 - synchronized ( stateEvent ){ 12.559 - switch (state) { 12.560 - case OPENING : return "OPENING" ; 12.561 - case ESTABLISHED : return "ESTABLISHED" ; 12.562 - case CLOSE_SENT : return "CLOSE_SENT" ; 12.563 - case CLOSE_RECVD : return "CLOSE_RECVD" ; 12.564 - case ABORT : return "ABORT" ; 12.565 - default : return "???" ; 12.566 - } 12.567 - } 12.568 - } 12.569 - 12.570 - public synchronized boolean isPostInitialContexts() { 12.571 - return postInitialContexts; 12.572 - } 12.573 - 12.574 - // Can never be unset... 12.575 - public synchronized void setPostInitialContexts(){ 12.576 - postInitialContexts = true; 12.577 - } 12.578 - 12.579 - /** 12.580 - * Wake up the outstanding requests on the connection, and hand them 12.581 - * COMM_FAILURE exception with a given minor code. 12.582 - * 12.583 - * Also, delete connection from connection table and 12.584 - * stop the reader thread. 12.585 - 12.586 - * Note that this should only ever be called by the Reader thread for 12.587 - * this connection. 12.588 - * 12.589 - * @param minor_code The minor code for the COMM_FAILURE major code. 12.590 - * @param die Kill the reader thread (this thread) before exiting. 12.591 - */ 12.592 - public void purgeCalls(SystemException systemException, 12.593 - boolean die, boolean lockHeld) 12.594 - { 12.595 - } 12.596 - 12.597 - /************************************************************************* 12.598 - * The following methods are for dealing with Connection cleaning for 12.599 - * better scalability of servers in high network load conditions. 12.600 - **************************************************************************/ 12.601 - 12.602 - public void sendCloseConnection(GIOPVersion giopVersion) 12.603 - throws IOException 12.604 - { 12.605 - Message msg = MessageBase.createCloseConnection(giopVersion); 12.606 - sendHelper(giopVersion, msg); 12.607 - } 12.608 - 12.609 - public void sendMessageError(GIOPVersion giopVersion) 12.610 - throws IOException 12.611 - { 12.612 - Message msg = MessageBase.createMessageError(giopVersion); 12.613 - sendHelper(giopVersion, msg); 12.614 - } 12.615 - 12.616 - /** 12.617 - * Send a CancelRequest message. This does not lock the connection, so the 12.618 - * caller needs to ensure this method is called appropriately. 12.619 - * @exception IOException - could be due to abortive connection closure. 12.620 - */ 12.621 - public void sendCancelRequest(GIOPVersion giopVersion, int requestId) 12.622 - throws IOException 12.623 - { 12.624 - 12.625 - Message msg = MessageBase.createCancelRequest(giopVersion, requestId); 12.626 - sendHelper(giopVersion, msg); 12.627 - } 12.628 - 12.629 - protected void sendHelper(GIOPVersion giopVersion, Message msg) 12.630 - throws IOException 12.631 - { 12.632 - // REVISIT: See comments in CDROutputObject constructor. 12.633 - CDROutputObject outputObject = 12.634 - new CDROutputObject((ORB)orb, null, giopVersion, this, msg, 12.635 - ORBConstants.STREAM_FORMAT_VERSION_1); 12.636 - msg.write(outputObject); 12.637 - 12.638 - outputObject.writeTo(this); 12.639 - } 12.640 - 12.641 - public void sendCancelRequestWithLock(GIOPVersion giopVersion, 12.642 - int requestId) 12.643 - throws IOException 12.644 - { 12.645 - writeLock(); 12.646 - try { 12.647 - sendCancelRequest(giopVersion, requestId); 12.648 - } finally { 12.649 - writeUnlock(); 12.650 - } 12.651 - } 12.652 - 12.653 - // Begin Code Base methods --------------------------------------- 12.654 - // 12.655 - // Set this connection's code base IOR. The IOR comes from the 12.656 - // SendingContext. This is an optional service context, but all 12.657 - // JavaSoft ORBs send it. 12.658 - // 12.659 - // The set and get methods don't need to be synchronized since the 12.660 - // first possible get would occur during reading a valuetype, and 12.661 - // that would be after the set. 12.662 - 12.663 - // Sets this connection's code base IOR. This is done after 12.664 - // getting the IOR out of the SendingContext service context. 12.665 - // Our ORBs always send this, but it's optional in CORBA. 12.666 - 12.667 - public final void setCodeBaseIOR(IOR ior) { 12.668 - codeBaseServerIOR = ior; 12.669 - } 12.670 - 12.671 - public final IOR getCodeBaseIOR() { 12.672 - return codeBaseServerIOR; 12.673 - } 12.674 - 12.675 - // Get a CodeBase stub to use in unmarshaling. The CachedCodeBase 12.676 - // won't connect to the remote codebase unless it's necessary. 12.677 - public final CodeBase getCodeBase() { 12.678 - return cachedCodeBase; 12.679 - } 12.680 - 12.681 - // End Code Base methods ----------------------------------------- 12.682 - 12.683 - // Can be overridden in subclass for different options. 12.684 - protected void setSocketOptions(Socket socket) 12.685 - { 12.686 - } 12.687 - 12.688 - public String toString() 12.689 - { 12.690 - synchronized ( stateEvent ){ 12.691 - return 12.692 - "BufferConnectionImpl[" + " " 12.693 - + getStateString( state ) + " " 12.694 - + shouldUseSelectThreadToWait() + " " 12.695 - + shouldUseWorkerThreadForEvent() 12.696 - + "]" ; 12.697 - } 12.698 - } 12.699 - 12.700 - // Must be public - used in encoding. 12.701 - public void dprint(String msg) 12.702 - { 12.703 - ORBUtility.dprint("SocketOrChannelConnectionImpl", msg); 12.704 - } 12.705 - 12.706 - protected void dprint(String msg, Throwable t) 12.707 - { 12.708 - dprint(msg); 12.709 - t.printStackTrace(System.out); 12.710 - } 12.711 -} 12.712 - 12.713 -// End of file.