Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-18965

A wiki macro with a parameter type defined in an extension is broken as soon as an extension on the same namespace is upgraded or uninstalled

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • 13.7
    • Rendering - WikiMacro
    • None
    • Unknown

    Description

      Prerequisites: Have PDF Viewer Macro (Pro) version 2.2.1 installed on the main wiki and get a trial license.

      Steps to reproduce:

      1. Login with superadmin and edit XWiki.PDFViewerMacro to display, besides the pdf, the type of the file parameter by adding inside Macro code 
        $wikimacro.parameters.file.class.name

        ($wikimacro.parameters.file should invoke a Converter for the file parameter in case it can be found, since this parameter has a Java type defined)

      1. View XWiki.PDFViewerMacro and see that the above code is not returning something 
      2. Locally update macro-pdfviewer's code to contain a converter from String to PDFResourceReference https://github.com/oanalavinia/macro-pdfviewer/blob/master/api/src/main/java/com/xwiki/pdfviewer/PDFResourceReference.java, which is the  file parameter type (I added the Converter here https://github.com/oanalavinia/macro-pdfviewer/commit/cf0182f15533c789f6751b90df0f283632b60b53 )
      3. Build the new version and upgrade the macro to it
      4. Go to XWiki.PDFViewerMacro 

       

      Expected result:

      The newly added converter is found and the added code will return com.xwiki.pdfviewer.PDFResourceReference.

       

      Actual result:

      The result for the added code is still $wikimacro.parameters.file.class.name as if there isn't any converter

       

      At this point I tested the following groovy script and the converter was found (returns com.xwiki.pdfviewer.internal.PDFResourceReferenceConverter@58bb77d8)

       

      {{groovy}}
      import org.xwiki.properties.ConverterManager
      def converterManager = services.component.getInstance(ConverterManager.class)
      println converterManager.getConverter(com.xwiki.pdfviewer.PDFResourceReference.class)
      {{/groovy}}
      

       

       

       

      After this I restarted the instance and checked XWiki.PDFViewerMacro, where now the converter is found and I get the following result:

      I got the same result with just resaving XWiki.PDFViewerMacro page (with superadmin, since the application is under a license)

       

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            oana.florean@xwiki.com Florean Oana-Lavinia
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: