Skip to content

Commit

Permalink
fix: PgObject isNull() was reporting the opposite fixes Issue #2411 (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
davecramer committed Jan 19, 2022
1 parent 9385985 commit 4d494bf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pgjdbc/src/main/java/org/postgresql/util/PGobject.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public final String getType() {
* @return true if the current object wraps `null` value.
*/
public boolean isNull() {
return getValue() != null;
return getValue() == null;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

import org.postgresql.geometric.PGbox;
import org.postgresql.geometric.PGcircle;
Expand Down Expand Up @@ -78,6 +79,7 @@ public void setNullAsPGobject() throws SQLException {
PGobject object = new PGobject();
object.setType(typeName);
object.setValue(null);
assertTrue("IsNull should return true", object.isNull());
testSet(object, expected, PGobject.class);
}

Expand Down

0 comments on commit 4d494bf

Please sign in to comment.