java.io.ObjectInputStream.GetField Java Examples

The following examples show how to use java.io.ObjectInputStream.GetField. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: jdk1.8-source-analysis   Author: raysonfang   File: URL.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * readObject is called to restore the state of the URL from the
 * stream.  It reads the components of the URL and finds the local
 * stream handler.
 */
private synchronized void readObject(java.io.ObjectInputStream s)
        throws IOException, ClassNotFoundException {
    GetField gf = s.readFields();
    String protocol = (String)gf.get("protocol", null);
    if (getURLStreamHandler(protocol) == null) {
        throw new IOException("unknown protocol: " + protocol);
    }
    String host = (String)gf.get("host", null);
    int port = gf.get("port", -1);
    String authority = (String)gf.get("authority", null);
    String file = (String)gf.get("file", null);
    String ref = (String)gf.get("ref", null);
    int hashCode = gf.get("hashCode", -1);
    if (authority == null
            && ((host != null && host.length() > 0) || port != -1)) {
        if (host == null)
            host = "";
        authority = (port == -1) ? host : host + ":" + port;
    }
    tempState = new UrlDeserializedState(protocol, host, port, authority,
           file, ref, hashCode);
}
 
Example #2
Source Project: dragonwell8_jdk   Author: alibaba   File: URL.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * readObject is called to restore the state of the URL from the
 * stream.  It reads the components of the URL and finds the local
 * stream handler.
 */
private synchronized void readObject(java.io.ObjectInputStream s)
        throws IOException, ClassNotFoundException {
    GetField gf = s.readFields();
    String protocol = (String)gf.get("protocol", null);
    if (getURLStreamHandler(protocol) == null) {
        throw new IOException("unknown protocol: " + protocol);
    }
    String host = (String)gf.get("host", null);
    int port = gf.get("port", -1);
    String authority = (String)gf.get("authority", null);
    String file = (String)gf.get("file", null);
    String ref = (String)gf.get("ref", null);
    int hashCode = gf.get("hashCode", -1);
    if (authority == null
            && ((host != null && host.length() > 0) || port != -1)) {
        if (host == null)
            host = "";
        authority = (port == -1) ? host : host + ":" + port;
    }
    tempState = new UrlDeserializedState(protocol, host, port, authority,
           file, ref, hashCode);
}
 
Example #3
Source Project: TencentKona-8   Author: Tencent   File: URL.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * readObject is called to restore the state of the URL from the
 * stream.  It reads the components of the URL and finds the local
 * stream handler.
 */
private synchronized void readObject(java.io.ObjectInputStream s)
        throws IOException, ClassNotFoundException {
    GetField gf = s.readFields();
    String protocol = (String)gf.get("protocol", null);
    if (getURLStreamHandler(protocol) == null) {
        throw new IOException("unknown protocol: " + protocol);
    }
    String host = (String)gf.get("host", null);
    int port = gf.get("port", -1);
    String authority = (String)gf.get("authority", null);
    String file = (String)gf.get("file", null);
    String ref = (String)gf.get("ref", null);
    int hashCode = gf.get("hashCode", -1);
    if (authority == null
            && ((host != null && host.length() > 0) || port != -1)) {
        if (host == null)
            host = "";
        authority = (port == -1) ? host : host + ":" + port;
    }
    tempState = new UrlDeserializedState(protocol, host, port, authority,
           file, ref, hashCode);
}
 
Example #4
Source Project: JDKSourceCode1.8   Author: wupeixuan   File: URL.java    License: MIT License 6 votes vote down vote up
/**
 * readObject is called to restore the state of the URL from the
 * stream.  It reads the components of the URL and finds the local
 * stream handler.
 */
