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

BasicModularXMLParserTest.java and LayerModularXMLParserTest.java fails due to stax.properties left over by FactoryFindTest.java

XMLWordPrintable

       javax/xml/jaxp/module/ServiceProviderTest/BasicModularXMLParserTest.java
       javax/xml/jaxp/module/ServiceProviderTest/LayerModularXMLParserTest.java

       Fails if jdk/lib/stax.properties exist. This file seems created and left over by
       javax/xml/jaxp/unittest/stream/FactoryFindTest.java:

           @Test
           public void testFactoryFindUsingStaxProperties() {
       ...
               String configFile = System.getProperty("java.home") + File.separator + "lib" + File.separator + "stax.properties";

               File f = new File(configFile);
               if (f.exists()) {
                   try {
                       FileInputStream fis = new FileInputStream(f);
                       props.load(fis);
                       fis.close();
                   } catch (FileNotFoundException e) {
                       return;
                   } catch (IOException e) {
                       return;
                   }
               } else {
                   props.setProperty(FACTORY_KEY, "com.sun.xml.internal.stream.XMLInputFactoryImpl");
                   try {
                       FileOutputStream fos = new FileOutputStream(f);
                       props.store(fos, null);
                       fos.close();
                       f.deleteOnExit();
                   } catch (FileNotFoundException e) {
                       return;
                   } catch (IOException e) {
                       return;
                   }
               }

       In case FactoryFindTest.java failed to delete it's created file jdk/lib/stax.properties, BasicModularXMLParserTest.java and LayerModularXMLParserTest.java then will fail:

       Expect javax.xml.stream.XMLInputFactory is provided by module xmlprovider1, but actual implementation class com.sun.xml.internal.stream.XMLInputFactoryImpl is provided by module java.xml
       Exception in thread "main" java.lang.AssertionError: 1 services are not provided by expected module
       at Main.main(Main.java:63)

       test BasicModularXMLParserTest.testWithTwoProvider(): failure



       Need to move FactoryFindTest.java to isolatedjdk to fix this issue.

            fyuan Frank Yuan (Inactive)
            amlu Amy Lu (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: