Skip to content

Commit

Permalink
#3341 String length validation with Postgres PGobject (JSON/JSONB)
Browse files Browse the repository at this point in the history
  • Loading branch information
rbygrave committed Mar 1, 2024
1 parent 5fa09a6 commit 9e461e4
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ final class UTF8 implements BindMaxLength {

@Override
public long length(int dbLength, Object obj) {
if (obj instanceof String) {
if (obj == null) {
return -1;
} else if (obj instanceof String) {
String s = (String) obj;
return utf8String(dbLength, s);
} else if (obj instanceof byte[]) {
Expand Down Expand Up @@ -69,7 +71,9 @@ final class Standard implements BindMaxLength {

@Override
public long length(int dbLength, Object obj) {
if (obj instanceof String) {
if (obj == null) {
return -1;
} else if (obj instanceof String) {
return ((String) obj).length();
} else if (obj instanceof byte[]) {
return ((byte[]) obj).length;
Expand Down

0 comments on commit 9e461e4

Please sign in to comment.