You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by GitBox <gi...@apache.org> on 2021/01/02 13:06:28 UTC

[GitHub] [tomcat-jakartaee-migration] rmannibucau edited a comment on issue #9: Fails with javax.xml since it is ambiguous

rmannibucau edited a comment on issue #9:
URL: https://github.com/apache/tomcat-jakartaee-migration/issues/9#issuecomment-753469631


   The test does not test what i described.
   Issue is that the fields of this class are qname so handled by ee regex so at runtile you get a nosuchfielderror (use a classloader to list field in javax and jakarta lands).
   Can help if you spend too much time on it - thought it was easy originally but can be faster to do a pr ;):
   
   ```
       @Test
       public void testXPathConstants() throws IOException {
           final Migration migration = new Migration();
           migration.setEESpecProfile(EESpecProfile.EE);
           final String name = XPathConstantClient.class.getName().replace('.', '/') + ".class";
           final File destination = new File(folder.getRoot(), name);
           migration.setSource(Paths.get("target/test-classes")
                   .resolve(name).toFile());
           migration.setDestination(destination);
           migration.execute();
           assertTrue(destination.exists());
   
           final byte[] bytecode = Files.readAllBytes(destination.toPath());
           final JavaClass javaClass = new ClassParser(new ByteArrayInputStream(bytecode), "unknown").parse();
           final String constantPool = javaClass.getConstantPool().toString();
           // but stay javax since it is the one from the jvm, not the jakarta one (from xpathconstants dep)
           assertTrue(constantPool, constantPool.contains("CONSTANT_Utf8[1](\"Ljavax/xml/namespace/QName;\")"));
           assertTrue(constantPool, constantPool.contains("CONSTANT_Utf8[1](\"javax/xml/xpath/XPathConstants\")"));
           assertFalse(constantPool, constantPool.contains("CONSTANT_Utf8[1](\"Ljakarta/xml/namespace/QName;\")"));
       }
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org