org.springframework.core.serializer.support.SerializationFailedException Java Examples
The following examples show how to use
org.springframework.core.serializer.support.SerializationFailedException.
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: CompositeTransactionManagerKafkaImpl.java From microservices-transactions-tcc with Apache License 2.0 | 6 votes |
@SuppressWarnings("unchecked") @Override public List<EntityCommand<?>> fetch(String txId) { List<EntityCommand<?>> transactionOperations = new ArrayList<EntityCommand<?>>(); Map<String, Object> consumerConfigs = (Map<String, Object>)configuration.get("kafkaConsumerConfiguration"); consumerConfigs.put(ConsumerConfig.GROUP_ID_CONFIG, UUID.randomUUID().toString()); KafkaConsumer<String, String> kafkaConsumer = new KafkaConsumer<String, String>(consumerConfigs); kafkaConsumer.subscribe(Arrays.asList(txId)); ConsumerRecords<String, String> records = kafkaConsumer.poll(kafkaConsumerPollTimeout); for (ConsumerRecord<String, String> record : records){ LOG.info("offset = {}, key = {}, value = {}", record.offset(), record.key(), record.value()); try { transactionOperations.add(serializer.readFromString(record.value())); } catch (SerializationFailedException e) { LOG.error("Unable to deserialize [{}] because of: {}", record.value(), e.getMessage()); } } kafkaConsumer.close(); return transactionOperations; }
Example #2
Source File: SerializationConverterTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void nonSerializableField() { SerializingConverter toBytes = new SerializingConverter(); try { toBytes.convert(new UnSerializable()); fail("Expected SerializationFailureException"); } catch (SerializationFailedException e) { assertNotNull(e.getCause()); assertTrue(e.getCause() instanceof NotSerializableException); } }
Example #3
Source File: SerializationConverterTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void nonSerializableObject() { SerializingConverter toBytes = new SerializingConverter(); try { toBytes.convert(new Object()); fail("Expected IllegalArgumentException"); } catch (SerializationFailedException e) { assertNotNull(e.getCause()); assertTrue(e.getCause() instanceof IllegalArgumentException); } }
Example #4
Source File: SerializationConverterTests.java From java-technology-stack with MIT License | 5 votes |
@Test public void nonSerializableObject() { SerializingConverter toBytes = new SerializingConverter(); try { toBytes.convert(new Object()); fail("Expected IllegalArgumentException"); } catch (SerializationFailedException e) { assertNotNull(e.getCause()); assertTrue(e.getCause() instanceof IllegalArgumentException); } }
Example #5
Source File: SerializationConverterTests.java From java-technology-stack with MIT License | 5 votes |
@Test public void nonSerializableField() { SerializingConverter toBytes = new SerializingConverter(); try { toBytes.convert(new UnSerializable()); fail("Expected SerializationFailureException"); } catch (SerializationFailedException e) { assertNotNull(e.getCause()); assertTrue(e.getCause() instanceof NotSerializableException); } }
Example #6
Source File: SerializationConverterTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void nonSerializableField() { SerializingConverter toBytes = new SerializingConverter(); try { toBytes.convert(new UnSerializable()); fail("Expected SerializationFailureException"); } catch (SerializationFailedException e) { assertNotNull(e.getCause()); assertTrue(e.getCause() instanceof NotSerializableException); } }
Example #7
Source File: SerializationConverterTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void nonSerializableObject() { SerializingConverter toBytes = new SerializingConverter(); try { toBytes.convert(new Object()); fail("Expected IllegalArgumentException"); } catch (SerializationFailedException e) { assertNotNull(e.getCause()); assertTrue(e.getCause() instanceof IllegalArgumentException); } }
Example #8
Source File: AbstractEntityCommandJsonSerializer.java From microservices-transactions-tcc with Apache License 2.0 | 5 votes |
@Override public String writeToString(EntityCommand<T> object) throws SerializationFailedException { try { return jacksonMapper.writeValueAsString(object); } catch (JsonProcessingException e) { throw new SerializationFailedException("Error performing EntityCommand serialization", e); } }
Example #9
Source File: SerializationConverterTests.java From spring4-understanding with Apache License 2.0 | 4 votes |
@Test(expected = SerializationFailedException.class) public void deserializationFailure() { DeserializingConverter fromBytes = new DeserializingConverter(); fromBytes.convert("Junk".getBytes()); }
Example #10
Source File: AbstractEntityCommandJsonSerializer.java From microservices-transactions-tcc with Apache License 2.0 | 4 votes |
@Override public abstract EntityCommand<T> readFromString(String chars) throws SerializationFailedException;
Example #11
Source File: AbstractEntityCommandJsonSerializer.java From microservices-transactions-tcc with Apache License 2.0 | 4 votes |
@Override public EntityCommand<T> read(byte[] bytes) throws SerializationFailedException { return readFromString(new String(bytes)); }
Example #12
Source File: AbstractEntityCommandJsonSerializer.java From microservices-transactions-tcc with Apache License 2.0 | 4 votes |
@Override public byte[] write(EntityCommand<T> object) throws SerializationFailedException { return writeToString(object).getBytes(); }
Example #13
Source File: SerializationConverterTests.java From java-technology-stack with MIT License | 4 votes |
@Test(expected = SerializationFailedException.class) public void deserializationFailure() { DeserializingConverter fromBytes = new DeserializingConverter(); fromBytes.convert("Junk".getBytes()); }
Example #14
Source File: SerializationConverterTests.java From spring-analysis-note with MIT License | 4 votes |
@Test(expected = SerializationFailedException.class) public void deserializationFailure() { DeserializingConverter fromBytes = new DeserializingConverter(); fromBytes.convert("Junk".getBytes()); }
Example #15
Source File: Serializer.java From microservices-transactions-tcc with Apache License 2.0 | votes |
T readFromString(String chars) throws SerializationFailedException;
Example #16
Source File: Serializer.java From microservices-transactions-tcc with Apache License 2.0 | votes |
T read(byte[] bytes) throws SerializationFailedException;
Example #17
Source File: Serializer.java From microservices-transactions-tcc with Apache License 2.0 | votes |
String writeToString(T object) throws SerializationFailedException;
Example #18
Source File: Serializer.java From microservices-transactions-tcc with Apache License 2.0 | votes |
byte[] write(T object) throws SerializationFailedException;