Adjust to reworked exception API.

This commit is contained in:
Jonathan Schleifer 2013-06-23 16:17:39 +02:00
parent bfdfabcf40
commit 7f5c58ffc7
14 changed files with 224 additions and 270 deletions

View file

@ -171,10 +171,9 @@
if ((rc = stringprep_profile([username UTF8String], &node,
"SASLprep", 0)) != STRINGPREP_OK)
@throw [XMPPStringPrepFailedException
exceptionWithClass: [self class]
connection: self
profile: @"SASLprep"
string: username];
exceptionWithConnection: self
profile: @"SASLprep"
string: username];
@try {
_username = [[OFString alloc] initWithUTF8String: node];
@ -203,10 +202,9 @@
if ((rc = stringprep_profile([resource UTF8String], &res,
"Resourceprep", 0)) != STRINGPREP_OK)
@throw [XMPPStringPrepFailedException
exceptionWithClass: [self class]
connection: self
profile: @"Resourceprep"
string: resource];
exceptionWithConnection: self
profile: @"Resourceprep"
string: resource];
@try {
_resource = [[OFString alloc] initWithUTF8String: res];
@ -253,10 +251,9 @@
if ((rc = stringprep_profile([domain_ UTF8String], &srv,
"Nameprep", 0)) != STRINGPREP_OK)
@throw [XMPPStringPrepFailedException
exceptionWithClass: [self class]
connection: self
profile: @"Nameprep"
string: domain_];
exceptionWithConnection: self
profile: @"Nameprep"
string: domain_];
@try {
_domain = [[OFString alloc] initWithUTF8String: srv];
@ -290,10 +287,9 @@
if ((rc = stringprep_profile([password UTF8String], &pass,
"SASLprep", 0)) != STRINGPREP_OK)
@throw [XMPPStringPrepFailedException
exceptionWithClass: [self class]
connection: self
profile: @"SASLprep"
string: password];
exceptionWithConnection: self
profile: @"SASLprep"
string: password];
@try {
_password = [[OFString alloc] initWithUTF8String: pass];
@ -339,8 +335,7 @@
OFEnumerator *enumerator;
if (_socket != nil)
@throw [OFAlreadyConnectedException
exceptionWithClass: [self class]];
@throw [OFAlreadyConnectedException exception];
_socket = [[OFTCPSocket alloc] init];
@ -691,9 +686,7 @@
{
if (![name isEqual: @"stream"] || ![prefix isEqual: @"stream"] ||
![ns isEqual: XMPP_NS_STREAM])
@throw [OFMalformedXMLException
exceptionWithClass: [builder class]
parser: nil];
@throw [OFMalformedXMLException exception];
else {
[self close];
}
@ -873,10 +866,9 @@
namespace: XMPP_NS_XMPP_STREAM] stringValue];
@throw [XMPPStreamErrorException
exceptionWithClass: [self class]
connection: self
condition: condition
reason: reason];
exceptionWithConnection: self
condition: condition
reason: reason];
return;
}
@ -915,7 +907,7 @@
if ([[element name] isEqual: @"failure"])
/* TODO: Find/create an exception to throw here */
@throw [OFException exceptionWithClass: [self class]];
@throw [OFException exception];
assert(0);
}
@ -961,9 +953,8 @@
of_log(@"Auth failed!");
// FIXME: Do more parsing/handling
@throw [XMPPAuthFailedException
exceptionWithClass: [self class]
connection: self
reason: [element XMLString]];
exceptionWithConnection: self
reason: [element XMLString]];
}
assert(0);
@ -1028,7 +1019,7 @@
if (_encryptionRequired && !_encrypted)
/* TODO: Find/create an exception to throw here */
@throw [OFException exceptionWithClass: [self class]];
@throw [OFException exception];
if ([element elementForName: @"ver"
namespace: XMPP_NS_ROSTERVER] != nil)
@ -1221,10 +1212,9 @@
if ((rc = idna_to_ascii_8z([domain_ UTF8String],
&cDomain, IDNA_USE_STD3_ASCII_RULES)) != IDNA_SUCCESS)
@throw [XMPPIDNATranslationFailedException
exceptionWithClass: [self class]
connection: self
operation: @"ToASCII"
string: domain_];
exceptionWithConnection: self
operation: @"ToASCII"
string: domain_];
@try {
ret = [[OFString alloc] initWithUTF8String: cDomain];
@ -1253,8 +1243,8 @@
- (void)setDataStorage: (id <XMPPStorage>)dataStorage
{
if (_streamOpen)
@throw [OFInvalidArgumentException
exceptionWithClass: [self class]];
/* FIXME: Find a better exception! */
@throw [OFInvalidArgumentException exception];
_dataStorage = dataStorage;
}

View file

@ -47,9 +47,7 @@
@try {
if (category == nil || type == nil)
@throw [OFInvalidArgumentException
exceptionWithClass: [self class]
selector: _cmd];
@throw [OFInvalidArgumentException exception];
_category = [category copy];
_name = [name copy];
@ -151,9 +149,7 @@
return OF_ORDERED_SAME;
if (![object isKindOfClass: [XMPPDiscoIdentity class]])
@throw [OFInvalidArgumentException
exceptionWithClass: [self class]
selector: _cmd];
@throw [OFInvalidArgumentException exception];
identity = (XMPPDiscoIdentity*)object;

View file

@ -60,8 +60,11 @@
self = [super init];
@try {
if (JID == nil)
@throw [OFInvalidArgumentException exception];
_JID = [JID copy];
_node= [node copy];
_node = [node copy];
_name = [name copy];
_identities = [OFSortedList new];
_features = [OFSortedList new];

View file

@ -41,24 +41,20 @@
/**
* \brief Creates a new XMPPException.
*
* \param class_ The class of the object which caused the exception
* \param connection The connection that received the data responsible
* for this exception
* \return A new XMPPException
*/
+ exceptionWithClass: (Class)class_
connection: (XMPPConnection*)connection;
+ exceptionWithConnection: (XMPPConnection*)connection;
/**
* \brief Initializes an already allocated XMPPException.
*
* \param class_ The class of the object which caused the exception
* \param connection The connection that received the data responsible
* for this exception
* \return An initialized XMPPException
*/
- initWithClass: (Class)class_
connection: (XMPPConnection*)connection;
- initWithConnection: (XMPPConnection*)connection;
- (XMPPConnection*)connection;
@end
@ -82,30 +78,26 @@
/**
* \brief Creates a new XMPPStreamErrorException.
*
* \param class_ The class of the object which caused the exception
* \param connection The connection that received the stream error
* \param condition The defined error condition specified by the stream error
* \param reason The descriptive free-form text specified by the stream error
* \return A new XMPPStreamErrorException
*/
+ exceptionWithClass: (Class)class_
connection: (XMPPConnection*)connection
condition: (OFString*)condition
reason: (OFString*)reason;
+ exceptionWithConnection: (XMPPConnection*)connection
condition: (OFString*)condition
reason: (OFString*)reason;
/**
* \brief Initializes an already allocated XMPPStreamErrorException.
*
* \param class_ The class of the object which caused the exception
* \param connection The connection that received the stream error
* \param condition The defined error condition specified by the stream error
* \param reason The descriptive free-form text specified by the stream error
* \return An initialized XMPPStreamErrorException
*/
- initWithClass: (Class)class_
connection: (XMPPConnection*)connection
condition: (OFString*)condition
reason: (OFString*)reason;
- initWithConnection: (XMPPConnection*)connection
condition: (OFString*)condition
reason: (OFString*)reason;
- (OFString*)condition;
- (OFString*)reason;
@ -131,30 +123,26 @@
/**
* \brief Creates a new XMPPStringPrepFailedException.
*
* \param class_ The class of the object which caused the exception
* \param connection The connection the string relates to
* \param profile The name of the stringprep profile that did not apply
* \param string The string that failed the stringprep profile
* \return A new XMPPStringPrepFailedException
*/
+ exceptionWithClass: (Class)class_
connection: (XMPPConnection*)connection
profile: (OFString*)profile
string: (OFString*)string;
+ exceptionWithConnection: (XMPPConnection*)connection
profile: (OFString*)profile
string: (OFString*)string;
/**
* \brief Initializes an already allocated XMPPStringPrepFailedException.
*
* \param class_ The class of the object which caused the exception
* \param connection The connection the string relates to
* \param profile The name of the stringprep profile that did not apply
* \param string The string that failed the stringprep profile
* \return An initialized XMPPStringPrepFailedException
*/
- initWithClass: (Class)class_
connection: (XMPPConnection*)connection
profile: (OFString*)profile
string: (OFString*)string;
- initWithConnection: (XMPPConnection*)connection
profile: (OFString*)profile
string: (OFString*)string;
- (OFString*)profile;
- (OFString*)string;
@ -179,30 +167,26 @@
/**
* \brief Creates a new XMPPIDNATranslationFailedException.
*
* \param class_ The class of the object which caused the exception
* \param connection The connection the string relates to
* \param operation The name of the stringprep profile that did not apply
* \param string The string that could not be translated
* \return A new XMPPIDNATranslationFailedException
*/
+ exceptionWithClass: (Class)class_
connection: (XMPPConnection*)connection
operation: (OFString*)operation
string: (OFString*)string;
+ exceptionWithConnection: (XMPPConnection*)connection
operation: (OFString*)operation
string: (OFString*)string;
/**
* \brief Initializes an already allocated XMPPIDNATranslationFailedException.
*
* \param class_ The class of the object which caused the exception
* \param connection The connection the string relates to
* \param operation The name of the stringprep profile that did not apply
* \param string The string that could not be translated
* \return An initialized XMPPIDNATranslationFailedException
*/
- initWithClass: (Class)class_
connection: (XMPPConnection*)connection
operation: (OFString*)operation
string: (OFString*)string;
- initWithConnection: (XMPPConnection*)connection
operation: (OFString*)operation
string: (OFString*)string;
- (OFString*)operation;
- (OFString*)string;
@ -224,26 +208,22 @@
/**
* \brief Creates a new XMPPAuthFailedException.
*
* \param class_ The class of the object which caused the exception
* \param connection The connection that could not be authenticated
* \param reason The reason the authentication failed
* \return A new XMPPAuthFailedException
*/
+ exceptionWithClass: (Class)class_
connection: (XMPPConnection*)connection
reason: (OFString*)reason;
+ exceptionWithConnection: (XMPPConnection*)connection
reason: (OFString*)reason;
/**
* \brief Initializes an already allocated XMPPAuthFailedException.
*
* \param class_ The class of the object which caused the exception
* \param connection The connection that could not be authenticated
* \param reason The reason the authentication failed
* \return An initialized XMPPAuthFailedException
*/
- initWithClass: (Class)class_
connection: (XMPPConnection*)connection
reason: (OFString*)reason;
- initWithConnection: (XMPPConnection*)connection
reason: (OFString*)reason;
- (OFString*)reason;
@end

View file

@ -24,29 +24,32 @@
# include "config.h"
#endif
#include <stdlib.h>
#import "XMPPExceptions.h"
#import "XMPPConnection.h"
@implementation XMPPException
+ exceptionWithClass: (Class)class
connection: (XMPPConnection*)connection
+ exceptionWithConnection: (XMPPConnection*)connection
{
return [[[self alloc] initWithClass: class
connection: connection] autorelease];
return [[[self alloc] initWithConnection: connection] autorelease];
}
- initWithClass: (Class)class
- init
{
Class c = [self class];
[self release];
@throw [OFNotImplementedException exceptionWithClass: c
selector: _cmd];
@try {
[self doesNotRecognizeSelector: _cmd];
} @catch (id e) {
[self release];
@throw e;
}
abort();
}
- initWithClass: (Class)class
connection: (XMPPConnection*)connection
- initWithConnection: (XMPPConnection*)connection
{
self = [super initWithClass: class];
self = [super init];
@try {
_connection = [connection retain];
@ -67,38 +70,37 @@
- (XMPPConnection*)connection
{
OF_GETTER(_connection, NO)
OF_GETTER(_connection, false)
}
@end
@implementation XMPPStreamErrorException
+ exceptionWithClass: (Class)class
connection: (XMPPConnection*)connection
+ exceptionWithConnection: (XMPPConnection*)connection
condition: (OFString*)condition
reason: (OFString*)reason;
{
return [[[self alloc] initWithConnection: connection
condition: condition
reason: reason] autorelease];
}
- initWithConnection: (XMPPConnection*)connection
{
@try {
[self doesNotRecognizeSelector: _cmd];
} @catch (id e) {
[self release];
@throw e;
}
abort();
}
- initWithConnection: (XMPPConnection*)connection
condition: (OFString*)condition
reason: (OFString*)reason;
reason: (OFString*)reason
{
return [[[self alloc] initWithClass: class
connection: connection
condition: condition
reason: reason] autorelease];
}
- initWithClass: (Class)class
connection: (XMPPConnection*)connection
{
Class c = [self class];
[self release];
@throw [OFNotImplementedException exceptionWithClass: c
selector: _cmd];
}
- initWithClass: (Class)class
connection: (XMPPConnection*)connection
condition: (OFString*)condition
reason: (OFString*)reason
{
self = [super initWithClass: class
connection: connection];
self = [super initWithConnection: connection];
@try {
_condition = [condition copy];
@ -122,49 +124,47 @@
- (OFString*)description
{
return [OFString stringWithFormat:
@"Got stream error in class %@: %@. Reason: %@!", [self inClass],
_condition, _reason];
@"Got stream error: %@. Reason: %@!", _condition, _reason];
}
- (OFString*)condition
{
OF_GETTER(_condition, NO)
OF_GETTER(_condition, false)
}
- (OFString*)reason
{
OF_GETTER(_reason, NO)
OF_GETTER(_reason, false)
}
@end
@implementation XMPPStringPrepFailedException
+ exceptionWithClass: (Class)class
connection: (XMPPConnection*)connection
+ exceptionWithConnection: (XMPPConnection*)connection
profile: (OFString*)profile
string: (OFString*)string
{
return [[[self alloc] initWithConnection: connection
profile: profile
string: string] autorelease];
}
- initWithConnection: (XMPPConnection*)connection
{
@try {
[self doesNotRecognizeSelector: _cmd];
} @catch (id e) {
[self release];
@throw e;
}
abort();
}
- initWithConnection: (XMPPConnection*)connection
profile: (OFString*)profile
string: (OFString*)string
{
return [[[self alloc] initWithClass: class
connection: connection
profile: profile
string: string] autorelease];
}
- initWithClass: (Class)class
connection: (XMPPConnection*)connection
{
Class c = [self class];
[self release];
@throw [OFNotImplementedException exceptionWithClass: c
selector: _cmd];
}
- initWithClass: (Class)class
connection: (XMPPConnection*)connection
profile: (OFString*)profile
string: (OFString*)string
{
self = [super initWithClass: class
connection: connection];
self = [super initWithConnection: connection];
@try {
_profile = [profile copy];
@ -188,49 +188,48 @@
- (OFString*)description
{
return [OFString stringWithFormat:
@"Stringprep with profile %@ failed in class %@ on string '%@'!",
_profile, [self inClass], _string];
@"Stringprep with profile %@ failed on string '%@'!",
_profile, _string];
}
- (OFString*)profile
{
OF_GETTER(_profile, NO)
OF_GETTER(_profile, false)
}
- (OFString*)string
{
OF_GETTER(_string, NO)
OF_GETTER(_string, false)
}
@end
@implementation XMPPIDNATranslationFailedException
+ exceptionWithClass: (Class)class
connection: (XMPPConnection*)connection
+ exceptionWithConnection: (XMPPConnection*)connection
operation: (OFString*)operation
string: (OFString*)string
{
return [[[self alloc] initWithConnection: connection
operation: operation
string: string] autorelease];
}
- initWithConnection: (XMPPConnection*)connection
{
@try {
[self doesNotRecognizeSelector: _cmd];
} @catch (id e) {
[self release];
@throw e;
}
abort();
}
- initWithConnection: (XMPPConnection*)connection
operation: (OFString*)operation
string: (OFString*)string
{
return [[[self alloc] initWithClass: class
connection: connection
operation: operation
string: string] autorelease];
}
- initWithClass: (Class)class
connection: (XMPPConnection*)connection
{
Class c = [self class];
[self release];
@throw [OFNotImplementedException exceptionWithClass: c
selector: _cmd];
}
- initWithClass: (Class)class
connection: (XMPPConnection*)connection
operation: (OFString*)operation
string: (OFString*)string
{
self = [super initWithClass: class
connection: connection];
self = [super initWithConnection: connection];
@try {
_operation = [operation copy];
@ -254,46 +253,44 @@
- (OFString*)description
{
return [OFString stringWithFormat:
@"IDNA operation %@ failed in class %@ on string '%@'!", _operation,
[self inClass], _string];
@"IDNA operation %@ failed on string '%@'!", _operation, _string];
}
- (OFString*)operation
{
OF_GETTER(_operation, NO)
OF_GETTER(_operation, false)
}
- (OFString*)string
{
OF_GETTER(_string, NO)
OF_GETTER(_string, false)
}
@end
@implementation XMPPAuthFailedException
+ exceptionWithClass: (Class)class
connection: (XMPPConnection*)connection
reason: (OFString*)reason;
+ exceptionWithConnection: (XMPPConnection*)connection
reason: (OFString*)reason;
{
return [[[self alloc] initWithClass: class
connection: connection
reason: reason] autorelease];
return [[[self alloc] initWithConnection: connection
reason: reason] autorelease];
}
- initWithClass: (Class)class
connection: (XMPPConnection*)connection
- initWithConnection: (XMPPConnection*)connection
{
Class c = [self class];
[self release];
@throw [OFNotImplementedException exceptionWithClass: c
selector: _cmd];
@try {
[self doesNotRecognizeSelector: _cmd];
} @catch (id e) {
[self release];
@throw e;
}
abort();
}
- initWithClass: (Class)class
connection: (XMPPConnection*)connection
reason: (OFString*)reason
- initWithConnection: (XMPPConnection*)connection
reason: (OFString*)reason
{
self = [super initWithClass: class
connection: connection];
self = [super initWithConnection: connection];
@try {
_reason = [reason copy];
@ -315,12 +312,11 @@
- (OFString*)description
{
return [OFString stringWithFormat:
@"Authentication failed in class %@. Reason: %@!", [self inClass],
_reason];
@"Authentication failed. Reason: %@!", _reason];
}
- (OFString*)reason
{
OF_GETTER(_reason, NO)
OF_GETTER(_reason, false)
}
@end

View file

@ -24,6 +24,8 @@
# include "config.h"
#endif
#include <stdlib.h>
#import <ObjFW/OFString.h>
#import <ObjFW/OFArray.h>
#import <ObjFW/OFDictionary.h>
@ -38,10 +40,14 @@
@implementation XMPPFileStorage
- init
{
Class c = [self class];
[self release];
@throw [OFNotImplementedException exceptionWithClass: c
selector: _cmd];
@try {
[self doesNotRecognizeSelector: _cmd];
} @catch (id e) {
[self release];
@throw e;
}
abort();
}
- initWithFile: (OFString*)file
@ -54,7 +60,7 @@
_file = [file copy];
@try {
_data = [[[OFDataArray dataArrayWithContentsOfFile:
file] binaryPackValue] retain];
file] messagePackValue] retain];
} @catch (id e) {
_data = [OFMutableDictionary new];
}
@ -78,7 +84,7 @@
- (void)save
{
[[_data binaryPackRepresentation] writeToFile: _file];
[[_data messagePackRepresentation] writeToFile: _file];
}
- (void)XMPP_setObject: (id)object

View file

@ -46,9 +46,7 @@
@try {
if (![type isEqual: @"get"] && ![type isEqual: @"set"] &&
![type isEqual: @"result"] && ![type isEqual: @"error"])
@throw [OFInvalidArgumentException
exceptionWithClass: [self class]
selector: _cmd];
@throw [OFInvalidArgumentException exception];
} @catch (id e) {
[self release];
@throw e;

View file

@ -119,10 +119,9 @@
"Nodeprep", 0)) != STRINGPREP_OK) || (nodepart[0] == '\0') ||
(strlen(nodepart) > 1023))
@throw [XMPPStringPrepFailedException
exceptionWithClass: [self class]
connection: nil
profile: @"Nodeprep"
string: node];
exceptionWithConnection: nil
profile: @"Nodeprep"
string: node];
@try {
_node = [[OFString alloc] initWithUTF8String: nodepart];
@ -148,10 +147,9 @@
"Nameprep", 0)) != STRINGPREP_OK) || (srv[0] == '\0') ||
(strlen(srv) > 1023))
@throw [XMPPStringPrepFailedException
exceptionWithClass: [self class]
connection: nil
profile: @"Nameprep"
string: domain];
exceptionWithConnection: nil
profile: @"Nameprep"
string: domain];
@try {
_domain = [[OFString alloc] initWithUTF8String: srv];
@ -183,10 +181,9 @@
"Resourceprep", 0)) != STRINGPREP_OK) || (res[0] == '\0') ||
(strlen(res) > 1023))
@throw [XMPPStringPrepFailedException
exceptionWithClass: [self class]
connection: nil
profile: @"Resourceprep"
string: resource];
exceptionWithConnection: nil
profile: @"Resourceprep"
string: resource];
@try {
_resource = [[OFString alloc] initWithUTF8String: res];

View file

@ -184,9 +184,7 @@ static int show_to_int(OFString *show)
intmax_t prio = [priority intMaxValue];
if ((prio < -128) || (prio > 127))
@throw [OFInvalidArgumentException
exceptionWithClass: [self class]
selector: _cmd];
@throw [OFInvalidArgumentException exception];
OFXMLElement *oldPriority = [self elementForName: @"priority"
namespace: XMPP_NS_CLIENT];
@ -219,9 +217,7 @@ static int show_to_int(OFString *show)
return OF_ORDERED_SAME;
if (![object isKindOfClass: [XMPPPresence class]])
@throw [OFInvalidArgumentException
exceptionWithClass: [self class]
selector: _cmd];
@throw [OFInvalidArgumentException exception];
otherPresence = (XMPPPresence*)object;
otherPriority = [otherPresence priority];

View file

@ -213,8 +213,8 @@
- (void)setDataStorage: (id <XMPPStorage>)dataStorage
{
if (_rosterRequested)
@throw [OFInvalidArgumentException
exceptionWithClass: [self class]];
/* FIXME: Find a better exception! */
@throw [OFInvalidArgumentException exception];
_dataStorage = dataStorage;
}

View file

@ -168,9 +168,8 @@
[_clientFirstMessageBare release];
_clientFirstMessageBare = nil;
_clientFirstMessageBare = [[OFString alloc] initWithFormat: @"n=%@,r=%@",
_authcid,
_cNonce];
_clientFirstMessageBare = [[OFString alloc]
initWithFormat: @"n=%@,r=%@", _authcid, _cNonce];
[ret addItems: [_GS2Header UTF8String]
count: [_GS2Header UTF8StringLength]];
@ -230,10 +229,9 @@
if ([comp hasPrefix: @"r="]) {
if (![entry hasPrefix: _cNonce])
@throw [XMPPAuthFailedException
exceptionWithClass: [self class]
connection: nil
reason: @"Received wrong "
@"nonce"];
exceptionWithConnection: nil
reason: @"Received wrong "
@"nonce"];
sNonce = entry;
got |= GOT_SNONCE;
@ -248,8 +246,7 @@
}
if (got != (GOT_SNONCE | GOT_SALT | GOT_ITERCOUNT))
@throw [OFInvalidServerReplyException
exceptionWithClass: [self class]];
@throw [OFInvalidServerReplyException exception];
// Add c=<base64(GS2Header+channelBindingData)>
tmpArray = [OFDataArray dataArray];
@ -390,15 +387,13 @@
if ([mess hasPrefix: @"v="]) {
if (![value isEqual: [_serverSignature stringByBase64Encoding]])
@throw [XMPPAuthFailedException
exceptionWithClass: [self class]
connection: nil
reason: @"Received wrong "
@"ServerSignature"];
exceptionWithConnection: nil
reason: @"Received wrong "
@"ServerSignature"];
_authenticated = YES;
} else
@throw [XMPPAuthFailedException exceptionWithClass: [self class]
connection: nil
reason: value];
@throw [XMPPAuthFailedException exceptionWithConnection: nil
reason: value];
return nil;
}

View file

@ -25,6 +25,8 @@
# include "config.h"
#endif
#include <stdlib.h>
#include <assert.h>
#include <arpa/inet.h>
@ -55,10 +57,14 @@
- init
{
Class c = [self class];
[self release];
@throw [OFNotImplementedException exceptionWithClass: c
selector: _cmd];
@try {
[self doesNotRecognizeSelector: _cmd];
} @catch (id e) {
[self release];
@throw e;
}
abort();
}
- initWithPriority: (uint16_t)priority
@ -208,9 +214,7 @@
if (res_ninit(&_resState))
@throw [OFAddressTranslationFailedException
exceptionWithClass: [self class]
socket: nil
host: _domain];
exceptionWithHost: _domain];
answer = [self allocMemoryWithSize: pageSize];
answerLen = res_nsearch(&_resState,
@ -221,18 +225,13 @@
(h_errno == NO_DATA)))
return;
if (answerLen < 1 || answerLen > pageSize) {
if (answerLen < 1 || answerLen > pageSize)
@throw [OFAddressTranslationFailedException
exceptionWithClass: [self class]
socket: nil
host: _domain];
}
exceptionWithHost: _domain];
if (ns_initparse(answer, answerLen, &handle))
@throw [OFAddressTranslationFailedException
exceptionWithClass: [self class]
socket: nil
host: _domain];
exceptionWithHost: _domain];
resourceRecordCount = ns_msg_count(handle, ns_s_an);
for (i = 0; i < resourceRecordCount; i++) {

View file

@ -96,9 +96,7 @@
@try {
if (![name isEqual: @"iq"] && ![name isEqual: @"message"] &&
![name isEqual: @"presence"])
@throw [OFInvalidArgumentException
exceptionWithClass: [self class]
selector: _cmd];
@throw [OFInvalidArgumentException exception];
[self setDefaultNamespace: XMPP_NS_CLIENT];
[self setPrefix: @"stream"

View file

@ -32,12 +32,12 @@
- (void)parser: (OFXMLParser*)parser
foundProcessingInstructions: (OFString*)pi
{
@throw [OFMalformedXMLException exceptionWithClass: [self class]];
@throw [OFMalformedXMLException exception];
}
- (void)parser: (OFXMLParser*)parser
foundComment: (OFString*)comment
{
@throw [OFMalformedXMLException exceptionWithClass: [self class]];
@throw [OFMalformedXMLException exception];
}
@end