From 8ce79f32b1501c3c8c8c6d8899baf331088dfd57 Mon Sep 17 00:00:00 2001 From: zzz Date: Wed, 8 Nov 2023 08:14:45 -0500 Subject: [PATCH] NetDB: Fix and deprecate unused store() method was broken for LS2, would have thrown cast exception --- router/java/src/net/i2p/router/NetworkDatabaseFacade.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/router/java/src/net/i2p/router/NetworkDatabaseFacade.java b/router/java/src/net/i2p/router/NetworkDatabaseFacade.java index a7ad944d7f..c1dd2cea9e 100644 --- a/router/java/src/net/i2p/router/NetworkDatabaseFacade.java +++ b/router/java/src/net/i2p/router/NetworkDatabaseFacade.java @@ -120,13 +120,14 @@ public abstract void lookupLeaseSetRemotely(Hash key, Job onFindJob, Job onFaile * @return the old entry if it already existed at that key * @throws IllegalArgumentException if the data is not valid * @since 0.9.16 + * @deprecated unused */ + @Deprecated public DatabaseEntry store(Hash key, DatabaseEntry entry) throws IllegalArgumentException { - if (entry.getType() == DatabaseEntry.KEY_TYPE_ROUTERINFO) + if (!entry.isLeaseSet()) return store(key, (RouterInfo) entry); - if (entry.getType() == DatabaseEntry.KEY_TYPE_LEASESET) + else return store(key, (LeaseSet) entry); - throw new IllegalArgumentException("unknown type"); } /**