---- PortableObject implementation -----------------------------------
324640
@Override
    public void readExternal(PofReader reader)
            throws IOException {
        name = reader.readString(0);
        mutator = reader.readBoolean(1);
        args = reader.readObjectArray(2, new Object[0]);
    }
788701
public static void init(Object object)
	{
		if (object instanceof Collection)
		{
			initCollection((Collection<?>)object);
		}
		else if (object instanceof Marshalizable)
		{
			Marshalizable m = (Marshalizable)object;
			m.marshallize();
		}
	}
1319471
public void publish(Object obj) {
        try {
            if (_isBatch) {
                publishBatch(obj);
            } else {
                publish(obj, true);
            }
        } catch (InsufficientCapacityException ex) {
            throw new RuntimeException("This code should be unreachable!");
        }
    }
961658
@Override
    public void writeObject(Object obj, AbstractHessianOutput out)
        throws IOException
    {
        if (out.addRef(obj)) {
            return;
        }

        int ref = out.writeObjectBegin(getClassName(obj));

        if (ref < -1) {
            out.writeString("value");

            InputStream is = null;

            try {
                is = getInputStream(obj);
            } catch (Exception e) {
                log.log(Level.WARNING, e.toString(), e);
            }

            if (is != null) {
                try {
                    out.writeByteStream(is);
                } finally {
                    is.close();
                }
            } else {
                out.writeNull();
            }

            out.writeMapEnd();
        }
        else {
            if (ref == -1) {
                out.writeClassFieldLength(1);
                out.writeString("value");

                out.writeObjectBegin(getClassName(obj));
            }

            InputStream is = null;

            try {
                is = getInputStream(obj);
            } catch (Exception e) {
                log.log(Level.WARNING, e.toString(), e);
            }

            try {
                if (is != null)
                    out.writeByteStream(is);
                else
                    out.writeNull();
            } finally {
                if (is != null)
                    is.close();
            }
        }
    }
1086778
private void initFinalPositionAndOffset(BufferObjectDataInput in, ClassDefinition cd) {
        int fieldCount;
        try {
            // final position after portable is read
            finalPosition = in.readInt();
            fieldCount = in.readInt();
        } catch (IOException e) {
            throw new HazelcastSerializationException(e);
        }
        if (fieldCount != cd.getFieldCount()) {
            throw new IllegalStateException("Field count[" + fieldCount + "] in stream does not match " + cd);
        }
        offset = in.position();
    }
126445
@Override
    public void writeObject(DataOutputStream dataOutputStream) throws ObjectManagerException, IOException
    {
        super.writeObject(dataOutputStream);

        // Write out our serialVersionUID
        dataOutputStream.writeLong(serialVersionUID);

        dataOutputStream.writeLong(_uniqueID);
        dataOutputStream.writeLong(_streamID);
        dataOutputStream.writeLong(_lockID);
        dataOutputStream.writeLong(_referredID);
        dataOutputStream.writeLong(_sequence);
        dataOutputStream.writeLong(_expiryTime);
        dataOutputStream.writeInt(_redeliveredCount);
        dataOutputStream.writeInt(_storageStrategy);
        dataOutputStream.writeInt(_priority);
        dataOutputStream.writeInt(_persistentSize);
        dataOutputStream.writeInt(_maxDepth);

        dataOutputStream.writeBoolean(_canExpireSilently);
        dataOutputStream.writeBoolean(_containsExpirables);

        // If the string variables aren't null then
        // write the flag and then write them to the
        // stream.
        if (_type != null)
        {
            dataOutputStream.writeBoolean(true);
            dataOutputStream.writeUTF(_type);
        }
        else
        {
            dataOutputStream.writeBoolean(false);
        }
        if (_className != null)
        {
            dataOutputStream.writeBoolean(true);
            dataOutputStream.writeUTF(_className);
        }
        else
        {
            dataOutputStream.writeBoolean(false);
        }

        // We need to write out the length of the tran ID
        // before we write the bytes so that we can read
        // it back in successfully
        if (_transactionId != null)
        {
            dataOutputStream.writeInt(_transactionId.length);
            dataOutputStream.write(_transactionId, 0, _transactionId.length);
        }
        else
        {
            dataOutputStream.writeInt(-1);
        }

        // Call the Tokens to write themselves out but
        // only if they exist. If the don't then we need
        // to write a boolean to the stream so that we
        // don't try and read back in non-existent tokens.
        if (_streamListToken != null)
        {
            dataOutputStream.writeBoolean(true);
            _streamListToken.writeObject(dataOutputStream);
        }
        else
        {
            dataOutputStream.writeBoolean(false);
        }

        if (_itemListToken != null)
        {
            dataOutputStream.writeBoolean(true);
            _itemListToken.writeObject(dataOutputStream);
        }
        else
        {
            dataOutputStream.writeBoolean(false);
        }

        if (_rawDataToken != null)
        {
            dataOutputStream.writeBoolean(true);
            _rawDataToken.writeObject(dataOutputStream);
        }
        else
        {
            dataOutputStream.writeBoolean(false);
        }

        if (_streamListEntryToken != null)
        {
            dataOutputStream.writeBoolean(true);
            _streamListEntryToken.writeObject(dataOutputStream);
        }
        else
        {
            dataOutputStream.writeBoolean(false);
        }

        if (_itemListEntryToken != null)
        {
            dataOutputStream.writeBoolean(true);
            _itemListEntryToken.writeObject(dataOutputStream);
        }
        else
        {
            dataOutputStream.writeBoolean(false);
        }

        // write the _deliveryDelayTime
        dataOutputStream.writeLong(_deliveryDelayTime);

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
            SibTr.debug(this, tc, "bytes written==" + dataOutputStream.size());
    }
