Package com.google.gwt.user.client.rpc

Examples of com.google.gwt.user.client.rpc.SerializationException


  private void validateTypeVersions(Class<?> instanceClass,
      SerializedInstanceReference serializedInstRef) throws SerializationException {
    String clientTypeSignature = serializedInstRef.getSignature();
    if (clientTypeSignature.length() == 0) {
      throw new SerializationException("Missing type signature for " + instanceClass.getName());
    }

    String serverTypeSignature =
        SerializabilityUtil.getSerializationSignature(instanceClass, serializationPolicy);

    if (!clientTypeSignature.equals(serverTypeSignature)) {
      throw new SerializationException("Invalid type signature for " + instanceClass.getName());
    }
  }
View Full Code Here


    /*
     * Probably trying to serialize a type that isn't supposed to be
     * serializable.
     */
    if (methodMapNative.get(typeSignature) == null) {
      throw new SerializationException(typeSignature);
    }

    assert methodMapNative.get(typeSignature).length() >= length : "Not enough methods, expecting "
        + length + " saw " + methodMapNative.get(typeSignature).length();
  }
View Full Code Here

    if (typeHandlerClass == null) {
     /*
      * Probably trying to serialize a type that isn't supposed to be
      * serializable.
      */
      throw new SerializationException(typeSignature);
    }

    TypeHandler typeHandler = handlerCache.get(typeHandlerClass);

    if (typeHandler == null) {
      try {
        Class<?> klass = ReflectionHelper.loadClass(typeHandlerClass);
        typeHandler = (TypeHandler) ReflectionHelper.newInstance(klass);
        handlerCache.put(typeHandlerClass, typeHandler);
      } catch (Exception e) {
        throw new SerializationException(e);
      }
    }
    return typeHandler;
  }
View Full Code Here

    if (customFieldSerializer == null) {
      if (CustomFieldSerializer.class.isAssignableFrom(customSerializerClass)) {
        try {
          customFieldSerializer = (CustomFieldSerializer<?>) customSerializerClass.newInstance();
        } catch (InstantiationException e) {
          throw new SerializationException(e);

        } catch (IllegalAccessException e) {
          throw new SerializationException(e);
        }
      } else {
        customFieldSerializer = NO_SUCH_SERIALIZER;
      }
      CLASS_TO_SERIALIZER_INSTANCE.put(customSerializerClass, customFieldSerializer);
View Full Code Here

            && (instance.getMarkerValue() instanceof String) && ((String) instance.getMarkerValue())
            .equals("LocalMarker"))) {
      instance.setMarker(TypeCheckedObjectsTestSetValidator.markerKey,
          TypeCheckedObjectsTestSetValidator.markerValue);
    } else {
      throw new SerializationException(
          "Incorrect markers in TypeCheckedGenericClass server deserialization. "
              + "Custom instantiate probably not called.");
    }

    try {
      Field declField = TypeCheckedGenericClass.class.getField("hashField");
      Type declGenericType = declField.getGenericType();
      SerializabilityUtil.resolveTypes(declGenericType, resolvedTypes);
      instance.hashField = (HashMap) streamReader.readObject(declGenericType, resolvedTypes);
      SerializabilityUtil.releaseTypes(declGenericType, resolvedTypes);
    } catch (Exception e) {
      throw new SerializationException(e);
    }
  }
View Full Code Here

            && (instance.getMarkerValue() instanceof String) && ((String) instance.getMarkerValue())
            .equals("LocalMarker"))) {
      instance.setMarker(TypeCheckedObjectsTestSetValidator.markerKey,
          TypeCheckedObjectsTestSetValidator.markerValue);
    } else {
      throw new SerializationException(
          "Incorrect markers in TypeCheckedGenericClass server deserialization. "
              + "Custom instantiate probably not called.");
    }

    instance.hashField = (HashMap) streamReader.readObject();
View Full Code Here

      try {
        value = declField.get(instance);
        serializeValue(value, declField.getType());

      } catch (IllegalArgumentException e) {
        throw new SerializationException(e);

      } catch (IllegalAccessException e) {
        throw new SerializationException(e);
      }
    }

    Class<?> superClass = instanceClass.getSuperclass();
    if (serializationPolicy.shouldSerializeFields(superClass)) {
View Full Code Here

          return;
        }
      }
      throw new NoSuchMethodException("serialize");
    } catch (SecurityException e) {
      throw new SerializationException(e);

    } catch (NoSuchMethodException e) {
      throw new SerializationException(e);

    } catch (IllegalArgumentException e) {
      throw new SerializationException(e);

    } catch (IllegalAccessException e) {
      throw new SerializationException(e);

    } catch (InvocationTargetException e) {
      throw new SerializationException(e);
    }
  }
View Full Code Here

   * @see com.google.gwt.user.server.rpc.SerializationPolicy#validateDeserialize(java.lang.String)
   */
  @Override
  public void validateDeserialize(Class<?> clazz) throws SerializationException {
    if (!isInstantiable(clazz)) {
      throw new SerializationException(
          "Type '"
              + clazz.getName()
              + "' was not included in the set of types which can be deserialized by this SerializationPolicy or its Class object could not be loaded. For security purposes, this type will not be deserialized.");
    }
  }
View Full Code Here

   * @see com.google.gwt.user.server.rpc.SerializationPolicy#validateSerialize(java.lang.String)
   */
  @Override
  public void validateSerialize(Class<?> clazz) throws SerializationException {
    if (!isInstantiable(clazz)) {
      throw new SerializationException(
          "Type '"
              + clazz.getName()
              + "' was not included in the set of types which can be serialized by this SerializationPolicy or its Class object could not be loaded. For security purposes, this type will not be serialized.");
    }
  }
View Full Code Here

TOP

Related Classes of com.google.gwt.user.client.rpc.SerializationException

Copyright © 2018 www.massapicom. 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.