java类java.io.InvalidObjectException的实例源码

BatchUpdateException.java 文件源码 项目:OpenJSharp 阅读 16 收藏 0 点赞 0 评论 0
/**
 * readObject is called to restore the state of the
 * {@code BatchUpdateException} from a stream.
 */
private void readObject(ObjectInputStream s)
        throws IOException, ClassNotFoundException {

   ObjectInputStream.GetField fields = s.readFields();
   int[] tmp = (int[])fields.get("updateCounts", null);
   long[] tmp2 = (long[])fields.get("longUpdateCounts", null);
   if(tmp != null && tmp2 != null && tmp.length != tmp2.length)
       throw new InvalidObjectException("update counts are not the expected size");
   if (tmp != null)
       updateCounts = tmp.clone();
   if (tmp2 != null)
       longUpdateCounts = tmp2.clone();
   if(updateCounts == null && longUpdateCounts != null)
       updateCounts = copyUpdateCount(longUpdateCounts);
   if(longUpdateCounts == null && updateCounts != null)
       longUpdateCounts = copyUpdateCount(updateCounts);

}
URL.java 文件源码 项目:openjdk-jdk10 阅读 27 收藏 0 点赞 0 评论 0
private URL fabricateNewURL()
            throws InvalidObjectException {
    // create URL string from deserialized object
    URL replacementURL = null;
    String urlString = tempState.reconstituteUrlString();

    try {
        replacementURL = new URL(urlString);
    } catch (MalformedURLException mEx) {
        resetState();
        InvalidObjectException invoEx = new InvalidObjectException(
                "Malformed URL:  " + urlString);
        invoEx.initCause(mEx);
        throw invoEx;
    }
    replacementURL.setSerializedHashCode(tempState.getHashCode());
    resetState();
    return replacementURL;
}
InetSocketAddress.java 文件源码 项目:jdk8u-jdk 阅读 17 收藏 0 点赞 0 评论 0
private void readObject(ObjectInputStream in)
    throws IOException, ClassNotFoundException
{
    // Don't call defaultReadObject()
    ObjectInputStream.GetField oisFields = in.readFields();
    final String oisHostname = (String)oisFields.get("hostname", null);
    final InetAddress oisAddr = (InetAddress)oisFields.get("addr", null);
    final int oisPort = oisFields.get("port", -1);

    // Check that our invariants are satisfied
    checkPort(oisPort);
    if (oisHostname == null && oisAddr == null)
        throw new InvalidObjectException("hostname and addr " +
                                         "can't both be null");

    InetSocketAddressHolder h = new InetSocketAddressHolder(oisHostname,
                                                            oisAddr,
                                                            oisPort);
    UNSAFE.putObject(this, FIELDS_OFFSET, h);
}
IIOPInputStream.java 文件源码 项目:openjdk-jdk10 阅读 22 收藏 0 点赞 0 评论 0
private static void setCharField(Object o, Class<?> c, String fieldName, char v)
{
    try {
        Field fld = getDeclaredField( c, fieldName ) ;
        if ((fld != null) && (fld.getType() == Character.TYPE)) {
            long key = bridge.objectFieldOffset( fld ) ;
            bridge.putChar( o, key, v ) ;
        } else {
            throw new InvalidObjectException("Field Type mismatch");
        }
    } catch (Exception e) {
        if (o != null) {
            throw utilWrapper.errorSetCharField( e, fieldName,
                o.toString(),
                new Character(v) ) ;
        } else {
            throw utilWrapper.errorSetCharField( e, fieldName,
                "null " + c.getName() + " object",
                new Character(v) ) ;
        }
    }
}
DefaultMXBeanMappingFactory.java 文件源码 项目:jdk8u-jdk 阅读 25 收藏 0 点赞 0 评论 0
@Override
final Object fromNonNullOpenValue(Object openValue)
        throws InvalidObjectException {
    final Object[] openArray = (Object[]) openValue;
    final Type javaType = getJavaType();
    final Object[] valueArray;
    final Type componentType;
    if (javaType instanceof GenericArrayType) {
        componentType =
            ((GenericArrayType) javaType).getGenericComponentType();
    } else if (javaType instanceof Class<?> &&
               ((Class<?>) javaType).isArray()) {
        componentType = ((Class<?>) javaType).getComponentType();
    } else {
        throw new IllegalArgumentException("Not an array: " +
                                           javaType);
    }
    valueArray = (Object[]) Array.newInstance((Class<?>) componentType,
                                              openArray.length);
    for (int i = 0; i < openArray.length; i++)
        valueArray[i] = elementMapping.fromOpenValue(openArray[i]);
    return valueArray;
}
URL.java 文件源码 项目:jdk8u-jdk 阅读 22 收藏 0 点赞 0 评论 0
private URL fabricateNewURL()
            throws InvalidObjectException {
    // create URL string from deserialized object
    URL replacementURL = null;
    String urlString = tempState.reconstituteUrlString();

    try {
        replacementURL = new URL(urlString);
    } catch (MalformedURLException mEx) {
        resetState();
        InvalidObjectException invoEx = new InvalidObjectException(
                "Malformed URL: " + urlString);
        invoEx.initCause(mEx);
        throw invoEx;
    }
    replacementURL.setSerializedHashCode(tempState.getHashCode());
    resetState();
    return replacementURL;
}
InetSocketAddress.java 文件源码 项目:openjdk-jdk10 阅读 16 收藏 0 点赞 0 评论 0
private void readObject(ObjectInputStream in)
    throws IOException, ClassNotFoundException
{
    // Don't call defaultReadObject()
    ObjectInputStream.GetField oisFields = in.readFields();
    final String oisHostname = (String)oisFields.get("hostname", null);
    final InetAddress oisAddr = (InetAddress)oisFields.get("addr", null);
    final int oisPort = oisFields.get("port", -1);

    // Check that our invariants are satisfied
    checkPort(oisPort);
    if (oisHostname == null && oisAddr == null)
        throw new InvalidObjectException("hostname and addr " +
                                         "can't both be null");

    InetSocketAddressHolder h = new InetSocketAddressHolder(oisHostname,
                                                            oisAddr,
                                                            oisPort);
    UNSAFE.putObject(this, FIELDS_OFFSET, h);
}
OtherContentConnectorCoreExt.java 文件源码 项目:CommonInformationSpace 阅读 16 收藏 0 点赞 0 评论 0
/**
 * This message is called by the ConnectorCore when a message was receive. It will be translatet to the Application
 * representation and the translatet message if send via the registered callback to the application.
 * 
 * @param msg
 * @throws InvalidObjectException
 */
public void msgReceived(CISPayload payload) throws InvalidObjectException {
    log.info("--> messageReceived");

    if (payload instanceof CISOtherContent) {
        CISOtherContent otherCont = (CISOtherContent)payload;
        if (otherCont.getMimeType().equalsIgnoreCase(CoreConstants.MIME_TYPE_KMZ)) {
            AppCallbackHandlerImpl.getInstance().getCallback(CoreConstants.MSGTYPE_KMZ).msgReceived(payload);
        } else if (otherCont.getMimeType().equalsIgnoreCase(CoreConstants.MIME_TYPE_WMS)) {
            AppCallbackHandlerImpl.getInstance().getCallback(CoreConstants.MSGTYPE_WMS).msgReceived(payload);
        } else if (otherCont.getMimeType().equalsIgnoreCase(CoreConstants.MIME_TYPE_WFS)) {
            AppCallbackHandlerImpl.getInstance().getCallback(CoreConstants.MSGTYPE_WFS).msgReceived(payload);
        } if (otherCont.getMimeType().equalsIgnoreCase(CoreConstants.MIME_TYPE_MLP)) {
            AppCallbackHandlerImpl.getInstance().getCallback(CoreConstants.MSGTYPE_MLP).msgReceived(payload);
        }

    } else {
        throw new InvalidObjectException("Object is not OtherContent Object!");
    }


    log.info("messageReceived -->");
}
DefaultMXBeanMappingFactory.java 文件源码 项目:OpenJSharp 阅读 29 收藏 0 点赞 0 评论 0
@Override
final Object fromNonNullOpenValue(Object openValue)
        throws InvalidObjectException {
    final Object[] openArray = (Object[]) openValue;
    final Collection<Object> valueCollection;
    try {
        valueCollection = cast(collectionClass.newInstance());
    } catch (Exception e) {
        throw invalidObjectException("Cannot create collection", e);
    }
    for (Object o : openArray) {
        Object value = elementMapping.fromOpenValue(o);
        if (!valueCollection.add(value)) {
            final String msg =
                "Could not add " + o + " to " +
                collectionClass.getName() +
                " (duplicate set element?)";
            throw new InvalidObjectException(msg);
        }
    }
    return valueCollection;
}
DefaultMXBeanMappingFactory.java 文件源码 项目:OpenJSharp 阅读 26 收藏 0 点赞 0 评论 0
@Override
final Object fromNonNullOpenValue(Object openValue)
        throws InvalidObjectException {
    final Object[] openArray = (Object[]) openValue;
    final Type javaType = getJavaType();
    final Object[] valueArray;
    final Type componentType;
    if (javaType instanceof GenericArrayType) {
        componentType =
            ((GenericArrayType) javaType).getGenericComponentType();
    } else if (javaType instanceof Class<?> &&
               ((Class<?>) javaType).isArray()) {
        componentType = ((Class<?>) javaType).getComponentType();
    } else {
        throw new IllegalArgumentException("Not an array: " +
                                           javaType);
    }
    valueArray = (Object[]) Array.newInstance((Class<?>) componentType,
                                              openArray.length);
    for (int i = 0; i < openArray.length; i++)
        valueArray[i] = elementMapping.fromOpenValue(openArray[i]);
    return valueArray;
}
IIOPInputStream.java 文件源码 项目:openjdk-jdk10 阅读 15 收藏 0 点赞 0 评论 0
private static void setShortField(Object o, Class<?> c, String fieldName, short v)
{
    try {
        Field fld = getDeclaredField( c, fieldName ) ;
        if ((fld != null) && (fld.getType() == Short.TYPE)) {
            long key = bridge.objectFieldOffset( fld ) ;
            bridge.putShort( o, key, v ) ;
        } else {
            throw new InvalidObjectException("Field Type mismatch");
        }
    } catch (Exception e) {
        if (o != null) {
        throw utilWrapper.errorSetShortField( e, fieldName,
            o.toString(),
            new Short(v) ) ;
        } else {
            throw utilWrapper.errorSetShortField( e, fieldName,
                "null " + c.getName() + " object",
                new Short(v) ) ;
        }
    }
}
DefaultMXBeanMappingFactory.java 文件源码 项目:openjdk-jdk10 阅读 24 收藏 0 点赞 0 评论 0
@Override
final Object fromNonNullOpenValue(Object openValue)
        throws InvalidObjectException {
    final Object[] openArray = (Object[]) openValue;
    final Collection<Object> valueCollection;
    try {
        @SuppressWarnings("deprecation")
        Collection<?> tmp = collectionClass.newInstance();
        valueCollection = cast(tmp);
    } catch (Exception e) {
        throw invalidObjectException("Cannot create collection", e);
    }
    for (Object o : openArray) {
        Object value = elementMapping.fromOpenValue(o);
        if (!valueCollection.add(value)) {
            final String msg =
                "Could not add " + o + " to " +
                collectionClass.getName() +
                " (duplicate set element?)";
            throw new InvalidObjectException(msg);
        }
    }
    return valueCollection;
}
IIOPInputStream.java 文件源码 项目:openjdk-jdk10 阅读 22 收藏 0 点赞 0 评论 0
private static void setByteField(Object o, Class<?> c, String fieldName, byte v)
{
    try {
        Field fld = getDeclaredField( c, fieldName ) ;
        if ((fld != null) && (fld.getType() == Byte.TYPE)) {
            long key = bridge.objectFieldOffset( fld ) ;
            bridge.putByte( o, key, v ) ;
        } else {
            throw new InvalidObjectException("Field Type mismatch");
        }
    } catch (Exception e) {
        if (o != null) {
            throw utilWrapper.errorSetByteField( e, fieldName,
                o.toString(),
                new Byte(v) ) ;
        } else {
            throw utilWrapper.errorSetByteField( e, fieldName,
                "null " + c.getName() + " object",
                new Byte(v) ) ;
        }
    }
}
GcInfoCompositeData.java 文件源码 项目:OpenJSharp 阅读 26 收藏 0 点赞 0 评论 0
public static Map<String, MemoryUsage>
        getMemoryUsageAfterGc(CompositeData cd) {
    try {
        TabularData td = (TabularData) cd.get(MEMORY_USAGE_AFTER_GC);
        //return (Map<String,MemoryUsage>)
        return cast(memoryUsageMapType.toJavaTypeData(td));
    } catch (InvalidObjectException | OpenDataException e) {
        // Should never reach here
        throw new AssertionError(e);
    }
}
MappedMXBeanType.java 文件源码 项目:jdk8u-jdk 阅读 22 收藏 0 点赞 0 评论 0
Object toJavaTypeData(Object data)
    throws OpenDataException, InvalidObjectException {

    final Object[] openArray = (Object[]) data;
    List<Object> result = new ArrayList<>(openArray.length);
    for (Object o : openArray) {
        result.add(paramType.toJavaTypeData(o));
    }
    return result;
}
ChoiceFormat.java 文件源码 项目:OpenJSharp 阅读 18 收藏 0 点赞 0 评论 0
/**
 * After reading an object from the input stream, do a simple verification
 * to maintain class invariants.
 * @throws InvalidObjectException if the objects read from the stream is invalid.
 */
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
    in.defaultReadObject();
    if (choiceLimits.length != choiceFormats.length) {
        throw new InvalidObjectException(
                "limits and format arrays of different length.");
    }
}
DirectoryIteratorException.java 文件源码 项目:jdk8u-jdk 阅读 15 收藏 0 点赞 0 评论 0
/**
 * Called to read the object from a stream.
 *
 * @throws  InvalidObjectException
 *          if the object is invalid or has a cause that is not
 *          an {@code IOException}
 */
private void readObject(ObjectInputStream s)
    throws IOException, ClassNotFoundException
{
    s.defaultReadObject();
    Throwable cause = super.getCause();
    if (!(cause instanceof IOException))
        throw new InvalidObjectException("Cause must be an IOException");
}
VariableMirrorTranslator.java 文件源码 项目:incubator-netbeans 阅读 17 收藏 0 点赞 0 评论 0
private static void setValueToFinalField(ObjectReference obj, String name, ClassType clazz, Value fv, VirtualMachine vm, ThreadReference thread) throws InternalExceptionWrapper, VMDisconnectedExceptionWrapper, ClassNotPreparedExceptionWrapper, ClassNotLoadedException, ObjectCollectedExceptionWrapper, IncompatibleThreadStateException, UnsupportedOperationExceptionWrapper, InvalidTypeException, InvalidObjectException {
    ObjectReference fieldRef = getDeclaredOrInheritedField(clazz, name, vm, thread);
    if (fieldRef == null) {
        InvalidObjectException ioex = new InvalidObjectException("No field "+name+" of class "+clazz);
        throw ioex;
    }
    // field.setAccessible(true);
    ClassType fieldClassType = (ClassType) ValueWrapper.type(fieldRef);
    com.sun.jdi.Method setAccessibleMethod = ClassTypeWrapper.concreteMethodByName(
            fieldClassType, "setAccessible", "(Z)V");
    try {
        ObjectReferenceWrapper.invokeMethod(fieldRef, thread, setAccessibleMethod,
                                            Collections.singletonList(vm.mirrorOf(true)),
                                            ClassType.INVOKE_SINGLE_THREADED);
        // field.set(newInstance, fv);
        com.sun.jdi.Method setMethod = ClassTypeWrapper.concreteMethodByName(
                fieldClassType, "set", "(Ljava/lang/Object;Ljava/lang/Object;)V");
        if (fv instanceof PrimitiveValue) {
            PrimitiveType pt = (PrimitiveType) ValueWrapper.type(fv);
            ReferenceType fieldBoxingClass = EvaluatorVisitor.adjustBoxingType(clazz, pt, null);
            fv = EvaluatorVisitor.box((PrimitiveValue) fv, fieldBoxingClass, thread, null);
        }
        List<Value> args = Arrays.asList(new Value[] { obj, fv });
        ObjectReferenceWrapper.invokeMethod(fieldRef, thread, setMethod,
                                            args,
                                            ClassType.INVOKE_SINGLE_THREADED);
    } catch (InvocationException iex) {
        throw new InvalidObjectException(
                "Problem setting value "+fv+" to field "+name+" of class "+clazz+
                " : "+iex.exception());
    }
}
ValueRange.java 文件源码 项目:jdk8u-jdk 阅读 15 收藏 0 点赞 0 评论 0
/**
 * Restore the state of an ValueRange from the stream.
 * Check that the values are valid.
 *
 * @param s the stream to read
 * @throws InvalidObjectException if
 *     the smallest minimum is greater than the smallest maximum,
 *  or the smallest maximum is greater than the largest maximum
 *  or the largest minimum is greater than the largest maximum
 * @throws ClassNotFoundException if a class cannot be resolved
 */
