2
votes

I'm trying to get a folder ID by path like:

Folder folder = (Folder) getCmisSession().getObjectByPath(folderPath);

and the path that I'm requesting is:

/SIGAP/2011/DIRECCIÓN GENERAL DE PRUEBAS/SIN EXPEDIENTE/2010001231

and as you can see there's a special character Ó in the string,

the error that throws chemistry is:

STACK TRACE:
org.cmis.ws.CmisException: Not found an object for the specific path: /SIGAP/2011/DIRECCIÃ?N GENERAL DE PRUEBAS/OFICIOS
    at com.emc.documentum.fs.cmis.impl.dfs.utils.CmisExceptionFactory.create(CmisExceptionFactory.java:24)
    at com.emc.documentum.fs.cmis.impl.dfs.utils.CmisExceptionBuilder.build(CmisExceptionBuilder.java:31)
    at com.emc.documentum.fs.cmis.impl.dfs.action.GetObjectByPathAction.getNonCabinetObjectByPath(GetObjectByPathAction.java:170)

it changes the string from DIRECCIÓN to DIRECCIÃ?N,

how can I set to the session the charset to be utf-8? or how do I have to encode the path?

Update 1:

as @FlorianMüller sugested, with help of SoapUI, I try requesting the same folder by path like this:

 <soapenv:Body>
      <ns:getObjectByPath>
         <ns:repositoryId>LHD_ECM</ns:repositoryId>
         <ns:path>/SIGAP/2011/DIRECCIÓN GENERAL DE PRUEBAS/SIN EXPEDIENTE/2010001231</ns:path>
      </ns:getObjectByPath>
   </soapenv:Body>

and got the server got it rigth:

<S:Body>
      <ns2:getObjectByPathResponse xmlns="http://docs.oasis-open.org/ns/cmis/core/200908/" xmlns:ns2="http://docs.oasis-open.org/ns/cmis/messaging/200908/">
         <ns2:object>
            <properties>
               <propertyString queryName="cmis:name" displayName="Name" localName="object_name" propertyDefinitionId="cmis:name">
                  <value>2010001231</value>
               </propertyString>
               <propertyId queryName="cmis:objectTypeId" displayName="Object Type ID" localName="r_object_type" propertyDefinitionId="cmis:objectTypeId">
                  <value>sigapfolio</value>
               </propertyId>
               <propertyId queryName="cmis:baseTypeId" displayName="Base Type Id" localName="" propertyDefinitionId="cmis:baseTypeId">
                  <value>cmis:folder</value>
               </propertyId>
               <propertyId queryName="cmis:objectId" displayName="Object Id" localName="r_object_id" propertyDefinitionId="cmis:objectId">
                  <value>0b00020280080815</value>
               </propertyId>
               <propertyString queryName="cmis:createdBy" displayName="Created By" localName="r_creator_name" propertyDefinitionId="cmis:createdBy">
                  <value>dmadmin</value>
               </propertyString>
               <propertyDateTime queryName="cmis:creationDate" displayName="Creation Date" localName="r_creation_date" propertyDefinitionId="cmis:creationDate">
                  <value>2016-04-05T04:54:44.000-05:00</value>
               </propertyDateTime>
               <propertyString queryName="cmis:lastModifiedBy" displayName="Last Modified By" localName="r_modifier" propertyDefinitionId="cmis:lastModifiedBy">
                  <value>dmadmin</value>
               </propertyString>
               <propertyDateTime queryName="cmis:lastModificationDate" displayName="Last Modification Date" localName="r_modify_date" propertyDefinitionId="cmis:lastModificationDate">
                  <value>2016-04-05T04:54:44.000-05:00</value>
               </propertyDateTime>
               <propertyString queryName="cmis:changeToken" displayName="Change Token" localName="i_vstamp" propertyDefinitionId="cmis:changeToken">
                  <value>1</value>
               </propertyString>
               <propertyId queryName="cmis:parentId" displayName="Parent Id" localName="i_folder_id" propertyDefinitionId="cmis:parentId">
                  <value>0b00020280005a3b</value>
               </propertyId>
               <propertyString queryName="cmis:path" displayName="Folder Path" localName="r_folder_path" propertyDefinitionId="cmis:path">
                  <value>/SIGAP/2011/DIRECCIÓN GENERAL DE PRUEBAS/SIN EXPEDIENTE/2010001231</value>
               </propertyString>
               <propertyId queryName="cmis:allowedChildObjectTypeIds" displayName="Allowed Child Object Type IDs" localName="" propertyDefinitionId="cmis:allowedChildObjectTypeIds">
                  <value>cmis:folder</value>
                  <value>cmis:document</value>
               </propertyId>
            </properties>
         </ns2:object>
      </ns2:getObjectByPathResponse>
   </S:Body>
</S:Envelope>

so it's definitly something wrong with Apache Chemistry :(

1
Are you certain you're correctly passing the string into Java?Gagravarr
@Gagravarr yes, debuging the code before execution the string was correct.Alfredo M
OpenCMIS is already using UTF-8 here. This problem is related to Unicode normalization (NFC/NFD). Only NFC is reliability working across all CMIS bindings. There is not a lot you can do on the client side. The repository has to manage this.Florian Müller
@FlorianMüller thank's for the comment, I tried it with soapui and it got it right, check the edit in the question :DAlfredo M
This is not an OpenCMIS problem. The server doesn't handle Unicode normalizations correctly. The AtomPub and Browser binding send the path in the URL, which must be NFC normalized. The server doesn't take this into account.Florian Müller

1 Answers

3
votes

So the problem IS the binding, switch from AtomPub to Webservices and the problem went away.

parameter.put(SessionParameter.BINDING_TYPE, BindingType.WEBSERVICES.value());