Refactor OfficeConverter API to remove getFormatRegistry

Hi everyone,

as part of the upgrade of Jodconverter to version 4.4 I noticed that we are currently exposing in our OfficeConverter interface some classes from Jodconverter. The problem with that kind of practice is that each time Jodconverter community performs changes on their API it’s also breaking our own API. And it’s actually here when upgrading from Jodconverter 3.2 to 4.4 since the package names have changed.

Now I reviewed quickly the internal usages of OfficeConverter#getFormatRegistry and it appears that we’re using it for 3 reasons:

  • in some isPresentation method to check if a file is a presentation based on the file extension
  • in a isConversionSupported method in the OfficeViewerScriptService
  • in a getExportType method in oldcore mainly used for the office Export

I also check the usages of this API in xwiki-contrib, but I haven’t found any.
So since upgrading to jodconverter 4.4 will necessarily imply some breaking changes, I propose to use the opportunity to completely remove OfficeConverter#getFormatRegistry and to provide instead the 3 missing methods related to our internal usages.

For information I already opened a PR with the preliminary work for upgrading jodconverter without the refactoring: https://github.com/xwiki/xwiki-platform/pull/1495

wdyt?

+1

+1, Thanks

+1

Thanks,
Marius

I just merged the work with the API removal. It will be part of 13.1RC1.