Re: [PR] Fix SocketFactory creation (geronimo-mail)

sebsoftware (via GitHub) <[email protected]>
Newsgroups gmane.comp.java.geronimo.devel
Message-ID <PR_kwDONrBQJs6yGL-T-5ea8fc5f-7c15-43d5-9cfc-7b92f18319b3@gitbox.apache.org>
sebsoftware commented on code in PR #2:
URL: https://github.com/apache/geronimo-mail/pull/2#discussion_r2508022611


##########
geronimo-mail_2.1_impl/geronimo-mail_2.1_provider/src/main/java/org/apache/geronimo/mail/util/MailConnection.java:
##########
@@ -354,10 +354,22 @@ private boolean createSocketFromFactory(boolean ssl, boolean layer) throws IOExc
                 // done indirectly, we need to invoke the method using reflection.
                 // This retrieves a factory instance.
                 //Method getDefault = factoryClass.getMethod("getDefault", new Class[0]); //TODO check instantiation of socket factory
-                Object defFactory = factoryClass.newInstance();// getDefault.invoke(new Object(), new Object[0]);
+                // Object defFactory = factoryClass.newInstance();// getDefault.invoke(new Object(), new Object[0]);
                 // now that we have the factory, there are two different createSocket() calls we use,
                 // depending on whether we have a localAddress override.
 
+                Object defFactory = null;
+                try {
+                	defFactory = factoryClass.newInstance();
+                } catch (Throwable t) {
+                	Method getDefault = factoryClass.getMethod("getDefault", new Class[0]); //TODO check instantiation of socket factory

Review Comment:
   That gives it only more details, else it would be already handled by the surrounding try / catch (Line 348 & 403)



-- 
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: dev-unsubscribe-nmThH5wfGryY1pf4d8vP8EB+6BGkLq7r@public.gmane.org

For queries about this service, please contact Infrastructure at:
users-pF6z+fRhj9EyzMRdD/[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.