Examples of InvalidObjectException


Examples of java.io.InvalidObjectException

        /**
         * Resolves instances being deserialized to the predefined constants.
         */
        protected Object readResolve() throws InvalidObjectException {
            if (this.getClass() != Attribute.class) {
                throw new InvalidObjectException("subclass didn't correctly implement readResolve");
            }

            Attribute instance = (Attribute) instanceMap.get(getName());
            if (instance != null) {
                return instance;
            } else {
                throw new InvalidObjectException("unknown attribute name");
            }
        }
View Full Code Here

Examples of java.io.InvalidObjectException

  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);
      }

      Object[] array = new Object[valueCount];
      for (int j = 0; j < valueCount; j++) {
        array[j] = stream.readObject();
      }
      builder.put(key, ImmutableList.copyOf(array));
      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);
  }
View Full Code Here

Examples of java.io.InvalidObjectException

  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, ImmutableSet<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);
      }

      Object[] array = new Object[valueCount];
      for (int j = 0; j < valueCount; j++) {
        array[j] = stream.readObject();
      }
      ImmutableSet<Object> valueSet = ImmutableSet.copyOf(array);
      if (valueSet.size() != array.length) {
        throw new InvalidObjectException(
            "Duplicate key-value pairs exist for key " + key);
      }
      builder.put(key, valueSet);
      tmpSize += valueCount;
    }

    ImmutableMap<Object, ImmutableSet<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);
  }
View Full Code Here

Examples of java.io.InvalidObjectException

    private static final long serialVersionUID = 0;
  }

  private void readObject(ObjectInputStream stream)
      throws InvalidObjectException {
    throw new InvalidObjectException("Use SerializedForm");
  }
View Full Code Here

Examples of java.io.InvalidObjectException

  */
  protected Object readResolve() throws InvalidObjectException
  {
    if (this.getClass() != JRTextAttribute.class)
    {
      throw new InvalidObjectException("Subclass didn't correctly implement readResolve");
    }
   
    JRTextAttribute instance = (JRTextAttribute) instanceMap.get(getName());
    if (instance != null)
    {
      return instance;
    }

    throw new InvalidObjectException("Unknown attribute name");
  }
View Full Code Here

Examples of java.io.InvalidObjectException

    private static final long serialVersionUID = 0;
  }

  private void readObject(ObjectInputStream stream)
      throws InvalidObjectException {
    throw new InvalidObjectException("Use SerializedForm");
  }
View Full Code Here

Examples of java.io.InvalidObjectException

  // Don't allow default serialization.
  @GwtIncompatible("java.io.ObjectStreamException")
  @SuppressWarnings("unused") // actually used during deserialization
  private void readObjectNoData() throws ObjectStreamException {
    throw new InvalidObjectException("Stream data required");
  }
View Full Code Here

Examples of java.io.InvalidObjectException

        if (recursionDepth == 0) {
            throw new NotActiveException("readObject not Active");
        }

        if (obj == null) {
            throw new InvalidObjectException(
                    "Null is not a valid callback object");
        }

        Validation val = new Validation(obj, prio);
View Full Code Here

Examples of java.io.InvalidObjectException

            } else if (type.equals("Cc")) {
                return CC;
            } else if (type.equals("Bcc")) {
                return BCC;
            } else {
                throw new InvalidObjectException("Invalid RecipientType: " + type);
            }
        }
View Full Code Here

Examples of java.io.InvalidObjectException

     * such as CMYK.Cyan in the test suite.
     */
    try {
      return valueOf(c, name);
    } catch (IllegalArgumentException iae) {
      InvalidObjectException ioe = new InvalidObjectException(name + " is not a valid enum for " + c.getName());
      try {
        ioe.initCause(iae);
      } catch (NoSuchMethodError nsm) {
        // cause should be set according to the spec but it's only available in 1.4
      }
       
      throw ioe;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.