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

The following examples show how to use com.google.gwt.user.client.rpc.SerializationException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ModuleBuilder.java    From EasyML with Apache License 2.0 6 votes vote down vote up
/**
 * Generate dataset module based on path and id
 *
 * @param path
 *          dataset path
 * @param id
 *          dataset uuid
 * @return Dataset
 * @throws Exception
 */
public static Dataset buildDataset(String path, String id) throws Exception {
	if (HDFSIO.exist(path)) {
		Dataset dataset = new Dataset();
		List list;
		try {
			Dataset temp = SecureDao.getObject(dataset, " and id = '" + id + "'");
			if ( temp != null ) {
				dataset = temp;
			} else {
				dataset.setId(id);
				dataset.setName("id" + id);
				dataset.setPath(path);
			}
		} catch (Exception e) {
			e.printStackTrace();
			throw new SerializationException(e);
		}
		return dataset;
	} else {
		System.out.println("DataSet is return null");
		return null;
	}
}
 
Example #2
Source File: CustomFieldSerializerTest.java    From auto with Apache License 2.0 5 votes vote down vote up
@Test
public void testCustomFieldSerializerGenericWithBuilder() throws SerializationException {
  Map<Integer, Integer> map = ImmutableMap.of(2, 2);
  AutoValue_CustomFieldSerializerTest_GenericValueTypeWithBuilder<Integer, Integer> instance =
      (AutoValue_CustomFieldSerializerTest_GenericValueTypeWithBuilder<Integer, Integer>)
          GenericValueTypeWithBuilder.<Integer, Integer>builder().map(map).build();
  AutoValue_CustomFieldSerializerTest_GenericValueTypeWithBuilder_CustomFieldSerializer.serialize(
      streamWriter, instance);
  verify(streamWriter).writeObject(map);
  verifyNoMoreInteractions(streamWriter);
}
 
Example #3
Source File: CommandSerializationStreamFactory.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public SerializationStreamReader createStreamReader(String encoded) throws SerializationException {
	ClientSerializationStreamReader clientSerializationStreamReader =
		new ClientSerializationStreamReader(this.serializer);
	String encodedResponse = encoded;
	if (encoded.startsWith("//OK") || encodedResponse.startsWith("//EX")) {
		encodedResponse = encodedResponse.substring(4);
	}
	clientSerializationStreamReader.prepareToRead(encodedResponse);
	return clientSerializationStreamReader;
}
 
Example #4
Source File: EventEndpoint.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
private String serializeMessage(final EventMessage messageDto) throws SerializationException {
	ServerSerializationStreamWriter serverSerializationStreamWriter = new ServerSerializationStreamWriter(
			new SimpleSerializationPolicy());
	serverSerializationStreamWriter.writeObject(messageDto);
	String result = serverSerializationStreamWriter.toString();
	return result;
}
 
Example #5
Source File: CommandServiceCompositeSerializer.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public Object instantiate(SerializationStreamReader stream, String typeSignature) throws SerializationException {
	for (Serializer serializer : this.serializers) {
		try {
			Object o = serializer.instantiate(stream, typeSignature);
			if (o != null) {
				return o;
			}
		} catch (SerializationException e) {
			continue;
		}
	}
	throw new SerializationException(typeSignature);
}
 
Example #6
Source File: CommandServiceCompositeSerializer.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void deserialize(SerializationStreamReader stream, Object instance, String typeSignature)
	throws SerializationException {
	for (Serializer serializer : this.serializers) {
		try {
			serializer.deserialize(stream, instance, typeSignature);
			return;
		} catch (SerializationException e) {
			continue;
		}
	}
	throw new SerializationException(typeSignature);
}
 
Example #7
Source File: CommandServiceCompositeSerializer.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void serialize(SerializationStreamWriter stream, Object instance, String typeSignature)
	throws SerializationException {
	for (Serializer serializer : this.serializers) {
		try {
			serializer.serialize(stream, instance, typeSignature);
			return;
		} catch (SerializationException e) {
			continue;
		}
	}
	throw new SerializationException(typeSignature);
}
 
Example #8
Source File: EventListener.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Here there is the trick, the Async Service that is usual return by the
 * deferred binding is also an instance of a SerializationStreamFactory.
 * That can be used for serialize and deserialize objects
 * 
 * @param message the message to serialize
 * 
 * @return the message serialized in a string
 */
public String serializeMessage(EventMessage message) {
	try {
		SerializationStreamFactory factory = (SerializationStreamFactory) GWT
				.create(WebsocketsMessageService.class);
		SerializationStreamWriter writer = factory.createStreamWriter();
		writer.writeObject(message);
		final String data = writer.toString();
		return data;
	} catch (final SerializationException e) {
		Log.error(e.getMessage(), null, e);
	}
	return null;
}
 
