public SimpleWriteOpResult( @Nonnull ErrorCode error, @Nullable ReplicationInformation replInfo, @Nullable ShardingInformation shardInfo, @Nonnull OpTime optime, Object... args) { this.error = error; this.replInfo = replInfo; this.shardInfo = shardInfo; if (error.equals(ErrorCode.OK)) { if (args.length != 0) { throw new IllegalArgumentException( "Error description must be " + "null when the given error code is OK"); } this.errorDesc = null; } else { errorDesc = MessageFormat.format(error.getErrorMessage(), args); } this.optime = optime; }