corba/src/share/classes/com/sun/corba/se/impl/io/ValueHandlerImpl.java

Print this page
rev 502 : 8000631: Restrict access to class constructor
Reviewed-by: alanb, ahgross

*** 1,7 **** /* ! * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 51,61 **** import com.sun.corba.se.spi.logging.CORBALogDomains; import com.sun.corba.se.impl.logging.OMGSystemException; import com.sun.corba.se.impl.logging.UtilSystemException; ! public class ValueHandlerImpl implements javax.rmi.CORBA.ValueHandlerMultiFormat { // Property to override our maximum stream format version public static final String FORMAT_VERSION_PROPERTY = "com.sun.CORBA.MaxStreamFormatVersion"; --- 51,61 ---- import com.sun.corba.se.spi.logging.CORBALogDomains; import com.sun.corba.se.impl.logging.OMGSystemException; import com.sun.corba.se.impl.logging.UtilSystemException; ! public final class ValueHandlerImpl implements javax.rmi.CORBA.ValueHandlerMultiFormat { // Property to override our maximum stream format version public static final String FORMAT_VERSION_PROPERTY = "com.sun.CORBA.MaxStreamFormatVersion";
*** 148,165 **** } writeValueWithVersion(out, value, streamFormatVersion); } ! public ValueHandlerImpl(){} ! public ValueHandlerImpl(boolean isInputStream) { this(); useHashtables = false; this.isInputStream = isInputStream; } /** * Writes the value to the stream using java semantics. * @param out The stream to write the value to * @param value The value to be written to the stream **/ --- 148,173 ---- } writeValueWithVersion(out, value, streamFormatVersion); } ! private ValueHandlerImpl(){} ! private ValueHandlerImpl(boolean isInputStream) { this(); useHashtables = false; this.isInputStream = isInputStream; } + static ValueHandlerImpl getInstance() { + return new ValueHandlerImpl(); + } + + static ValueHandlerImpl getInstance(boolean isInputStream) { + return new ValueHandlerImpl(isInputStream); + } + /** * Writes the value to the stream using java semantics. * @param out The stream to write the value to * @param value The value to be written to the stream **/
*** 456,471 **** **/ public java.io.Serializable writeReplace(java.io.Serializable value) { return ObjectStreamClass.lookup(value.getClass()).writeReplace(value); } ! /** ! * Encapsulates writing of Java char arrays so that the 1.3 subclass ! * can override it without exposing internals across packages. This ! * is a fix for bug 4367783. ! */ ! protected void writeCharArray(org.omg.CORBA_2_3.portable.OutputStream out, char[] array, int offset, int length) { out.write_wchar_array(array, offset, length); --- 464,474 ---- **/ public java.io.Serializable writeReplace(java.io.Serializable value) { return ObjectStreamClass.lookup(value.getClass()).writeReplace(value); } ! private void writeCharArray(org.omg.CORBA_2_3.portable.OutputStream out, char[] array, int offset, int length) { out.write_wchar_array(array, offset, length);
*** 574,589 **** } } } } ! /** ! * Encapsulates reading of Java char arrays so that the 1.3 subclass ! * can override it without exposing internals across packages. This ! * is a fix for bug 4367783. ! */ ! protected void readCharArray(org.omg.CORBA_2_3.portable.InputStream in, char[] array, int offset, int length) { in.read_wchar_array(array, offset, length); --- 577,587 ---- } } } } ! private void readCharArray(org.omg.CORBA_2_3.portable.InputStream in, char[] array, int offset, int length) { in.read_wchar_array(array, offset, length);
*** 793,803 **** private boolean isArray(String repId){ return RepositoryId.cache.getId(repId).isSequence(); } ! protected String getOutputStreamClassName() { return "com.sun.corba.se.impl.io.IIOPOutputStream"; } private IIOPOutputStream createOutputStream() { final String name = getOutputStreamClassName(); --- 791,801 ---- private boolean isArray(String repId){ return RepositoryId.cache.getId(repId).isSequence(); } ! private String getOutputStreamClassName() { return "com.sun.corba.se.impl.io.IIOPOutputStream"; } private IIOPOutputStream createOutputStream() { final String name = getOutputStreamClassName();
*** 841,873 **** * Returning null indicates a non-built is specified. */ private IIOPOutputStream createOutputStreamBuiltInNoPriv( final String name ) throws IOException { ! return ! name.equals( ! IIOPOutputStream ! .class.getName() ! ) ? ! new IIOPOutputStream() : ! ! name.equals( ! com.sun.corba.se.impl.orbutil.IIOPOutputStream_1_3 ! .class.getName() ! ) ? ! new com.sun.corba.se.impl.orbutil.IIOPOutputStream_1_3() : ! ! name.equals( ! com.sun.corba.se.impl.orbutil.IIOPOutputStream_1_3_1 ! .class.getName() ! ) ? ! new com.sun.corba.se.impl.orbutil.IIOPOutputStream_1_3_1() : ! ! null; } ! protected String getInputStreamClassName() { return "com.sun.corba.se.impl.io.IIOPInputStream"; } private IIOPInputStream createInputStream() { final String name = getInputStreamClassName(); --- 839,853 ---- * Returning null indicates a non-built is specified. */ private IIOPOutputStream createOutputStreamBuiltInNoPriv( final String name ) throws IOException { ! return name.equals(IIOPOutputStream.class.getName()) ? ! new IIOPOutputStream() : null; } ! private String getInputStreamClassName() { return "com.sun.corba.se.impl.io.IIOPInputStream"; } private IIOPInputStream createInputStream() { final String name = getInputStreamClassName();
*** 911,940 **** * Returning null indicates a non-built is specified. */ private IIOPInputStream createInputStreamBuiltInNoPriv( final String name ) throws IOException { ! return ! name.equals( ! IIOPInputStream ! .class.getName() ! ) ? ! new IIOPInputStream() : ! ! name.equals( ! com.sun.corba.se.impl.orbutil.IIOPInputStream_1_3 ! .class.getName() ! ) ? ! new com.sun.corba.se.impl.orbutil.IIOPInputStream_1_3() : ! ! name.equals( ! com.sun.corba.se.impl.orbutil.IIOPInputStream_1_3_1 ! .class.getName() ! ) ? ! new com.sun.corba.se.impl.orbutil.IIOPInputStream_1_3_1() : ! ! null; } /** * Create a custom implementation without privileges. */ --- 891,902 ---- * Returning null indicates a non-built is specified. */ private IIOPInputStream createInputStreamBuiltInNoPriv( final String name ) throws IOException { ! return name.equals(IIOPInputStream.class.getName()) ? ! new IIOPInputStream() : null; } /** * Create a custom implementation without privileges. */
*** 956,969 **** // as expensive as it looks. return streamClass.newInstance(); } ! /** ! * Our JDK 1.3 and JDK 1.3.1 behavior subclasses override this. ! * The correct behavior is for a Java char to map to a CORBA wchar, ! * but our older code mapped it to a CORBA char. ! */ ! protected TCKind getJavaCharTCKind() { return TCKind.tk_wchar; } } --- 918,926 ---- // as expensive as it looks. return streamClass.newInstance(); } ! TCKind getJavaCharTCKind() { return TCKind.tk_wchar; } }