private void readObject(ObjectInputStream s)
     throws IOException, ClassNotFoundException, InvalidObjectException
{
    s.defaultReadObject();
    if (minSmallest > minLargest) {
        throw new InvalidObjectException("Smallest minimum value must be less than largest minimum value");
    }
    if (maxSmallest > maxLargest) {
        throw new InvalidObjectException("Smallest maximum value must be less than largest maximum value");
    }
    if (minLargest > maxLargest) {
        throw new InvalidObjectException("Minimum value must be less than maximum value");
    }
}
MappedMXBeanType.java 文件源码 项目:openjdk-jdk10 阅读 19 收藏 0 点赞 0 评论 0
public static Object toJavaTypeData(Object openData, Type t)
        throws OpenDataException, InvalidObjectException {
    if (openData == null) {
        return null;
    }
    MappedMXBeanType mt = getMappedType(t);
    return mt.toJavaTypeData(openData);
}
CapConnectorCoreExt.java 文件源码 项目:CommonInformationSpace 阅读 15 收藏 0 点赞 0 评论 0
/**
 * This message is called by the ConnectorCore when a message was received. It will be translatet to the Application
 * representation and the translatet message if send via the registered callback to the application.
 * @param msg
 * @throws InvalidObjectException
 */
public void msgReceived(CISPayload payload) throws InvalidObjectException {
    log.info("--> messageReceived");

    //Parse your object to your domain objects here

    // create and forward the message to the connector
    AppCallbackHandlerImpl.getInstance().getCallback(CoreConstants.MSGTYPE_CAP).msgReceived(payload);
}
EnumSyntax.java 文件源码 项目:jdk8u-jdk 阅读 21 收藏 0 点赞 0 评论 0
/**
 * During object input, convert this deserialized enumeration instance to
 * the proper enumeration value defined in the enumeration attribute class.
 *
 * @return  The enumeration singleton value stored at index
 *          <I>i</I>-<I>L</I> in the enumeration value table returned by
 *          {@link #getEnumValueTable() getEnumValueTable()},
 *          where <I>i</I> is this enumeration value's integer value and
 *          <I>L</I> is the value returned by {@link #getOffset()
 *          getOffset()}.
 *
 * @throws ObjectStreamException if the stream can't be deserialised
 * @throws  InvalidObjectException
 *     Thrown if the enumeration value table is null, this enumeration
 *     value's integer value does not correspond to an element in the
 *     enumeration value table, or the corresponding element in the
 *     enumeration value table is null. (Note: {@link
 *     java.io.InvalidObjectException InvalidObjectException} is a subclass
 *     of {@link java.io.ObjectStreamException ObjectStreamException}, which
 *     <CODE>readResolve()</CODE> is declared to throw.)
 */
