Skip to content
This repository was archived by the owner on Jan 31, 2022. It is now read-only.

Commit 949e36d

Browse files
author
Clément Le Provost
committed
Remove superfluous type checking in OfflineClient.getIndex()
1 parent 5107d26 commit 949e36d

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

algoliasearch/src/offline/java/com/algolia/search/saas/OfflineClient.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,12 +135,7 @@ public MirroredIndex initIndex(@NonNull String indexName)
135135
MirroredIndex index = null;
136136
WeakReference<Index> existingIndex = indices.get(indexName);
137137
if (existingIndex != null) {
138-
Index anIndex = existingIndex.get();
139-
if (anIndex != null && !(anIndex instanceof MirroredIndex)) {
140-
throw new IllegalStateException("An index with the same name but a different type has already been created");
141-
} else {
142-
index = (MirroredIndex)anIndex;
143-
}
138+
index = (MirroredIndex)existingIndex.get();
144139
}
145140
if (index == null) {
146141
index = new MirroredIndex(this, indexName);

0 commit comments

Comments
 (0)