Don't access isa directly.

This commit is contained in:
Jonathan Schleifer 2012-07-12 05:34:20 +02:00
parent 867450105e
commit f590ff46fe
10 changed files with 43 additions and 40 deletions

View file

@ -110,7 +110,7 @@
if ((rc = stringprep_profile([username_ UTF8String], &node, if ((rc = stringprep_profile([username_ UTF8String], &node,
"SASLprep", 0)) != STRINGPREP_OK) "SASLprep", 0)) != STRINGPREP_OK)
@throw [XMPPStringPrepFailedException @throw [XMPPStringPrepFailedException
exceptionWithClass: isa exceptionWithClass: [self class]
connection: self connection: self
profile: @"SASLprep" profile: @"SASLprep"
string: username_]; string: username_];
@ -138,7 +138,7 @@
if ((rc = stringprep_profile([resource_ UTF8String], &res, if ((rc = stringprep_profile([resource_ UTF8String], &res,
"Resourceprep", 0)) != STRINGPREP_OK) "Resourceprep", 0)) != STRINGPREP_OK)
@throw [XMPPStringPrepFailedException @throw [XMPPStringPrepFailedException
exceptionWithClass: isa exceptionWithClass: [self class]
connection: self connection: self
profile: @"Resourceprep" profile: @"Resourceprep"
string: resource_]; string: resource_];
@ -179,7 +179,7 @@
if ((rc = stringprep_profile([domain_ UTF8String], &srv, if ((rc = stringprep_profile([domain_ UTF8String], &srv,
"Nameprep", 0)) != STRINGPREP_OK) "Nameprep", 0)) != STRINGPREP_OK)
@throw [XMPPStringPrepFailedException @throw [XMPPStringPrepFailedException
exceptionWithClass: isa exceptionWithClass: [self class]
connection: self connection: self
profile: @"Nameprep" profile: @"Nameprep"
string: domain_]; string: domain_];
@ -209,7 +209,7 @@
if ((rc = stringprep_profile([password_ UTF8String], &pass, if ((rc = stringprep_profile([password_ UTF8String], &pass,
"SASLprep", 0)) != STRINGPREP_OK) "SASLprep", 0)) != STRINGPREP_OK)
@throw [XMPPStringPrepFailedException @throw [XMPPStringPrepFailedException
exceptionWithClass: isa exceptionWithClass: [self class]
connection: self connection: self
profile: @"SASLprep" profile: @"SASLprep"
string: password_]; string: password_];
@ -695,10 +695,11 @@
elementForName: @"text" elementForName: @"text"
namespace: XMPP_NS_XMPP_STREAM] stringValue]; namespace: XMPP_NS_XMPP_STREAM] stringValue];
@throw [XMPPStreamErrorException exceptionWithClass: isa @throw [XMPPStreamErrorException
connection: self exceptionWithClass: [self class]
condition: condition connection: self
reason: reason]; condition: condition
reason: reason];
return; return;
} }
@ -735,7 +736,7 @@
if ([[element name] isEqual: @"failure"]) if ([[element name] isEqual: @"failure"])
/* TODO: Find/create an exception to throw here */ /* TODO: Find/create an exception to throw here */
@throw [OFException exceptionWithClass: isa]; @throw [OFException exceptionWithClass: [self class]];
assert(0); assert(0);
} }
@ -781,7 +782,7 @@
of_log(@"Auth failed!"); of_log(@"Auth failed!");
// FIXME: Do more parsing/handling // FIXME: Do more parsing/handling
@throw [XMPPAuthFailedException @throw [XMPPAuthFailedException
exceptionWithClass: isa exceptionWithClass: [self class]
connection: self connection: self
reason: [element XMLString]]; reason: [element XMLString]];
} }
@ -848,7 +849,7 @@
if (encryptionRequired && !encrypted) if (encryptionRequired && !encrypted)
/* TODO: Find/create an exception to throw here */ /* TODO: Find/create an exception to throw here */
@throw [OFException exceptionWithClass: isa]; @throw [OFException exceptionWithClass: [self class]];
if ([element elementForName: @"ver" if ([element elementForName: @"ver"
namespace: XMPP_NS_ROSTERVER] != nil) namespace: XMPP_NS_ROSTERVER] != nil)
@ -1038,7 +1039,7 @@
if ((rc = idna_to_ascii_8z([domain_ UTF8String], if ((rc = idna_to_ascii_8z([domain_ UTF8String],
&cDomain, IDNA_USE_STD3_ASCII_RULES)) != IDNA_SUCCESS) &cDomain, IDNA_USE_STD3_ASCII_RULES)) != IDNA_SUCCESS)
@throw [XMPPIDNATranslationFailedException @throw [XMPPIDNATranslationFailedException
exceptionWithClass: isa exceptionWithClass: [self class]
connection: self connection: self
operation: @"ToASCII" operation: @"ToASCII"
string: domain_]; string: domain_];
@ -1070,7 +1071,8 @@
- (void)setDataStorage: (id <XMPPStorage>)dataStorage_ - (void)setDataStorage: (id <XMPPStorage>)dataStorage_
{ {
if (streamOpen) if (streamOpen)
@throw [OFInvalidArgumentException exceptionWithClass: isa]; @throw [OFInvalidArgumentException
exceptionWithClass: [self class]];
dataStorage = dataStorage_; dataStorage = dataStorage_;
} }

View file

@ -37,7 +37,7 @@
- initWithClass: (Class)class_ - initWithClass: (Class)class_
{ {
Class c = isa; Class c = [self class];
[self release]; [self release];
@throw [OFNotImplementedException exceptionWithClass: c @throw [OFNotImplementedException exceptionWithClass: c
selector: _cmd]; selector: _cmd];
@ -97,7 +97,7 @@
- initWithClass: (Class)class_ - initWithClass: (Class)class_
connection: (XMPPConnection*)conn connection: (XMPPConnection*)conn
{ {
Class c = isa; Class c = [self class];
[self release]; [self release];
@throw [OFNotImplementedException exceptionWithClass: c @throw [OFNotImplementedException exceptionWithClass: c
selector: _cmd]; selector: _cmd];
@ -167,7 +167,7 @@
- initWithClass: (Class)class_ - initWithClass: (Class)class_
connection: (XMPPConnection*)conn connection: (XMPPConnection*)conn
{ {
Class c = isa; Class c = [self class];
[self release]; [self release];
@throw [OFNotImplementedException exceptionWithClass: c @throw [OFNotImplementedException exceptionWithClass: c
selector: _cmd]; selector: _cmd];
@ -238,7 +238,7 @@
- initWithClass: (Class)class_ - initWithClass: (Class)class_
connection: (XMPPConnection*)conn connection: (XMPPConnection*)conn
{ {
Class c = isa; Class c = [self class];
[self release]; [self release];
@throw [OFNotImplementedException exceptionWithClass: c @throw [OFNotImplementedException exceptionWithClass: c
selector: _cmd]; selector: _cmd];
@ -306,7 +306,7 @@
- initWithClass: (Class)class_ - initWithClass: (Class)class_
connection: (XMPPConnection*)conn connection: (XMPPConnection*)conn
{ {
Class c = isa; Class c = [self class];
[self release]; [self release];
@throw [OFNotImplementedException exceptionWithClass: c @throw [OFNotImplementedException exceptionWithClass: c
selector: _cmd]; selector: _cmd];

View file

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

View file

@ -116,7 +116,7 @@
"Nodeprep", 0)) != STRINGPREP_OK) || (nodepart[0] == '\0') || "Nodeprep", 0)) != STRINGPREP_OK) || (nodepart[0] == '\0') ||
(strlen(nodepart) > 1023)) (strlen(nodepart) > 1023))
@throw [XMPPStringPrepFailedException @throw [XMPPStringPrepFailedException
exceptionWithClass: isa exceptionWithClass: [self class]
connection: nil connection: nil
profile: @"Nodeprep" profile: @"Nodeprep"
string: node_]; string: node_];
@ -145,7 +145,7 @@
"Nameprep", 0)) != STRINGPREP_OK) || (srv[0] == '\0') || "Nameprep", 0)) != STRINGPREP_OK) || (srv[0] == '\0') ||
(strlen(srv) > 1023)) (strlen(srv) > 1023))
@throw [XMPPStringPrepFailedException @throw [XMPPStringPrepFailedException
exceptionWithClass: isa exceptionWithClass: [self class]
connection: nil connection: nil
profile: @"Nameprep" profile: @"Nameprep"
string: domain_]; string: domain_];
@ -180,7 +180,7 @@
"Resourceprep", 0)) != STRINGPREP_OK) || (res[0] == '\0') || "Resourceprep", 0)) != STRINGPREP_OK) || (res[0] == '\0') ||
(strlen(res) > 1023)) (strlen(res) > 1023))
@throw [XMPPStringPrepFailedException @throw [XMPPStringPrepFailedException
exceptionWithClass: isa exceptionWithClass: [self class]
connection: nil connection: nil
profile: @"Resourceprep" profile: @"Resourceprep"
string: resource_]; string: resource_];

View file

@ -37,7 +37,7 @@
@implementation XMPPJSONFileStorage @implementation XMPPJSONFileStorage
- init - init
{ {
Class c = isa; Class c = [self class];
[self release]; [self release];
@throw [OFNotImplementedException exceptionWithClass: c @throw [OFNotImplementedException exceptionWithClass: c
selector: _cmd]; selector: _cmd];

View file

@ -213,7 +213,8 @@
- (void)setDataStorage: (id <XMPPStorage>)dataStorage_ - (void)setDataStorage: (id <XMPPStorage>)dataStorage_
{ {
if (rosterRequested) if (rosterRequested)
@throw [OFInvalidArgumentException exceptionWithClass: isa]; @throw [OFInvalidArgumentException
exceptionWithClass: [self class]];
dataStorage = dataStorage_; dataStorage = dataStorage_;
} }

View file

@ -231,7 +231,7 @@
if ([comp hasPrefix: @"r="]) { if ([comp hasPrefix: @"r="]) {
if (![entry hasPrefix: cNonce]) if (![entry hasPrefix: cNonce])
@throw [XMPPAuthFailedException @throw [XMPPAuthFailedException
exceptionWithClass: isa exceptionWithClass: [self class]
connection: nil connection: nil
reason: @"Received wrong " reason: @"Received wrong "
@"nonce"]; @"nonce"];
@ -249,7 +249,8 @@
} }
if (got != (GOT_SNONCE | GOT_SALT | GOT_ITERCOUNT)) if (got != (GOT_SNONCE | GOT_SALT | GOT_ITERCOUNT))
@throw [OFInvalidServerReplyException exceptionWithClass: isa]; @throw [OFInvalidServerReplyException
exceptionWithClass: [self class]];
// Add c=<base64(GS2Header+channelBindingData)> // Add c=<base64(GS2Header+channelBindingData)>
tmpArray = [OFDataArray dataArray]; tmpArray = [OFDataArray dataArray];
@ -392,13 +393,13 @@
if ([mess hasPrefix: @"v="]) { if ([mess hasPrefix: @"v="]) {
if (![value isEqual: [serverSignature stringByBase64Encoding]]) if (![value isEqual: [serverSignature stringByBase64Encoding]])
@throw [XMPPAuthFailedException @throw [XMPPAuthFailedException
exceptionWithClass: isa exceptionWithClass: [self class]
connection: nil connection: nil
reason: @"Received wrong " reason: @"Received wrong "
@"ServerSignature"]; @"ServerSignature"];
authenticated = YES; authenticated = YES;
} else } else
@throw [XMPPAuthFailedException exceptionWithClass: isa @throw [XMPPAuthFailedException exceptionWithClass: [self class]
connection: nil connection: nil
reason: value]; reason: value];

View file

@ -55,7 +55,7 @@
- init - init
{ {
Class c = isa; Class c = [self class];
[self release]; [self release];
@throw [OFNotImplementedException exceptionWithClass: c @throw [OFNotImplementedException exceptionWithClass: c
selector: _cmd]; selector: _cmd];
@ -98,7 +98,7 @@
if (dn_expand(ns_msg_base(handle), ns_msg_end(handle), if (dn_expand(ns_msg_base(handle), ns_msg_end(handle),
(uint8_t*)&rdata[3], buffer, NS_MAXDNAME) < 1) (uint8_t*)&rdata[3], buffer, NS_MAXDNAME) < 1)
@throw [OFInitializationFailedException @throw [OFInitializationFailedException
exceptionWithClass: isa]; exceptionWithClass: [self class]];
target = [[OFString alloc] target = [[OFString alloc]
initWithCString: buffer initWithCString: buffer
@ -120,10 +120,9 @@
- (OFString*)description - (OFString*)description
{ {
return [OFString stringWithFormat: @"<%@ priority: %" PRIu16 return [OFString stringWithFormat:
@", weight: %" PRIu16 @"<%@ priority: %" PRIu16 @", weight: %" PRIu16 @", target: %@:%"
@", target: %@:%" PRIu16 @">", PRIu16 @">", [self class], priority, weight, target, port];
isa, priority, weight, target, port];
} }
- (uint16_t)priority - (uint16_t)priority
@ -208,7 +207,7 @@
if (res_ninit(&resState)) if (res_ninit(&resState))
@throw [OFAddressTranslationFailedException @throw [OFAddressTranslationFailedException
exceptionWithClass: isa exceptionWithClass: [self class]
socket: nil socket: nil
host: domain]; host: domain];
@ -223,14 +222,14 @@
if (answerLen < 1 || answerLen > of_pagesize) { if (answerLen < 1 || answerLen > of_pagesize) {
@throw [OFAddressTranslationFailedException @throw [OFAddressTranslationFailedException
exceptionWithClass: isa exceptionWithClass: [self class]
socket: nil socket: nil
host: domain]; host: domain];
} }
if (ns_initparse(answer, answerLen, &handle)) if (ns_initparse(answer, answerLen, &handle))
@throw [OFAddressTranslationFailedException @throw [OFAddressTranslationFailedException
exceptionWithClass: isa exceptionWithClass: [self class]
socket: nil socket: nil
host: domain]; host: domain];

View file

@ -97,7 +97,7 @@
if (![name_ isEqual: @"iq"] && ![name_ isEqual: @"message"] && if (![name_ isEqual: @"iq"] && ![name_ isEqual: @"message"] &&
![name_ isEqual: @"presence"]) ![name_ isEqual: @"presence"])
@throw [OFInvalidArgumentException @throw [OFInvalidArgumentException
exceptionWithClass: isa exceptionWithClass: [self class]
selector: _cmd]; selector: _cmd];
[self setDefaultNamespace: XMPP_NS_CLIENT]; [self setDefaultNamespace: XMPP_NS_CLIENT];

View file

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