logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1501492 - /logging/log4j/log4j2/trunk/flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/Agent.java
Date Tue, 09 Jul 2013 19:45:31 GMT
Author: ggregory
Date: Tue Jul  9 19:45:31 2013
New Revision: 1501492

URL: http://svn.apache.org/r1501492
Log:
Simplify with Integers.parseInt().

Modified:
    logging/log4j/log4j2/trunk/flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/Agent.java

Modified: logging/log4j/log4j2/trunk/flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/Agent.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/Agent.java?rev=1501492&r1=1501491&r2=1501492&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/Agent.java
(original)
+++ logging/log4j/log4j2/trunk/flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/Agent.java
Tue Jul  9 19:45:31 2013
@@ -20,6 +20,7 @@ import org.apache.logging.log4j.Logger;
 import org.apache.logging.log4j.core.config.plugins.Plugin;
 import org.apache.logging.log4j.core.config.plugins.PluginAttr;
 import org.apache.logging.log4j.core.config.plugins.PluginFactory;
+import org.apache.logging.log4j.core.helpers.Integers;
 import org.apache.logging.log4j.status.StatusLogger;
 
 /**
@@ -72,22 +73,18 @@ public final class Agent {
      */
     @PluginFactory
     public static Agent createAgent(@PluginAttr("host") String host,
-                                    @PluginAttr("port") final String port) {
-        if (host == null) {
-            host = DEFAULT_HOST;
-        }
-
-        int portNum;
-        if (port != null) {
-            try {
-                portNum = Integer.parseInt(port);
-            } catch (final Exception ex) {
-                LOGGER.error("Error parsing port number " + port, ex);
-                return null;
-            }
-        } else {
-            portNum = DEFAULT_PORT;
-        }
-        return new Agent(host, portNum);
-    }
+			@PluginAttr("port") final String port) {
+		if (host == null) {
+			host = DEFAULT_HOST;
+		}
+
+		int portNum;
+		try {
+			portNum = Integers.parseInt(port, DEFAULT_PORT);
+		} catch (final Exception ex) {
+			LOGGER.error("Error parsing port number " + port, ex);
+			return null;
+		}
+		return new Agent(host, portNum);
+	}
 }



Mime
View raw message