continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r331552 - /maven/continuum/trunk/continuum-notifiers/continuum-notifier-jabber/src/main/java/org/apache/maven/continuum/notification/jabber/JabberContinuumNotifier.java
Date Mon, 07 Nov 2005 17:30:48 GMT
Author: evenisse
Date: Mon Nov  7 09:30:42 2005
New Revision: 331552

URL: http://svn.apache.org/viewcvs?rev=331552&view=rev
Log:
o Fix check of boolean value
o Fix parsing of jabber port

Thanks to Frank Zhao

Modified:
    maven/continuum/trunk/continuum-notifiers/continuum-notifier-jabber/src/main/java/org/apache/maven/continuum/notification/jabber/JabberContinuumNotifier.java

Modified: maven/continuum/trunk/continuum-notifiers/continuum-notifier-jabber/src/main/java/org/apache/maven/continuum/notification/jabber/JabberContinuumNotifier.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-notifiers/continuum-notifier-jabber/src/main/java/org/apache/maven/continuum/notification/jabber/JabberContinuumNotifier.java?rev=331552&r1=331551&r2=331552&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-notifiers/continuum-notifier-jabber/src/main/java/org/apache/maven/continuum/notification/jabber/JabberContinuumNotifier.java
(original)
+++ maven/continuum/trunk/continuum-notifiers/continuum-notifier-jabber/src/main/java/org/apache/maven/continuum/notification/jabber/JabberContinuumNotifier.java
Mon Nov  7 09:30:42 2005
@@ -252,23 +252,28 @@
     {
         if ( configuration.containsKey( "port" ) )
         {
-            return ( (Integer) configuration.get( "port" ) ).intValue();
-        }
-        else
-        {
-            if ( port > 0 )
+            try
             {
-                return port;
+                return Integer.parseInt( (String) configuration.get( "port" ) );
             }
-            else if ( isSslConnection ( configuration ) )
+            catch ( NumberFormatException e )
             {
-                return 5223;
-            }
-            else
-            {
-                return 5222;
+                getLogger().error( "jabber port isn't a number.", e );
             }
         }
+
+        if ( port > 0 )
+        {
+            return port;
+        }
+        else if ( isSslConnection ( configuration ) )
+        {
+            return 5223;
+        }
+        else
+        {
+            return 5222;
+        }
     }
 
     private String getUsername( Map configuration )
@@ -302,7 +307,7 @@
     {
         if ( configuration.containsKey( "sslConnection" ) )
         {
-            return Boolean.getBoolean( (String ) configuration.get( "sslConnection" ) );
+            return convertBoolean( (String ) configuration.get( "sslConnection" ) );
         }
 
         return sslConnection;
@@ -322,7 +327,19 @@
     {
         if ( configuration.containsKey( "isGroup" ) )
         {
-            return ( (Boolean) configuration.get( "isGroup" ) ).booleanValue();
+            return convertBoolean( (String) configuration.get( "isGroup" ) );
+        }
+        else
+        {
+            return false;
+        }
+    }
+
+    private boolean convertBoolean( String value )
+    {
+        if ( "true".equalsIgnoreCase( value ) || "on".equalsIgnoreCase( value ) || "yes".equalsIgnoreCase(
value ) )
+        {
+            return true;
         }
         else
         {



Mime
View raw message