Skip to content
Advertisement

Tag: serialization

JSON parse error: Cannot deserialize instance of ArrayList

I’m trying to send a JSON to a POST bodyRequest service to use this information as a Java ArrayList or something like that. When I try to do it, I receive a deserialize error This is my JSON: {information: [ {fields: “Periods Offered”, tables: “Courses”, columns: “Academic Level*”}, {fields: “Default Grading Basis*”, tables: “Courses”, columns: “Default Offering Percentage”}, {fields: “Allowed

Unable to load a groovy classes

I am trying to serialize and deserialize a groovy object with the below class in the jenkins pipeline. SerializationUtil.groovy Test.groovy Jenkins pipeline script I was able to serialize the object but not deserialize. I am getting the below exception. From the exception, I could see that GroovyClassLoader is not called and I assume that might be the issue. Answer The

Serial version uid in abstract exception class

I have a base custom exception class BaseException and several custom exceptions that extends BaseException I got a warning about serial version uid being not declared in the BaseException class. Is it needed in an abstract class? Is it a good practice? Is any way to get rid of the warning? Answer Yes, you need to define the serialVersionUID in

Recover data after closing a Jar file

I am working with a jar file that deals with a program where I open a window (using JFrame). In this window, I manipulate some data and store some of it in the private fields of a class. When I close my windows and reopen my jar file, all my data is lost. How can I save my data so

Sonar “Make transient or serializable” error

I have the following serializable class (implements serializable): However , it seems like this property is causing some problems with serialization : How can I solve this problem ? Also , is there any downside in not making this transient or serializable ? Will I be able to serialize this class fully ? Answer The Map interface does not extend

Custom Jackson Deserialization of a Generic Abstract class

I am having issues when trying to deserializing the following class: My generic abstract class: I have two concrete classes which implement MetricValueDto: IntMetricValueDto: FloatMetricValueDto: Any idea of what’s the correct strategy to deserialize MetricValueDto so I can parse it through ObjectMapper or an RestTemplate? Whenever I run: I get Caused by: com.fasterxml.jackson.databind.JsonMappingException: Can not construct instance of com.resson.dto.MetricValueDto: abstract

Spring deserializes a LocalDate in a @RequestBody differently from one in a @RequestParam – why, and can they be the same?

QUESTION: Spring appears to use different deserialization methods for LocalDate depending on whether it appears in a @RequestBody or a request @ReqestParam – is this correct, and if so, is there a way to configure them to be the same throughout an application? BACKGROUND: In my @RestController, I have two methods – one GET, and one POST. The GET expects

Advertisement