Author: gavincornwell
Date: Fri Jul 18 12:18:51 2014
New Revision: 1611607

URL: http://svn.apache.org/r1611607
Log:
CMIS-823: Apps that use the ObjectiveCMIS static library crash when attempting 
to use the browser binding

The reason was the NSDictionary category being declared in it's own file. I've 
moved the category to a new CMISDictionaryUtil class and defined a helper 
method that is used by the library, this is enough to get the category loaded.

Added:
    chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISDictionaryUtil.h
    chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISDictionaryUtil.m
Removed:
    
chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISNSDictionary+CMISUtil.h
    
chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISNSDictionary+CMISUtil.m
Modified:
    chemistry/objectivecmis/trunk/ObjectiveCMIS.xcodeproj/project.pbxproj
    
chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/Browser/CMISBrowserUtil.m
    
chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISCreatablePropertyTypes.m
    chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISErrors.m
    
chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISNewTypeSettableAttributes.m
    chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISObjectConverter.m

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS.xcodeproj/project.pbxproj
URL: 
http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS.xcodeproj/project.pbxproj?rev=1611607&r1=1611606&r2=1611607&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS.xcodeproj/project.pbxproj 
(original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS.xcodeproj/project.pbxproj Fri 
Jul 18 12:18:51 2014
@@ -63,6 +63,8 @@
                4EA61BE91564F75000C759E4 /* CMISErrors.h in Headers */ = {isa = 
PBXBuildFile; fileRef = 4EA61BE71564F75000C759E4 /* CMISErrors.h */; settings = 
{ATTRIBUTES = (Public, ); }; };
                4EA61BEA1564F75000C759E4 /* CMISErrors.m in Sources */ = {isa = 
PBXBuildFile; fileRef = 4EA61BE81564F75000C759E4 /* CMISErrors.m */; };
                4EA61BEB1564F75000C759E4 /* CMISErrors.m in Sources */ = {isa = 
PBXBuildFile; fileRef = 4EA61BE81564F75000C759E4 /* CMISErrors.m */; };
+               581A001E197945B8003581F4 /* CMISDictionaryUtil.h in Headers */ 
= {isa = PBXBuildFile; fileRef = 581A001C197945B8003581F4 /* 
CMISDictionaryUtil.h */; settings = {ATTRIBUTES = (Public, ); }; };
+               581A001F197945B8003581F4 /* CMISDictionaryUtil.m in Sources */ 
= {isa = PBXBuildFile; fileRef = 581A001D197945B8003581F4 /* 
CMISDictionaryUtil.m */; };
                5892CB74192CB5DF00C7734A /* CMISLinkRelations.h in Headers */ = 
{isa = PBXBuildFile; fileRef = 5892CB72192CB5DF00C7734A /* CMISLinkRelations.h 
*/; settings = {ATTRIBUTES = (Public, ); }; };
                5892CB75192CB5DF00C7734A /* CMISLinkRelations.m in Sources */ = 
{isa = PBXBuildFile; fileRef = 5892CB73192CB5DF00C7734A /* CMISLinkRelations.m 
*/; };
                5892CB80192CB65D00C7734A /* CMISFolderTypeDefinition.h in 
Headers */ = {isa = PBXBuildFile; fileRef = 5892CB76192CB65D00C7734A /* 
CMISFolderTypeDefinition.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -140,9 +142,6 @@
                5892CC0E192CB83800C7734A /* CMISBrowserVersioningService.m in 
Sources */ = {isa = PBXBuildFile; fileRef = 5892CBF7192CB83800C7734A /* 
CMISBrowserVersioningService.m */; };
                5892CC13192CB91300C7734A /* CMISMimeHelper.h in Headers */ = 
{isa = PBXBuildFile; fileRef = 5892CC0F192CB91300C7734A /* CMISMimeHelper.h */; 
settings = {ATTRIBUTES = (Public, ); }; };
                5892CC14192CB91300C7734A /* CMISMimeHelper.m in Sources */ = 
{isa = PBXBuildFile; fileRef = 5892CC10192CB91300C7734A /* CMISMimeHelper.m */; 
};
-               5892CC15192CB91300C7734A /* CMISNSDictionary+CMISUtil.h in 
Headers */ = {isa = PBXBuildFile; fileRef = 5892CC11192CB91300C7734A /* 
CMISNSDictionary+CMISUtil.h */; settings = {ATTRIBUTES = (Public, ); }; };
-               5892CC16192CB91300C7734A /* CMISNSDictionary+CMISUtil.m in 
Sources */ = {isa = PBXBuildFile; fileRef = 5892CC12192CB91300C7734A /* 
CMISNSDictionary+CMISUtil.m */; };
-               5892CC17192CB93E00C7734A /* CMISNSDictionary+CMISUtil.m in 
Sources */ = {isa = PBXBuildFile; fileRef = 5892CC12192CB91300C7734A /* 
CMISNSDictionary+CMISUtil.m */; };
                5892CC1A192CE23F00C7734A /* CMISReachability.h in Headers */ = 
{isa = PBXBuildFile; fileRef = 5892CC18192CE23F00C7734A /* CMISReachability.h 
*/; settings = {ATTRIBUTES = (Public, ); }; };
                5892CC1B192CE23F00C7734A /* CMISReachability.m in Sources */ = 
{isa = PBXBuildFile; fileRef = 5892CC19192CE23F00C7734A /* CMISReachability.m 
*/; };
                5892CC20192CEE3E00C7734A /* SystemConfiguration.framework in 
Frameworks */ = {isa = PBXBuildFile; fileRef = 5892CC1F192CEE3E00C7734A /* 
SystemConfiguration.framework */; };
@@ -317,6 +316,8 @@
                4EA61BE71564F75000C759E4 /* CMISErrors.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
CMISErrors.h; path = Common/CMISErrors.h; sourceTree = "<group>"; };
                4EA61BE81564F75000C759E4 /* CMISErrors.m */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name 
= CMISErrors.m; path = Common/CMISErrors.m; sourceTree = "<group>"; };
                580123DB196AEE010028422E /* ObjectiveCMIS.xcconfig */ = {isa = 
PBXFileReference; lastKnownFileType = text.xcconfig; path = 
ObjectiveCMIS.xcconfig; sourceTree = "<group>"; };
+               581A001C197945B8003581F4 /* CMISDictionaryUtil.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
CMISDictionaryUtil.h; path = Utils/CMISDictionaryUtil.h; sourceTree = 
"<group>"; };
+               581A001D197945B8003581F4 /* CMISDictionaryUtil.m */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name 
= CMISDictionaryUtil.m; path = Utils/CMISDictionaryUtil.m; sourceTree = 
"<group>"; };
                5892CB72192CB5DF00C7734A /* CMISLinkRelations.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
CMISLinkRelations.h; path = Common/CMISLinkRelations.h; sourceTree = "<group>"; 
};
                5892CB73192CB5DF00C7734A /* CMISLinkRelations.m */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name 
