@@ -198,28 +198,22 @@ size_t i, count; va_copy(argumentsCopy, arguments); if (firstKey == nil) - @throw [OFInvalidArgumentException - exceptionWithClass: [self class] - selector: _cmd]; + @throw [OFInvalidArgumentException exception]; key = firstKey; if ((object = va_arg(arguments, id)) == nil) - @throw [OFInvalidArgumentException - exceptionWithClass: [self class] - selector: _cmd]; + @throw [OFInvalidArgumentException exception]; count = 1; for (; va_arg(argumentsCopy, id) != nil; count++); if (count % 2 != 0) - @throw [OFInvalidArgumentException - exceptionWithClass: [self class] - selector: _cmd]; + @throw [OFInvalidArgumentException exception]; count /= 2; _mapTable = [[OFMapTable alloc] initWithKeyFunctions: keyFunctions @@ -232,13 +226,11 @@ for (i = 1; i < count; i++) { key = va_arg(arguments, id); object = va_arg(arguments, id); if (key == nil || object == nil) - @throw [OFInvalidArgumentException - exceptionWithClass: [self class] - selector: _cmd]; + @throw [OFInvalidArgumentException exception]; [_mapTable setValue: object forKey: key]; } } @catch (id e) { @@ -263,12 +255,11 @@ namespace: OF_SERIALIZATION_NS]; objects = [element elementsForName: @"object" namespace: OF_SERIALIZATION_NS]; if ([keys count] != [objects count]) - @throw [OFInvalidFormatException - exceptionWithClass: [self class]]; + @throw [OFInvalidFormatException exception]; _mapTable = [[OFMapTable alloc] initWithKeyFunctions: keyFunctions valueFunctions: valueFunctions capacity: [keys count]]; @@ -284,12 +275,11 @@ OF_SERIALIZATION_NS] firstObject]; object = [[objectElement elementsForNamespace: OF_SERIALIZATION_NS] firstObject]; if (key == nil || object == nil) - @throw [OFInvalidFormatException - exceptionWithClass: [self class]]; + @throw [OFInvalidFormatException exception]; [_mapTable setValue: [object objectByDeserializing] forKey: [key objectByDeserializing]]; objc_autoreleasePoolPop(pool2); @@ -311,21 +301,11 @@ [super dealloc]; } - (id)objectForKey: (id)key { - id ret; - - @try { - ret = [_mapTable valueForKey: key]; - } @catch (OFInvalidArgumentException *e) { - @throw [OFInvalidArgumentException - exceptionWithClass: [self class] - selector: _cmd]; - } - - return ret; + return [_mapTable valueForKey: key]; } - (size_t)count { return [_mapTable count]; @@ -456,16 +436,15 @@ ^ (void *key, void *value, bool *stop) { block(key, value, stop); }]; } @catch (OFEnumerationMutationException *e) { @throw [OFEnumerationMutationException - exceptionWithClass: [self class] - object: self]; + exceptionWithObject: self]; } } #endif - (uint32_t)hash { return [_mapTable hash]; } @end