You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by pe...@apache.org on 2013/01/24 10:52:37 UTC
svn commit: r1437924 - in
/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub:
AtomPubParser/CMISServiceDocumentParser.m CMISAtomPubObjectService.m
Author: peberlein
Date: Thu Jan 24 09:52:37 2013
New Revision: 1437924
URL: http://svn.apache.org/viewvc?rev=1437924&view=rev
Log:
bug fix: parser did not report errors correctly
bug fix: documents with no content stream caused an error although this is spec compliant
Modified:
chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISServiceDocumentParser.m
chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubObjectService.m
Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISServiceDocumentParser.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISServiceDocumentParser.m?rev=1437924&r1=1437923&r2=1437924&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISServiceDocumentParser.m (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISServiceDocumentParser.m Thu Jan 24 09:52:37 2013
@@ -69,8 +69,6 @@
- (BOOL)parseAndReturnError:(NSError **)error;
{
- BOOL parseSuccessful = YES;
-
// create the array to hold the workspaces we find
self.internalWorkspaces = [NSMutableArray array];
@@ -78,13 +76,14 @@
NSXMLParser *parser = [[NSXMLParser alloc] initWithData:self.atomData];
[parser setShouldProcessNamespaces:YES];
[parser setDelegate:self];
- parseSuccessful = [parser parse];
+ BOOL parseSuccessful = [parser parse];
if (!parseSuccessful)
{
- log(@"Parsing error : %@", [parser parserError]);
- if (*error) {
- *error = [parser parserError];
+ NSError *parserError = [parser parserError];
+ log(@"Parsing error : %@", parserError);
+ if (error) {
+ *error = parserError;
}
}
return parseSuccessful;
Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubObjectService.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubObjectService.m?rev=1437924&r1=1437923&r2=1437924&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubObjectService.m (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubObjectService.m Thu Jan 24 09:52:37 2013
@@ -108,26 +108,32 @@ andIncludeAllowableActions:(BOOL)include
} else {
NSURL *contentUrl = objectData.contentUrl;
- // This is not spec-compliant!! Took me half a day to find this in opencmis ...
- if (streamId != nil) {
- contentUrl = [CMISURLUtil urlStringByAppendingParameter:kCMISParameterStreamId withValue:streamId toUrl:contentUrl];
- }
-
- unsigned long long streamLength = [[[objectData.properties.propertiesDictionary objectForKey:kCMISPropertyContentStreamLength] firstValue] unsignedLongLongValue];
-
- [HttpUtil invoke:contentUrl
- withHttpMethod:HTTP_GET
- withSession:self.bindingSession
- outputStream:outputStream
- bytesExpected:streamLength
- completionBlock:^(CMISHttpResponse *httpResponse, NSError *error)
- {
- if (completionBlock) {
- completionBlock(error);
+ if (contentUrl) {
+ // This is not spec-compliant!! Took me half a day to find this in opencmis ...
+ if (streamId != nil) {
+ contentUrl = [CMISURLUtil urlStringByAppendingParameter:kCMISParameterStreamId withValue:streamId toUrl:contentUrl];
+ }
+
+ unsigned long long streamLength = [[[objectData.properties.propertiesDictionary objectForKey:kCMISPropertyContentStreamLength] firstValue] unsignedLongLongValue];
+
+ [HttpUtil invoke:contentUrl
+ withHttpMethod:HTTP_GET
+ withSession:self.bindingSession
+ outputStream:outputStream
+ bytesExpected:streamLength
+ completionBlock:^(CMISHttpResponse *httpResponse, NSError *error)
+ {
+ if (completionBlock) {
+ completionBlock(error);
+ }
}
- }
- progressBlock:progressBlock
- requestObject:request];
+ progressBlock:progressBlock
+ requestObject:request];
+ } else { // it is spec-compliant to have no content stream set and in this case there is nothing to download
+ if (completionBlock) {
+ completionBlock(nil);
+ }
+ }
}
}];