cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bra...@apache.org
Subject [9/10] ios commit: Debug cleanup. Improved error messages for XML parsing.
Date Fri, 23 Nov 2012 21:26:53 GMT
Debug cleanup. Improved error messages for XML parsing.


Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/df186efa
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/df186efa
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/df186efa

Branch: refs/heads/master
Commit: df186efa37406f4347218e33b264aec6e0110194
Parents: 8ff5197
Author: Braden Shepherdson <braden@chromium.org>
Authored: Fri Nov 23 11:34:09 2012 -0500
Committer: Braden Shepherdson <braden@chromium.org>
Committed: Fri Nov 23 11:34:09 2012 -0500

----------------------------------------------------------------------
 CordovaLib/Classes/CDVViewController.m |   22 +++++-----------------
 1 files changed, 5 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/df186efa/CordovaLib/Classes/CDVViewController.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVViewController.m b/CordovaLib/Classes/CDVViewController.m
index e343f31..332e99a 100644
--- a/CordovaLib/Classes/CDVViewController.m
+++ b/CordovaLib/Classes/CDVViewController.m
@@ -148,13 +148,11 @@
     NSURL *url = [NSURL fileURLWithPath:path];
 
     configParser = [[NSXMLParser alloc] initWithContentsOfURL:url];
-    NSLog(@"configParser = %@", configParser);
     if (configParser == nil) {
-        NSLog(@"Failed to load config.xml.");
+        NSLog(@"Failed to initialize XML parser.");
         return;
     }
     [configParser setDelegate:((id<NSXMLParserDelegate>)self)];
-    NSLog(@"About to start parsing: %@", url);
     [configParser parse];
 }
 
@@ -168,28 +166,18 @@
 
 - (void)parser:(NSXMLParser*)parser didStartElement:(NSString*)elementName namespaceURI:(NSString*)namespaceURI
qualifiedName:(NSString*)qualifiedName attributes:(NSDictionary*)attributeDict
 {
-    NSLog(@"start of element %@", elementName);
     if ([elementName isEqualToString:@"preference"]) {
-        NSString* key = [attributeDict objectForKey:@"name"];
-        NSString* value = [attributeDict objectForKey:@"value"];
-        NSLog(@"setting %@ = %@", key, value);
-        [settings setObject:value forKey:key];
+        [settings setObject:[attributeDict objectForKey:@"value"] forKey:[attributeDict objectForKey:@"name"]];
     } else if ([elementName isEqualToString:@"plugin"]) {
-        NSString* key = [attributeDict objectForKey:@"name"];
-        NSString* value = [attributeDict objectForKey:@"value"];
-        NSLog(@"plugin %@ = %@", key, value);
-        [pluginsDict setObject:value forKey:key];
+        [pluginsDict setObject:[attributeDict objectForKey:@"value"] forKey:[attributeDict
objectForKey:@"name"]];
     } else if ([elementName isEqualToString:@"access"]) {
-        NSString* origin = [attributeDict objectForKey:@"origin"];
-        NSLog(@"whitelisting %@", origin);
-        [whitelistHosts addObject:origin];
+        [whitelistHosts addObject:[attributeDict objectForKey:@"origin"]];
     }
 }
 
 - (void)parser:(NSXMLParser*)parser parseErrorOccurred:(NSError*)parseError
 {
-    NSLog(@"Parser error");
-    NSAssert(NO, @"config.xml loading error line %d col %d: %@", [parser lineNumber], [parser
columnNumber], [parseError localizedDescription]);
+    NSAssert(NO, @"config.xml parse error line %d col %d", [parser lineNumber], [parser columnNumber]);
 }
 
 // Implement viewDidLoad to do additional setup after loading the view, typically from a
nib.


Mime
View raw message