GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — NonUniqueResultException · jamesagada/objectbox-java@4ee5178

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • objectbox-java/src/main/java/io/objectbox
    • exception
      • NonUniqueResultException.java
    • query
      • Query.java
  • tests/objectbox-java-test/src/test/java/io/objectbox/query
    • QueryTest.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎objectbox-java/src/main/java/io/objectbox/exception/NonUniqueResultException.java‎

Copy file name to clipboard
+24Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* Copyright 2018 ObjectBox Ltd. All rights reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package io.objectbox.exception;
18+
19+
/** Throw if {@link io.objectbox.query.Query#findUnique()} returns more than one result. */
20+
public class NonUniqueResultException extends DbException {
21+
public NonUniqueResultException(String message) {
22+
super(message);
23+
}
24+
}
Collapse file

‎objectbox-java/src/main/java/io/objectbox/query/Query.java‎

Copy file name to clipboardExpand all lines: objectbox-java/src/main/java/io/objectbox/query/Query.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ private void ensureNoComparator() {
169169
/**
170170
* Find the unique Object matching the query.
171171
*
172-
* @throws io.objectbox.exception.DbException if result was not unique
172+
* @throws io.objectbox.exception.NonUniqueResultException if result was not unique
173173
*/
174174
@Nullable
175175
public T findUnique() {
Collapse file

‎tests/objectbox-java-test/src/test/java/io/objectbox/query/QueryTest.java‎

Copy file name to clipboardExpand all lines: tests/objectbox-java-test/src/test/java/io/objectbox/query/QueryTest.java
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
import io.objectbox.TestEntity;
3434
import io.objectbox.TestEntity_;
3535
import io.objectbox.TxCallback;
36-
import io.objectbox.exception.DbException;
3736
import io.objectbox.exception.DbExceptionListener;
37+
import io.objectbox.exception.NonUniqueResultException;
3838
import io.objectbox.query.QueryBuilder.StringOrder;
3939
import io.objectbox.relation.MyObjectBox;
4040
import io.objectbox.relation.Order;
@@ -720,7 +720,7 @@ public void onDbException(Exception e) {
720720
try {
721721
query.findUnique();
722722
fail("Should have thrown");
723-
} catch (DbException e) {
723+
} catch (NonUniqueResultException e) {
724724
assertSame(e, exs[0]);
725725
}
726726
}

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.