You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
java.sql.Time throws java.lang.UnsupportedOperationException when serialized because org.eclipse.yasson.internal.serializer.types.DateSerializer tries to convert the object to a java.time.Instant, using method java.sql.Time.toInstant(). For type java.sql.Date this issue was handled in the class org.eclipse.yasson.internal.serializer.types.SqlDateSerializer. The same aproach may be used to java.sql.Time.
To Reproduce
Create a class with a java.sql.Time field:
public class MyBean {
private java.sql.Time time;
public java.sql.Time getTime() {
return time;
}
public void setTime(java.sql.Time time) {
this.time = time;
}
}
// Try to serialize this bean.
MyBean value = new MyBean();
value.setTime(java.sql.Time.valueOf("10:00:00"));
Jsonb jsonb = JsonbBuilder.newBuilder().build();
String str = jsonb.toJson(value);
Expected behavior
Must serialize correctly, but throws UnsupportedOperationException:
Caused by: java.lang.UnsupportedOperationException
at java.sql/java.sql.Time.toInstant(Time.java:281)
at [email protected]/org.eclipse.yasson.internal.serializer.types.DateSerializer.toInstant(DateSerializer.java:36)
at [email protected]/org.eclipse.yasson.internal.serializer.types.SqlDateSerializer.toInstant(SqlDateSerializer.java:36)
at [email protected]/org.eclipse.yasson.internal.serializer.types.DateSerializer.formatDefault(DateSerializer.java:41)
at [email protected]/org.eclipse.yasson.internal.serializer.types.SqlDateSerializer.formatDefault(SqlDateSerializer.java:45)
at [email protected]/org.eclipse.yasson.internal.serializer.types.SqlDateSerializer.formatDefault(SqlDateSerializer.java:23)
....
System information:
OS: any
Java Version: >= 8
Yasson Version: 3.0.4
The text was updated successfully, but these errors were encountered:
Describe the bug
java.sql.Time throws java.lang.UnsupportedOperationException when serialized because org.eclipse.yasson.internal.serializer.types.DateSerializer tries to convert the object to a java.time.Instant, using method java.sql.Time.toInstant(). For type java.sql.Date this issue was handled in the class org.eclipse.yasson.internal.serializer.types.SqlDateSerializer. The same aproach may be used to java.sql.Time.
To Reproduce
Create a class with a java.sql.Time field:
Expected behavior
Must serialize correctly, but throws UnsupportedOperationException:
Caused by: java.lang.UnsupportedOperationException
at java.sql/java.sql.Time.toInstant(Time.java:281)
at [email protected]/org.eclipse.yasson.internal.serializer.types.DateSerializer.toInstant(DateSerializer.java:36)
at [email protected]/org.eclipse.yasson.internal.serializer.types.SqlDateSerializer.toInstant(SqlDateSerializer.java:36)
at [email protected]/org.eclipse.yasson.internal.serializer.types.DateSerializer.formatDefault(DateSerializer.java:41)
at [email protected]/org.eclipse.yasson.internal.serializer.types.SqlDateSerializer.formatDefault(SqlDateSerializer.java:45)
at [email protected]/org.eclipse.yasson.internal.serializer.types.SqlDateSerializer.formatDefault(SqlDateSerializer.java:23)
....
System information:
The text was updated successfully, but these errors were encountered: