Uploaded image for project: 'Ivy'
  1. Ivy
  2. IVY-1457

XmlModuleDescriptorWritter doesn't support fully extra infos elements

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.3.0
    • 2.4.0-RC1
    • Core
    • None

    Description

      Ivy supports a way to add your own elements into extends tag.
      Exemple :

      <info organisation="org.apache.easyant" module="standard-java-app" revision="0.1" status="integration" >
              <ea:build organisation="org.apache.easyant.buildtypes" module="build-std-java" revision="0.9">
                  <ea:property name="run.main.classname" value="org.apache.easyant.example.Example"/>
                  <ea:plugin organisation="org.apache.easyant.plugins" module="run-java" revision="0.9" />
              </ea:build>
          </info>
      

      After invoking XmlModuleDescriptorWritter.write()
      We get the following :

      <info organisation="org.apache.easyant"
                      module="standard-java-app"
                      revision="0.1"
                      status="integration"
                      publication="20131231193827"
              >
                    <ea:property>
                  </ea:property>
              </info>
      

      We can notice a few things :

      • <ea:plugin> element is missing
      • <ea:build> element is missing
      • wrong identation on ending <ea:property> (probably due to nested elements)
      • attributes from <ea:property> gets wiped

      Here is the code form XmlModuleDescriptorParser.endElement() method :

      else if (state == State.EXTRA_INFO) {
                      getMd().addExtraInfo(qName, buffer == null ? "" : buffer.toString());
                      buffer = null;
                      state = State.INFO;
                  } 
      

      Unfortunatly buffer doesn't contains attributes and doesn't seems to handle nested element.

      Here is the code writting extra infos elements from XmlModuleDescriptorWritter :

                  for (Iterator it = md.getExtraInfo().entrySet().iterator(); it.hasNext();) {
                      Map.Entry extraDescr = (Map.Entry) it.next();
                      if (extraDescr.getValue() == null 
                              || ((String) extraDescr.getValue()).length() == 0) {
                          continue;
                      }
                      out.print("\t\t<");
                      out.print(extraDescr.getKey());
                      out.print(">");
                      out.print(XMLHelper.escape((String) extraDescr.getValue()));
                      out.print("</");
                      out.print(extraDescr.getKey());
                      out.println(">");
                  }
      

      Still no attributes support and all "contents" will be escaped.

      I don't know how much this feature is used by the community but fixing this bug could break backward compatibility.

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            jboudart Jean-Louis Boudart
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment