james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nor...@apache.org
Subject svn commit: r911868 - /james/server/trunk/user-library/src/main/java/org/apache/james/impl/jamesuser/LocalJamesUsersRepository.java
Date Fri, 19 Feb 2010 17:13:08 GMT
Author: norman
Date: Fri Feb 19 17:13:08 2010
New Revision: 911868

URL: http://svn.apache.org/viewvc?rev=911868&view=rev
Log:
Check if wrapped UsersRepository is really an instanceof JamesUsersRepository (JAMES-970)

Modified:
    james/server/trunk/user-library/src/main/java/org/apache/james/impl/jamesuser/LocalJamesUsersRepository.java

Modified: james/server/trunk/user-library/src/main/java/org/apache/james/impl/jamesuser/LocalJamesUsersRepository.java
URL: http://svn.apache.org/viewvc/james/server/trunk/user-library/src/main/java/org/apache/james/impl/jamesuser/LocalJamesUsersRepository.java?rev=911868&r1=911867&r2=911868&view=diff
==============================================================================
--- james/server/trunk/user-library/src/main/java/org/apache/james/impl/jamesuser/LocalJamesUsersRepository.java
(original)
+++ james/server/trunk/user-library/src/main/java/org/apache/james/impl/jamesuser/LocalJamesUsersRepository.java
Fri Feb 19 17:13:08 2010
@@ -38,28 +38,44 @@
      * @see org.apache.james.impl.jamesuser.JamesUsersRepository#setEnableAliases(boolean)
      */
     public void setEnableAliases(boolean enableAliases) {
-        ((JamesUsersRepository) users).setEnableAliases(enableAliases);
+        if (users instanceof JamesUsersRepository) {
+            ((JamesUsersRepository) users).setEnableAliases(enableAliases);
+        } else {
+            throw new UnsupportedOperationException("Not supported by this implementation");
+        }
     }
 
     /**
      * @see org.apache.james.impl.jamesuser.JamesUsersRepository#setEnableForwarding(boolean)
      */
     public void setEnableForwarding(boolean enableForwarding) {
-        ((JamesUsersRepository) users).setEnableForwarding(enableForwarding);
+        if (users instanceof JamesUsersRepository) {
+            ((JamesUsersRepository) users).setEnableForwarding(enableForwarding);
+        } else {
+            throw new UnsupportedOperationException("Not supported by this implementation");
+        }
     }
 
     /**
      * @see org.apache.james.impl.jamesuser.JamesUsersRepository#setIgnoreCase(boolean)
      */
     public void setIgnoreCase(boolean ignoreCase) {
-        ((JamesUsersRepository) users).setIgnoreCase(ignoreCase);
+        if (users instanceof JamesUsersRepository) {
+            ((JamesUsersRepository) users).setIgnoreCase(ignoreCase);
+        } else {
+            throw new UnsupportedOperationException("Not supported by this implementation");
+        }
     }
 
     /**
      * @see org.apache.james.api.vut.VirtualUserTable#getMappings(java.lang.String, java.lang.String)
      */
     public Collection<String> getMappings(String user, String domain) throws ErrorMappingException
{
-        return ((JamesUsersRepository) users).getMappings(user, domain);
+        if (users instanceof JamesUsersRepository) {
+            return ((JamesUsersRepository) users).getMappings(user, domain);
+            
+        }
+        return null;
     }
 
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message