Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-6631

Code macro doesn't correctly handle empty strings

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Low
    • 3.5
    • 2.2.6
    • None

    Description

      Found a small bug in the color rendering of the code xml macro - color rendering is reversed after the occurrence of an empty attribute. Have attached a small example to demonstrate.

      Bug is in Confluence 2.1.3 running under Tomcat on Windows 2003 Server under JVM 1.5.0_06.

      Consider the following XML snippet contained in a {code:xml} macro:

      {code:xml}
      <?xml version="1.0" encoding="UTF-8"?>
      <JDBC_MSG>
          <Transaction ID="61">
              <SQL rowcount="2" exception="false">
                  <Statement>select * from project p limit 2</Statement>
                  <ResultSet>
                      <Row>
                          <Column name="ID" value="10073" type="DECIMAL" precision="18" scale="0" displaySize="19" />
                          <Column name="pname" value="m3t4.studio" type="VARCHAR" precision="255" scale="0" displaySize="255" />
                          <Column name="URL" value="" type="VARCHAR" precision="255" scale="0" displaySize="255" />
                          <Column name="LEAD" value="dbigwood" type="VARCHAR" precision="255" scale="0" displaySize="255" />
                          <Column name="DESCRIPTION" value="" type="VARCHAR" precision="65535" scale="0" displaySize="65535" />
                          <Column name="pkey" value="META" type="VARCHAR" precision="255" scale="0" displaySize="255" />
                          <Column name="pcounter" value="0" type="DECIMAL" precision="18" scale="0" displaySize="19" />
                          <Column name="ASSIGNEETYPE" value="2" type="DECIMAL" precision="18" scale="0" displaySize="19" />
                      </Row>
                  </ResultSet>
              </SQL>
          </Transaction>
      </JDBC_MSG>
      {code}
      

      Specifically the section in the middle starting:

      <Column name="URL" value="" type="VARCHAR"
      

      The problem is with the color coding after the empty value attribute quotes. Before the empty quotes strings are green and attribute names blue, after the empty quotes until the end of the current tag, the colors are reversed.

      Regards
      -David Bigwood

      The problem is in the regex

          public static final String QUOTES = "(\"|\\&quot;)(.+?)(?<!(\"|\\&quot;))(\"|\\&quot;)";
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            tom@atlassian.com Tom Davies
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: