cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject [10/22] git commit: updated refs/heads/saml2 to 54986d5
Date Mon, 18 Aug 2014 09:43:35 GMT
CLOUDSTACK-7177: Fixed AlertSyslogAppender does not honor a non-default port in sysloghost
parameter


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/97f5281c
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/97f5281c
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/97f5281c

Branch: refs/heads/saml2
Commit: 97f5281cf46e686d23df0fe0b1db0a6b6d591944
Parents: aadb5f4
Author: Anshul Gangwar <anshul.gangwar@citrix.com>
Authored: Thu Jul 24 10:58:05 2014 +0530
Committer: Devdeep Singh <devdeep@gmail.com>
Committed: Mon Aug 18 11:38:29 2014 +0530

----------------------------------------------------------------------
 .../cloudstack/syslog/AlertsSyslogAppender.java | 32 ++++++++++++++------
 1 file changed, 22 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/97f5281c/plugins/alert-handlers/syslog-alerts/src/org/apache/cloudstack/syslog/AlertsSyslogAppender.java
----------------------------------------------------------------------
diff --git a/plugins/alert-handlers/syslog-alerts/src/org/apache/cloudstack/syslog/AlertsSyslogAppender.java
b/plugins/alert-handlers/syslog-alerts/src/org/apache/cloudstack/syslog/AlertsSyslogAppender.java
index 50ccbc1..5f6e8ec 100644
--- a/plugins/alert-handlers/syslog-alerts/src/org/apache/cloudstack/syslog/AlertsSyslogAppender.java
+++ b/plugins/alert-handlers/syslog-alerts/src/org/apache/cloudstack/syslog/AlertsSyslogAppender.java
@@ -157,13 +157,25 @@ public class AlertsSyslogAppender extends AppenderSkeleton {
 
     private boolean validateIpAddresses() {
         for (String ipAddress : _syslogHostsList) {
-            if (ipAddress.trim().equalsIgnoreCase("localhost")) {
-                continue;
-            }
-            if (!NetUtils.isValidIp(ipAddress)) {
+            String[] hostTokens = (ipAddress.trim()).split(":");
+            String ip = hostTokens[0];
+
+            if (hostTokens.length >= 1 && hostTokens.length <= 2) {
+                if (hostTokens.length == 2 && !NetUtils.isValidPort(hostTokens[1]))
{
+                    return false;
+                }
+                if (ip.equalsIgnoreCase("localhost")) {
+                    continue;
+                }
+                if (!NetUtils.isValidIp(ip)) {
+                    return false;
+                }
+            } else
+            {
                 return false;
             }
         }
+
         return true;
     }
 
@@ -265,7 +277,7 @@ public class AlertsSyslogAppender extends AppenderSkeleton {
             return;
         }
 
-        this._facility = facility;
+        _facility = facility;
         if (_syslogAppenders != null && !_syslogAppenders.isEmpty()) {
             for (SyslogAppender syslogAppender : _syslogAppenders) {
                 syslogAppender.setFacility(facility);
@@ -299,8 +311,8 @@ public class AlertsSyslogAppender extends AppenderSkeleton {
     }
 
     public void setSyslogHosts(String syslogHosts) {
-        this._syslogHosts = syslogHosts;
-        this.setSyslogAppenders();
+        _syslogHosts = syslogHosts;
+        setSyslogAppenders();
     }
 
     public String getDelimiter() {
@@ -308,7 +320,7 @@ public class AlertsSyslogAppender extends AppenderSkeleton {
     }
 
     public void setDelimiter(String delimiter) {
-        this._delimiter = delimiter;
+        _delimiter = delimiter;
     }
 
     public String getPairDelimiter() {
@@ -316,7 +328,7 @@ public class AlertsSyslogAppender extends AppenderSkeleton {
     }
 
     public void setPairDelimiter(String pairDelimiter) {
-        this._pairDelimiter = pairDelimiter;
+        _pairDelimiter = pairDelimiter;
     }
 
     public String getKeyValueDelimiter() {
@@ -324,6 +336,6 @@ public class AlertsSyslogAppender extends AppenderSkeleton {
     }
 
     public void setKeyValueDelimiter(String keyValueDelimiter) {
-        this._keyValueDelimiter = keyValueDelimiter;
+        _keyValueDelimiter = keyValueDelimiter;
     }
 }


Mime
View raw message