axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r636038 - in /webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2: receivers/AbstractMessageReceiver.java transport/mail/server/MailAddress.java
Date Tue, 11 Mar 2008 18:01:24 GMT
Author: dims
Date: Tue Mar 11 11:01:22 2008
New Revision: 636038

URL: http://svn.apache.org/viewvc?rev=636038&view=rev
Log:
Fix for AXIS2-3593 - AbstractMessageReceiver defines custom class loader without using doPrivileged
Fix for AXIS2-3594 - MailAddress defines equals() but not hashCode()


Modified:
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/receivers/AbstractMessageReceiver.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/mail/server/MailAddress.java

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/receivers/AbstractMessageReceiver.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/receivers/AbstractMessageReceiver.java?rev=636038&r1=636037&r2=636038&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/receivers/AbstractMessageReceiver.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/receivers/AbstractMessageReceiver.java
Tue Mar 11 11:01:22 2008
@@ -47,6 +47,8 @@
 
 import java.lang.reflect.Method;
 import java.net.URL;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 
 public abstract class AbstractMessageReceiver implements MessageReceiver {
     protected static final Log log = LogFactory.getLog(AbstractMessageReceiver.class);
@@ -58,7 +60,7 @@
     public static final String DO_ASYNC = "messageReceiver.invokeOnSeparateThread";
 
     // Place to store previous values
-    public class ThreadContextDescriptor {
+    public static class ThreadContextDescriptor {
         public ClassLoader oldClassLoader;
         public MessageContext oldMessageContext;
     }
@@ -118,10 +120,10 @@
      * @param msgContext the current MessageContext
      * @return a ThreadContextDescriptor containing the old values
      */
-    protected ThreadContextDescriptor setThreadContext(MessageContext msgContext) {
+    protected ThreadContextDescriptor setThreadContext(final MessageContext msgContext) {
         ThreadContextDescriptor tc = new ThreadContextDescriptor();
         tc.oldMessageContext = (MessageContext) MessageContext.currentMessageContext.get();
-        ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
+        final ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
         tc.oldClassLoader = contextClassLoader;
 
         AxisService service = msgContext.getAxisService();
@@ -131,10 +133,15 @@
 
             if (serviceTCCL.equals(Constants.TCCL_COMPOSITE)) {
                 Thread.currentThread().setContextClassLoader(
-                        new MultiParentClassLoader(new URL[] {}, new ClassLoader[] {
-                                msgContext.getAxisService().getClassLoader(),
-                                contextClassLoader,
-                        }));
+                	(ClassLoader) AccessController.doPrivileged(new PrivilegedAction() {
+                		public Object run() {
+                			return new MultiParentClassLoader(new URL[] {}, 
+                				new ClassLoader[] {
+                					msgContext.getAxisService().getClassLoader(),
+                					contextClassLoader
+                			});
+                		}
+                	}));
             } else if (serviceTCCL.equals(Constants.TCCL_SERVICE)) {
                 Thread.currentThread().setContextClassLoader(
                         msgContext.getAxisService().getClassLoader()

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/mail/server/MailAddress.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/mail/server/MailAddress.java?rev=636038&r1=636037&r2=636038&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/mail/server/MailAddress.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/mail/server/MailAddress.java
Tue Mar 11 11:01:22 2008
@@ -35,11 +35,41 @@
         this.mailAddy = mAddy;
     }
 
-    public boolean equals(Object addr) {
-        return this.mailAddy.equals(addr);
-    }
+    
 
-    public String toString() {
+    /**
+	 * @see java.lang.Object#hashCode()
+	 */
+	public int hashCode() {
+		final int prime = 31;
+		int result = 1;
+		result = prime * result
+				+ ((mailAddy == null) ? 0 : mailAddy.hashCode());
+		return result;
+	}
+
+
+
+	/**
+	 * @see java.lang.Object#equals(java.lang.Object)
+	 */
+	public boolean equals(Object obj) {
+		if (this == obj)
+			return true;
+		if (!(obj instanceof MailAddress))
+			return false;
+		final MailAddress other = (MailAddress) obj;
+		if (mailAddy == null) {
+			if (other.mailAddy != null)
+				return false;
+		} else if (!mailAddy.equals(other.mailAddy))
+			return false;
+		return true;
+	}
+
+
+
+	public String toString() {
         return this.mailAddy;
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message