Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public MongoBulkWriteException(final BulkWriteResult writeResult, final List<Bul
* @param errorLabels any server errorLabels
* @since 4.1
*/
@SuppressWarnings("deprecation")
public MongoBulkWriteException(final BulkWriteResult writeResult, final List<BulkWriteError> writeErrors,
@Nullable final WriteConcernError writeConcernError, final ServerAddress serverAddress,
final Set<String> errorLabels) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public MongoWriteConcernException(final WriteConcernError writeConcernError, fin
* @param serverAddress the non-null server address
* @since 3.2
*/
@SuppressWarnings("deprecation")
public MongoWriteConcernException(final WriteConcernError writeConcernError, @Nullable final WriteConcernResult writeConcernResult,
final ServerAddress serverAddress) {
super(writeConcernError.getCode(), writeConcernError.getMessage(), serverAddress);
Expand All @@ -63,6 +64,7 @@ public MongoWriteConcernException(final WriteConcernError writeConcernError, @Nu
}

@Override
@SuppressWarnings("deprecation")
public void addLabel(final String errorLabel) {
writeConcernError.addLabel(errorLabel);
super.addLabel(errorLabel);
Expand Down
6 changes: 6 additions & 0 deletions driver-core/src/main/com/mongodb/bulk/WriteConcernError.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ public WriteConcernError(final int code, final String codeName, final String mes
* @param details any details
* @param errorLabels any error labels
* @since 4.1
* @deprecated Prefer using error labels included in the top level response document
*/
@Deprecated
public WriteConcernError(final int code, final String codeName, final String message, final BsonDocument details,
final Set<String> errorLabels) {
this.code = code;
Expand Down Expand Up @@ -113,7 +115,9 @@ public BsonDocument getDetails() {
* @param errorLabel the non-null error label to add to the exception
*
* @since 4.1
* @deprecated Prefer using error labels included in the top level response document
*/
@Deprecated
public void addLabel(final String errorLabel) {
notNull("errorLabel", errorLabel);
errorLabels.add(errorLabel);
Expand All @@ -124,8 +128,10 @@ public void addLabel(final String errorLabel) {
*
* @return the error labels, which may not be null but may be empty
* @since 4.1
* @deprecated Prefer using error labels included in the top level response document
*/
@NonNull
@Deprecated
public Set<String> getErrorLabels() {
return Collections.unmodifiableSet(errorLabels);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ public MongoBulkWriteException getError() {
serverAddress, errorLabels);
}

@SuppressWarnings("deprecation")
private void mergeWriteConcernError(final WriteConcernError writeConcernError) {
if (writeConcernError != null) {
if (writeConcernErrors.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public T apply(final BsonDocument result, final AsyncConnection connection) {
};
}

@SuppressWarnings("deprecation")
private static <T> T transformDocument(final BsonDocument result, final ServerAddress serverAddress) {
if (hasWriteConcernError(result)) {
MongoWriteConcernException writeConcernException = new MongoWriteConcernException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public static boolean hasWriteConcernError(final BsonDocument result) {
return result.containsKey("writeConcernError");
}

@SuppressWarnings("deprecation")
public static MongoWriteConcernException createWriteConcernException(final BsonDocument result, final ServerAddress serverAddress) {
MongoWriteConcernException writeConcernException = new MongoWriteConcernException(
createWriteConcernError(result.getDocument("writeConcernError")),
Expand All @@ -69,6 +70,7 @@ public static MongoWriteConcernException createWriteConcernException(final BsonD
return writeConcernException;
}

@SuppressWarnings("deprecation")
public static WriteConcernError createWriteConcernError(final BsonDocument writeConcernErrorDocument) {
return new WriteConcernError(writeConcernErrorDocument.getNumber("code").intValue(),
writeConcernErrorDocument.getString("codeName", new BsonString("")).getValue(),
Expand Down