private synchronized void readObject(java.io.ObjectInputStream s)
        throws IOException, ClassNotFoundException {
    GetField gf = s.readFields();
    String protocol = (String)gf.get("protocol", null);
    if (getURLStreamHandler(protocol) == null) {
        throw new IOException("unknown protocol: " + protocol);
    }
    String host = (String)gf.get("host", null);
    int port = gf.get("port", -1);
    String authority = (String)gf.get("authority", null);
    String file = (String)gf.get("file", null);
    String ref = (String)gf.get("ref", null);
    int hashCode = gf.get("hashCode", -1);
    if (authority == null
            && ((host != null && host.length() > 0) || port != -1)) {
        if (host == null)
            host = "";
        authority = (port == -1) ? host : host + ":" + port;
    }
    tempState = new UrlDeserializedState(protocol, host, port, authority,
           file, ref, hashCode);
}
 
Example #5
Source Project: openjdk-jdk8u   Author: AdoptOpenJDK   File: URL.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * readObject is called to restore the state of the URL from the
 * stream.  It reads the components of the URL and finds the local
 * stream handler.
 */
private synchronized void readObject(java.io.ObjectInputStream s)
        throws IOException, ClassNotFoundException {
    GetField gf = s.readFields();
    String protocol = (String)gf.get("protocol", null);
    if (getURLStreamHandler(protocol) == null) {
        throw new IOException("unknown protocol: " + protocol);
    }
    String host = (String)gf.get("host", null);
    int port = gf.get("port", -1);
    String authority = (String)gf.get("authority", null);
    String file = (String)gf.get("file", null);
    String ref = (String)gf.get("ref", null);
    int hashCode = gf.get("hashCode", -1);
    if (authority == null
            && ((host != null && host.length() > 0) || port != -1)) {
        if (host == null)
            host = "";
        authority = (port == -1) ? host : host + ":" + port;
    }
    tempState = new UrlDeserializedState(protocol, host, port, authority,
           file, ref, hashCode);
}
 
Example #6
Source Project: alfresco-core   Author: Alfresco   File: Pair.java    License: GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Ensure that previously-serialized instances don't fail due to the member name change.
 */
@SuppressWarnings("unchecked")
private void readObject(ObjectInputStream is) throws ClassNotFoundException, IOException
{
    GetField fields = is.readFields();
    if (fields.defaulted("first"))
    {
        // This is a pre-V3.3
        this.first = (F) fields.get("fFirst", null);
        this.second = (S) fields.get("fSecond", null);
    }
    else
    {
        this.first = (F) fields.get("first", null);
        this.second = (S) fields.get("second", null);
    }
}
 
Example #7
Source Project: openjdk-jdk8u-backup   Author: AdoptOpenJDK   File: URL.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * readObject is called to restore the state of the URL from the
 * stream.  It reads the components of the URL and finds the local
 * stream handler.
 */
private synchronized void readObject(java.io.ObjectInputStream s)
        throws IOException, ClassNotFoundException {
    GetField gf = s.readFields();
    String protocol = (String)gf.get("protocol", null);
    if (getURLStreamHandler(protocol) == null) {
        throw new IOException("unknown protocol: " + protocol);
    }
    String host = (String)gf.get("host", null);
    int port = gf.get("port", -1);
    String authority = (String)gf.get("authority", null);
    String file = (String)gf.get("file", null);
    String ref = (String)gf.get("ref", null);
    int hashCode = gf.get("hashCode", -1);
    if (authority == null
            && ((host != null && host.length() > 0) || port != -1)) {
        if (host == null)
            host = "";
        authority = (port == -1) ? host : host + ":" + port;
    }
    tempState = new UrlDeserializedState(protocol, host, port, authority,
           file, ref, hashCode);
}
 
Example #8
Source Project: Bytecoder   Author: mirkosertic   File: URL.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * readObject is called to restore the state of the URL from the
 * stream.  It reads the components of the URL and finds the local
 * stream handler.
 */
@java.io.Serial
private synchronized void readObject(java.io.ObjectInputStream s)
        throws IOException, ClassNotFoundException {
    GetField gf = s.readFields();
    String protocol = (String)gf.get("protocol", null);
    if (getURLStreamHandler(protocol) == null) {
        throw new IOException("unknown protocol: " + protocol);
    }
    String host = (String)gf.get("host", null);
    int port = gf.get("port", -1);
    String authority = (String)gf.get("authority", null);
    String file = (String)gf.get("file", null);
    String ref = (String)gf.get("ref", null);
    int hashCode = gf.get("hashCode", -1);
    if (authority == null
            && ((host != null && !host.isEmpty()) || port != -1)) {
        if (host == null)
            host = "";
        authority = (port == -1) ? host : host + ":" + port;
    }
    tempState = new UrlDeserializedState(protocol, host, port, authority,
           file, ref, hashCode);
}
 
Example #9
Source Project: Bytecoder   Author: mirkosertic   File: InetAddress.java    License: Apache License 2.0 6 votes vote down vote up
@java.io.Serial
private void readObject (ObjectInputStream s) throws
                     IOException, ClassNotFoundException {
    if (getClass().getClassLoader() != null) {
        throw new SecurityException ("invalid address type");
    }
    GetField gf = s.readFields();
    String host = (String)gf.get("hostName", null);
    int address = gf.get("address", 0);
    int family = gf.get("family", 0);
    if (family != IPv4 && family != IPv6) {
        throw new InvalidObjectException("invalid address family type: " + family);
    }
    InetAddressHolder h = new InetAddressHolder(host, address, family);
    UNSAFE.putReference(this, FIELDS_OFFSET, h);
}
 
Example #10
Source Project: openjdk-jdk9   Author: AdoptOpenJDK   File: URL.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * readObject is called to restore the state of the URL from the
 * stream.  It reads the components of the URL and finds the local
 * stream handler.
 */
private synchronized void readObject(java.io.ObjectInputStream s)
        throws IOException, ClassNotFoundException {
    GetField gf = s.readFields();
    String protocol = (String)gf.get("protocol", null);
    if (getURLStreamHandler(protocol) == null) {
        throw new IOException("unknown protocol: " + protocol);
    }
    String host = (String)gf.get("host", null);
    int port = gf.get("port", -1);
    String authority = (String)gf.get("authority", null);
    String file = (String)gf.get("file", null);
    String ref = (String)gf.get("ref", null);
    int hashCode = gf.get("hashCode", -1);
    if (authority == null
            && ((host != null && host.length() > 0) || port != -1)) {
        if (host == null)
            host = "";
        authority = (port == -1) ? host : host + ":" + port;
    }
    tempState = new UrlDeserializedState(protocol, host, port, authority,
           file, ref, hashCode);
}
 
Example #11
Source Project: jdk8u-jdk   Author: lambdalab-mirror   File: URL.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * readObject is called to restore the state of the URL from the
 * stream.  It reads the components of the URL and finds the local
 * stream handler.
 */
private synchronized void readObject(java.io.ObjectInputStream s)
        throws IOException, ClassNotFoundException {
    GetField gf = s.readFields();
    String protocol = (String)gf.get("protocol", null);
    if (getURLStreamHandler(protocol) == null) {
        throw new IOException("unknown protocol: " + protocol);
    }
    String host = (String)gf.get("host", null);
    int port = gf.get("port", -1);
    String authority = (String)gf.get("authority", null);
    String file = (String)gf.get("file", null);
    String ref = (String)gf.get("ref", null);
    int hashCode = gf.get("hashCode", -1);
    if (authority == null
            && ((host != null && host.length() > 0) || port != -1)) {
        if (host == null)
            host = "";
        authority = (port == -1) ? host : host + ":" + port;
    }
    tempState = new UrlDeserializedState(protocol, host, port, authority,
           file, ref, hashCode);
}
 
Example #12
Source Project: hottub   Author: dsrg-uoft   File: URL.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * readObject is called to restore the state of the URL from the
 * stream.  It reads the components of the URL and finds the local
 * stream handler.
 */
private synchronized void readObject(java.io.ObjectInputStream s)
        throws IOException, ClassNotFoundException {
    GetField gf = s.readFields();
    String protocol = (String)gf.get("protocol", null);
    if (getURLStreamHandler(protocol) == null) {
        throw new IOException("unknown protocol: " + protocol);
    }
    String host = (String)gf.get("host", null);
    int port = gf.get("port", -1);
    String authority = (String)gf.get("authority", null);
    String file = (String)gf.get("file", null);
    String ref = (String)gf.get("ref", null);
    int hashCode = gf.get("hashCode", -1);
    if (authority == null
            && ((host != null && host.length() > 0) || port != -1)) {
        if (host == null)
            host = "";
        authority = (port == -1) ? host : host + ":" + port;
    }
    tempState = new UrlDeserializedState(protocol, host, port, authority,
           file, ref, hashCode);
}
 
Example #13
Source Project: jasperreports   Author: TIBCOSoftware   File: BaseReturnValue.java    License: GNU Lesser General Public License v3.0 6 votes vote down vote up
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException
{
	GetField fields = stream.readFields();
	fromVariable = (String) fields.get("fromVariable", null);
	
	// the fields of BaseCommonReturnValue were originally in this class.
	// if deserializing an old object, we need to manually copy the values into the parent class.
	ObjectStreamClass streamClass = fields.getObjectStreamClass();
	if (streamClass.getField("toVariable") != null)
	{
		this.toVariable = (String) fields.get("toVariable", null);
	}
	if (streamClass.getField("calculation") != null)
	{
		this.calculation = (CalculationEnum) fields.get("calculation", null);
	}
	if (streamClass.getField("incrementerFactoryClassName") != null)
	{
		this.incrementerFactoryClassName = (String) fields.get("incrementerFactoryClassName", null);
	}
}
 
Example #14
Source Project: jasperreports   Author: TIBCOSoftware   File: JRVirtualizationContext.java    License: GNU Lesser General Public License v3.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException
{
	setThreadJasperReportsContext();

	GetField fields = in.readFields();
	cachedRenderers = (Map<String, Renderable>) fields.get("cachedRenderers", null);
	cachedTemplates = (Map<String, JRTemplateElement>) fields.get("cachedTemplates", null);
	virtualizableLists = (Map<PrintElementId, VirtualizableElementList>) fields.get("virtualizableLists", null);
	readOnly = fields.get("readOnly", false);
	// use configured default if serialized by old version
	pageElementSize = fields.get("pageElementSize", JRPropertiesUtil.getInstance(jasperReportsContext).getIntegerProperty(
			JRVirtualPrintPage.PROPERTY_VIRTUAL_PAGE_ELEMENT_SIZE, 0));
	
	setThreadVirtualizer();
	
	initLock();
}
 
Example #15
Source Project: jasperreports   Author: TIBCOSoftware   File: BarcodeComponent.java    License: GNU Lesser General Public License v3.0 6 votes vote down vote up
@SuppressWarnings("deprecation")
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
{
	GetField fields = in.readFields();
	this.PSEUDO_SERIAL_VERSION_UID = fields.get("PSEUDO_SERIAL_VERSION_UID", 0);
	if (PSEUDO_SERIAL_VERSION_UID < JRConstants.PSEUDO_SERIAL_VERSION_UID_3_7_2)
	{
		byte evaluationTime = fields.get("evaluationTime", (byte) 0);
		this.evaluationTimeValue = EvaluationTimeEnum.getByValue(evaluationTime);
	}
	else
	{
		this.evaluationTimeValue = (EvaluationTimeEnum) fields.get("evaluationTimeValue", null);
	}
	this.evaluationGroup = (String) fields.get("evaluationGroup", null);
	this.codeExpression = (JRExpression) fields.get("codeExpression", null);
	
	if (PSEUDO_SERIAL_VERSION_UID < JRConstants.PSEUDO_SERIAL_VERSION_UID_6_0_2
			&& this instanceof Barcode4jComponent)
	{
		//up to 6.0.0 this class had several fields that were moved to Barcode4jComponent in 6.0.2.
		//copying the values to the Barcode4jComponent fields.
		Barcode4jComponent barcode4jComponent = (Barcode4jComponent) this;
		barcode4jComponent.copyBarcodeComponentFields(fields);
	}
}
 
Example #16
Source Project: jdk8u_jdk   Author: JetBrains   File: URL.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * readObject is called to restore the state of the URL from the
 * stream.  It reads the components of the URL and finds the local
 * stream handler.
 */
