-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Filip,
On 7/22/20 12:41, Filip Hanik wrote: > Hi Christopher, >>> environments. - Class<?> clazz = >>> Class.forName(className); - return >>> (AuthConfigFactory) clazz.getConstructor().newInstance(); + if >>> (className.equals("org.apache.catalina.authenticator.jaspic.AuthConf ig >> >>> FactoryImpl")) >>> { >> >> Why not use AuthConfigFactoryImpl.class.getName()? It may help in >> the future with refactoring. > > [Filip Hanik] Trying to avoid a circular dependency. You see the > javax/jakarta package should not import org.apache.catalina code. I > should be able to execute the AuthConfigFactory code without > needing to load > org.apache.catalina.authenticator.jaspic.AuthConfigFactoryImpl > class. The JVM is smart enough that if the execution doesn't enter > the if statement block, it won't attempt the classloading of the > AuthConfigFactoryImpl class. However, if the AuthConfigFactoryImpl > Class itself is part of the evaluation statement, it will be > loaded. > > The previous implementation also had it as a string, instead of > AuthConfigFactoryImpl.class.getName() for the same reason. > https://github.com/apache/tomcat/blob/35dc7b9288aad4a7d70750c157543d4f f1593c98/java/jakarta/security/auth/message/config/AuthConfigFactory.jav a#L48-L49 > > This way, I can build a jakarta.security.auth.message library, > that can be used without the org.apache.catalina library. That's a very good reason. Thanks for explaining. > I need to change my commit to use the constant, instead of the > duplicated string in the IF statement. > > if (className.equals(DEFAULT_JASPI_AUTHCONFIGFACTORYIMPL)) { return > new > org.apache.catalina.authenticator.jaspic.AuthConfigFactoryImpl(); } > else { Class<?> clazz = Class.forName(className); return > (AuthConfigFactory) clazz.getConstructor().newInstance(); } :) - -chris -----BEGIN PGP SIGNATURE----- Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/ iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAl8ZyrUACgkQHPApP6U8 pFghOg//UxcPA7Xm+SKXtyCWEIcabjFkbdHv9o8kOHTiWVSUOrhXLBvTznDKYmYk +5zFjxsFbBjj1amQnGER/3zJSSJmvdcEUohpHpYHUHFGLh59YyXTVb0ou8PSiX+B iFEZCqKrkylZPCn21tPXN4wgmnvQxcD9S3++vZBWyCCiQw/BoUYwYGLtg9/sgCjj eqk2r/yqGRlVtHsMEu04wMadcqpum6f14LO1b8J1C5jP0N9fwiGTEsD4HXskcUfQ PeDjHtG6tJPXwfYjwRjzZolQIFmQwJ1B6WLufsyw0ZrUVBUENkU4xQwBy3pcVewn 0xc9+vgg+VSXblrDMnoswUBf2hLmfmpw49evcjeKSY7q0G0Fdoe1lUmt+OM74ppK EZ6qmvCphWtXakyCU5uXx82nQMsNXdwmgLG3Dni4ya79dVoGvn8j3Guh/7g45Jet 0bc7x7KsouqJIbqQAPqdt8E2xKRARsdUE4BH9S0ENkvTqnhhbCWmlxJk3CiPpwoy 3zD5xt9CoXuKX/CjK92hP+nw4b1j+Mdhmwj4whM4FbcvLC6Rq8JXt0obysArweT8 FbfZD45OsWqbgVrVpwcCt19z25+6Ar02DvUz0CkI1sbxzS+hd1yhp2BRbiqTd6HY EkUodl2R7H95ZmIRZ0QhcnEyq5tPJUcspXLvmzQ5Li25oJEWLrc= =XYLJ -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org