834116
private void writeObject(ObjectOutputStream out) throws IOException {
        Storable s = mStorable;
        if (s == null) {
            out.write(0);
        } else {
            out.write(1);
            out.writeObject(s.storableType());
            try {
                s.writeTo(out);
            } catch (SupportException e) {
                throw new IOException(e);
            }
        }
    }
267215
@Override
    public void visitCode(Code obj) {
        stack.resetForMethodEntry(this);
        nextAllocNumber = 1;
        storeToUserValue.clear();
        allocLocation.clear();
        allocToAddPCs.clear();
        optionalRanges.clear();

        addExceptionRanges(obj);

        super.visitCode(obj);

        for (List<Integer> pcs : allocToAddPCs.values()) {
            if (pcs.size() > 16) {
                bugReporter.reportBug(new BugInstance(this, BugType.PSC_PRESIZE_COLLECTIONS.name(), NORMAL_PRIORITY).addClass(this).addMethod(this)
                        .addSourceLine(this, pcs.get(0).intValue()));
            }
        }
    }
674265
public void setCurrentObject(Object obj) {
        if (((obj == null) && (this.nullString != null))
                || this.requiredType.isInstance(obj)
                || (obj instanceof String)
                || (obj instanceof File)
             //   || ((obj instanceof Task) && this.requiredType.isAssignableFrom(((Task) obj).getTaskResultType()))
                ) {
            this.currentValue = obj;
        } else {
            throw new IllegalArgumentException("Object not of required type.");
        }
    }
240685
public void put(Object objValue)
    {
        Class<?> classData = this.getNativeClassType();
        try {
            objValue = DataConverters.convertObjectToDatatype(objValue, classData, null);  // I do this just to be careful.
        } catch (Exception ex) {
            objValue = null;
        }
        if (this.getMessage() != null)
            this.getMessage().putNative(this.getFullKey(null), objValue);
    }