Example #9
Source File: CommandSerializationPolicy.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void validateDeserialize(Class<?> clazz) throws SerializationException {
	if (!this.isInstantiable(clazz)) {
		throw new SerializationException("Type '" + clazz.getName() + "' was not assignableJRE_BLACKSET to '"
			+ IsSerializable.class.getName() + "' and did not have a custom field serializer. "
			+ "For security purposes, this type will not be deserialized.");
	}
}
 
Example #10
Source File: CommandSerializationPolicy.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void validateSerialize(Class<?> clazz) throws SerializationException {
	if (!this.isInstantiable(clazz)) {
		throw new SerializationException("Type '" + clazz.getName() + "' was not assignable to '"
			+ IsSerializable.class.getName() + "' and did not have a custom field serializer."
			+ "For security purposes, this type will not be serialized.");
	}
}
 
Example #11
Source File: GeometrySerializer.java    From jts with GNU Lesser General Public License v2.1 5 votes vote down vote up
public static void serialize(SerializationStreamWriter streamWriter,
		Geometry instance) throws SerializationException {
	WKBWriter writer = sWriter;
	
	byte[] wkb = writer.write(instance);
	String hex = WKBWriter.toHex(wkb);
	streamWriter.writeString(hex);
}
 
Example #12
Source File: EventListener.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
public EventMessage deserializeMessae(String data) {
	try {
		SerializationStreamFactory factory = (SerializationStreamFactory) GWT
				.create(WebsocketsMessageService.class);
		final SerializationStreamReader streamReader = factory.createStreamReader(data);
		final EventMessage message = (EventMessage) streamReader.readObject();
		return message;
	} catch (final SerializationException e) {
		Log.error(e.getMessage(), null, e);
	}
	return null;
}
 
Example #13
Source File: CustomFieldSerializerTest.java    From auto with Apache License 2.0 5 votes vote down vote up
@Test
public void testCustomFieldSerializerWithBuilderAndGetters() throws SerializationException {
  AutoValue_CustomFieldSerializerTest_ValueTypeWithBuilderAndGetters instance =
      (AutoValue_CustomFieldSerializerTest_ValueTypeWithBuilderAndGetters)
          ValueTypeWithBuilderAndGetters.builder().setPackage("s").setDefault(false).build();
  AutoValue_CustomFieldSerializerTest_ValueTypeWithBuilderAndGetters_CustomFieldSerializer
      .serialize(streamWriter, instance);
  verify(streamWriter).writeString("s");
  verify(streamWriter).writeBoolean(false);
  verifyNoMoreInteractions(streamWriter);
}
 
Example #14
Source File: CustomFieldSerializerTest.java    From auto with Apache License 2.0 5 votes vote down vote up
@Test
public void testCustomFieldSerializerWithBuilder() throws SerializationException {
  AutoValue_CustomFieldSerializerTest_ValueTypeWithBuilder instance =
      (AutoValue_CustomFieldSerializerTest_ValueTypeWithBuilder)
          ValueTypeWithBuilder.builder().string("s").strings(ImmutableList.of("a", "b")).build();
  AutoValue_CustomFieldSerializerTest_ValueTypeWithBuilder_CustomFieldSerializer.serialize(
      streamWriter, instance);
  verify(streamWriter).writeString("s");
  verify(streamWriter).writeObject(ImmutableList.of("a", "b"));
  verifyNoMoreInteractions(streamWriter);
}
 
Example #15
Source File: CustomFieldSerializerTest.java    From auto with Apache License 2.0 5 votes vote down vote up
@Test
public void testCustomFieldSerializerGeneric() throws SerializationException {
  Map<Integer, Integer> map = ImmutableMap.of(2, 2);
  AutoValue_CustomFieldSerializerTest_GenericValueType<Integer, Integer> instance =
      (AutoValue_CustomFieldSerializerTest_GenericValueType<Integer, Integer>)
          GenericValueType.create(map);
  AutoValue_CustomFieldSerializerTest_GenericValueType_CustomFieldSerializer.serialize(
      streamWriter, instance);
  verify(streamWriter).writeObject(map);
  verifyNoMoreInteractions(streamWriter);
}
 
Example #16
Source File: CustomFieldSerializerTest.java    From auto with Apache License 2.0 5 votes vote down vote up
@Test
public void testCustomFieldSerializerWithGetters() throws SerializationException {
  AutoValue_CustomFieldSerializerTest_ValueTypeWithGetters instance =
      (AutoValue_CustomFieldSerializerTest_ValueTypeWithGetters)
          ValueTypeWithGetters.create("package", true);
  AutoValue_CustomFieldSerializerTest_ValueTypeWithGetters_CustomFieldSerializer.serialize(
      streamWriter, instance);
  verify(streamWriter).writeString("package");
  verify(streamWriter).writeBoolean(true);
  verifyNoMoreInteractions(streamWriter);
}
 
