You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@chemistry.apache.org by Carlos Luz Junior <ca...@savoirfairelinux.com> on 2012/03/19 16:49:55 UTC
Illegal character error
Hello everyone,
I'm facing an error when I try to add an image file using the following code:
private AlfrescoDocument addDocument(File fileToUpload, Folder parentFolder, Map<String, Object> properties) {
String documentName = "myDoc";
ContentStreamImpl contentStream = new ContentStreamImpl();
String fileMimeType = new MimetypesFileTypeMap().getContentType(fileToUpload);
try {
FileInputStream fileToUploadStream = new FileInputStream(fileToUpload);
contentStream = new ContentStreamImpl(documentName, BigInteger.valueOf(fileToUpload.getTotalSpace()), fileMimeType, fileToUploadStream);
} catch (FileNotFoundException e) {
logger.error(e.getCause());
e.printStackTrace();
}
return (AlfrescoDocument) parentFolder.createDocument(properties, contentStream, VersioningState.MAJOR);
}
Here's the exception:
ERROR [main] (CmisAtomImporter.java:87) - java.lang.ArrayIndexOutOfBoundsException
org.apache.chemistry.opencmis.commons.exceptions.CmisConnectionException: Cannot access http://localhost:8080/alfresco/service/cmis/s/workspace:SpacesStore/i/94d37493-d2ab-4e9d-b803-a8497622d39f/children?versioningState=major: null
at org.apache.chemistry.opencmis.client.bindings.spi.atompub.HttpUtils.invoke(HttpUtils.java:149)
at org.apache.chemistry.opencmis.client.bindings.spi.atompub.HttpUtils.invokePOST(HttpUtils.java:64)
at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.post(AbstractAtomPubService.java:493)
at org.apache.chemistry.opencmis.client.bindings.spi.atompub.ObjectServiceImpl.createDocument(ObjectServiceImpl.java:109)
at org.apache.chemistry.opencmis.client.runtime.SessionImpl.createDocument(SessionImpl.java:612)
at org.apache.chemistry.opencmis.client.runtime.FolderImpl.createDocument(FolderImpl.java:96)
at org.apache.chemistry.opencmis.client.runtime.FolderImpl.createDocument(FolderImpl.java:410)
at com.savoirfairelinux.repository.importer.cmis.CmisAtomImporter.addDocument(CmisAtomImporter.java:100)
at com.savoirfairelinux.repository.importer.cmis.CmisAtomImporter.doImport(CmisAtomImporter.java:70)
at com.savoirfairelinux.repository.client.RepositoryImporter.run(RepositoryImporter.java:27)
at com.savoirfairelinux.repository.client.Main.main(Main.java:21)
And here's the alfresco log:
org.springframework.extensions.webscripts.WebScriptException: 02160083 Wrapped Exception (with status template): 02160236 Failed to execute script 'classpath*:alfresco/templates/webscripts/org/alfresco/cmis/children.post.atom.js': 02160235 com.ctc.wstx.exc.WstxUnexpectedCharException: Illegal character (NULL, unicode 0) encountered: not valid in any content at [row,col {unknown-source}]: [1,2093905]
...
Caused by: org.alfresco.scripts.ScriptException: 02160236 Failed to execute script 'classpath*:alfresco/templates/webscripts/org/alfresco/cmis/children.post.atom.js': 02160235 com.ctc.wstx.exc.WstxUnexpectedCharException: Illegal character (NULL, unicode 0) encountered: not valid in any content at [row,col {unknown-source}]: [1,2093905]
...
It seems an encoding problem and it only happens with a few files, I've searched the problem and tried to change the encoding but the problem persists, do you have any tip?
Thank you.
Re: Illegal character error
Posted by Carlos Luz Junior <ca...@savoirfairelinux.com>.
Hello Florian,
Everything is running on my machine, it only happens with a few files, some of them are created correctly. I thought it could be a bug in the abdera version that I'm using (https://issues.apache.org/jira/browse/ABDERA-222) but I upgraded to version 1.1.1 and the error persists. I'll debug to see the XML.
Regards.
----- Original Message -----
From: "Florian Müller" <fm...@apache.org>
To: dev@chemistry.apache.org, "carlos luzjunior" <ca...@savoirfairelinux.com>
Sent: Monday, March 19, 2012 3:24:18 PM
Subject: Re: Illegal character error
Hi Carlos,
It is difficult to analyze your issue without seeing the XML that is
transfered.
But it is rather unlikely that an illegal character is the problem.
It's more likely that the connection between client and server is
interrupted before the transfer is complete.
Are you using a proxy or something like this?
- Florian
> Hello everyone,
>
> I'm facing an error when I try to add an image file using the
> following code:
>
> private AlfrescoDocument addDocument(File fileToUpload,
> Folder parentFolder, Map<String, Object> properties) {
> String documentName = "myDoc";
> ContentStreamImpl contentStream = new
> ContentStreamImpl();
> String fileMimeType = new
> MimetypesFileTypeMap().getContentType(fileToUpload);
> try {
> FileInputStream fileToUploadStream = new
> FileInputStream(fileToUpload);
> contentStream = new ContentStreamImpl(documentName,
> BigInteger.valueOf(fileToUpload.getTotalSpace()), fileMimeType,
> fileToUploadStream);
> } catch (FileNotFoundException e) {
> logger.error(e.getCause());
> e.printStackTrace();
> }
> return (AlfrescoDocument) parentFolder.createDocument(properties,
> contentStream, VersioningState.MAJOR);
> }
>
> Here's the exception:
>
> ERROR [main] (CmisAtomImporter.java:87) -
> java.lang.ArrayIndexOutOfBoundsException
>
> org.apache.chemistry.opencmis.commons.exceptions.CmisConnectionException:
> Cannot access
>
> http://localhost:8080/alfresco/service/cmis/s/workspace:SpacesStore/i/94d37493-d2ab-4e9d-b803-a8497622d39f/children?versioningState=major:
> null
> at
>
> org.apache.chemistry.opencmis.client.bindings.spi.atompub.HttpUtils.invoke(HttpUtils.java:149)
> at
>
> org.apache.chemistry.opencmis.client.bindings.spi.atompub.HttpUtils.invokePOST(HttpUtils.java:64)
> at
>
> org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.post(AbstractAtomPubService.java:493)
> at
>
> org.apache.chemistry.opencmis.client.bindings.spi.atompub.ObjectServiceImpl.createDocument(ObjectServiceImpl.java:109)
> at
>
> org.apache.chemistry.opencmis.client.runtime.SessionImpl.createDocument(SessionImpl.java:612)
> at
>
> org.apache.chemistry.opencmis.client.runtime.FolderImpl.createDocument(FolderImpl.java:96)
> at
>
> org.apache.chemistry.opencmis.client.runtime.FolderImpl.createDocument(FolderImpl.java:410)
> at
>
> com.savoirfairelinux.repository.importer.cmis.CmisAtomImporter.addDocument(CmisAtomImporter.java:100)
> at
>
> com.savoirfairelinux.repository.importer.cmis.CmisAtomImporter.doImport(CmisAtomImporter.java:70)
> at
>
> com.savoirfairelinux.repository.client.RepositoryImporter.run(RepositoryImporter.java:27)
> at
> com.savoirfairelinux.repository.client.Main.main(Main.java:21)
>
> And here's the alfresco log:
>
> org.springframework.extensions.webscripts.WebScriptException:
> 02160083 Wrapped Exception (with status template): 02160236 Failed to
> execute script
>
> 'classpath*:alfresco/templates/webscripts/org/alfresco/cmis/children.post.atom.js':
> 02160235 com.ctc.wstx.exc.WstxUnexpectedCharException: Illegal
> character (NULL, unicode 0) encountered: not valid in any content at
> [row,col {unknown-source}]: [1,2093905]
> ...
> Caused by: org.alfresco.scripts.ScriptException: 02160236
> Failed to execute script
>
> 'classpath*:alfresco/templates/webscripts/org/alfresco/cmis/children.post.atom.js':
> 02160235 com.ctc.wstx.exc.WstxUnexpectedCharException: Illegal
> character (NULL, unicode 0) encountered: not valid in any content at
> [row,col {unknown-source}]: [1,2093905]
> ...
>
> It seems an encoding problem and it only happens with a few files,
> I've searched the problem and tried to change the encoding but the
> problem persists, do you have any tip?
>
> Thank you.
Re: Illegal character error
Posted by Florian Müller <fm...@apache.org>.
Hi Carlos,
It is difficult to analyze your issue without seeing the XML that is
transfered.
But it is rather unlikely that an illegal character is the problem.
It's more likely that the connection between client and server is
interrupted before the transfer is complete.
Are you using a proxy or something like this?
- Florian
> Hello everyone,
>
> I'm facing an error when I try to add an image file using the
> following code:
>
> private AlfrescoDocument addDocument(File fileToUpload,
> Folder parentFolder, Map<String, Object> properties) {
> String documentName = "myDoc";
> ContentStreamImpl contentStream = new
> ContentStreamImpl();
> String fileMimeType = new
> MimetypesFileTypeMap().getContentType(fileToUpload);
> try {
> FileInputStream fileToUploadStream = new
> FileInputStream(fileToUpload);
> contentStream = new ContentStreamImpl(documentName,
> BigInteger.valueOf(fileToUpload.getTotalSpace()), fileMimeType,
> fileToUploadStream);
> } catch (FileNotFoundException e) {
> logger.error(e.getCause());
> e.printStackTrace();
> }
> return (AlfrescoDocument) parentFolder.createDocument(properties,
> contentStream, VersioningState.MAJOR);
> }
>
> Here's the exception:
>
> ERROR [main] (CmisAtomImporter.java:87) -
> java.lang.ArrayIndexOutOfBoundsException
>
> org.apache.chemistry.opencmis.commons.exceptions.CmisConnectionException:
> Cannot access
>
> http://localhost:8080/alfresco/service/cmis/s/workspace:SpacesStore/i/94d37493-d2ab-4e9d-b803-a8497622d39f/children?versioningState=major:
> null
> at
>
> org.apache.chemistry.opencmis.client.bindings.spi.atompub.HttpUtils.invoke(HttpUtils.java:149)
> at
>
> org.apache.chemistry.opencmis.client.bindings.spi.atompub.HttpUtils.invokePOST(HttpUtils.java:64)
> at
>
> org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.post(AbstractAtomPubService.java:493)
> at
>
> org.apache.chemistry.opencmis.client.bindings.spi.atompub.ObjectServiceImpl.createDocument(ObjectServiceImpl.java:109)
> at
>
> org.apache.chemistry.opencmis.client.runtime.SessionImpl.createDocument(SessionImpl.java:612)
> at
>
> org.apache.chemistry.opencmis.client.runtime.FolderImpl.createDocument(FolderImpl.java:96)
> at
>
> org.apache.chemistry.opencmis.client.runtime.FolderImpl.createDocument(FolderImpl.java:410)
> at
>
> com.savoirfairelinux.repository.importer.cmis.CmisAtomImporter.addDocument(CmisAtomImporter.java:100)
> at
>
> com.savoirfairelinux.repository.importer.cmis.CmisAtomImporter.doImport(CmisAtomImporter.java:70)
> at
>
> com.savoirfairelinux.repository.client.RepositoryImporter.run(RepositoryImporter.java:27)
> at
> com.savoirfairelinux.repository.client.Main.main(Main.java:21)
>
> And here's the alfresco log:
>
> org.springframework.extensions.webscripts.WebScriptException:
> 02160083 Wrapped Exception (with status template): 02160236 Failed to
> execute script
>
> 'classpath*:alfresco/templates/webscripts/org/alfresco/cmis/children.post.atom.js':
> 02160235 com.ctc.wstx.exc.WstxUnexpectedCharException: Illegal
> character (NULL, unicode 0) encountered: not valid in any content at
> [row,col {unknown-source}]: [1,2093905]
> ...
> Caused by: org.alfresco.scripts.ScriptException: 02160236
> Failed to execute script
>
> 'classpath*:alfresco/templates/webscripts/org/alfresco/cmis/children.post.atom.js':
> 02160235 com.ctc.wstx.exc.WstxUnexpectedCharException: Illegal
> character (NULL, unicode 0) encountered: not valid in any content at
> [row,col {unknown-source}]: [1,2093905]
> ...
>
> It seems an encoding problem and it only happens with a few files,
> I've searched the problem and tried to change the encoding but the
> problem persists, do you have any tip?
>
> Thank you.