private synchronized void readObject(java.io.ObjectInputStream s)
        throws IOException, ClassNotFoundException {
    GetField gf = s.readFields();
    String protocol = (String)gf.get("protocol", null);
    if (getURLStreamHandler(protocol) == null) {
        throw new IOException("unknown protocol: " + protocol);
    }
    String host = (String)gf.get("host", null);
    int port = gf.get("port", -1);
    String authority = (String)gf.get("authority", null);
    String file = (String)gf.get("file", null);
    String ref = (String)gf.get("ref", null);
    int hashCode = gf.get("hashCode", -1);
    if (authority == null
            && ((host != null && host.length() > 0) || port != -1)) {
        if (host == null)
            host = "";
        authority = (port == -1) ? host : host + ":" + port;
    }
    tempState = new UrlDeserializedState(protocol, host, port, authority,
           file, ref, hashCode);
}
 
Example #17
Source Project: jdk1.8-source-analysis   Author: raysonfang   File: InetAddress.java    License: Apache License 2.0 5 votes vote down vote up
private void readObject (ObjectInputStream s) throws
                     IOException, ClassNotFoundException {
    if (getClass().getClassLoader() != null) {
        throw new SecurityException ("invalid address type");
    }
    GetField gf = s.readFields();
    String host = (String)gf.get("hostName", null);
    int address= gf.get("address", 0);
    int family= gf.get("family", 0);
    InetAddressHolder h = new InetAddressHolder(host, address, family);
    UNSAFE.putObject(this, FIELDS_OFFSET, h);
}
 
Example #18
Source Project: dragonwell8_jdk   Author: alibaba   File: InetAddress.java    License: GNU General Public License v2.0 5 votes vote down vote up
private void readObject (ObjectInputStream s) throws
                     IOException, ClassNotFoundException {
    if (getClass().getClassLoader() != null) {
        throw new SecurityException ("invalid address type");
    }
    GetField gf = s.readFields();
    String host = (String)gf.get("hostName", null);
    int address = gf.get("address", 0);
    int family = gf.get("family", 0);
    if (family != IPv4 && family != IPv6) {
        throw new InvalidObjectException("invalid address family type: " + family);
    }
    InetAddressHolder h = new InetAddressHolder(host, address, family);
    UNSAFE.putObject(this, FIELDS_OFFSET, h);
}
 
Example #19
Source Project: dragonwell8_jdk   Author: alibaba   File: CryptoPermissions.java    License: GNU General Public License v2.0 5 votes vote down vote up
private void readObject(ObjectInputStream s)
    throws IOException, ClassNotFoundException {
    ObjectInputStream.GetField fields = s.readFields();
    @SuppressWarnings("unchecked")
    Hashtable<String,PermissionCollection> permTable =
            (Hashtable<String,PermissionCollection>)
            (fields.get("perms", null));
    if (permTable != null) {
        perms = new ConcurrentHashMap<>(permTable);
    } else {
        perms = new ConcurrentHashMap<>();
    }
}
 
Example #20
Source Project: TencentKona-8   Author: Tencent   File: InetAddress.java    License: GNU General Public License v2.0 5 votes vote down vote up
private void readObject (ObjectInputStream s) throws
                     IOException, ClassNotFoundException {
    if (getClass().getClassLoader() != null) {
        throw new SecurityException ("invalid address type");
    }
    GetField gf = s.readFields();
    String host = (String)gf.get("hostName", null);
    int address = gf.get("address", 0);
    int family = gf.get("family", 0);
    if (family != IPv4 && family != IPv6) {
        throw new InvalidObjectException("invalid address family type: " + family);
    }
    InetAddressHolder h = new InetAddressHolder(host, address, family);
    UNSAFE.putObject(this, FIELDS_OFFSET, h);
}
 
