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

Page history produced by rest service is empty on Oracle

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.2.2
    • Fix Version/s: 6.0
    • Component/s: REST
    • Labels:
      None
    • Environment:
      XWiki 5.2.2 on oracle
    • Difficulty:
      Easy
    • Documentation:
      N/A
    • Documentation in Release Notes:
      N/A
    • Pull Request Status:
      Pull Request accepted
    • Similar issues:

      Description

      On a XWiki 5.2.2 installation with an oracle backend the Rest call to

      /rest/wikis/xwiki/spaces/Sandbox/pages/HistTest/history 
      

      produces the following output, despite the site has revisions (minor and major):

      <history/>
      

      I studied the Java file PageHistoryResourceImpl.java and tried to nail down the problem with the following groovy macro (it executes the same XWQL query as PageHistoryResourceImpl):

      {{groovy}}
      import org.xwiki.query.Query;
      def order = "desc";
      def spaceName = "Sandbox";
      def pageName = "HistTest";
      def number = 100;
      def start = 0;
      
      def query = String.format("select doc.space, doc.name, doc.language, rcs.id, rcs.date, rcs.author, rcs.comment"
                      + " from XWikiRCSNodeInfo as rcs, XWikiDocument as doc where rcs.id.docId = doc.id and"
                      + " doc.space = :space and doc.name = :name and doc.language = :language"
                      + " order by rcs.date %s, rcs.id.version1 %s, rcs.id.version2 %s", order, order, order);
      
      def res = xwiki.queryManager.createQuery(query, Query.XWQL)
                          .bindValue("space", spaceName)
                          .bindValue("name", pageName)
                          .bindValue("language", "")
                          .setLimit(number)
                          .setOffset(start)
                          .execute();
      					
      println "Found $res.size entries"
      
      res.each() { row -> println row }
      {{/groovy}}
      

      The query in the groovy macro does not produce a result on oracle , on mysql it does.
      It seems that the language column of all Xwiki documents on oracle have the value null, but the query expects an empty string.

      I changed the query to

      def query = String.format("select doc.space, doc.name, doc.language, rcs.id, rcs.date, rcs.author, rcs.comment"
                      + " from XWikiRCSNodeInfo as rcs, XWikiDocument as doc where rcs.id.docId = doc.id and"
                      + " doc.space = :space and doc.name = :name and (doc.language = :language or doc.language is null)"
                      + " order by rcs.date %s, rcs.id.version1 %s, rcs.id.version2 %s", order, order, order);
      

      and got the correct result.

      What is the default value of the XWikiDocument.language column? xwiki.oracle.hbm.xml allows null values for this column.

        Attachments

          Activity

            People

            • Assignee:
              rhierlmeier Richard Hierlmeier
              Reporter:
              rhierlmeier Richard Hierlmeier
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Date of First Response: