Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

check if dict/value are null before setting value into dict

  • Loading branch information...
commit 809e1778128449ef429e526d0da257d2a9ad27ab 1 parent 0a52c8c
@bfuster bfuster authored
View
9 Classes/mediatype/JsonMediaType.m
@@ -95,7 +95,9 @@ - (id) marshall:(id)object forClient:(id)client {
for (id include in [self.includes allKeys]) {
id obj = [object valueForKey:include];
id dict = [obj dictionaryWithValuesForKeys:[obj propertyNames]];
- [newIncludes setObject:dict forKey:include];
+ if (dict != nil) {
+ [newIncludes setObject:dict forKey:include];
+ }
}
}
@@ -103,7 +105,10 @@ - (id) marshall:(id)object forClient:(id)client {
[props release];
for (id dictKey in [newIncludes allKeys]) {
- [objDict setValue:[newIncludes objectForKey:dictKey] forKey:dictKey];
+ id value = [newIncludes objectForKey:dictKey];
+ if (value != nil) {
+ [objDict setValue:value forKey:dictKey];
+ }
}
[newIncludes release];
View
30 Classes/mediatype/XmlMediaType.h
@@ -1,30 +0,0 @@
-/*
- * XmlMediaType.h
- * restfulie-objectivec
- *
- * Created by Bruno Fuster on 3/21/11.
- *
- * Copyright (c) 2009 Caelum - www.caelum.com.br/opensource
- * All rights reserved.
- *
- * 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>
-#import "MediaType.h"
-
-@interface XmlMediaType : NSObject<MediaType> {
-
-}
-
-@end
View
27 Classes/mediatype/XmlMediaType.m
@@ -1,27 +0,0 @@
-/*
- * XmlMediaType.m
- * restfulie-objectivec
- *
- * Created by Bruno Fuster on 3/21/11.
- *
- * Copyright (c) 2009 Caelum - www.caelum.com.br/opensource
- * All rights reserved.
- *
- * 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 "XmlMediaType.h"
-
-
-@implementation XmlMediaType
-
-@end
View
5 Classes/serialize/JSONUnmarshaller.m
@@ -22,18 +22,23 @@
#import "JSONUnmarshaller.h"
+//#import "JSON.h"
#import "JSONKit.h"
@implementation JSONUnmarshaller
-(NSDictionary *) unmarshall:(NSObject *)data {
+ // return [[SBJsonParser alloc] objectWithString:(NSString *)data];
+
if ([data isKindOfClass:[NSString class]]) {
NSString *jsonStr = (NSString*)data;
return [jsonStr objectFromJSONString];
}
+
+ //[NSException raise:@"Json unmarshaller falied!" format:@"NSString excepted!"];
return nil;
}
Please sign in to comment.
Something went wrong with that request. Please try again.