= CMISLinkRelations.m; path = Common/CMISLinkRelations.m; sourceTree = 
"<group>"; };
                5892CB76192CB65D00C7734A /* CMISFolderTypeDefinition.h */ = 
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; 
name = CMISFolderTypeDefinition.h; path = Bindings/CMISFolderTypeDefinition.h; 
sourceTree = "<group>"; };
@@ -394,8 +395,6 @@
                5892CBF7192CB83800C7734A /* CMISBrowserVersioningService.m */ = 
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = 
sourcecode.c.objc; path = CMISBrowserVersioningService.m; sourceTree = 
"<group>"; };
                5892CC0F192CB91300C7734A /* CMISMimeHelper.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
CMISMimeHelper.h; path = Utils/CMISMimeHelper.h; sourceTree = "<group>"; };
                5892CC10192CB91300C7734A /* CMISMimeHelper.m */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name 
= CMISMimeHelper.m; path = Utils/CMISMimeHelper.m; sourceTree = "<group>"; };
-               5892CC11192CB91300C7734A /* CMISNSDictionary+CMISUtil.h */ = 
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; 
name = "CMISNSDictionary+CMISUtil.h"; path = 
"Utils/CMISNSDictionary+CMISUtil.h"; sourceTree = "<group>"; };
-               5892CC12192CB91300C7734A /* CMISNSDictionary+CMISUtil.m */ = 
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = 
sourcecode.c.objc; name = "CMISNSDictionary+CMISUtil.m"; path = 
"Utils/CMISNSDictionary+CMISUtil.m"; sourceTree = "<group>"; };
                5892CC18192CE23F00C7734A /* CMISReachability.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
CMISReachability.h; path = Utils/CMISReachability.h; sourceTree = "<group>"; };
                5892CC19192CE23F00C7734A /* CMISReachability.m */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name 