154029
@Override
    public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?, ?> env)
                    throws Exception {
        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();

        // -----------------------------------------------------------------------
        // Is obj a Reference?
        // -----------------------------------------------------------------------
        if (!(obj instanceof Reference)) {
            return null;
        }

        Reference ref = (Reference) obj;

        // -----------------------------------------------------------------------
        // Is the right factory for this reference?
        // -----------------------------------------------------------------------
        if (!ivInstanceClassName.equals(ref.getFactoryClassName())) {
            return null;
        }

        // -----------------------------------------------------------------------
        // Is address null?
        // -----------------------------------------------------------------------
        RefAddr addr = ref.get(Addr_Type);
        if (addr == null) {
            NamingException nex = new NamingException("The address for this Reference is empty (null)");
            throw nex;
        }

        // -----------------------------------------------------------------------
        // Reference has the right factory and non empty address, so it is OK
        // to generate the EntityManager or EntityManagerFactory object now.
        // -----------------------------------------------------------------------

        Object retObj = null;

        JPAJndiLookupInfo info = (JPAJndiLookupInfo) addr.getContent();
        if (isTraceOn && tc.isDebugEnabled())
            Tr.debug(tc, "getting EntityManagerFactory for " + info);

        JPAPuId puId = info.getPuId(); // d424494
        J2EEName j2eeName = info.getJ2EEName(); // d510184
        String refName = info.getReferenceName(); // d510184
        boolean isSFSB = checkSFSBAccess(info, info.isSFSB()); // F743-30682
        JPAComponent jpaService = JPAAccessor.getJPAComponent();

        //Check to see see if we can delegate to the OSGi-aware JPA container
        JPALookupDelegate delegate = lookupDelegate.get();

        // If we find a delegate then call it to see if it can provide the Object
        if (delegate != null) {
            // Call the right method
            if (info.isFactory())
                retObj = delegate.getEntityManagerFactory(puId.getPuName(), j2eeName);
            else
                retObj = delegate.getEntityManager(puId.getPuName(), j2eeName, info.isExtendedContextType(), info.getPersistenceProperties());
        }

        if (retObj == null) {
            if (info.isFactory()) {
                retObj = jpaService.getEntityManagerFactory(puId,
                                                            j2eeName,
                                                            USE_EMF_PROXY_VALUE || isSFSB); // d706751
            } else {
                Map<?, ?> pCtxtProperties = info.getPersistenceProperties();
                retObj = jpaService.getEntityManager(puId,
                                                     j2eeName,
                                                     refName,
                                                     info.isExtendedContextType(),
                                                     info.isUnsynchronized(),
                                                     pCtxtProperties);

            }
        }

        return retObj;
    }
588493
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
        ULocale locale = (ULocale)in.readObject();
        initialize(locale);
    }
119934
private void readObject(ObjectInputStream s) throws java.io.IOException, java.lang.ClassNotFoundException {
        throw new UnsupportedOperationException(); // not serializable
    }
1244573
private void readObject(java.io.ObjectInputStream s)
        throws java.io.IOException, ClassNotFoundException  {
        // Read in any hidden stuff
        s.defaultReadObject();

        // Read in size (number of Mappings)
        int size = s.readInt();
        if (size < 0)
            throw new java.io.StreamCorruptedException
                ("Illegal mappings count: " + size);
        init(capacity(size));

        // Read the keys and values, and put the mappings in the table
        for (int i=0; i<size; i++) {
            @SuppressWarnings("unchecked")
                K key = (K) s.readObject();
            @SuppressWarnings("unchecked")
                V value = (V) s.readObject();
            putForCreate(key, value);
        }
    }
1013119
@Override
    public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException {
	out.writeObject(new LinkedHashMap(this));
    }
795787
public final void addObject(Object object) {
        if (object instanceof Iterable) {
            // Iterable
            for (Object o : (Iterable<?>) object) {
                objects.add(o);
            }
        } else if (object.getClass().isArray()) {
            // Array
            for (Object o : (Object[]) object) {
                objects.add(o);
            }
        } else {
            // Single object
            objects.add(object);
        }
    }
940353
@SuppressWarnings("null")
    // TODO: Too much code, improve this, possibly by breaking it
    public static final Object getObject(Object obj, String fieldName)
    {
        Field embeddedField;
        try
        {
            embeddedField = obj.getClass().getDeclaredField(fieldName);
            if (embeddedField != null)
            {
                if (!embeddedField.isAccessible())
                {
                    embeddedField.setAccessible(true);
                }
                Object embededObject = embeddedField.get(obj);
                if (embededObject == null)
                {
                    Class embeddedObjectClass = embeddedField.getType();
                    if (Collection.class.isAssignableFrom(embeddedObjectClass))
                    {
                        if (embeddedObjectClass.equals(List.class))
                        {
                            return new ArrayList();
                        }
                        else if (embeddedObjectClass.equals(Set.class))
                        {
                            return new HashSet();
                        }
                    }
                    else
                    {
                        embededObject = embeddedField.getType().newInstance();
                        embeddedField.set(obj, embededObject);
                    }

                }
                return embededObject;
            }
            else
            {
                throw new PropertyAccessException("Embedded object not found: " + fieldName);
            }

        }
        catch (Exception e)
        {
            throw new PropertyAccessException(e);
        }
    }