protected Object readResolve() throws ObjectStreamException {

    EnumSyntax[] theTable = getEnumValueTable();

    if (theTable == null) {
        throw new InvalidObjectException(
                            "Null enumeration value table for class " +
                            getClass());
    }

    int theOffset = getOffset();
    int theIndex = value - theOffset;

    if (0 > theIndex || theIndex >= theTable.length) {
        throw new InvalidObjectException
            ("Integer value = " +  value + " not in valid range " +
             theOffset + ".." + (theOffset + theTable.length - 1) +
             "for class " + getClass());
    }

    EnumSyntax result = theTable[theIndex];
    if (result == null) {
        throw new InvalidObjectException
            ("No enumeration value for integer value = " +
             value + "for class " + getClass());
    }
    return result;
}
Validator.java 文件源码 项目:CommonInformationSpace 阅读 25 收藏 0 点赞 0 评论 0
/**
 * This method validates if the given Object is a valid Google CAP Object.
 *  
 * @param msg The Coogle CAP Object
 * @return the valid Google CAP Object
 * @throws InvalidObjectException If the Object is no valid Google CAP object
 */
public static Alert checkIfAlertObject(Object msg) throws InvalidObjectException {
    Alert alert = null;
    if (msg instanceof Alert) {
        alert = (Alert)msg;
    } else {
        throw new InvalidObjectException("Given Object is no Alert Object!");
    }
    return alert;
}
MBeanTrustPermission.java 文件源码 项目:OpenJSharp 阅读 16 收藏 0 点赞 0 评论 0
private void readObject(ObjectInputStream in)
     throws IOException, ClassNotFoundException {

    // Reading private fields of base class
    in.defaultReadObject();
    try {
        validate(super.getName(),super.getActions());
    } catch (IllegalArgumentException e) {
        throw new InvalidObjectException(e.getMessage());
    }
}
WeekFields.java 文件源码 项目:openjdk-jdk10 阅读 17 收藏 0 点赞 0 评论 0
/**
 * Restore the state of a WeekFields from the stream.
 * Check that the values are valid.
 *
 * @param s the stream to read
 * @throws InvalidObjectException if the serialized object has an invalid
 *     value for firstDayOfWeek or minimalDays.
 * @throws ClassNotFoundException if a class cannot be resolved
 */