= CMISReachability.m; path = Utils/CMISReachability.m; sourceTree = "<group>"; 
};
                5892CC1C192CE2F700C7734A /* Security.framework */ = {isa = 
PBXFileReference; lastKnownFileType = wrapper.framework; name = 
Security.framework; path = System/Library/Frameworks/Security.framework; 
sourceTree = SDKROOT; };
@@ -821,6 +820,8 @@
                                4E39DF5B163A72B400F21DE6 /* CMISDateUtil.m */,
                                4E10ABFD16B916B500E2287E /* 
CMISDefaultNetworkProvider.h */,
                                4E10ABFE16B916B500E2287E /* 
CMISDefaultNetworkProvider.m */,
+                               581A001C197945B8003581F4 /* 
CMISDictionaryUtil.h */,
+                               581A001D197945B8003581F4 /* 
CMISDictionaryUtil.m */,
                                8276E12B155E355D00344A29 /* CMISFileUtil.h */,
                                8276E12C155E355D00344A29 /* CMISFileUtil.m */,
                                BD5C96FC16281A54002DDC6E /* CMISHttpRequest.h 
*/,
@@ -835,8 +836,6 @@
                                82895A1A16D8A8C5007BC80A /* CMISLog.m */,
                                5892CC0F192CB91300C7734A /* CMISMimeHelper.h */,
                                5892CC10192CB91300C7734A /* CMISMimeHelper.m */,
-                               5892CC11192CB91300C7734A /* 
CMISNSDictionary+CMISUtil.h */,
-                               5892CC12192CB91300C7734A /* 
CMISNSDictionary+CMISUtil.m */,
                                828073291515407000EF635C /* 
CMISObjectConverter.h */,
                                8280732A1515407000EF635C /* 
CMISObjectConverter.m */,
                                5892CC18192CE23F00C7734A /* CMISReachability.h 
*/,
@@ -932,7 +931,6 @@
                                5892CBC9192CB7D900C7734A /* 
CMISAtomPubExtensionDataParserBase.h in Headers */,
                                828072E91515403800EF635C /* 
CMISFileableObject.h in Headers */,
                                828072EB1515403800EF635C /* CMISFolder.h in 
Headers */,
-                               5892CC15192CB91300C7734A /* 
CMISNSDictionary+CMISUtil.h in Headers */,
                                5892CBCF192CB7D900C7734A /* 
CMISAtomPubPrincipalParser.h in Headers */,
                                5892CBF8192CB83800C7734A /* 
CMISBroswerFormDataWriter.h in Headers */,
                                828072ED1515403800EF635C /* CMISObject.h in 
Headers */,
@@ -1013,6 +1011,7 @@
                                FE417D6715761A34009056AA /* 
CMISTypeDefinition.h in Headers */,
                                5892CC07192CB83800C7734A /* 
CMISBrowserRepositoryService.h in Headers */,
                                FE417D6815761A34009056C0 /* CMISRenditionData.h 
in Headers */,
+                               581A001E197945B8003581F4 /* 
CMISDictionaryUtil.h in Headers */,
                                FE417D6815761A34009056C4 /* CMISRendition.h in 
Headers */,
                                4E39DF5C163A72B400F21DE6 /* CMISDateUtil.h in 
Headers */,
                                BD5C96FE16281A54002DDC6E /* CMISHttpRequest.h 
in Headers */,
@@ -1208,6 +1207,7 @@
                                82AD4AEC1541642A0012DDB6 /* 
CMISBindingFactory.m in Sources */,
                                5892CB81192CB65D00C7734A /* 
CMISFolderTypeDefinition.m in Sources */,
                                82ABA0491554655A00935225 /* 
CMISBindingSession.m in Sources */,
+                               581A001F197945B8003581F4 /* 
CMISDictionaryUtil.m in Sources */,
                                5892CBCC192CB7D900C7734A /* 
CMISAtomPubExtensionElementParser.m in Sources */,
                                25F721221907E0FE00B2FD66 /* 
CMISNewTypeSettableAttributes.m in Sources */,
                                5892CB97192CB73D00C7734A /* 
CMISAtomPubObjectByPathUriBuilder.m in Sources */,
@@ -1229,7 +1229,6 @@
                                5892CC02192CB83800C7734A /* 
CMISBrowserDiscoveryService.m in Sources */,
                                4EA61BE21564F73900C759E4 /* CMISObjectList.m in 
Sources */,
                                5892CBFC192CB83800C7734A /* 
CMISBrowserBaseService.m in Sources */,
-                               5892CC16192CB91300C7734A /* 
CMISNSDictionary+CMISUtil.m in Sources */,
                                4EA61BE51564F73900C759E4 /* CMISQueryResult.m 
in Sources */,
                                5892CBBC192CB7D900C7734A /* 
CMISAtomEntryParser.m in Sources */,
                                4EA61BEA1564F75000C759E4 /* CMISErrors.m in 
Sources */,
@@ -1281,7 +1280,6 @@
                                4EA61BD91564F70C00C759E4 /* 
CMISStringInOutParameter.m in Sources */,
                                4EA61BDC1564F70C00C759E4 /* CMISURLUtil.m in 
Sources */,
                                4EA61BE31564F73900C759E4 /* CMISObjectList.m in 
Sources */,
-                               5892CC17192CB93E00C7734A /* 
CMISNSDictionary+CMISUtil.m in Sources */,
                                4EA61BE61564F73900C759E4 /* CMISQueryResult.m 
in Sources */,
                                4EA61BEB1564F75000C759E4 /* CMISErrors.m in 
Sources */,
                                FE417D6815761A34009056D2 /* CMISBaseTest.m in 
Sources */,

Modified: 
chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/Browser/CMISBrowserUtil.m
URL: 
http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/Browser/CMISBrowserUtil.m?rev=1611607&r1=1611606&r2=1611607&view=diff
==============================================================================
--- 
chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/Browser/CMISBrowserUtil.m 
(original)
+++ 
chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/Browser/CMISBrowserUtil.m 
Fri Jul 18 12:18:51 2014
@@ -29,7 +29,7 @@
 #import "CMISItemTypeDefinition.h"
 #import "CMISSecondaryTypeDefinition.h"
 #import "CMISErrors.h"
-#import "CMISNSDictionary+CMISUtil.h"
+#import "CMISDictionaryUtil.h"
 #import "CMISRepositoryCapabilities.h"
 #import "CMISObjectConverter.h"
 #import "CMISAcl.h"

Modified: 
chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISCreatablePropertyTypes.m
URL: 
http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISCreatablePropertyTypes.m?rev=1611607&r1=1611606&r2=1611607&view=diff
==============================================================================
--- 
chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISCreatablePropertyTypes.m 
(original)
+++ 
chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISCreatablePropertyTypes.m 
Fri Jul 18 12:18:51 2014
@@ -21,7 +21,7 @@
 #import "CMISLog.h"
 #import "CMISObjectConverter.h"
 #import "CMISConstants.h"
-#import "CMISNSDictionary+CMISUtil.h"
+#import "CMISDictionaryUtil.h"
 
 @implementation CMISCreatablePropertyTypes
 

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISErrors.m
URL: 
http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISErrors.m?rev=1611607&r1=1611606&r2=1611607&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISErrors.m (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISErrors.m Fri Jul 18 
12:18:51 2014
@@ -18,6 +18,7 @@
  */
 
 #import "CMISErrors.h"
+#import "CMISDictionaryUtil.h"
 
 NSString * const kCMISErrorDomainName = @"org.apache.chemistry.objectivecmis";
 //to be used in the userInfo dictionary as Localized error description
@@ -68,30 +69,23 @@ NSString * const kCMISErrorDescriptionVe
     if (error == nil) {//shouldn't really get there
         return nil;
     }
+    
     if ([error.domain isEqualToString:kCMISErrorDomainName]) {
         return error;
     }
-    NSMutableDictionary *errorInfo = [NSMutableDictionary dictionary];
-    [errorInfo setValue:[CMISErrors localizedDescriptionForCode:code] 
forKey:NSLocalizedDescriptionKey];
-    [errorInfo setObject:error forKey:NSUnderlyingErrorKey];
-    
-    if (error.localizedFailureReason != nil)
-    {
-        errorInfo[NSLocalizedFailureReasonErrorKey] = 
error.localizedFailureReason;
-    }
     
-    return [NSError errorWithDomain:kCMISErrorDomainName code:code 
userInfo:errorInfo];
+    NSDictionary *userInfo = [CMISDictionaryUtil 
userInfoDictionaryForErrorWithDescription:[CMISErrors 
localizedDescriptionForCode:code]
+                                                                               
     reason:nil
+                                                                           
underlyingError:error];
+    return [NSError errorWithDomain:kCMISErrorDomainName code:code 
userInfo:userInfo];
 }
 
 + (NSError *)createCMISErrorWithCode:(CMISErrorCodes)code 
detailedDescription:(NSString *)detailedDescription
 {
-    NSMutableDictionary *errorInfo = [NSMutableDictionary dictionary];
-    [errorInfo setValue:[CMISErrors localizedDescriptionForCode:code] 
forKey:NSLocalizedDescriptionKey];
-    if (detailedDescription != nil) {
-        [errorInfo setValue:detailedDescription 
forKey:NSLocalizedFailureReasonErrorKey];
-    }
-    
-    return [NSError errorWithDomain:kCMISErrorDomainName code:code 
userInfo:errorInfo];
+    NSDictionary *userInfo = [CMISDictionaryUtil 
userInfoDictionaryForErrorWithDescription:[CMISErrors 
localizedDescriptionForCode:code]
+                                                                               
     reason:detailedDescription
+                                                                           
underlyingError:nil];
+    return [NSError errorWithDomain:kCMISErrorDomainName code:code 
userInfo:userInfo];
 }
 
 + (NSString *)localizedDescriptionForCode:(CMISErrorCodes)code

Modified: 
chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISNewTypeSettableAttributes.m
URL: 
http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISNewTypeSettableAttributes.m?rev=1611607&r1=1611606&r2=1611607&view=diff
==============================================================================
--- 
chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISNewTypeSettableAttributes.m
 (original)
+++ 
chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISNewTypeSettableAttributes.m
 Fri Jul 18 12:18:51 2014
@@ -18,7 +18,7 @@
  */
 
 #import "CMISNewTypeSettableAttributes.h"
-#import "CMISNSDictionary+CMISUtil.h"
+#import "CMISDictionaryUtil.h"
 #import "CMISLog.h"
 #import "CMISConstants.h"
 #import "CMISObjectConverter.h"

