Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8149506

jdk/test/javax/xml/bind/xjc/8032884/XjcOptionalPropertyTest.java generates files in source directory

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • 9
    • None
    • xml
    • None

      This test generates files in the test source directory, which is generally a bad thing to do.

      Test:
      jdk/test/javax/xml/bind/xjc/8032884/XjcOptionalPropertyTest.java

      Files:
      $ hg status -R jdk
      ? test/javax/xml/bind/xjc/8032884/generated/Foo.java
      ? test/javax/xml/bind/xjc/8032884/generated/ObjectFactory.java
      ? test/javax/xml/bind/xjc/8032884/generated/package-info.java

      In particular, as shown, they show up as unknown files for Mercurial. Yes, they could be .hgignore'd, but it would be better to follow the normal rules and write temporary files to the scratch directory.

      The problem is in this script:
      jdk/test/javax/xml/bind/xjc/8032884/compile-schema.sh
      which contains these lines:

      echo "compiling [optional-property-schema.xsd] schema ..."
      $TESTJAVA/bin/xjc -p generated -d ${TESTSRC} ${TESTSRC}/optional-property-schema.xsd

      It may be writing the files to the ${TESTSRC} directory in order to leverage jtreg's ability to compile the classes and run them with the test. The easiest workaround is to compile the generated classes, and compile and run the test classes from the script. A better solution would be to eliminate the script and do everything in a test class written in Java.

            aefimov Aleksej Efimov
            jjg Jonathan Gibbons
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: