From c9a4fde25b623012476becb764db0ae48db35a44 Mon Sep 17 00:00:00 2001 From: Nathaniel Date: Tue, 7 Nov 2023 17:08:02 -0700 Subject: [PATCH] do not return null when set is expected --- buildSrc/src/main/groovy/nucleodb.library.gradle | 2 +- .../library/database/tables/ConnectionHandler.java | 14 +++++++------- .../library/database/tables/DataTable.java | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/buildSrc/src/main/groovy/nucleodb.library.gradle b/buildSrc/src/main/groovy/nucleodb.library.gradle index 31f8efd..c9c4ddd 100644 --- a/buildSrc/src/main/groovy/nucleodb.library.gradle +++ b/buildSrc/src/main/groovy/nucleodb.library.gradle @@ -3,7 +3,7 @@ plugins { } group = 'com.nucleodb' -version = '1.9.14' +version = '1.9.15' repositories { mavenCentral() diff --git a/library/src/main/java/com/nucleocore/library/database/tables/ConnectionHandler.java b/library/src/main/java/com/nucleocore/library/database/tables/ConnectionHandler.java index a0cd887..b6ebe3d 100644 --- a/library/src/main/java/com/nucleocore/library/database/tables/ConnectionHandler.java +++ b/library/src/main/java/com/nucleocore/library/database/tables/ConnectionHandler.java @@ -148,7 +148,7 @@ public Set getByFrom(DataEntry de){ if(tmp!=null){ return tmp.stream().map(c->c.clone()).collect(Collectors.toSet()); } - return null; + return new TreeSetExt<>(); } public Set getByFromAndLabel(DataEntry from, String label){ @@ -156,7 +156,7 @@ public Set getByFromAndLabel(DataEntry from, String label){ if(tmp!=null) { return tmp.stream().map(c->c.clone()).collect(Collectors.toSet()); } - return null; + return new TreeSetExt<>(); } public Set getByFromAndLabelAndTo(DataEntry from, String label, DataEntry to){ @@ -164,35 +164,35 @@ public Set getByFromAndLabelAndTo(DataEntry from, String label, Data if(tmp!=null) { return tmp.stream().map(c->c.clone()).collect(Collectors.toSet()); } - return null; + return new TreeSetExt<>(); } public Set getByFromAndTo(DataEntry from, DataEntry to){ Set tmp = connections.get(from.getKey()+to.getKey()); if(tmp!=null) { return tmp.stream().map(c->c.clone()).collect(Collectors.toSet()); } - return null; + return new TreeSetExt<>(); } public Set getReverseByLabelAndTo(String label, DataEntry to){ Set tmp = connectionsReverse.get(to.getKey()+label); if(tmp!=null) { return tmp.stream().map(c->c.clone()).collect(Collectors.toSet()); } - return null; + return new TreeSetExt<>(); } public Set getReverseByFromAndLabelAndTo(DataEntry de, String label, DataEntry toDe){ Set tmp = connectionsReverse.get(de.getKey()+toDe.getKey()+label); if(tmp!=null) { return tmp.stream().map(c->c.clone()).collect(Collectors.toSet()); } - return null; + return new TreeSetExt<>(); } public Set getReverseByFromAndTo(DataEntry from, DataEntry to){ Set tmp = connectionsReverse.get(from.getKey()+to.getKey()); if(tmp!=null) { return tmp.stream().map(c->c.clone()).collect(Collectors.toSet()); } - return null; + return new TreeSetExt<>(); } private void putConnectionInKey(String key, Connection connection){ diff --git a/library/src/main/java/com/nucleocore/library/database/tables/DataTable.java b/library/src/main/java/com/nucleocore/library/database/tables/DataTable.java index 7dfae29..a48c55d 100644 --- a/library/src/main/java/com/nucleocore/library/database/tables/DataTable.java +++ b/library/src/main/java/com/nucleocore/library/database/tables/DataTable.java @@ -234,7 +234,7 @@ public Set createNewObject(Set o) { } catch (JsonProcessingException e) { e.printStackTrace(); } - return null; + return new TreeSetExt<>(); } DataEntry createNewObject(DataEntry o) {