File tree Expand file tree Collapse file tree 3 files changed +10
-4
lines changed
Expand file tree Collapse file tree 3 files changed +10
-4
lines changed Original file line number Diff line number Diff line change 4040
4141 clojure.lang.Indexed
4242 (nth [_ i]
43- (let [cursor (.getCursor ral (long i))]
44- (common/-read-from-cursor cursor)))
43+ (let [count (.count ral)
44+ idx (long i)]
45+ (if (and (>= idx 0 ) (< idx count))
46+ (common/-read-from-cursor (.getCursor ral idx))
47+ (throw (IndexOutOfBoundsException. (str " Index: " i " , Size: " count))))))
4548
4649 (nth [_ i not-found]
4750 (let [cursor (.getCursor ral (long i))]
Original file line number Diff line number Diff line change 185185 cursor (.getCursor rhs hash-code)]
186186 (some? cursor)))
187187
188- (defn ^WriteHashMap set-empty!
188+ (defn ^WriteHashSet set-empty!
189189 " Replaces the whs value with an empty set."
190190 [^WriteHashSet whs]
191191 (let [empty-set (conversion/v->slot! (.cursor whs) #{})]
Original file line number Diff line number Diff line change 2424 (swap! cursor1 assoc-in [3 :hidden ] :changed-by-swap! )
2525 (is (= [1 2 3 {:hidden :changed-by-swap! } 5 ]) (xdb/materialize @cursor1))
2626 (is (= :changed-by-swap! @cursor3))
27- (is (= 3 @cursor2))))))
27+ (is (= 3 @cursor2)))
28+
29+ (testing " Correctly handles invalid cursor path"
30+ (is (thrown? IndexOutOfBoundsException @(xdb/xdb-cursor db [:foo :bar 999 ])))))))
You can’t perform that action at this time.
0 commit comments