castor
  1. castor
  2. CASTOR-1307

Annotation Tag with */ leads to wrong sourcecode

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 1.0 M1
    • Fix Version/s: 1.0.4
    • Component/s: XML code generator
    • Labels:
      None
    • Number of attachments :
      6

      Description

      <xs:annotation>
      <xs:documentation>
      //

      {type='Module'}
      </xs:documentation>
      </xs:annotation>
      leads to follwoing java doc:

      /**
      * //{type='Module'}
      • @param classification the value of field 'classification'.
        */
        (the comment is closed ..)
        The easiest way to prevent tgis, would be to remove all /* and */ from annotations

        Activity

        Hide
        Werner Guttmann added a comment -

        Roland, can you please attach an XML schema that highlights the issue at hand ?

        Show
        Werner Guttmann added a comment - Roland, can you please attach an XML schema that highlights the issue at hand ?
        Hide
        Roland Spatzenegger added a comment -

        Minimal xml schema with that error

        Show
        Roland Spatzenegger added a comment - Minimal xml schema with that error
        Hide
        Roland Spatzenegger added a comment -

        generated file

        Show
        Roland Spatzenegger added a comment - generated file
        Hide
        Roland Spatzenegger added a comment -

        generated file

        Show
        Roland Spatzenegger added a comment - generated file
        Hide
        Werner Guttmann added a comment -

        Roland, can you pls. attach a XML sample document that successfully unmarshalls against the sources generated from the attached XML schema ?

        Show
        Werner Guttmann added a comment - Roland, can you pls. attach a XML sample document that successfully unmarshalls against the sources generated from the attached XML schema ?
        Hide
        Roland Spatzenegger added a comment -

        The problem in the sourcegenerator leads to java code which cannot be compiled (see ProcessDefinition.java for example). With this sourcecode I cannot unmarshall anything. If I remove the annotation from the schema file, it works.

        An example would be:
        <?xml version="1.0" encoding="UTF-8"?>
        <ProcessDefinition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ProcessDefinition.xsd">
        <Classification value="//"/>
        </ProcessDefinition>

        Show
        Roland Spatzenegger added a comment - The problem in the sourcegenerator leads to java code which cannot be compiled (see ProcessDefinition.java for example). With this sourcecode I cannot unmarshall anything. If I remove the annotation from the schema file, it works. An example would be: <?xml version="1.0" encoding="UTF-8"?> <ProcessDefinition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ProcessDefinition.xsd"> <Classification value="/ / "/> </ProcessDefinition>
        Hide
        Werner Guttmann added a comment -

        Initial (an dhopefully final) patch, adding code to BaseFactory.normalize(String) to replace each occuerence of "/" with "\/".

        Show
        Werner Guttmann added a comment - Initial (an dhopefully final) patch, adding code to BaseFactory.normalize(String) to replace each occuerence of " /" with " \/".
        Hide
        Werner Guttmann added a comment -

        Will commit the patch once you have attached a valid sample XML document for the given XML schema .. .

        Show
        Werner Guttmann added a comment - Will commit the patch once you have attached a valid sample XML document for the given XML schema .. .
        Hide
        Werner Guttmann added a comment -

        Roland ?

        Show
        Werner Guttmann added a comment - Roland ?
        Hide
        Roland Spatzenegger added a comment -

        I have added a complete eclipse project. Use "ant generate" to generate the test classes. You need the castor libs to run the project. start "main.Test" to start the test-class (reads in test.xml). You should get "blafasel" on the screen.

        Show
        Roland Spatzenegger added a comment - I have added a complete eclipse project. Use "ant generate" to generate the test classes. You need the castor libs to run the project. start "main.Test" to start the test-class (reads in test.xml). You should get "blafasel" on the screen.
        Hide
        Werner Guttmann added a comment -

        Thanks, Roland.

        Show
        Werner Guttmann added a comment - Thanks, Roland.
        Hide
        Werner Guttmann added a comment -

        Final patch

        Show
        Werner Guttmann added a comment - Final patch

          People

          • Assignee:
            Werner Guttmann
            Reporter:
            Roland Spatzenegger
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 30 minutes
              30m
              Remaining:
              Remaining Estimate - 30 minutes
              30m
              Logged:
              Time Spent - Not Specified
              Not Specified