Index: src/OFDNSResourceRecord.m ================================================================== --- src/OFDNSResourceRecord.m +++ src/OFDNSResourceRecord.m @@ -79,11 +79,11 @@ if ([string isEqual: @"IN"]) DNSClass = OF_DNS_CLASS_IN; else { @try { - DNSClass = (of_dns_class_t)[string decimalValue]; + DNSClass = (of_dns_class_t)string.decimalValue; } @catch (OFInvalidFormatException *e) { @throw [OFInvalidArgumentException exception]; } } @@ -124,11 +124,11 @@ else if ([string isEqual: @"ALL"]) recordType = OF_DNS_RECORD_TYPE_ALL; else { @try { recordType = - (of_dns_record_type_t)[string decimalValue]; + (of_dns_record_type_t)string.decimalValue; } @catch (OFInvalidFormatException *e) { @throw [OFInvalidArgumentException exception]; } } Index: src/OFHTTPResponse.m ================================================================== --- src/OFHTTPResponse.m +++ src/OFHTTPResponse.m @@ -21,11 +21,11 @@ #import "OFString.h" #import "OFDictionary.h" #import "OFArray.h" #import "OFData.h" -#import "OFInvalidEncodingException.h" +#import "OFInvalidArgumentException.h" #import "OFInvalidFormatException.h" #import "OFOutOfRangeException.h" #import "OFTruncatedDataException.h" #import "OFUnsupportedVersionException.h" @@ -216,11 +216,11 @@ charset = value; } @try { ret = of_string_parse_encoding(charset); - } @catch (OFInvalidEncodingException *e) { + } @catch (OFInvalidArgumentException *e) { ret = OF_STRING_ENCODING_AUTODETECT; } return ret; } Index: src/OFLocale.m ================================================================== --- src/OFLocale.m +++ src/OFLocale.m @@ -25,11 +25,10 @@ #import "OFDictionary.h" #import "OFNumber.h" #import "OFInitializationFailedException.h" #import "OFInvalidArgumentException.h" -#import "OFInvalidEncodingException.h" #import "OFInvalidFormatException.h" #import "OFOpenItemFailedException.h" #ifdef OF_AMIGAOS # include @@ -63,11 +62,11 @@ @try { if (encoding != NULL) *encoding = of_string_parse_encoding( [OFString stringWithCString: tmp encoding: enc]); - } @catch (OFInvalidEncodingException *e) { + } @catch (OFInvalidArgumentException *e) { } } /* Territory */ if ((tmp = strrchr(locale, '_')) != NULL) { @@ -431,11 +430,11 @@ @try { _encoding = of_string_parse_encoding( [OFString stringWithCString: buffer encoding: ASCII]); - } @catch (OFInvalidEncodingException *e) { + } @catch (OFInvalidArgumentException *e) { _encoding = OF_STRING_ENCODING_ISO_8859_1; } } else _encoding = OF_STRING_ENCODING_ISO_8859_1; Index: src/OFString.h ================================================================== --- src/OFString.h +++ src/OFString.h @@ -174,11 +174,11 @@ * @brief The decimal value of the string as an `intmax_t`. * * Leading and trailing whitespaces are ignored. * * If the string contains any non-number characters, an - * @ref OFInvalidEncodingException is thrown. + * @ref OFInvalidFormatException is thrown. * * If the number is too big to fit into an `intmax_t`, an * @ref OFOutOfRangeException is thrown. */ @property (readonly, nonatomic) intmax_t decimalValue; @@ -187,11 +187,11 @@ * @brief The hexadecimal value of the string as an `uintmax_t`. * * Leading and trailing whitespaces are ignored. * * If the string contains any non-number characters, an - * @ref OFInvalidEncodingException is thrown. + * @ref OFInvalidFormatException is thrown. * * If the number is too big to fit into an `uintmax_t`, an * @ref OFOutOfRangeException is thrown. */ @property (readonly, nonatomic) uintmax_t hexadecimalValue; @@ -200,11 +200,11 @@ * @brief The octal value of the string as an `uintmax_t`. * * Leading and trailing whitespaces are ignored. * * If the string contains any non-number characters, an - * @ref OFInvalidEncodingException is thrown. + * @ref OFInvalidFormatException is thrown. * * If the number is too big to fit into an `uintmax_t`, an * @ref OFOutOfRangeException is thrown. */ @property (readonly, nonatomic) uintmax_t octalValue; @@ -211,19 +211,19 @@ /*! * @brief The float value of the string as a float. * * If the string contains any non-number characters, an - * @ref OFInvalidEncodingException is thrown. + * @ref OFInvalidFormatException is thrown. */ @property (readonly, nonatomic) float floatValue; /*! * @brief The double value of the string as a double. * * If the string contains any non-number characters, an - * OFInvalidEncodingException is thrown. + * @ref OFInvalidFormatException is thrown. */ @property (readonly, nonatomic) double doubleValue; /*! * @brief The string as an array of Unicode characters. Index: src/OFString.m ================================================================== --- src/OFString.m +++ src/OFString.m @@ -188,11 +188,11 @@ else if ([string isEqual: @"koi8-r"]) encoding = OF_STRING_ENCODING_KOI8_R; else if ([string isEqual: @"koi8-u"]) encoding = OF_STRING_ENCODING_KOI8_U; else - @throw [OFInvalidEncodingException exception]; + @throw [OFInvalidArgumentException exception]; objc_autoreleasePoolPop(pool); return encoding; } Index: src/OFXMLParser.m ================================================================== --- src/OFXMLParser.m +++ src/OFXMLParser.m @@ -32,10 +32,12 @@ # import "OFFile.h" #endif #import "OFSystemInfo.h" #import "OFInitializationFailedException.h" +#import "OFInvalidArgumentException.h" +#import "OFInvalidEncodingException.h" #import "OFInvalidFormatException.h" #import "OFMalformedXMLException.h" #import "OFOutOfRangeException.h" #import "OFUnboundPrefixException.h" @@ -478,12 +480,19 @@ return false; hasVersion = true; } - if ([attribute isEqual: @"encoding"]) - _encoding = of_string_parse_encoding(value); + if ([attribute isEqual: @"encoding"]) { + @try { + _encoding = + of_string_parse_encoding(value); + } @catch (OFInvalidArgumentException *e) { + @throw [OFInvalidEncodingException + exception]; + } + } last = i + 1; PIState = 0; break; Index: utils/ofarc/OFArc.m ================================================================== --- utils/ofarc/OFArc.m +++ utils/ofarc/OFArc.m @@ -35,11 +35,10 @@ #import "TarArchive.h" #import "ZIPArchive.h" #import "OFCreateDirectoryFailedException.h" #import "OFInvalidArgumentException.h" -#import "OFInvalidEncodingException.h" #import "OFInvalidFormatException.h" #import "OFNotImplementedException.h" #import "OFOpenItemFailedException.h" #import "OFReadFailedException.h" #import "OFSeekFailedException.h" @@ -298,11 +297,11 @@ } @try { if (encodingString != nil) encoding = of_string_parse_encoding(encodingString); - } @catch (OFInvalidEncodingException *e) { + } @catch (OFInvalidArgumentException *e) { [of_stderr writeLine: OF_LOCALIZED( @"invalid_encoding", @"%[prog]: Invalid encoding: %[encoding]", @"prog", [OFApplication programName], @"encoding", encodingString)];