[ 
https://issues.apache.org/jira/browse/CMIS-924?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14602988#comment-14602988
 ] 

Dmitry commented on CMIS-924:
-----------------------------

In accordance with [CMIS 
specification|http://docs.oasis-open.org/cmis/CMIS/v1.0/errata-01/os/cmis-spec-v1.0-errata-01-os-complete.html#_Toc243905556]:

{noformat}
POSTing other document formats: (AtomPub)
    The behavior is repository specific when a non Atom entry or an atom 
document without the CMIS elements is posted to a folder collection. 
    For example, the repository MAY auto-create a document with a specific type 
(document) the client could edit. 
    If the repository does not support this scenario or another exception 
occurs, then the repository MUST return the appropriate HTTP status code.
{noformat}

The appropriate HTTP status codes described 
[here|http://docs.oasis-open.org/cmis/CMIS/v1.0/errata-01/os/cmis-spec-v1.0-errata-01-os-complete.html#_Toc243905503].

‘org.apache.chemistry.opencmis.tck.tests.crud.WhitespaceInNameTest’ test sends 
the following request:

{code:xml}
POST 
/cmis/versions/1.0/atom/children?id=34bc306d-3729-4f55-a1e1-6e5e79826e54&versioningState=major
 HTTP/1.1
User-Agent: Apache Chemistry OpenCMIS/0.13.0
Content-Type: application/atom+xml;type=entry
Authorization: Basic YWRtaW46YWRtaW4=
Cache-Control: no-cache
Pragma: no-cache
Host: xxx.xx.xx.xx:8080
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Connection: keep-alive
Transfer-Encoding: chunked
 
36d
<?xml version='1.0' encoding='UTF-8'?><atom:entry 
xmlns:atom="http://www.w3.org/2005/Atom"; 
xmlns:cmis="http://docs.oasis-open.org/ns/cmis/core/200908/"; 
xmlns:cmisra="http://docs.oasis-open.org/ns/cmis/restatom/200908/"; 
xmlns:chemistry="http://chemistry.apache.org/";><atom:id>urn:uuid:00000000-0000-0000-0000-00000000000</atom:id><atom:title>trailing.txt
 
</atom:title><atom:updated>2015-05-05T15:30:17.665Z</atom:updated><cmisra:content><cmisra:mediatype>text/plain</cmisra:mediatype><chemistry:filename>trailing.txt
 
</chemistry:filename><cmisra:base64/></cmisra:content><cmisra:object><cmis:properties><cmis:propertyId
 
propertyDefinitionId="cmis:objectTypeId"><cmis:value>cmis:document</cmis:value></cmis:propertyId><cmis:propertyString
 propertyDefinitionId="cmis:name"><cmis:value>trailing.txt 
</cmis:value></cmis:propertyString></cmis:properties></cmisra:object></atom:entry>
0
{code}

And receives the following response from the server:

{noformat}
HTTP/1.1 409 Conflict
Cache-Control: private, max-age=0
Server: Apache-Chemistry-OpenCMIS/0.11.0
Content-Type: text/html;charset=UTF-8
Transfer-Encoding: chunked
Date: Tue, 05 May 2015 15:30:30 GMT 

1fc3
<html><head><title>Apache Chemistry OpenCMIS - constraint 
error</title><style><!--H1 
{font-size:24px;line-height:normal;font-weight:bold;background-color:#f0f0f0;color:#003366;border-bottom:1px
 solid #3c78b5;padding:2px;} BODY 
{font-family:Verdana,arial,sans-serif;color:black;font-size:14px;} HR 
{color:#3c78b5;height:1px;}--></style></head><body><h1>HTTP Status 409 - 
<!--exception-->constraint<!--/exception--></h1><p><!--message-->Constraint 
violation: 04050002 Found 1 integrity violations:
Invalid property value: 
   Node: ea9976b0-6ff2-42da-a38d-a2bfa5beca48
   Name: trailing.txt 
   Type: content
   Property: name
   Constraint: 04050001 Value 'trailing.txt ' is not valid as a file name. This 
property must be a valid file name.<!--/message--></p><hr 
noshade='noshade'/><!--stacktrace--><pre>
org.apache.chemistry.opencmis.commons.exceptions.CmisConstraintException: 
Constraint violation: 04050002 Found 1 integrity violations:
Invalid property value: 
   Node: ea9976b0-6ff2-42da-a38d-a2bfa5beca48
   Name: trailing.txt 
   Type: content
   Property: name
   Constraint: 04050001 Value 'trailing.txt ' is not valid as a file name. This 
property must be a valid file name.
.at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
.at 
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
.at $Proxy324.create(Unknown Source)
.at 
org.apache.chemistry.opencmis.server.support.wrapper.ConformanceCmisServiceWrapper.create(ConformanceCmisServiceWrapper.java:727)
.at 
org.apache.chemistry.opencmis.server.impl.atompub.ObjectService$Create.serve(ObjectService.java:107)
.at 
org.apache.chemistry.opencmis.server.shared.Dispatcher.dispatch(Dispatcher.java:91)
.at 
org.apache.chemistry.opencmis.server.impl.atompub.CmisAtomPubServlet.dispatch(CmisAtomPubServlet.java:226)
.at 
org.apache.chemistry.opencmis.server.impl.atompub.CmisAtomPubServlet.service(CmisAtomPubServlet.java:173)
.at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
Caused by: integrity.IntegrityException: 04050002 Found 1 integrity violations:
Invalid property value: 
   Node: ea9976b0-6ff2-42da-a38d-a2bfa5beca48
   Name: trailing.txt 
   Type: content
   Property: name
   Constraint: 04050001 Value 'trailing.txt ' is not valid as a file name. This 
property must be a valid file name.
.at 
org.springframework.transaction.support.TransactionSynchronizationUtils.triggerBeforeCommit(TransactionSynchronizationUtils.java:95)
.at 
org.springframework.transaction.support.AbstractPlatformTransactionManager.triggerBeforeCommit(AbstractPlatformTransactionManager.java:927)
.at 
org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:737)
.at 
org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723)
.at 
org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:393)
.... 45 more

</pre><!--/stacktrace--><hr noshade='noshade'/></body></html>
0
{noformat}

CMIS specification includes the following 
[statement|http://docs.oasis-open.org/cmis/CMIS/v1.0/errata-01/os/cmis-spec-v1.0-errata-01-os-complete.html#_Toc243905449]
 in the description of the Web service bindings for 'createDocument()' service 
about the object name property:

{noformat}
nameConstraintViolation: See section 2.2.1.4.2 Specific Exceptions.  If the 
repository detects a violation with the given cmis:name property value, the 
repository MAY throw this exception or chose a name which does not conflict.
{noformat}

Thus, all the conditions are met: server does not create a document with not 
corresponding name (‘trailing.txt ’), returns an HTTP status code 409 
(‘Conflict’) and a detailed error message with it.

The test should be corrected

> Value 'trailing.txt ' is not valid as a file name. This property must be a 
> valid file name
> ------------------------------------------------------------------------------------------
>
>                 Key: CMIS-924
>                 URL: https://issues.apache.org/jira/browse/CMIS-924
>             Project: Chemistry
>          Issue Type: Bug
>    Affects Versions: OpenCMIS 0.11.0, OpenCMIS 0.12.0, OpenCMIS 0.13.0
>            Reporter: Dmitry
>
> {noformat}
> UNEXPECTED_EXCEPTION: Document could not be created! Exception: Constraint 
> violation: 03230002 Found 1 integrity violations: Invalid property value: 
> Node: 340d4304-26d3-4499-a3ae-31ee9a9bb81a Name: trailing.txt Type: content 
> Property: name Constraint: 03230001 Value 'trailing.txt ' is not valid as a 
> file name. This property must be a valid file name. 
> (AbstractSessionTest.java:470)
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to