private void readObject(ObjectInputStream s)
     throws IOException, ClassNotFoundException, InvalidObjectException
{
    s.defaultReadObject();
    if (firstDayOfWeek == null) {
        throw new InvalidObjectException("firstDayOfWeek is null");
    }

    if (minimalDays < 1 || minimalDays > 7) {
        throw new InvalidObjectException("Minimal number of days is invalid");
    }
}
TargetedNotification.java 文件源码 项目:openjdk-jdk10 阅读 22 收藏 0 点赞 0 评论 0
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
    ois.defaultReadObject();
    try {
        validate(this.notif, this.id);
    } catch (IllegalArgumentException e) {
        throw new InvalidObjectException(e.getMessage());
    }
}
WeekFields.java 文件源码 项目:openjdk-jdk10 阅读 18 收藏 0 点赞 0 评论 0
/**
 * Return the singleton WeekFields associated with the
 * {@code firstDayOfWeek} and {@code minimalDays}.
 * @return the singleton WeekFields for the firstDayOfWeek and minimalDays.
 * @throws InvalidObjectException if the serialized object has invalid
 *     values for firstDayOfWeek or minimalDays.
 */
private Object readResolve() throws InvalidObjectException {
    try {
        return WeekFields.of(firstDayOfWeek, minimalDays);
    } catch (IllegalArgumentException iae) {
        throw new InvalidObjectException("Invalid serialized WeekFields: " + iae.getMessage());
    }
}
ImmutableListMultimap.java 文件源码 项目:guava-mock 阅读 15 收藏 0 点赞 0 评论 0
@GwtIncompatible // java.io.ObjectInputStream
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
  stream.defaultReadObject();
  int keyCount = stream.readInt();
  if (keyCount < 0) {
    throw new InvalidObjectException("Invalid key count " + keyCount);
  }
  ImmutableMap.Builder<Object, ImmutableList<Object>> builder = ImmutableMap.builder();
  int tmpSize = 0;

  for (int i = 0; i < keyCount; i++) {
    Object key = stream.readObject();
    int valueCount = stream.readInt();
    if (valueCount <= 0) {
      throw new InvalidObjectException("Invalid value count " + valueCount);
    }

    ImmutableList.Builder<Object> valuesBuilder = ImmutableList.builder();
    for (int j = 0; j < valueCount; j++) {
      valuesBuilder.add(stream.readObject());
    }
    builder.put(key, valuesBuilder.build());
    tmpSize += valueCount;
  }

  ImmutableMap<Object, ImmutableList<Object>> tmpMap;
  try {
    tmpMap = builder.build();
  } catch (IllegalArgumentException e) {
    throw (InvalidObjectException) new InvalidObjectException(e.getMessage()).initCause(e);
  }

  FieldSettersHolder.MAP_FIELD_SETTER.set(this, tmpMap);
  FieldSettersHolder.SIZE_FIELD_SETTER.set(this, tmpSize);
}
TextAttribute.java 文件源码 项目:jdk8u-jdk 阅读 16 收藏 0 点赞 0 评论 0
/**
 * Resolves instances being deserialized to the predefined constants.
 */
protected Object readResolve() throws InvalidObjectException {
    if (this.getClass() != TextAttribute.class) {
        throw new InvalidObjectException(
            "subclass didn't correctly implement readResolve");
    }

    TextAttribute instance = instanceMap.get(getName());
    if (instance != null) {
        return instance;
    } else {
        throw new InvalidObjectException("unknown attribute name");
    }
}
JComponent.java 文件源码 项目:openjdk-jdk10 阅读 15 收藏 0 点赞 0 评论 0
/**
 * This is the method that's called after the entire graph
 * of objects has been read in.  It initializes
 * the UI property of all of the copmonents with
 * <code>SwingUtilities.updateComponentTreeUI</code>.
 */
public void validateObject() throws InvalidObjectException {
    try {
        for (JComponent root : roots) {
            SwingUtilities.updateComponentTreeUI(root);
        }
    }
    finally {
        readObjectCallbacks.remove(inputStream);
    }
}


问题


面经


文章

微信
公众号

扫码关注公众号