Skip to content

Commit

Permalink
Use Assert instead of NSAssert in URLEndpoint and Blob when validatin…
Browse files Browse the repository at this point in the history
…g values

NSAssert will be disable in release mode. Use Assert instead.

#2119
  • Loading branch information
pasin committed Mar 26, 2018
1 parent 07f021e commit 4e979cd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Objective-C/CBLBlob.mm
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ - (instancetype) initWithContentType: (NSString*)contentType
{
CBLAssertNotNil(contentType);
CBLAssertNotNil(url);
NSAssert(url.isFileURL, @"url must be a file-based URL");
Assert(url.isFileURL, @"url must be a file-based URL");

NSInputStream* stream = [[NSInputStream alloc] initWithURL: url];
if (!stream) {
Expand Down
14 changes: 7 additions & 7 deletions Objective-C/CBLURLEndpoint.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ @implementation CBLURLEndpoint
- (instancetype) initWithURL: (NSURL*)url {
CBLAssertNotNil(url);

NSAssert([url.scheme isEqualToString: kCBLURLEndpointScheme] ||
[url.scheme isEqualToString: kCBLURLEndpointTLSScheme],
@"Invalid scheme for URLEndpoint url (%@); must be either %@ or %@",
url.scheme, kCBLURLEndpointScheme, kCBLURLEndpointTLSScheme);
Assert([url.scheme isEqualToString: kCBLURLEndpointScheme] ||
[url.scheme isEqualToString: kCBLURLEndpointTLSScheme],
@"Invalid scheme for URLEndpoint url (%@); must be either %@ or %@",
url.scheme, kCBLURLEndpointScheme, kCBLURLEndpointTLSScheme);

NSAssert(!url.user && !url.password,
@"Embedded credentials in a URL (username:password@url) "
"are not allowed; use the BasicAuthenticator class instead");
Assert(!url.user && !url.password,
@"Embedded credentials in a URL (username:password@url) "
"are not allowed; use the BasicAuthenticator class instead");

self = [super init];
if (self) {
Expand Down

0 comments on commit 4e979cd

Please sign in to comment.