Example #17
Source File: CustomFieldSerializerTest.java    From auto with Apache License 2.0 5 votes vote down vote up
@Test
public void testCustomFieldSerializer() throws SerializationException {
  AutoValue_CustomFieldSerializerTest_ValueType withList =
      (AutoValue_CustomFieldSerializerTest_ValueType) WITH_LIST;
  AutoValue_CustomFieldSerializerTest_ValueType_CustomFieldSerializer.serialize(
      streamWriter, withList);
  verify(streamWriter).writeString("blim");
  verify(streamWriter).writeInt(11881376);
  verify(streamWriter).writeObject(SIMPLE);
  verify(streamWriter).writeObject(ImmutableList.of(SIMPLE, CONS));
  verifyNoMoreInteractions(streamWriter);
}
 
Example #18
Source File: GeometrySerializer.java    From jts with GNU Lesser General Public License v2.1 5 votes vote down vote up
public static Geometry instantiate(SerializationStreamReader streamReader)
		throws SerializationException {
	WKBReader reader = sReader;
	
	String hex = streamReader.readString();
	byte[] wkb = WKBReader.hexToBytes(hex);
	
	
	try {
		Geometry g = reader.read(wkb);
		return g;
	} catch (ParseException e) {
		throw new SerializationException(e);
	}
}
 
Example #19
Source File: GeometryCollection_CustomFieldSerializer.java    From jts with GNU Lesser General Public License v2.1 4 votes vote down vote up
public static GeometryCollection instantiate(SerializationStreamReader streamReader)
		throws SerializationException {
	return (GeometryCollection) GeometrySerializer.instantiate(streamReader);
}
 
Example #20
Source File: LinearRing_CustomFieldSerializer.java    From jts with GNU Lesser General Public License v2.1 4 votes vote down vote up
public static void serialize(SerializationStreamWriter streamWriter,
		LinearRing instance) throws SerializationException {
	GeometrySerializer.serialize(streamWriter, instance);
}
 
Example #21
Source File: Polygon_CustomFieldSerializer.java    From jts with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public void serializeInstance(SerializationStreamWriter streamWriter,
		Polygon instance) throws SerializationException {
	serialize(streamWriter, instance);
}
 
Example #22
Source File: Polygon_CustomFieldSerializer.java    From jts with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public void deserializeInstance(SerializationStreamReader streamReader,
		Polygon instance) throws SerializationException {
	deserialize(streamReader, instance);
}
 
Example #23
Source File: Polygon_CustomFieldSerializer.java    From jts with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public Polygon instantiateInstance(SerializationStreamReader streamReader)
		throws SerializationException {
	return instantiate(streamReader);
}
 
Example #24
Source File: Polygon_CustomFieldSerializer.java    From jts with GNU Lesser General Public License v2.1 4 votes vote down vote up
public static void serialize(SerializationStreamWriter streamWriter,
		Polygon instance) throws SerializationException {
	GeometrySerializer.serialize(streamWriter, instance);
}
 
Example #25
Source File: LinearRing_CustomFieldSerializer.java    From jts with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public void deserializeInstance(SerializationStreamReader streamReader,
		LinearRing instance) throws SerializationException {
	deserialize(streamReader, instance);
}
 
Example #26
Source File: ProcessorTest.java    From FreeBuilder with Apache License 2.0 4 votes vote down vote up
/**
 * Server-side deserialize does not match server-side serialize, so we can't test a round trip.
 */
public static <T> void gwtSerialize(T object) throws SerializationException {
  RPC.encodeResponseForSuccess(arbitraryVoidReturningMethod(), object);
}
 
Example #27
Source File: LinearRing_CustomFieldSerializer.java    From jts with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public LinearRing instantiateInstance(SerializationStreamReader streamReader)
		throws SerializationException {
	return instantiate(streamReader);
}
 
Example #28
Source File: Polygon_CustomFieldSerializer.java    From jts with GNU Lesser General Public License v2.1 4 votes vote down vote up
public static void deserialize(SerializationStreamReader streamReader,
		Polygon instance) throws SerializationException {
	//deserialization is done during instantiation
}
 
Example #29
Source File: LinearRing_CustomFieldSerializer.java    From jts with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public void serializeInstance(SerializationStreamWriter streamWriter,
		LinearRing instance) throws SerializationException {
	serialize(streamWriter, instance);
}
 
Example #30
Source File: Polygon_CustomFieldSerializer.java    From jts with GNU Lesser General Public License v2.1 4 votes vote down vote up
public static Polygon instantiate(SerializationStreamReader streamReader)
		throws SerializationException {
	return (Polygon) GeometrySerializer.instantiate(streamReader);
}