Index: src/exceptions/OFAcceptFailedException.m ================================================================== --- src/exceptions/OFAcceptFailedException.m +++ src/exceptions/OFAcceptFailedException.m @@ -62,18 +62,13 @@ [super dealloc]; } - (OFString*)description { - if (_description != nil) - return _description; - - _description = [[OFString alloc] initWithFormat: + return [OFString stringWithFormat: @"Failed to accept connection in socket of type %@! " ERRFMT, _inClass, ERRPARAM]; - - return _description; } - (OFTCPSocket*)socket { OF_GETTER(_socket, NO) Index: src/exceptions/OFAddressTranslationFailedException.m ================================================================== --- src/exceptions/OFAddressTranslationFailedException.m +++ src/exceptions/OFAddressTranslationFailedException.m @@ -67,26 +67,21 @@ [super dealloc]; } - (OFString*)description { - if (_description != nil) - return _description; - if (_host != nil) - _description = [[OFString alloc] initWithFormat: + return [OFString stringWithFormat: @"The host %@ could not be translated to an address in " @"class %@. This means that either the host was not found, " @"there was a problem with the name server, there was a " @"problem with your network connection or you specified an " @"invalid host. " ERRFMT, _host, _inClass, AT_ERRPARAM]; else - _description = [[OFString alloc] initWithFormat: + return [OFString stringWithFormat: @"An address translation failed in class %@! " ERRFMT, _inClass, AT_ERRPARAM]; - - return _description; } - (OFTCPSocket*)socket { OF_GETTER(_socket, NO) Index: src/exceptions/OFAlreadyConnectedException.m ================================================================== --- src/exceptions/OFAlreadyConnectedException.m +++ src/exceptions/OFAlreadyConnectedException.m @@ -61,20 +61,15 @@ [super dealloc]; } - (OFString*)description { - if (_description != nil) - return _description; - - _description = [[OFString alloc] initWithFormat: + return [OFString stringWithFormat: @"The socket of type %@ is already connected or bound and thus " @"can't be connected or bound again!", _inClass]; - - return _description; } - (OFTCPSocket*)socket { OF_GETTER(_socket, NO) } @end Index: src/exceptions/OFBindFailedException.m ================================================================== --- src/exceptions/OFBindFailedException.m +++ src/exceptions/OFBindFailedException.m @@ -76,18 +76,13 @@ [super dealloc]; } - (OFString*)description { - if (_description != nil) - return _description; - - _description = [[OFString alloc] initWithFormat: + return [OFString stringWithFormat: @"Binding to port %" @PRIu16 @" on host %@ failed in class %@! " ERRFMT, _port, _host, _inClass, ERRPARAM]; - - return _description; } - (OFTCPSocket*)socket { OF_GETTER(_socket, NO) Index: src/exceptions/OFChangeDirectoryFailedException.m ================================================================== --- src/exceptions/OFChangeDirectoryFailedException.m +++ src/exceptions/OFChangeDirectoryFailedException.m @@ -66,18 +66,13 @@ [super dealloc]; } - (OFString*)description { - if (_description != nil) - return _description; - - _description = [[OFString alloc] initWithFormat: + return [OFString stringWithFormat: @"Failed to change to directory %@ in class %@! " ERRFMT, _path, _inClass, ERRPARAM]; - - return _description; } - (int)errNo { return _errNo; Index: src/exceptions/OFChangeFileModeFailedException.m ================================================================== --- src/exceptions/OFChangeFileModeFailedException.m +++ src/exceptions/OFChangeFileModeFailedException.m @@ -70,18 +70,13 @@ [super dealloc]; } - (OFString*)description { - if (_description != nil) - return _description; - - _description = [[OFString alloc] initWithFormat: + return [OFString stringWithFormat: @"Failed to change mode for file %@ to %d in class %@! " ERRFMT, _path, _mode, _inClass, ERRPARAM]; - - return _description; } - (int)errNo { return _errNo; Index: src/exceptions/OFChangeFileOwnerFailedException.m ================================================================== --- src/exceptions/OFChangeFileOwnerFailedException.m +++ src/exceptions/OFChangeFileOwnerFailedException.m @@ -77,27 +77,22 @@ [super dealloc]; } - (OFString*)description { - if (_description != nil) - return _description; - if (_group == nil) - _description = [[OFString alloc] initWithFormat: + return [OFString stringWithFormat: @"Failed to change owner for file %@ to %@ in class %@! " ERRFMT, _path, _owner, _inClass, ERRPARAM]; else if (_owner == nil) - _description = [[OFString alloc] initWithFormat: + return [OFString stringWithFormat: @"Failed to change group for file %@ to %@ in class %@! " ERRFMT, _path, _group, _inClass, ERRPARAM]; else - _description = [[OFString alloc] initWithFormat: + return [OFString stringWithFormat: @"Failed to change owner for file %@ to %@:%@ in class %@! " ERRFMT, _path, _owner, _group, _inClass, ERRPARAM]; - - return _description; } - (int)errNo { return _errNo; Index: src/exceptions/OFConditionBroadcastFailedException.m ================================================================== --- src/exceptions/OFConditionBroadcastFailedException.m +++ src/exceptions/OFConditionBroadcastFailedException.m @@ -59,19 +59,14 @@ [super dealloc]; } - (OFString*)description { - if (_description != nil) - return _description; - - _description = [[OFString alloc] initWithFormat: + return [OFString stringWithFormat: @"Broadcasting a condition of type %@ failed!", _inClass]; - - return _description; } - (OFCondition*)condition { OF_GETTER(_condition, NO) } @end Index: src/exceptions/OFConditionSignalFailedException.m ================================================================== --- src/exceptions/OFConditionSignalFailedException.m +++ src/exceptions/OFConditionSignalFailedException.m @@ -59,19 +59,14 @@ [super dealloc]; } - (OFString*)description { - if (_description != nil) - return _description; - - _description = [[OFString alloc] initWithFormat: + return [OFString stringWithFormat: @"Signaling a condition of type %@ failed!", _inClass]; - - return _description; } - (OFCondition*)condition { OF_GETTER(_condition, NO) } @end Index: src/exceptions/OFConditionStillWaitingException.m ================================================================== --- src/exceptions/OFConditionStillWaitingException.m +++ src/exceptions/OFConditionStillWaitingException.m @@ -59,20 +59,15 @@ [super dealloc]; } - (OFString*)description { - if (_description != nil) - return _description; - - _description = [[OFString alloc] initWithFormat: + return [OFString stringWithFormat: @"Deallocation of a condition of type %@ was tried, even though a " @"thread was still waiting for it!", _inClass]; - - return _description; } - (OFCondition*)condition { OF_GETTER(_condition, NO) } @end Index: src/exceptions/OFConditionWaitFailedException.m ================================================================== --- src/exceptions/OFConditionWaitFailedException.m +++ src/exceptions/OFConditionWaitFailedException.m @@ -59,19 +59,14 @@ [super dealloc]; } - (OFString*)description { - if (_description != nil) - return _description; - - _description = [[OFString alloc] initWithFormat: + return [OFString stringWithFormat: @"Waiting for a condition of type %@ failed!", _inClass]; - - return _description; } - (OFCondition*)condition { OF_GETTER(_condition, NO) } @end Index: src/exceptions/OFConnectionFailedException.m ================================================================== --- src/exceptions/OFConnectionFailedException.m +++ src/exceptions/OFConnectionFailedException.m @@ -76,19 +76,14 @@ [super dealloc]; } - (OFString*)description { - if (_description != nil) - return _description; - - _description = [[OFString alloc] initWithFormat: + return [OFString stringWithFormat: @"A connection to %@ on port %" @PRIu16 @" could not be " @"established in class %@! " ERRFMT, _host, _port, _inClass, ERRPARAM]; - - return _description; } - (OFTCPSocket*)socket { OF_GETTER(_socket, NO) Index: src/exceptions/OFCopyFileFailedException.m ================================================================== --- src/exceptions/OFCopyFileFailedException.m +++ src/exceptions/OFCopyFileFailedException.m @@ -71,18 +71,13 @@ [super dealloc]; } - (OFString*)description { - if (_description != nil) - return _description; - - _description = [[OFString alloc] initWithFormat: + return [OFString stringWithFormat: @"Failed to copy file %@ to %@ in class %@! " ERRFMT, _sourcePath, _destinationPath, _inClass, ERRPARAM]; - - return _description; } - (int)errNo { return _errNo; Index: src/exceptions/OFCreateDirectoryFailedException.m ================================================================== --- src/exceptions/OFCreateDirectoryFailedException.m +++ src/exceptions/OFCreateDirectoryFailedException.m @@ -66,18 +66,13 @@ [super dealloc]; } - (OFString*)description { - if (_description != nil) - return _description; - - _description = [[OFString alloc] initWithFormat: + return [OFString stringWithFormat: @"Failed to create directory %@ in class %@! " ERRFMT, _path, _inClass, ERRPARAM]; - - return _description; } - (int)errNo { return _errNo; Index: src/exceptions/OFDeleteDirectoryFailedException.m ================================================================== --- src/exceptions/OFDeleteDirectoryFailedException.m +++ src/exceptions/OFDeleteDirectoryFailedException.m @@ -66,18 +66,13 @@ [super dealloc]; } - (OFString*)description { - if (_description != nil) - return _description; - - _description = [[OFString alloc] initWithFormat: + return [OFString stringWithFormat: @"Failed to delete directory %@ in class %@! " ERRFMT, _path, _inClass, ERRPARAM]; - - return _description; } - (int)errNo { return _errNo; Index: src/exceptions/OFDeleteFileFailedException.m ================================================================== --- src/exceptions/OFDeleteFileFailedException.m +++ src/exceptions/OFDeleteFileFailedException.m @@ -66,18 +66,13 @@ [super dealloc]; } - (OFString*)description { - if (_description != nil) - return _description; - - _description = [[OFString alloc] initWithFormat: + return [OFString stringWithFormat: @"Failed to delete file %@ in class %@! " ERRFMT, _path, _inClass, ERRPARAM]; - - return _description; } - (int)errNo { return _errNo; Index: src/exceptions/OFEnumerationMutationException.m ================================================================== --- src/exceptions/OFEnumerationMutationException.m +++ src/exceptions/OFEnumerationMutationException.m @@ -60,19 +60,14 @@ [super dealloc]; } - (OFString*)description { - if (_description != nil) - return _description; - - _description = [[OFString alloc] initWithFormat: + return [OFString stringWithFormat: @"Object of class %@ was mutated during enumeration!", _inClass]; - - return _description; } - (id)object { OF_GETTER(_object, NO) } @end Index: src/exceptions/OFException.h ================================================================== --- src/exceptions/OFException.h +++ src/exceptions/OFException.h @@ -25,11 +25,10 @@ * the OFAllocFailedException. */ @interface OFException: OFObject { Class _inClass; - OFString *_description; } #ifdef OF_HAVE_PROPERTIES @property (readonly) Class inClass; #endif Index: src/exceptions/OFException.m ================================================================== --- src/exceptions/OFException.m +++ src/exceptions/OFException.m @@ -46,29 +46,17 @@ _inClass = class; return self; } -- (void)dealloc -{ - [_description release]; - - [super dealloc]; -} - - (Class)inClass { return _inClass; } - (OFString*)description { - if (_description != nil) - return _description; - - _description = [[OFString alloc] initWithFormat: + return [OFString stringWithFormat: @"An exception of class %@ occurred in class %@!", object_getClass(self), _inClass]; - - return _description; } @end Index: src/exceptions/OFHTTPRequestFailedException.m ================================================================== --- src/exceptions/OFHTTPRequestFailedException.m +++ src/exceptions/OFHTTPRequestFailedException.m @@ -21,11 +21,10 @@ #import "OFHTTPRequestFailedException.h" #import "OFString.h" #import "OFHTTPRequest.h" #import "OFHTTPRequestReply.h" -#import "autorelease.h" #import "common.h" @implementation OFHTTPRequestFailedException + (instancetype)exceptionWithClass: (Class)class request: (OFHTTPRequest*)request @@ -68,16 +67,12 @@ [super dealloc]; } - (OFString*)description { - void *pool; const char *type = "(unknown)"; - if (_description != nil) - return _description; - switch ([_request requestType]) { case OF_HTTP_REQUEST_TYPE_GET: type = "GET"; break; case OF_HTTP_REQUEST_TYPE_HEAD: @@ -86,19 +81,13 @@ case OF_HTTP_REQUEST_TYPE_POST: type = "POST"; break; } - pool = objc_autoreleasePoolPush(); - - _description = [[OFString alloc] initWithFormat: + return [OFString stringWithFormat: @"A HTTP %s request in class %@ with URL %@ failed with code %d", type, _inClass, [_request URL], [_reply statusCode]]; - - objc_autoreleasePoolPop(pool); - - return _description; } - (OFHTTPRequest*)request { OF_GETTER(_request, NO) Index: src/exceptions/OFHashAlreadyCalculatedException.m ================================================================== --- src/exceptions/OFHashAlreadyCalculatedException.m +++ src/exceptions/OFHashAlreadyCalculatedException.m @@ -61,20 +61,15 @@ [super dealloc]; } - (OFString*)description { - if (_description != nil) - return _description; - - _description = [[OFString alloc] initWithFormat: + return [OFString stringWithFormat: @"The hash has already been calculated in class %@ and thus no new " @"data can be added", _inClass]; - - return _description; } - (OFHash*)hashObject { OF_GETTER(_hashObject, NO) } @end Index: src/exceptions/OFInitializationFailedException.m ================================================================== --- src/exceptions/OFInitializationFailedException.m +++ src/exceptions/OFInitializationFailedException.m @@ -20,14 +20,9 @@ #import "OFString.h" @implementation OFInitializationFailedException - (OFString*)description { - if (_description != nil) - return _description; - - _description = [[OFString alloc] initWithFormat: + return [OFString stringWithFormat: @"Initialization failed for or in class %@!", _inClass]; - - return _description; } @end Index: src/exceptions/OFInvalidArgumentException.m ================================================================== --- src/exceptions/OFInvalidArgumentException.m +++ src/exceptions/OFInvalidArgumentException.m @@ -53,20 +53,15 @@ return self; } - (OFString*)description { - if (_description != nil) - return _description; - - _description = [[OFString alloc] initWithFormat: + return [OFString stringWithFormat: @"The argument or receiver for method %s of class %@ is invalid!", sel_getName(_selector), _inClass]; - - return _description; } - (SEL)selector { return _selector; } @end Index: src/exceptions/OFInvalidEncodingException.m ================================================================== --- src/exceptions/OFInvalidEncodingException.m +++ src/exceptions/OFInvalidEncodingException.m @@ -20,14 +20,9 @@ #import "OFString.h" @implementation OFInvalidEncodingException - (OFString*)description { - if (_description != nil) - return _description; - - _description = [[OFString alloc] initWithFormat: + return [OFString stringWithFormat: @"The encoding is invalid for class %@!", _inClass]; - - return _description; } @end Index: src/exceptions/OFInvalidFormatException.m ================================================================== --- src/exceptions/OFInvalidFormatException.m +++ src/exceptions/OFInvalidFormatException.m @@ -20,14 +20,9 @@ #import "OFString.h" @implementation OFInvalidFormatException - (OFString*)description { - if (_description != nil) - return _description; - - _description = [[OFString alloc] initWithFormat: + return [OFString stringWithFormat: @"The format is invalid for class %@!", _inClass]; - - return _description; } @end Index: src/exceptions/OFInvalidJSONException.m ================================================================== --- src/exceptions/OFInvalidJSONException.m +++ src/exceptions/OFInvalidJSONException.m @@ -51,20 +51,15 @@ return self; } - (OFString*)description { - if (_description != nil) - return _description; - - _description = [[OFString alloc] initWithFormat: + return [OFString stringWithFormat: @"The JSON representation class %@ tried to parse is invalid in " @"line %zd!", _inClass, _line]; - - return _description; } - (size_t)line { return _line; } @end Index: src/exceptions/OFInvalidServerReplyException.m ================================================================== --- src/exceptions/OFInvalidServerReplyException.m +++ src/exceptions/OFInvalidServerReplyException.m @@ -20,14 +20,9 @@ #import "OFString.h" @implementation OFInvalidServerReplyException - (OFString*)description { - if (_description != nil) - return _description; - - _description = [[OFString alloc] initWithFormat: + return [OFString stringWithFormat: @"Got an invalid reply from the server in class %@", _inClass]; - - return _description; } @end Index: src/exceptions/OFLinkFailedException.m ================================================================== --- src/exceptions/OFLinkFailedException.m +++ src/exceptions/OFLinkFailedException.m @@ -72,18 +72,13 @@ [super dealloc]; } - (OFString*)description { - if (_description != nil) - return _description; - - _description = [[OFString alloc] initWithFormat: + return [OFString stringWithFormat: @"Failed to link file %@ to %@ in class %@! " ERRFMT, _sourcePath, _destinationPath, _inClass, ERRPARAM]; - - return _description; } - (int)errNo { return _errNo; Index: src/exceptions/OFListenFailedException.m ================================================================== --- src/exceptions/OFListenFailedException.m +++ src/exceptions/OFListenFailedException.m @@ -66,18 +66,13 @@ [super dealloc]; } - (OFString*)description { - if (_description != nil) - return _description; - - _description = [[OFString alloc] initWithFormat: + return [OFString stringWithFormat: @"Failed to listen in socket of type %@ with a back log of %d! " ERRFMT, _inClass, _backLog, ERRPARAM]; - - return _description; } - (OFTCPSocket*)socket { OF_GETTER(_socket, NO) Index: src/exceptions/OFLockFailedException.m ================================================================== --- src/exceptions/OFLockFailedException.m +++ src/exceptions/OFLockFailedException.m @@ -46,20 +46,15 @@ [super dealloc]; } - (OFString*)description { - if (_description != nil) - return _description; - - _description = [[OFString alloc] initWithFormat: + return [OFString stringWithFormat: @"A lock of type %@ could not be locked in class %@!", [_lock class], _inClass]; - - return _description; } - (id )lock { OF_GETTER(_lock, NO) } @end Index: src/exceptions/OFMalformedXMLException.m ================================================================== --- src/exceptions/OFMalformedXMLException.m +++ src/exceptions/OFMalformedXMLException.m @@ -47,23 +47,18 @@ [super dealloc]; } - (OFString*)description { - if (_description != nil) - return _description; - if (_parser != nil) - _description = [[OFString alloc] initWithFormat: + return [OFString stringWithFormat: @"The XML parser in class %@ encountered malformed XML!", _inClass]; else - _description = @"An XML parser encountered malformed XML!"; - - return _description; + return @"An XML parser encountered malformed XML!"; } - (OFXMLParser*)parser { OF_GETTER(_parser, NO) } @end Index: src/exceptions/OFMemoryNotPartOfObjectException.m ================================================================== --- src/exceptions/OFMemoryNotPartOfObjectException.m +++ src/exceptions/OFMemoryNotPartOfObjectException.m @@ -51,22 +51,17 @@ return self; } - (OFString*)description { - if (_description != nil) - return _description; - - _description = [[OFString alloc] initWithFormat: + return [OFString stringWithFormat: @"Memory at %p was not allocated as part of object of class %@, " @"thus the memory allocation was not changed! It is also possible " @"that there was an attempt to free the same memory twice.", _pointer, _inClass]; - - return _description; } - (void*)pointer { return _pointer; } @end Index: src/exceptions/OFNotConnectedException.m ================================================================== --- src/exceptions/OFNotConnectedException.m +++ src/exceptions/OFNotConnectedException.m @@ -61,19 +61,14 @@ [super dealloc]; } - (OFString*)description { - if (_description != nil) - return _description; - - _description = [[OFString alloc] initWithFormat: + return [OFString stringWithFormat: @"The socket of type %@ is not connected or bound!", _inClass]; - - return _description; } - (OFStreamSocket*)socket { OF_GETTER(_socket, NO) } @end Index: src/exceptions/OFNotImplementedException.m ================================================================== --- src/exceptions/OFNotImplementedException.m +++ src/exceptions/OFNotImplementedException.m @@ -53,20 +53,15 @@ return self; } - (OFString*)description { - if (_description != nil) - return _description; - - _description = [[OFString alloc] initWithFormat: + return [OFString stringWithFormat: @"The selector %s is not understood by class %@ or not (fully) " @"implemented!", sel_getName(_selector), _inClass]; - - return _description; } - (SEL)selector { return _selector; } @end Index: src/exceptions/OFOpenFileFailedException.m ================================================================== --- src/exceptions/OFOpenFileFailedException.m +++ src/exceptions/OFOpenFileFailedException.m @@ -71,18 +71,13 @@ [super dealloc]; } - (OFString*)description { - if (_description != nil) - return _description; - - _description = [[OFString alloc] initWithFormat: + return [OFString stringWithFormat: @"Failed to open file %@ with mode %@ in class %@! " ERRFMT, _path, _mode, _inClass, ERRPARAM]; - - return _description; } - (int)errNo { return _errNo; Index: src/exceptions/OFOutOfMemoryException.m ================================================================== --- src/exceptions/OFOutOfMemoryException.m +++ src/exceptions/OFOutOfMemoryException.m @@ -37,24 +37,19 @@ return self; } - (OFString*)description { - if (_description != nil) - return _description; - if (_requestedSize != 0) - _description = [[OFString alloc] initWithFormat: + return [OFString stringWithFormat: @"Could not allocate %zu bytes in class %@!", _requestedSize, _inClass]; else - _description = [[OFString alloc] initWithFormat: + return [OFString stringWithFormat: @"Could not allocate enough memory in class %@!", _inClass]; - - return _description; } - (size_t)requestedSize { return _requestedSize; } @end Index: src/exceptions/OFOutOfRangeException.m ================================================================== --- src/exceptions/OFOutOfRangeException.m +++ src/exceptions/OFOutOfRangeException.m @@ -20,14 +20,9 @@ #import "OFString.h" @implementation OFOutOfRangeException - (OFString*)description { - if (_description != nil) - return _description; - - _description = [[OFString alloc] initWithFormat: + return [OFString stringWithFormat: @"Value out of range in class %@!", _inClass]; - - return _description; } @end Index: src/exceptions/OFReadFailedException.m ================================================================== --- src/exceptions/OFReadFailedException.m +++ src/exceptions/OFReadFailedException.m @@ -22,15 +22,10 @@ #import "common.h" @implementation OFReadFailedException - (OFString*)description { - if (_description != nil) - return _description; - - _description = [[OFString alloc] initWithFormat: + return [OFString stringWithFormat: @"Failed to read %zu bytes in class %@! " ERRFMT, _requestedLength, _inClass, ERRPARAM]; - - return _description; } @end Index: src/exceptions/OFRenameFileFailedException.m ================================================================== --- src/exceptions/OFRenameFileFailedException.m +++ src/exceptions/OFRenameFileFailedException.m @@ -71,18 +71,13 @@ [super dealloc]; } - (OFString*)description { - if (_description != nil) - return _description; - - _description = [[OFString alloc] initWithFormat: + return [OFString stringWithFormat: @"Failed to rename file %@ to %@ in class %@! " ERRFMT, _sourcePath, _destinationPath, _inClass, ERRPARAM]; - - return _description; } - (int)errNo { return _errNo; Index: src/exceptions/OFSeekFailedException.m ================================================================== --- src/exceptions/OFSeekFailedException.m +++ src/exceptions/OFSeekFailedException.m @@ -70,17 +70,12 @@ [super dealloc]; } - (OFString*)description { - if (_description != nil) - return _description; - - _description = [[OFString alloc] initWithFormat: + return [OFString stringWithFormat: @"Seeking failed in class %@! " ERRFMT, _inClass, ERRPARAM]; - - return _description; } - (OFSeekableStream*)stream { OF_GETTER(_stream, NO) Index: src/exceptions/OFSetOptionFailedException.m ================================================================== --- src/exceptions/OFSetOptionFailedException.m +++ src/exceptions/OFSetOptionFailedException.m @@ -61,19 +61,14 @@ [super dealloc]; } - (OFString*)description { - if (_description != nil) - return _description; - - _description = [[OFString alloc] initWithFormat: + return [OFString stringWithFormat: @"Setting an option in class %@ failed!", _inClass]; - - return _description; } - (OFStream*)stream { OF_GETTER(_stream, NO) } @end Index: src/exceptions/OFStillLockedException.m ================================================================== --- src/exceptions/OFStillLockedException.m +++ src/exceptions/OFStillLockedException.m @@ -46,20 +46,15 @@ [super dealloc]; } - (OFString*)description { - if (_description != nil) - return _description; - - _description = [[OFString alloc] initWithFormat: + return [OFString stringWithFormat: @"Deallocation of a lock of type %@ was tried in class %@, even " @"though it was still locked!", [_lock class], _inClass]; - - return _description; } - (id )lock { OF_GETTER(_lock, NO) } @end Index: src/exceptions/OFSymlinkFailedException.m ================================================================== --- src/exceptions/OFSymlinkFailedException.m +++ src/exceptions/OFSymlinkFailedException.m @@ -72,18 +72,13 @@ [super dealloc]; } - (OFString*)description { - if (_description != nil) - return _description; - - _description = [[OFString alloc] initWithFormat: + return [OFString stringWithFormat: @"Failed to symlink file %@ to %@ in class %@! " ERRFMT, _sourcePath, _destinationPath, _inClass, ERRPARAM]; - - return _description; } - (int)errNo { return _errNo; Index: src/exceptions/OFThreadJoinFailedException.m ================================================================== --- src/exceptions/OFThreadJoinFailedException.m +++ src/exceptions/OFThreadJoinFailedException.m @@ -59,20 +59,15 @@ [super dealloc]; } - (OFString*)description { - if (_description != nil) - return _description; - - _description = [[OFString alloc] initWithFormat: + return [OFString stringWithFormat: @"Joining a thread of class %@ failed! Most likely, another thread " @"already waits for the thread to join.", _inClass]; - - return _description; } - (OFThread*)thread { OF_GETTER(_thread, NO) } @end Index: src/exceptions/OFThreadStartFailedException.m ================================================================== --- src/exceptions/OFThreadStartFailedException.m +++ src/exceptions/OFThreadStartFailedException.m @@ -59,19 +59,14 @@ [super dealloc]; } - (OFString*)description { - if (_description != nil) - return _description; - - _description = [[OFString alloc] initWithFormat: + return [OFString stringWithFormat: @"Starting a thread of class %@ failed!", _inClass]; - - return _description; } - (OFThread*)thread { OF_GETTER(_thread, NO) } @end Index: src/exceptions/OFThreadStillRunningException.m ================================================================== --- src/exceptions/OFThreadStillRunningException.m +++ src/exceptions/OFThreadStillRunningException.m @@ -59,20 +59,15 @@ [super dealloc]; } - (OFString*)description { - if (_description != nil) - return _description; - - _description = [[OFString alloc] initWithFormat: + return [OFString stringWithFormat: @"Deallocation of a thread of type %@ was tried, even though it " @"was still running!", _inClass]; - - return _description; } - (OFThread*)thread { OF_GETTER(_thread, NO) } @end Index: src/exceptions/OFTruncatedDataException.m ================================================================== --- src/exceptions/OFTruncatedDataException.m +++ src/exceptions/OFTruncatedDataException.m @@ -20,15 +20,10 @@ #import "OFString.h" @implementation OFTruncatedDataException - (OFString*)description { - if (_description != nil) - return _description; - - _description = [[OFString alloc] initWithFormat: + return [OFString stringWithFormat: @"Truncated data was received or produced in class %@ while it " @"should not have been truncated!", _inClass]; - - return _description; } @end Index: src/exceptions/OFUnboundNamespaceException.m ================================================================== --- src/exceptions/OFUnboundNamespaceException.m +++ src/exceptions/OFUnboundNamespaceException.m @@ -88,23 +88,22 @@ [super dealloc]; } - (OFString*)description { - if (_description != nil) - return _description; - if (_namespace != nil) - _description = [[OFString alloc] initWithFormat: + return [OFString stringWithFormat: @"The namespace %@ is not bound in class %@", _namespace, _inClass]; else if (_prefix != nil) - _description = [[OFString alloc] initWithFormat: + return [OFString stringWithFormat: @"The prefix %@ is not bound to any namespace in class %@", _prefix, _inClass]; - - return _description; + else + return [OFString stringWithFormat: + @"A namespace or prefix is not bound in class %@", + _inClass]; } - (OFString*)namespace { OF_GETTER(_namespace, NO) Index: src/exceptions/OFUnlockFailedException.m ================================================================== --- src/exceptions/OFUnlockFailedException.m +++ src/exceptions/OFUnlockFailedException.m @@ -46,20 +46,15 @@ [super dealloc]; } - (OFString*)description { - if (_description != nil) - return _description; - - _description = [[OFString alloc] initWithFormat: + return [OFString stringWithFormat: @"A lock of class %@ could not be unlocked in class %@!", [_lock class], _inClass]; - - return _description; } - (id )lock { OF_GETTER(_lock, NO) } @end Index: src/exceptions/OFUnsupportedProtocolException.m ================================================================== --- src/exceptions/OFUnsupportedProtocolException.m +++ src/exceptions/OFUnsupportedProtocolException.m @@ -66,20 +66,15 @@ [super dealloc]; } - (OFString*)description { - if (_description != nil) - return _description; - - _description = [[OFString alloc] initWithFormat: + return [OFString stringWithFormat: @"The protocol of URL %@ is not supported by class %@", _URL, _inClass]; - - return _description; } - (OFURL*)URL { OF_GETTER(_URL, NO) } @end Index: src/exceptions/OFUnsupportedVersionException.m ================================================================== --- src/exceptions/OFUnsupportedVersionException.m +++ src/exceptions/OFUnsupportedVersionException.m @@ -65,20 +65,15 @@ [super dealloc]; } - (OFString*)description { - if (_description != nil) - return _description; - - _description = [[OFString alloc] initWithFormat: + return [OFString stringWithFormat: @"Version %@ of the format or protocol is not supported by class " @"%@", _version, _inClass]; - - return _description; } - (OFString*)version { OF_GETTER(_version, NO) } @end Index: src/exceptions/OFWriteFailedException.m ================================================================== --- src/exceptions/OFWriteFailedException.m +++ src/exceptions/OFWriteFailedException.m @@ -22,15 +22,10 @@ #import "common.h" @implementation OFWriteFailedException - (OFString*)description { - if (_description != nil) - return _description; - - _description = [[OFString alloc] initWithFormat: + return [OFString stringWithFormat: @"Failed to write %zu bytes in class %@! " ERRFMT, _requestedLength, _inClass, ERRPARAM]; - - return _description; } @end