mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Mark Craig
07.18.2014 9c3b4a8e274d82536619eff31cfa6e490a7482ee
Fix for OPENDJ-1335: Doc build breaks on duplicate xml:id values in generated log reference

This fix changes the fragments in links to specific log messages, so if anyone links to those directly, they'll have to update their links vs. 2.6.
1 files modified
20 ■■■■■ changed files
opendj3-server-dev/src/build-tools/org/opends/build/tools/GenerateMessageFile.java 20 ●●●●● patch | view | raw | blame | history
opendj3-server-dev/src/build-tools/org/opends/build/tools/GenerateMessageFile.java
@@ -537,22 +537,26 @@
    private Severity severity;
    private Integer id;
    private String xmlId;
    private String formatString;
    /**
     * Build log reference entry for an log message.
     *
     * @param msgPropKey
     * @param category
     * @param severity
     * @param ordinal
     * @param formatString
     */
    public MessageRefEntry(final Category category, final Severity severity,
    public MessageRefEntry(final String msgPropKey,
        final Category category, final Severity severity,
        final Integer ordinal, final String formatString)
    {
      this.severity = severity;
      this.formatString = formatString;
      id = calculateId(category, severity, ordinal);
      xmlId = getXmlId(msgPropKey);
    }
    private Integer calculateId(final Category category,
@@ -562,6 +566,17 @@
      return new Integer(ordinal);
    }
    private String getXmlId(final String messagePropertyKey)
    {
        // XML IDs must be unique, and must begin with a letter ([A-Za-z])
        // and may be followed by any number of letters, digits ([0-9]),
        // hyphens ("-"), underscores ("_"), colons (":"), and periods (".").
        final String invalidChars = "[^A-Za-z0-9\\-_:\\.]";
        String xmlId = messagePropertyKey.replaceAll(invalidChars, "-");
        return xmlId;
    }
    /**
     * Return a DocBook XML <varlistentry> of this log reference entry.
     * This implementation copies the message string verbatim, and does not
@@ -572,7 +587,7 @@
    public String toString()
    {
      return
          "  <varlistentry xml:id=\"log-ref-" + id.intValue() + "\">" + EOL
          "  <varlistentry xml:id=\"log-ref-" + xmlId + "\">" + EOL
          + "   <term>ID: " + id.intValue() + "</term>" + EOL
          + "   <listitem>" + EOL
          + "    <para>Severity: " + severity.name() + "</para>" + EOL
@@ -973,6 +988,7 @@
                  || s.name().equalsIgnoreCase("SEVERE_ERROR")) {
                MessageRefEntry entry =
                        new MessageRefEntry(
                                key.toString(),
                                c,
                                s,
                                globalOrdinal != null ?