can lead to classcastexception in case it is not a map of dataobjects
344334
public Iterable<Obj> asObjSeq(final @Nullable Obj obj) {
		return new Iterable<Obj>() {
			@Override public Iterator<Obj> iterator() {
				if (obj != null) {
					final Iterator<Entry<String, Object>> i = obj.iterator();
					return new Iterator<Obj>() {
						@Override public boolean hasNext() {
							return i.hasNext();
						}
						@Override public Obj next() {
							return (Obj) i.next().getValue();
						}
						@Override public void remove() {
							Check.unsupportedoperation.fail();
						}
					};
				}
				return java.util.Collections.emptyIterator();
			}
		};
	}
125960
private void readObject(ObjectInputStream in) throws ClassNotFoundException, NoSuchMethodException, IOException {
        type = ClassRef.read(in);
        name = in.readUTF();
        val = in.readObject();
    }
877024
public static Object[] cast(Class<?> type, Object arrayObj) throws NullPointerException, IllegalArgumentException {
		if (null == arrayObj) {
			throw new NullPointerException("Argument [arrayObj] is null !");
		}
		if (false == arrayObj.getClass().isArray()) {
			throw new IllegalArgumentException("Argument [arrayObj] is not array !");
		}
		if (null == type) {
			return (Object[]) arrayObj;
		}

		final Class<?> componentType = type.isArray() ? type.getComponentType() : type;
		final Object[] array = (Object[]) arrayObj;
		final Object[] result = ArrayUtil.newArray(componentType, array.length);
		System.arraycopy(array, 0, result, 0, array.length);
		return result;
	}
1178934
private static boolean implementsMap(ClassDescriptor d) {
        while (d != null) {
            try {
                // Do not report this warning for EnumMap: EnumMap.keySet()/get() iteration is as fast as entrySet() iteration
                if ("java.util.EnumMap".equals(d.getDottedClassName())) {
                    return false;
                }
                // True if variable is itself declared as a Map
                if ("java.util.Map".equals(d.getDottedClassName())) {
                    return true;
                }
                XClass classNameAndInfo = Global.getAnalysisCache().getClassAnalysis(XClass.class, d);
                ClassDescriptor is[] = classNameAndInfo.getInterfaceDescriptorList();
                d = classNameAndInfo.getSuperclassDescriptor();
                for (ClassDescriptor i : is) {
                    if ("java.util.Map".equals(i.getDottedClassName())) {
                        return true;
                    }
                }
            } catch (CheckedAnalysisException e) {
                d = null;
            }
        }
        return false;
    }
245548
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
		in.defaultReadObject();

		// may be null if this serializer was deserialized from an older version
		if (this.values == null) {
			this.values = enumClass.getEnumConstants();

			this.valueToOrdinal = new EnumMap<>(this.enumClass);
			int i = 0;
			for (T value : values) {
				this.valueToOrdinal.put(value, i++);
			}
		}
	}
331838
private void parseClassDescriptions() throws Exception {
        int refCount = acceptInteger(input.readByte());
        if (refCount < 0) {
            throw new IllegalArgumentException("Invalid binary data: Expected count of references, but was: " + refCount);
        }
        refs = new Object[refCount];

        int classMapSize = acceptMap(input.readByte());
        classes = new ClassInfo[classMapSize]; // Guaranteed non-negative by acceptMap()
        classMap = new HashMap<>(classMapSize);

        for (int position = 0; position < classMapSize; position++) {
            ClassInfo classInfo = parseClassInfo();
            classes[position] = classInfo;
            classMap.put(classInfo.type, classInfo);
        }
    }
187295
private void readObject(ObjectInputStream in)
        throws IOException, ClassNotFoundException, NoSuchMethodException {
        componentType = ClassRef.read(in);
    }
