OpenJPA
  1. OpenJPA
  2. OPENJPA-2044

Invalid header in MetaModel classes generated by AnnotationProcessor

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Trivial Trivial
    • Resolution: Fixed
    • Affects Version/s: 2.0.1, 2.1.1, 2.2.0
    • Fix Version/s: 2.2.0
    • Component/s: criteria
    • Labels:
    • Environment:
      Any

      Description

      The documentation at http://openjpa.apache.org/builds/latest/docs/manual/ch13s04.html talks about an option available in org.apache.openjpa.persistence.meta.AnnotationProcessor6:

      -Aopenjpa.header=<url> : A url whose content will appear as comment header to the generated file(s).

      This option does not work.

      If I give it a URL - either an http or a file URL - it doesn't put the contents from these URLs into the header of the generated files. It puts something like:

      sun.net.www. content.text.PlainTextInputStream@9ea09ea

      in the header instead.

      I suspect that the AnnotationProcessor is essentially doing:

      URL headerurl = new URL(<openjpa.header value>);
      String newHeaderComment = headerurl.getContent().toString();

      The getContent() is returning an InputStream - as documented here in the absence of a content handler factory: http://download.oracle.com/javase/6/docs/api/java/net/URLConnection.html#getContent()

      Then the toString() call just returns the string representation of the instance of the InputStream object.

      I think the AnnotationProcessor should read from the stream instead?

        Activity

        Hide
        Kevin Sutter added a comment -

        Dale was right on with his comments. The openjpa.header property on the AnnotationProcessor was not being processed correctly. I am in the process of correcting this.

        Show
        Kevin Sutter added a comment - Dale was right on with his comments. The openjpa.header property on the AnnotationProcessor was not being processed correctly. I am in the process of correcting this.
        Hide
        Pinaki Poddar added a comment -

        If you are fixing this, please put the fix of reading the content of an URL into openjpa-lib/...../Files.java

        Show
        Pinaki Poddar added a comment - If you are fixing this, please put the fix of reading the content of an URL into openjpa-lib/...../Files.java
        Hide
        Kevin Sutter added a comment -

        I already committed the changes to trunk. Since the original URL processing code was localized to AnnotationProcessor6, I followed the same pattern. Moving this type of simple change to Files seemed like overkill. And, since the actual processing of the stream into Comment format is pretty unique to the SourceCode file, I really didn't see a need to generalize it for Files.

        Show
        Kevin Sutter added a comment - I already committed the changes to trunk. Since the original URL processing code was localized to AnnotationProcessor6, I followed the same pattern. Moving this type of simple change to Files seemed like overkill. And, since the actual processing of the stream into Comment format is pretty unique to the SourceCode file, I really didn't see a need to generalize it for Files.
        Hide
        Dale Lane added a comment -

        Tried the fix from a nightly snapshot - it fixed the problem for us. The MetaModel classes are now being generated correctly. Many thanks.

        Show
        Dale Lane added a comment - Tried the fix from a nightly snapshot - it fixed the problem for us. The MetaModel classes are now being generated correctly. Many thanks.
        Hide
        Kevin Sutter added a comment -

        Resolved in trunk (2.2.0-SNAPSHOT).

        Show
        Kevin Sutter added a comment - Resolved in trunk (2.2.0-SNAPSHOT).
        Hide
        Albert Lee added a comment -

        Close issue in-preparation for 2.2.0 release.

        Show
        Albert Lee added a comment - Close issue in-preparation for 2.2.0 release.

          People

          • Assignee:
            Kevin Sutter
            Reporter:
            Dale Lane
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 0.5h
              0.5h
              Remaining:
              Remaining Estimate - 0.5h
              0.5h
              Logged:
              Time Spent - Not Specified
              Not Specified

                Development