Author: mattsicker
Date: Tue Apr 15 04:57:04 2014
New Revision: 1587413
URL: http://svn.apache.org/r1587413
Log:
Use safer reflection instantiation.
Modified:
logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/MulticastDNSAdvertiser.java
Modified:
logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/MulticastDNSAdvertiser.java
URL:
http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/MulticastDNSAdvertiser.java?rev=1587413&r1=1587412&r2=1587413&view=diff
==============================================================================
---
logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/MulticastDNSAdvertiser.java
(original)
+++
logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/MulticastDNSAdvertiser.java
Tue Apr 15 04:57:04 2014
@@ -140,11 +140,15 @@ public class MulticastDNSAdvertiser impl
private static Object createJmDNSVersion1()
{
try {
- return jmDNSClass.newInstance();
+ return jmDNSClass.getConstructor().newInstance();
} catch (final InstantiationException e) {
LOGGER.warn("Unable to instantiate JMDNS", e);
} catch (final IllegalAccessException e) {
LOGGER.warn("Unable to instantiate JMDNS", e);
+ } catch (final NoSuchMethodException e) {
+ LOGGER.warn("Unable to instantiate JMDNS", e);
+ } catch (final InvocationTargetException e) {
+ LOGGER.warn("Unable to instantiate JMDNS", e);
}
return null;
}