Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with "Confluence CLI Connector" and Attachments (docx)

Daniel Vehof February 20, 2017

Hi,

we are currently evaluating if we can change some URLs in confluence pages with the Confluence CLI Connector. At the moment we have got Problems with attached docx files. The cli connector seems to try to change the URLs even in the docx files. But something goes wrong there.

From the logfile:

caused by: java.lang.IllegalArgumentException: The char '0x13' in 'java.io.IOException: java.lang.IllegalArgumentException: The char '0x13' in '... <PART OF THE DOCX HERE> ... ' is not a valid XML character.' is not a valid XML character.
at org.apache.axis.components.encoding.AbstractXMLEncoder.encode(AbstractXMLEncoder.java:110)

Is there anything we are doing wrong? Can we exclude attachments (or docx)? We use the atlassian-cli 6.1.0 (on linux) and the latest plugin version.

this is how we try to do it:

./confluence.sh --server https://url.to/confluence --user USERNAME --password "PASSWORD" --action runFromContentList --search "\"https://OLD.URL/confluence\"" --space @all --common "--action modifyPage --id @pageId@ --findReplace \"https://OLD.URL/confluence###https://NEW.URL/confluence\" --special \" ###\" "

Thanks for any help!

2 answers

0 votes
Bob Swift
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 24, 2017

It would be more helpful if you provide the results from a CLI action that shows an error. 

In any case, modifyPage only changes pages. A suggestion also would be to use the cql parameter instead of search, something like:

--cql "text ~ 'https://OLD.URL/confluence' and type = page"
Daniel Vehof February 27, 2017

Thanks for your answer!

It works with --cql instead of --search. So the problem seems to be, that --search also searches in attachments (in my case docx) and this fails somehow.

CLI only says:

Remote error: (500)Internal Server Error

The entries in the confluence logfile are as mentioned above in my first post.

But as --cql works, and if you say it is equal to --search in this case, this will be enough for me.

Daniel Vehof February 27, 2017

Sorry, it's me again. 

Now tried the same command (with --cql) that worked for the confluence URL to replace an old JIRA URL in the same confluence instance.

Replacing the JIRA URL fails:

cli output says:

Remote error: java.lang.NullPointerException: null

confluence log says:

2017-02-27 13:18:21,652 WARN [ajp-nio-8010-exec-10] [confluence.impl.hibernate.ConfluenceHibernateTransactionManager] doRollback Performing rollback. Transactions:
  ->[com.atlassian.confluence.api.impl.service.content.finder.ContentFinderFactory$ContentFinderImpl.fetchMappedByContentType]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT,readOnly (Session #1429300833)
 -- url: /confluence/rest/api/latest/content/search | traceId: 32196a5a9e309e11 | userName: <MYUSERID>
2017-02-27 13:18:21,653 ERROR [ajp-nio-8010-exec-10] [rest.api.model.ExceptionConverter] convertServiceException No status code found for exception, converting to internal server error : 
 -- url: /confluence/rest/api/latest/content/search | traceId: 32196a5a9e309e11 | userName: <MYUSERID>
java.lang.NullPointerException
	at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:210)
	at com.atlassian.confluence.api.model.content.History$HistoryBuilder.createdDate(History.java:231)
	at com.atlassian.confluence.api.impl.service.content.factory.HistoryFactory.buildRef(HistoryFactory.java:102)
	at com.atlassian.confluence.api.impl.service.content.factory.HistoryFactory.buildReferences(HistoryFactory.java:56)
	at com.atlassian.confluence.api.impl.service.content.factory.ContentFactory.addCommonFieldsToBuilders(ContentFactory.java:161)
	at com.atlassian.confluence.api.impl.service.content.factory.ContentFactory.buildersFrom(ContentFactory.java:154)
	at com.atlassian.confluence.api.impl.service.content.factory.ContentFactory.buildFrom(ContentFactory.java:103)
	at com.atlassian.confluence.api.impl.service.content.finder.ContentFinderFactory$ContentFinderImpl.lambda$fetchMany$1(ContentFinderFactory.java:123)
	at com.atlassian.confluence.api.impl.pagination.PaginationServiceImpl.executeBatch(PaginationServiceImpl.java:167)
	at com.atlassian.confluence.api.impl.pagination.PaginationServiceImpl.lambda$doRequestInTransaction$1(PaginationServiceImpl.java:143)
	at com.atlassian.confluence.api.impl.ReadOnlyAndReadWriteTransactionConversionTemplate.executeInReadOnly(ReadOnlyAndReadWriteTransactionConversionTemplate.java:40)
	at com.atlassian.confluence.api.impl.pagination.PaginationServiceImpl.doRequestInTransaction(PaginationServiceImpl.java:138)
	at com.atlassian.confluence.api.impl.pagination.PaginationServiceImpl.doPaginationListRequest(PaginationServiceImpl.java:70)
	at com.atlassian.confluence.api.impl.service.content.finder.ContentFinderFactory$ContentFinderImpl.fetchMany(ContentFinderFactory.java:117)
	at com.atlassian.confluence.api.impl.service.content.finder.ContentFinderFactory$ContentFinderImpl.fetchMappedByContentType(ContentFinderFactory.java:153)
...

Maybe you have another hint for me.
Thanks! 

Daniel Vehof March 15, 2017

@Bob Swift [Bob Swift Atlassian Add-ons]: The problem still exists, you got any other hint for us?

Bob Swift
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 15, 2017

The log shows it is a Confluence server error running the CQL. Your CQL looks ok. Generally, REST APIs are not suppose to result in server errors - that implies a problem on the Confluence side. That means you will need to open a Atlassian support issue and give them the Confluence version, the CQL used and the stack trace. sad

Daniel Vehof March 15, 2017

Thanks for your response! We will give it a try.

0 votes
Rob Woodgate
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 21, 2017

The CLI developer, @Bob Swift [Bob Swift Atlassian Add-ons] will see this mention and be along shortly smile

Daniel Vehof February 22, 2017

Thanks for the hint smile

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events