Example #21
Source Project: TencentKona-8   Author: Tencent   File: CryptoPermissions.java    License: GNU General Public License v2.0 5 votes vote down vote up
private void readObject(ObjectInputStream s)
    throws IOException, ClassNotFoundException {
    ObjectInputStream.GetField fields = s.readFields();
    @SuppressWarnings("unchecked")
    Hashtable<String,PermissionCollection> permTable =
            (Hashtable<String,PermissionCollection>)
            (fields.get("perms", null));
    if (permTable != null) {
        perms = new ConcurrentHashMap<>(permTable);
    } else {
        perms = new ConcurrentHashMap<>();
    }
}
 
Example #22
Source Project: jdk8u60   Author: chenghanpeng   File: InetAddress.java    License: GNU General Public License v2.0 5 votes vote down vote up
private void readObject (ObjectInputStream s) throws
                     IOException, ClassNotFoundException {
    if (getClass().getClassLoader() != null) {
        throw new SecurityException ("invalid address type");
    }
    GetField gf = s.readFields();
    String host = (String)gf.get("hostName", null);
    int address= gf.get("address", 0);
    int family= gf.get("family", 0);
    InetAddressHolder h = new InetAddressHolder(host, address, family);
    UNSAFE.putObject(this, FIELDS_OFFSET, h);
}
 
Example #23
Source Project: jdk8u60   Author: chenghanpeng   File: CryptoPermissions.java    License: GNU General Public License v2.0 5 votes vote down vote up
private void readObject(ObjectInputStream s)
    throws IOException, ClassNotFoundException {
    ObjectInputStream.GetField fields = s.readFields();
    @SuppressWarnings("unchecked")
    Hashtable<String,PermissionCollection> permTable =
            (Hashtable<String,PermissionCollection>)
            (fields.get("perms", null));
    if (permTable != null) {
        perms = new ConcurrentHashMap<>(permTable);
    } else {
        perms = new ConcurrentHashMap<>();
    }
}
 
Example #24
Source Project: JDKSourceCode1.8   Author: wupeixuan   File: InetAddress.java    License: MIT License 5 votes vote down vote up
private void readObject (ObjectInputStream s) throws
                     IOException, ClassNotFoundException {
    if (getClass().getClassLoader() != null) {
        throw new SecurityException ("invalid address type");
    }
    GetField gf = s.readFields();
    String host = (String)gf.get("hostName", null);
    int address = gf.get("address", 0);
    int family = gf.get("family", 0);
    if (family != IPv4 && family != IPv6) {
        throw new InvalidObjectException("invalid address family type: " + family);
    }
    InetAddressHolder h = new InetAddressHolder(host, address, family);
    UNSAFE.putObject(this, FIELDS_OFFSET, h);
}
 
Example #25
Source Project: openjdk-jdk8u   Author: AdoptOpenJDK   File: InetAddress.java    License: GNU General Public License v2.0 5 votes vote down vote up
private void readObject (ObjectInputStream s) throws
                     IOException, ClassNotFoundException {
    if (getClass().getClassLoader() != null) {
        throw new SecurityException ("invalid address type");
    }
    GetField gf = s.readFields();
    String host = (String)gf.get("hostName", null);
    int address = gf.get("address", 0);
    int family = gf.get("family", 0);
    if (family != IPv4 && family != IPv6) {
        throw new InvalidObjectException("invalid address family type: " + family);
    }
    InetAddressHolder h = new InetAddressHolder(host, address, family);
    UNSAFE.putObject(this, FIELDS_OFFSET, h);
}
 
Example #26
Source Project: openjdk-jdk8u   Author: AdoptOpenJDK   File: CryptoPermissions.java    License: GNU General Public License v2.0 5 votes vote down vote up
private void readObject(ObjectInputStream s)
    throws IOException, ClassNotFoundException {
    ObjectInputStream.GetField fields = s.readFields();
    @SuppressWarnings("unchecked")
    Hashtable<String,PermissionCollection> permTable =
            (Hashtable<String,PermissionCollection>)
            (fields.get("perms", null));
    if (permTable != null) {
        perms = new ConcurrentHashMap<>(permTable);
    } else {
        perms = new ConcurrentHashMap<>();
    }
}
 
Example #27
Source Project: alfresco-repository   Author: Alfresco   File: VersionHistoryImpl.java    License: GNU Lesser General Public License v3.0 5 votes vote down vote up
@SuppressWarnings({ "unchecked", "deprecation" })
private void readObject(ObjectInputStream is) throws ClassNotFoundException, IOException
{
    GetField fields = is.readFields();
    if (fields.defaulted("versionsByLabel"))
    {
        // This is a V2.2 class
        // The old 'rootVersion' maps to the current 'rootVersion'
        this.versionsByLabel = (HashMap<String, Version>) fields.get("versions", new HashMap<String, Version>());
        // The old 'versionHistory' maps to the current 'versionHistory'
        this.versionHistory = (HashMap<String, String>) fields.get("versionHistory", new HashMap<String, String>());
        // Need this comparator as versionsByLabel is not a LinkedHashMap in this version 
        this.versionComparatorDesc = new VersionLabelComparator(); 
    }
    else if (fields.defaulted("versionComparatorDesc"))
    {
        // This is a V3.1.0 class
        // The old 'rootVersion' maps to the current 'rootVersion'
        this.versionsByLabel = (HashMap<String, Version>) fields.get("versionsByLabel", new HashMap<String, Version>());
        // The old 'versionHistory' maps to the current 'versionHistory'
        this.versionHistory = (HashMap<String, String>) fields.get("versionHistory", new HashMap<String, String>());
        // Need this comparator as versionsByLabel is not a LinkedHashMap in this version 
        this.versionComparatorDesc = new VersionLabelComparator(); 
    }
    else
    {
        // This is a V4.1.3 (and 4.0.2 HF) class
        // The old 'rootVersion' maps to the current 'rootVersion'
        this.versionsByLabel = (Map<String, Version>) fields.get("versionsByLabel", new LinkedHashMap<String, Version>());
        // The old 'versionHistory' maps to the current 'versionHistory'
        this.versionHistory = (HashMap<String, String>) fields.get("versionHistory", new HashMap<String, String>());
        this.versionComparatorDesc = (Comparator<Version>) fields.get("versionComparatorDesc", null); 
    }
}
 
Example #28
Source Project: lams   Author: lamsfoundation   File: SimpleRoleGroup.java    License: GNU General Public License v2.0 5 votes vote down vote up
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
{
   GetField getField = in.readFields();
   Object fieldValue = (ArrayList<?>) getField.get("roles", null);
   if (fieldValue instanceof ArrayList) {
      ArrayList<?> stringList = (ArrayList<?>) fieldValue;
      this.roles = new HashSet<Role>((ArrayList<Role>) stringList);
   } else {
      this.roles = new HashSet<Role>();
   }
}
 
Example #29
Source Project: openjdk-jdk8u-backup   Author: AdoptOpenJDK   File: InetAddress.java    License: GNU General Public License v2.0 5 votes vote down vote up
private void readObject (ObjectInputStream s) throws
                     IOException, ClassNotFoundException {
    if (getClass().getClassLoader() != null) {
        throw new SecurityException ("invalid address type");
    }
    GetField gf = s.readFields();
    String host = (String)gf.get("hostName", null);
    int address= gf.get("address", 0);
    int family= gf.get("family", 0);
    InetAddressHolder h = new InetAddressHolder(host, address, family);
    UNSAFE.putObject(this, FIELDS_OFFSET, h);
}
 
Example #30
Source Project: openjdk-jdk8u-backup   Author: AdoptOpenJDK   File: CryptoPermissions.java    License: GNU General Public License v2.0 5 votes vote down vote up
private void readObject(ObjectInputStream s)
    throws IOException, ClassNotFoundException {
    ObjectInputStream.GetField fields = s.readFields();
    @SuppressWarnings("unchecked")
    Hashtable<String,PermissionCollection> permTable =
            (Hashtable<String,PermissionCollection>)
            (fields.get("perms", null));
    if (permTable != null) {
        perms = new ConcurrentHashMap<>(permTable);
    } else {
        perms = new ConcurrentHashMap<>();
    }
}