667605
public function mapObjects()
    {
        if ($this->mapObjects === null) {
            $objType = $this->objType();
            if (!$objType) {
                throw new UnexpectedValueException(sprintf(
                    '%1$s cannot create collection map. Object type is not defined.',
                    get_class($this)
                ));
            }

            $loader = $this->collectionLoader();
            $loader->setModel($this->proto());

            $collectionConfig = $this->collectionConfig();
            if (is_array($collectionConfig) && !empty($collectionConfig)) {
                unset($collectionConfig['properties']);
                $loader->setData($collectionConfig);
            }

            $callback = function(&$obj) {
                $obj->mapInfoboxTemplate = $this->infoboxTemplate();

                if ($this->latProperty() && $this->latProperty()) {
                    $obj->mapShowMarker = true;
                    $obj->mapLat = $this->getPropertyValue($obj, $this->latProperty());
                    $obj->mapLon = $this->getPropertyValue($obj, $this->lonProperty());

                    if (!$obj->mapLat || !$obj->mapLon) {
                        $obj = null;
                    }
                } else {
                    $obj->mapShowMarker = false;
                }

                if ($this->pathProperty()) {
                    $mapPath = $this->getPropertyValue($obj, $this->pathProperty());
                    if ($mapPath) {
                        $obj->mapShowPath = true;
                        // Same type of coords.
                        $obj->mapPath = $this->formatPolygon($mapPath);

                        if (!$obj->mapPath) {
                            $obj = null;
                        }
                    } else {
                        $obj->mapShowPath = false;
                    }
                }

                if ($this->polygonProperty()) {
                    $mapPolygon = $this->getPropertyValue($obj, $this->polygonProperty());
                    if ($mapPolygon) {
                        $obj->mapShowPolygon = true;
                        $obj->mapPolygon = $this->formatPolygon($mapPolygon);

                        if (!$obj->mapPolygon) {
                            $obj = null;
                        }
                    } else {
                        $obj->mapShowPolygon = false;
                    }
                }
            };

            $loader->setCallback($callback->bindTo($this));

            $this->mapObjects = $loader->load();
        }

        foreach ($this->mapObjects as $obj) {
            $GLOBALS['widget_template'] = $obj->mapInfoboxTemplate;
            yield $obj;
            $GLOBALS['widget_template'] = '';
        }
    }
337298
@Override
	public Object getObject(final int columnIndex) throws SQLException {
		String columnLabel = getWrapped().getMetaData().getColumnLabel(columnIndex);

		return getObject(columnLabel);
	}
197755
@Override
    public void isValid() throws Exception {
        if (numStmnts() >= 2) {
            if (primaryJoinableHooks.size() > 0) {
                for (String joinField:primaryJoinableHooks) {
                    if (joinField.equals("timestamp")) {// timestamp is implicitly present in the result.
                        continue;
                    }
                    for (QueryMeta query: getAllStmnts()) {
                        boolean isPresent = false;
                        if (query instanceof BaseAggQueryMeta) {// Since BaseAggQueryMeta is also a PlainDimQueryMeta we go with former first.
                            for (AggItem item:((BaseAggQueryMeta)query).aggregations) {
                                if (joinField.equals(item.fieldName) || (item.asName != null && joinField.equals(item.asName))) {
                                    isPresent = true;
                                }
                            }
                        }
                        if (query instanceof PlainDimQueryMeta) {
                            Map<String, String> dims = ((PlainDimQueryMeta)query).fetchDimensions;
                            for (Map.Entry<String, String> entry :dims.entrySet()) {
                                if (joinField.equals(entry.getKey()) || (entry.getValue() != null && joinField.equals(entry.getValue()))) {
                                    isPresent = true;
                                }
                            }
                        }
                        if (!isPresent) {
                            String error = joinField + " mentioned in the composite key should appear in all the data sources being queried and joined.";
                            throw new Exception(error);
                        }
                    }
                }
            } else {
                String error = "Need atleast one field to join on";
                throw new Exception(error);
            }
        }
    }
1147911
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
        in.defaultReadObject();
        this.factoryLoader = ServiceLoader.load(PropertyFactory.class, PropertyFactory.class.getClassLoader());
    }
