[GitHub] [commons-configuration] garydgregory commented on a diff in pull request #186: [CONFIGURATION-813]: Support both javax and jakarta namespace in mailapi
garydgregory commented on code in PR #186: URL: https://github.com/apache/commons-configuration/pull/186#discussion_r896732187 ## src/test/java/org/apache/commons/configuration2/TestDataConfiguration.java: ## @@ -839,7 +842,7 @@ public void testConversionException() throws Exception { } try { -conf.get(Class.forName("javax.mail.internet.InternetAddress"), "key1"); +conf.get(Class.forName("jakarta.mail.internet.InternetAddress"), "key1"); Review Comment: Another magic string, reuse the constant... -- 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. To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [commons-configuration] garydgregory commented on a diff in pull request #186: [CONFIGURATION-813]: Support both javax and jakarta namespace in mailapi
garydgregory commented on code in PR #186: URL: https://github.com/apache/commons-configuration/pull/186#discussion_r896733283 ## src/main/java/org/apache/commons/configuration2/convert/PropertyConverter.java: ## @@ -607,12 +612,22 @@ static Object toInternetAddress(final Object value) throws ConversionException { if (value.getClass().getName().equals(INTERNET_ADDRESS_CLASSNAME)) { return value; } +if (value.getClass().getName().equals(INTERNET_ADDRESS_CLASSNAME_JAKARTA)) { +return value; +} if (!(value instanceof String)) { throw new ConversionException("The value " + value + " can't be converted to a InternetAddress"); } try { -final Constructor ctor = Class.forName(INTERNET_ADDRESS_CLASSNAME).getConstructor(String.class); -return ctor.newInstance(value); +try { Review Comment: So this WILL cause a class cast exception? How is that ok? -- 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. To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [commons-configuration] garydgregory commented on a diff in pull request #186: [CONFIGURATION-813]: Support both javax and jakarta namespace in mailapi
garydgregory commented on code in PR #186: URL: https://github.com/apache/commons-configuration/pull/186#discussion_r896731746 ## src/test/java/org/apache/commons/configuration2/TestDataConfiguration.java: ## @@ -73,10 +73,13 @@ private static Date expectedDate() throws ParseException { /** * Create an instance of InternetAddress. This trick is necessary to compile and run the test with Java 1.3 and the - * javamail-1.4 which is not compatible with Java 1.3 + * javamail-1.4 which is not compatible with Java 1.3. + * + * javamail-2.0 had a namespace change, moving javax.mail.* to jakarta.mail.*. This test verifies if we have + * javax.mail.* in the classpath before trying the Jakarta classes. */ private Object createInternetAddress(final String email) throws Exception { -final Class cls = Class.forName("javax.mail.internet.InternetAddress"); +final Class cls = Class.forName("jakarta.mail.internet.InternetAddress"); Review Comment: Reuse the constant you created above. -- 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. To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [commons-configuration] garydgregory commented on a diff in pull request #186: [CONFIGURATION-813]: Support both javax and jakarta namespace in mailapi
garydgregory commented on code in PR #186: URL: https://github.com/apache/commons-configuration/pull/186#discussion_r896730985 ## src/main/java/org/apache/commons/configuration2/convert/PropertyConverter.java: ## @@ -70,6 +70,9 @@ public final class PropertyConverter { /** The fully qualified name of {@code javax.mail.internet.InternetAddress} */ private static final String INTERNET_ADDRESS_CLASSNAME = "javax.mail.internet.InternetAddress"; +/** The fully qualified name of {@code jakarta.mail.internet.InternetAddress} */ Review Comment: Maybe rename the other constant to have a JAVAX postfix? -- 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. To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org