diff --git a/swift/src/Ice/InputStream.swift b/swift/src/Ice/InputStream.swift index 8cbad648d2b..c0f60d1e01a 100644 --- a/swift/src/Ice/InputStream.swift +++ b/swift/src/Ice/InputStream.swift @@ -361,11 +361,8 @@ public class InputStream { return } - ICETraceUtil.traceSlicing( - kind: sliceType == SliceType.ExceptionSlice ? "exception" : "object", - typeId: typeId, - slicingCat: "Slicing", - logger: LoggerWrapper(handle: communicator.getLogger())) + let kind = sliceType == SliceType.ExceptionSlice ? "exception" : "object" + communicator.getLogger().trace(category: "Slicing", message: "unknown \(kind) type '\(typeId)'") } static func throwUOE(expectedType: Value.Type, v: Value) throws { diff --git a/swift/src/Ice/ServantManager.swift b/swift/src/Ice/ServantManager.swift index fcdc2e13663..406ca7e75f6 100644 --- a/swift/src/Ice/ServantManager.swift +++ b/swift/src/Ice/ServantManager.swift @@ -25,7 +25,7 @@ class ServantManager: Dispatcher { if m[facet] != nil { var id = communicator.identityToString(ident) if !facet.isEmpty { - id += try " - f " + escapeString(string: facet, special: "", communicator: communicator) + id += " -f \(facet)" } throw AlreadyRegisteredException(kindOfObject: "servant", id: id) } @@ -52,7 +52,7 @@ class ServantManager: Dispatcher { guard var m = servantMapMap[ident], let obj = m.removeValue(forKey: facet) else { var id = communicator.identityToString(ident) if !facet.isEmpty { - id += try " - f " + escapeString(string: facet, special: "", communicator: communicator) + id += " -f \(facet)" } throw NotRegisteredException(kindOfObject: "servant", id: id) } @@ -125,8 +125,7 @@ class ServantManager: Dispatcher { func addServantLocator(locator: ServantLocator, category: String) throws { return try mutex.sync { guard locatorMap[category] == nil else { - let id = try escapeString(string: category, special: "", communicator: communicator) - throw AlreadyRegisteredException(kindOfObject: "servant locator", id: id) + throw AlreadyRegisteredException(kindOfObject: "servant locator", id: category) } locatorMap[category] = locator @@ -136,8 +135,7 @@ class ServantManager: Dispatcher { func removeServantLocator(category: String) throws -> ServantLocator { return try mutex.sync { guard let l = locatorMap.removeValue(forKey: category) else { - let id = try escapeString(string: category, special: "", communicator: communicator) - throw NotRegisteredException(kindOfObject: "servant locator", id: id) + throw NotRegisteredException(kindOfObject: "servant locator", id: category) } return l diff --git a/swift/src/Ice/Util.swift b/swift/src/Ice/Util.swift index b134733498c..780bf44cd46 100644 --- a/swift/src/Ice/Util.swift +++ b/swift/src/Ice/Util.swift @@ -26,18 +26,6 @@ func stringToMajorMinor(_ s: String) throws -> (UInt8, UInt8) { return (major, minor) } -func escapeString(string: String, special: String, communicator: Communicator) throws -> String { - guard factoriesRegistered else { - fatalError("Unable to initialize Ice") - } - return try autoreleasepool { - try ICEUtil.escapeString( - string: string, - special: special, - communicator: (communicator as! CommunicatorI).handle) - } -} - func checkSupportedEncoding(_ v: EncodingVersion) throws { let c = currentEncoding if v.major != c.major || v.minor > c.minor { diff --git a/swift/src/IceImpl/IceUtil.mm b/swift/src/IceImpl/IceUtil.mm index 5c0a541df84..31f1d6cef81 100644 --- a/swift/src/IceImpl/IceUtil.mm +++ b/swift/src/IceImpl/IceUtil.mm @@ -6,8 +6,6 @@ #import "include/Logger.h" #import "include/Properties.h" -#import "Ice/Instance.h" -#import "Ice/Network.h" #import "Ice/StringUtil.h" namespace @@ -180,32 +178,4 @@ + (NSString*)encodingVersionToString:(UInt8)major minor:(UInt8)minor return toNSString(Ice::encodingVersionToString(v)); } -+ (NSString*)escapeString:(NSString*)string - special:(NSString*)special - communicator:(ICECommunicator*)communicator - error:(NSError* __autoreleasing _Nullable*)error -{ - try - { - auto instance = IceInternal::getInstance([communicator communicator]); - return toNSString( - IceInternal::escapeString(fromNSString(string), fromNSString(special), instance->toStringMode())); - } - catch (...) - { - *error = convertException(std::current_exception()); - return nil; - } -} - -+ (NSString*)errorToString:(int32_t)error -{ - return toNSString(IceInternal::errorToString(error)); -} - -+ (NSString*)errorToStringDNS:(int32_t)error -{ - return toNSString(IceInternal::errorToStringDNS(error)); -} - @end diff --git a/swift/src/IceImpl/TraceUtil.mm b/swift/src/IceImpl/TraceUtil.mm deleted file mode 100644 index 7e8df0233e1..00000000000 --- a/swift/src/IceImpl/TraceUtil.mm +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) ZeroC, Inc. All rights reserved. - -#import "include/TraceUtil.h" - -#import "Ice/TraceUtil.h" -#import "LoggerWrapperI.h" - -@implementation ICETraceUtil - -+ (void)traceSlicing:(NSString*)kind - typeId:(NSString*)typeId - slicingCat:(NSString*)slicingCat - logger:(id)logger -{ - auto l = std::make_shared(logger); - IceInternal::traceSlicing(fromNSString(kind).c_str(), fromNSString(typeId), fromNSString(slicingCat).c_str(), l); -} - -@end diff --git a/swift/src/IceImpl/include/IceUtil.h b/swift/src/IceImpl/include/IceUtil.h index 98bc2fd32f6..cfeae3c77cf 100644 --- a/swift/src/IceImpl/include/IceUtil.h +++ b/swift/src/IceImpl/include/IceUtil.h @@ -49,15 +49,6 @@ ICEIMPL_API @interface ICEUtil : NSObject + (NSString*)encodingVersionToString:(UInt8)major minor:(UInt8)minor NS_SWIFT_NAME(encodingVersionToString(major:minor:)); - -+ (nullable NSString*)escapeString:(NSString*)string - special:(NSString*)special - communicator:(ICECommunicator*)communicator - error:(NSError* _Nullable* _Nullable)error - NS_SWIFT_NAME(escapeString(string:special:communicator:)); - -+ (NSString*)errorToString:(int32_t)error NS_SWIFT_NAME(errorToString(_:)); -+ (NSString*)errorToStringDNS:(int32_t)error NS_SWIFT_NAME(errorToStringDNS(_:)); @end NS_ASSUME_NONNULL_END diff --git a/swift/src/IceImpl/include/TraceUtil.h b/swift/src/IceImpl/include/TraceUtil.h deleted file mode 100644 index c638f0f2fd7..00000000000 --- a/swift/src/IceImpl/include/TraceUtil.h +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) ZeroC, Inc. -#import "Logger.h" - -NS_ASSUME_NONNULL_BEGIN - -ICEIMPL_API @interface ICETraceUtil : NSObject - -+ (void)traceSlicing:(NSString*)kind - typeId:(NSString*)typeId - slicingCat:(NSString*)slicingCat - logger:(id)logger NS_SWIFT_NAME(traceSlicing(kind:typeId:slicingCat:logger:)); - -@end - -NS_ASSUME_NONNULL_END