227728
Object getDataService(T session, Class cls) throws DataServiceException {
		String dataServiceClassName = cls.getName();
		logger.debug("Looking for dataservice : {}", dataServiceClassName);
		if (cls.isAnnotationPresent(DataService.class)) {
			return _getDataService(session, cls);
		} else {
			throw new DataServiceException(dataServiceClassName + " is not annotated with @" + DataService.class.getSimpleName());
		}
	}
1212269
public void loadClassFromByteCodes(Map<String, byte[]> inputByteCodes) {

        if (inputByteCodes == null || inputByteCodes.isEmpty()) {
            throw new IllegalArgumentException("byteCodes can not be null");
        }

        for (Map.Entry<String, byte[]> byteCode : inputByteCodes.entrySet()) {
            byteCodesClass.put(byteCode.getKey(), defineClass(null, byteCode.getValue(), 0, byteCode.getValue().length));
        }
    }
49133
private void _serializeClass(PageContext pc, Set test, Class clazz, Object obj, StringBuilder sb, boolean serializeQueryByColumns, Set<Object> done) throws ConverterException {

	Struct sct = new StructImpl(Struct.TYPE_LINKED);
	if (test == null) test = new HashSet();

	// Fields
	Field[] fields = clazz.getFields();
	Field field;
	for (int i = 0; i < fields.length; i++) {
	    field = fields[i];
	    if (obj != null || (field.getModifiers() & Modifier.STATIC) > 0) try {
		sct.setEL(field.getName(), testRecusrion(test, field.get(obj)));
	    }
	    catch (Exception e) {
		SystemOut.printDate(e);
	    }
	}
	if (obj != null) {
	    // setters
	    Method[] setters = Reflector.getSetters(clazz);
	    for (int i = 0; i < setters.length; i++) {
		sct.setEL(setters[i].getName().substring(3), NULL);
	    }
	    // getters
	    Method[] getters = Reflector.getGetters(clazz);
	    for (int i = 0; i < getters.length; i++) {
		try {
		    sct.setEL(getters[i].getName().substring(3), testRecusrion(test, getters[i].invoke(obj, ArrayUtil.OBJECT_EMPTY)));

		}
		catch (Exception e) {}
	    }
	}

	test.add(clazz);

	_serializeStruct(pc, test, sct, sb, serializeQueryByColumns, true, done);
    }
947868
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
        jsonObject = Utils.mapper().readValue((DataInput) stream, ObjectNode.class);
    }
269164
static void skipSerializedStates(DataInputView in) throws IOException {
		TypeSerializer<String> nameSerializer = StringSerializer.INSTANCE;
		TypeSerializer<State.StateType> stateTypeSerializer = new EnumSerializer<>(State.StateType.class);
		TypeSerializer<StateTransitionAction> actionSerializer = new EnumSerializer<>(StateTransitionAction.class);

		final int noOfStates = in.readInt();

		for (int i = 0; i < noOfStates; i++) {
			nameSerializer.deserialize(in);
			stateTypeSerializer.deserialize(in);
		}

		for (int i = 0; i < noOfStates; i++) {
			String srcName = nameSerializer.deserialize(in);

			int noOfTransitions = in.readInt();
			for (int j = 0; j < noOfTransitions; j++) {
				String src = nameSerializer.deserialize(in);
				Preconditions.checkState(src.equals(srcName),
					"Source Edge names do not match (" + srcName + " - " + src + ").");

				nameSerializer.deserialize(in);
				actionSerializer.deserialize(in);

				try {
					skipCondition(in);
				} catch (ClassNotFoundException e) {
					e.printStackTrace();
				}
			}
		}
	}
910124
public Object getObject(int parameterIndex, Map<String, Class<?>> map)
			throws SQLException {
		checkClosed();
		try {
			return this.internalCallableStatement.getObject(parameterIndex, map);
		} catch (SQLException e) {
			throw this.connectionHandle.markPossiblyBroken(e);
			
		}

	}