commons-beanutils
commons-beanutils copied to clipboard
BEANUTILS-566: Use ContextClassLoader for Instantiating Loggers
https://issues.apache.org/jira/browse/BEANUTILS-566
Swaps our the thread context classloader to avoid memory leaks in some scenarios.
20 files changed files and zero tests is not good.
Try and see if Mockito helps.
Hi @garydgregory ,
I've found a way to test that the context classloader is used. I also tested the negative case to verify it's not called. There may be an easier way to test, but I simply created my own classloader and load the tests from the target/test-classes directory. I tried to add comments to make it more clear on what is occurring.
I'm not sure how to run the jobs -- they failed due to check-style violations which I've since fixed.
I would appreciate any feedback for improvements. Thank you.
I pushed up another test which also let the builds run.
Everything passed except for Java 23, but those failures are unrelated to my changes from the looks of.
Error: Failures:
Error: SqlTimeConverterTestCase.testLocale:118->AbstractDateConverterTest.validConversion:572 Converting 'java.lang.String' value '3:06 pm' threw org.apache.commons.beanutils2.ConversionException: Error converting 'String' to 'java.sql.Time' using pattern 'h:mm a', localized pattern 'h:mm a', errorIndex 4, calendar type GregorianCalendar, this org.apache.commons.beanutils2.sql.converters.SqlTimeConverter[UseDefault=false, UseLocaleFormat=true]
Error: SqlTimestampConverterTestCase.testLocale:138->AbstractDateConverterTest.validConversion:572 Converting 'java.lang.String' value '3/21/06, 3:06 PM' threw org.apache.commons.beanutils2.ConversionException: Error converting 'String' to 'java.sql.Timestamp' using pattern 'M/d/yy, h:mm a', localized pattern 'M/d/yy, h:mm a', errorIndex 13, calendar type GregorianCalendar, this org.apache.commons.beanutils2.sql.converters.SqlTimestampConverter[UseDefault=false, UseLocaleFormat=true]
[INFO]
@garydgregory following up again for any feedback. And if the community would prefer not to use this change, that's fine, but, please let me know. Thank you.