Java Code Examples for java.io.ObjectInputStream.GetField#get()

The following examples show how to use java.io.ObjectInputStream.GetField#get() . 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 File: BaseReturnValue.java    From jasperreports with 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 2
Source File: URL.java    From jdk8u-jdk with 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 File: URL.java    From openjdk-jdk9 with 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 File: JRVirtualizationContext.java    From jasperreports with 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 5
Source File: URL.java    From jdk8u_jdk with 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 File: Pair.java    From alfresco-core with 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 File: URL.java    From hottub with 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 File: URL.java    From JDKSourceCode1.8 with 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 9
Source File: URL.java    From TencentKona-8 with 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 10
Source File: URL.java    From dragonwell8_jdk with 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 File: InetAddress.java    From hottub with 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 12
Source File: InetAddress.java    From openjdk-8-source with 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 13
Source File: InetAddress.java    From jdk8u-jdk with 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 14
Source File: InetAddress.java    From jdk8u_jdk with 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 15
Source File: InetAddress.java    From TencentKona-8 with 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 16
Source File: DesignCell.java    From jasperreports with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
{
	GetField fields = in.readFields();
	rowSpan = (Integer) fields.get("rowSpan", null);
	
	//DesignBaseCell fields were originally (until 6.11) in this class
	//read the values from the stream object if present and set them in the parent
	ObjectStreamClass streamClass = fields.getObjectStreamClass();
	if (streamClass.getField("defaultStyleProvider") != null)
	{
		defaultStyleProvider = (JRDefaultStyleProvider) fields.get("defaultStyleProvider", null);
	}
	if (streamClass.getField("style") != null)
	{
		style = (JRStyle) fields.get("style", null);
	}
	if (streamClass.getField("styleNameReference") != null)
	{
		styleNameReference = (String) fields.get("styleNameReference", null);
	}
	if (streamClass.getField("box") != null)
	{
		box = (JRLineBox) fields.get("box", null);
	}
	if (streamClass.getField("height") != null)
	{
		height = (Integer) fields.get("height", null);
	}
	if (streamClass.getField("propertiesMap") != null)
	{
		propertiesMap = (JRPropertiesMap) fields.get("propertiesMap", null);
	}
}
 
Example 17
Source File: InetAddress.java    From openjdk-jdk8u-backup with 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 18
Source File: CompiledCell.java    From jasperreports with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
{
	GetField fields = in.readFields();
	rowSpan = (Integer) fields.get("rowSpan", null);
	
	//CompiledBaseCell fields were originally (until 6.11) in this class
	//read the values from the stream object if present and set them in the parent
	ObjectStreamClass streamClass = fields.getObjectStreamClass();
	if (streamClass.getField("defaultStyleProvider") != null)
	{
		defaultStyleProvider = (JRDefaultStyleProvider) fields.get("defaultStyleProvider", null);
	}
	if (streamClass.getField("style") != null)
	{
		style = (JRStyle) fields.get("style", null);
	}
	if (streamClass.getField("styleNameReference") != null)
	{
		styleNameReference = (String) fields.get("styleNameReference", null);
	}
	if (streamClass.getField("box") != null)
	{
		box = (JRLineBox) fields.get("box", null);
	}
	if (streamClass.getField("height") != null)
	{
		height = (Integer) fields.get("height", null);
	}
	if (streamClass.getField("propertiesMap") != null)
	{
		propertiesMap = (JRPropertiesMap) fields.get("propertiesMap", null);
	}
}
 
Example 19
Source File: InetAddress.java    From openjdk-8 with 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 20
Source File: InetAddress.java    From jdk1.8-source-analysis with 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);
}