{"action":"closed","issue":{"url":"https://api.github.com/repos/cappuccino/cappuccino/issues/2422","repository_url":"https://api.github.com/repos/cappuccino/cappuccino","labels_url":"https://api.github.com/repos/cappuccino/cappuccino/issues/2422/labels{/name}","comments_url":"https://api.github.com/repos/cappuccino/cappuccino/issues/2422/comments","events_url":"https://api.github.com/repos/cappuccino/cappuccino/issues/2422/events","html_url":"https://github.com/cappuccino/cappuccino/issues/2422","id":136102335,"number":2422,"title":"Encode/Decode problem on CPDictionaries with keys != CPString","user":{"login":"cpasslack","id":11424968,"avatar_url":"https://avatars.githubusercontent.com/u/11424968?v=3","gravatar_id":"","url":"https://api.github.com/users/cpasslack","html_url":"https://github.com/cpasslack","followers_url":"https://api.github.com/users/cpasslack/followers","following_url":"https://api.github.com/users/cpasslack/following{/other_user}","gists_url":"https://api.github.com/users/cpasslack/gists{/gist_id}","starred_url":"https://api.github.com/users/cpasslack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cpasslack/subscriptions","organizations_url":"https://api.github.com/users/cpasslack/orgs","repos_url":"https://api.github.com/users/cpasslack/repos","events_url":"https://api.github.com/users/cpasslack/events{/privacy}","received_events_url":"https://api.github.com/users/cpasslack/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/cappuccino/cappuccino/labels/%23needs-confirmation","name":"#needs-confirmation","color":"d9a6e8"},{"url":"https://api.github.com/repos/cappuccino/cappuccino/labels/bug","name":"bug","color":"adcdff"},{"url":"https://api.github.com/repos/cappuccino/cappuccino/labels/Foundation","name":"Foundation","color":"ededed"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/cappuccino/cappuccino/milestones/4","html_url":"https://github.com/cappuccino/cappuccino/milestones/Someday","labels_url":"https://api.github.com/repos/cappuccino/cappuccino/milestones/4/labels","id":107283,"number":4,"title":"Someday","description":"","creator":{"login":"aparajita","id":22218,"avatar_url":"https://avatars.githubusercontent.com/u/22218?v=3","gravatar_id":"","url":"https://api.github.com/users/aparajita","html_url":"https://github.com/aparajita","followers_url":"https://api.github.com/users/aparajita/followers","following_url":"https://api.github.com/users/aparajita/following{/other_user}","gists_url":"https://api.github.com/users/aparajita/gists{/gist_id}","starred_url":"https://api.github.com/users/aparajita/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aparajita/subscriptions","organizations_url":"https://api.github.com/users/aparajita/orgs","repos_url":"https://api.github.com/users/aparajita/repos","events_url":"https://api.github.com/users/aparajita/events{/privacy}","received_events_url":"https://api.github.com/users/aparajita/received_events","type":"User","site_admin":false},"open_issues":83,"closed_issues":1044,"state":"open","created_at":"2012-04-12T21:50:28Z","updated_at":"2016-06-24T19:08:48Z","due_on":null,"closed_at":null},"comments":7,"created_at":"2016-02-24T15:58:24Z","updated_at":"2016-06-24T19:08:48Z","closed_at":"2016-06-24T19:08:48Z","body":"An encoded CPDictionary which keys are not CPStrings causes an Exception \"Uncaught Error: *** 280NPLIST marker not recognized in Plist.\" on initForReadingWithData: in CPKeyedUnarchiver. The cause is malformed archived data.\r\n\r\nHere is my reduction:\r\n\r\n```Objective-J\r\n@implementation AppController : CPObject\r\n{\r\n}\r\n\r\n- (void)applicationDidFinishLaunching:(CPNotification)aNotification\r\n{\r\n\tvar testClass = [[TestClass alloc] init];\r\n\tvar encodedModel = [[CPKeyedArchiver archivedDataWithRootObject:testClass] rawString];\r\n\tvar unarchiver = [[CPKeyedUnarchiver alloc] initForReadingWithData:[CPData dataWithRawString:encodedModel]];\r\n\tvar object = [unarchiver decodeObjectForKey:@\"root\"];\r\n\t[unarchiver finishDecoding];\t\r\n}\r\n\r\n@end\r\n\r\n@implementation TestClass : CPObject\r\n{\r\n\tCPDictionary dict;\r\n}\r\n\r\n- (id)init\r\n{\r\n\tself = [super init];\r\n\tif (self)\r\n\t{\r\n\t\tdict = [[CPMutableDictionary alloc] init];\r\n\t\t[dict setObject:\"Test\" forKey:\"13\"]; // OK\r\n\t\t[dict setObject:\"Test\" forKey:[CPNumber numberWithInt:10]]; // will fail\r\n\t}\r\n\treturn self;\r\n}\r\n\r\n- (void)encodeWithCoder:(CPCoder)coder\r\n{\r\n\t[coder encodeObject:dict forKey:@\"dict\"];\r\n}\r\n\r\n- (id)initWithCoder:(CPCoder)coder\r\n{\r\n\tdict = [coder decodeObjectForKey:@\"dict\"];\t\r\n}\r\n\r\n@end\r\n```\r\n\r\nThe encoded CPString as Dictionary-Key will result in the archived data as:\r\nCP.objectsD;K;2;10D;\r\n\r\nThe CPNumber as:\r\nCP.objectsD;K;undefined;10D\r\n\r\nThe 'undefined' of the second example clearly causes the failure."}}
{"actor":{"display_login":"aparajita"}}