Added: chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISDictionaryUtil.h
URL: 
http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISDictionaryUtil.h?rev=1611607&view=auto
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISDictionaryUtil.h 
(added)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISDictionaryUtil.h Fri 
Jul 18 12:18:51 2014
@@ -0,0 +1,38 @@
+/*
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+ http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ */
+
+#import <Foundation/Foundation.h>
+
+
+@interface NSDictionary (CMISDictionaryUtils)
+
+///returns the object or nil if value is NSNull for given key
+- (id)cmis_objectForKeyNotNull:(id)aKey;
+
+///convenient method; returns BOOL value or NO if value is NSNull for given key
+- (BOOL)cmis_boolForKey:(id)aKey;
+
+///convenient method; returns int value or 0 if value is NSNull for given key
+- (int)cmis_intForKey:(id)aKey;
+
+@end
+
+
+@interface CMISDictionaryUtil : NSObject
+
++ (NSDictionary *)userInfoDictionaryForErrorWithDescription:(NSString 
*)description
+                                                     reason:(NSString *)reason
+                                            underlyingError:(NSError *)error;
+
+@end

Added: chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISDictionaryUtil.m
URL: 
http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISDictionaryUtil.m?rev=1611607&view=auto
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISDictionaryUtil.m 
(added)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISDictionaryUtil.m Fri 
Jul 18 12:18:51 2014
@@ -0,0 +1,72 @@
+/*
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+ http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ */
+
+#import "CMISDictionaryUtil.h"
+
+@implementation NSDictionary (CMISDictionaryUtils)
+
+- (id)cmis_objectForKeyNotNull:(id)aKey
+{
+    id value = self[aKey];
+    return value == [NSNull null] ? nil : value;
+}
+
+- (BOOL)cmis_boolForKey:(id)aKey
+{
+    return [[self cmis_objectForKeyNotNull:aKey] boolValue];
+}
+
+- (int)cmis_intForKey:(id)aKey
+{
+    return [[self cmis_objectForKeyNotNull:aKey] intValue];
+}
+
+@end
+
+
+@implementation CMISDictionaryUtil
+
++ (NSDictionary *)userInfoDictionaryForErrorWithDescription:(NSString 
*)description
+                                                     reason:(NSString *)reason
+                                            underlyingError:(NSError *)error
+{
+    NSMutableDictionary *errorInfo = [NSMutableDictionary dictionary];
+    
+    if (description != nil) {
+        errorInfo[NSLocalizedDescriptionKey] = description;
+    }
+    
+    if (reason != nil) {
+        errorInfo[NSLocalizedFailureReasonErrorKey] = reason;
+    }
+    
+    if (error != nil) {
+        
+        errorInfo[NSUnderlyingErrorKey] = error;
+        
+        // if a description hasn't been supplied bubble up the underlying 
error description, if possible
+        if (description == nil && error.localizedDescription != nil) {
+            errorInfo[NSLocalizedDescriptionKey] = error.localizedDescription;
+        }
+        
+        // if a reason hasn't been supplied bubble up the underlying error 
reason, if possible
+        if (reason == nil && error.localizedFailureReason != nil) {
+            errorInfo[NSLocalizedFailureReasonErrorKey] = 
error.localizedFailureReason;
+        }
+    }
+    
+    return errorInfo;
+}
+
+@end

Modified: 
chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISObjectConverter.m
URL: 
http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISObjectConverter.m?rev=1611607&r1=1611606&r2=1611607&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISObjectConverter.m 
(original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISObjectConverter.m Fri 
Jul 18 12:18:51 2014
@@ -26,7 +26,7 @@
 #import "CMISSession.h"
 #import "CMISDateUtil.h"
 #import "CMISConstants.h"
-#import "CMISNSDictionary+CMISUtil.h"
+#import "CMISDictionaryUtil.h"
 
 @interface CMISObjectConverter ()
 @property (nonatomic, weak) CMISSession *session;


Reply via email to