1

I'm getting this error while trying to parse from my server to my client. I am developing a servlet, and when I have to retrieve the date from my client, I got this error. I know the problem is the date can not be parsed but why? I'm passing the same object from my server to my client so why is not possible to parse? This is the object which is received from the server.

private String dni;
private String name;
private int habitacion;
private Date fechaIngreso;
private String refHospital;
private Date fechaSalida;

@JsonbTypeAdapter( LinkJsonbAdapter.class )
private Link link;

public IngresadoJson(String name, int habitacion, Date fechaIngreso, Date fechaSalida, String refHospital,String dni, Link link) {
    this.name = name;
    this.habitacion = habitacion;
    this.fechaIngreso = fechaIngreso;
    this.refHospital = refHospital;
    this.link = link;
    this.fechaSalida = fechaSalida;
    this.dni= dni;
}

// Getters and setters omitted for brevity
Daniel Jacob
  • 1,455
  • 9
  • 17
  • 3
    This is `2020` and you still using more than two decades old and broken `java.util.Date`. Change `Date` fields to `LocalDate` type. Also, post the date string that you are trying to parse. Also, post the code of your servlet. The code you have posted is not enough for anyone to find out the problem. – Arvind Kumar Avinash May 23 '20 at 16:55
  • Side note: [This](https://stackoverflow.com/questions/32437550/whats-the-difference-between-instant-and-localdatetime/32443004#32443004) is a helpful overview of several `java.time` concepts and classes. – andrewJames May 25 '20 at 17:29

0 Answers0