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/01 21:33:48 UTC

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

rmannibucau opened a new issue #9:
URL: https://github.com/apache/tomcat-jakartaee-migration/issues/9


   Execute the CLI on javax.xml.xpath.XPathConstants and you get jakarta namespace whereas it should stay javax.
   Guess the EEProfile thing will need to move to something configurable since it only handles very particular cases today.


----------------------------------------------------------------
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


[GitHub] [tomcat-jakartaee-migration] ebourg commented on issue #9: Fails with javax.xml since it is ambiguous

Posted by GitBox <gi...@apache.org>.
ebourg commented on issue #9:
URL: https://github.com/apache/tomcat-jakartaee-migration/issues/9#issuecomment-753491358


   Is there an EE API that uses the javax.xml.namespace package?


----------------------------------------------------------------
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


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

Posted by GitBox <gi...@apache.org>.
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;\")"));
       }
   ```
   
   and
   
   ```
   import javax.xml.namespace.QName;
   import javax.xml.xpath.XPathConstants;
   
   public class XPathConstantClient {
       public void method() {
           final QName nodeset = XPathConstants.NODESET;
       }
   }
   ```


----------------------------------------------------------------
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


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

Posted by GitBox <gi...@apache.org>.
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


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

Posted by GitBox <gi...@apache.org>.
rmannibucau commented on issue #9:
URL: https://github.com/apache/tomcat-jakartaee-migration/issues/9#issuecomment-753511230


   @ebourg I'm not sure to be honest, it is not in ee bundle jar but https://raw.githubusercontent.com/eclipse-ee4j/jakartaee-platform/master/namespace/mappings.adoc makes it mapped to jakarta.xml.namespace (https://github.com/jakartaee/jakarta.ee/issues/592). Not sure it is just outdated or not. Happy if the fix is to drop namespace from the regex too.


----------------------------------------------------------------
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


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

Posted by GitBox <gi...@apache.org>.
rmannibucau commented 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 ;).


----------------------------------------------------------------
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


[GitHub] [tomcat-jakartaee-migration] ebourg commented on issue #9: Fails with javax.xml since it is ambiguous

Posted by GitBox <gi...@apache.org>.
ebourg commented on issue #9:
URL: https://github.com/apache/tomcat-jakartaee-migration/issues/9#issuecomment-753542284


   I'm tempted to think the mapping document is wrong. I'm going to remove the `javax.xml.namespace` package from the EE profile. If there is an EE API using this package we can whitelist the QName class which belongs to Java SE.


----------------------------------------------------------------
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


[GitHub] [tomcat-jakartaee-migration] ebourg closed issue #9: Do not migrate javax.xml.namespace

Posted by GitBox <gi...@apache.org>.
ebourg closed issue #9:
URL: https://github.com/apache/tomcat-jakartaee-migration/issues/9


   


----------------------------------------------------------------
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


[GitHub] [tomcat-jakartaee-migration] ebourg commented on issue #9: Fails with javax.xml since it is ambiguous

Posted by GitBox <gi...@apache.org>.
ebourg commented on issue #9:
URL: https://github.com/apache/tomcat-jakartaee-migration/issues/9#issuecomment-753455465


   I'm unable to reproduce this issue, I've added `javax.xml.xpath.XPathConstants` to the test case in f393d76 and it passed for both profiles.


----------------------------------------------------------------
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


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

Posted by GitBox <gi...@apache.org>.
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 runtime 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;\")"));
       }
   ```
   
   and
   
   ```
   import javax.xml.namespace.QName;
   import javax.xml.xpath.XPathConstants;
   
   public class XPathConstantClient {
       public void method() {
           final QName nodeset = XPathConstants.NODESET;
       }
   }
   ```


----------------------------------------------------------------
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


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

Posted by GitBox <gi...@apache.org>.
rmannibucau commented on issue #9:
URL: https://github.com/apache/tomcat-jakartaee-migration/issues/9#issuecomment-753477945


   Created https://github.com/apache/tomcat-jakartaee-migration/pull/10 to illustrate and fix the case I got on primefaces 7.0.
   
   Side note: it is a partial fix (in regards of the theory). I'd love we add a CUSTOM profile which would be configured from system properties. Config would be includes/excludes but should also be OpCode+related data, this part is a but harder to do simple enough to stay usable so didn't give a try yet but something to keep in mind if we encounter too much this kind of issue (I'm expecting it with transaction too since SE has part of XA API).


----------------------------------------------------------------
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