You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by nt...@apache.org on 2007/02/10 00:31:30 UTC

svn commit: r505551 - in /webservices/axis2/trunk/java/modules: jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java metadata/src/org/apache/axis2/jaxws/util/WSDL4JWrapper.java

Author: nthaker
Date: Fri Feb  9 15:31:29 2007
New Revision: 505551

URL: http://svn.apache.org/viewvc?view=rev&rev=505551
Log:
Axis2-2158
Adding java2 Security in ServiceDelegate and WSDL4JWrapper code.

Modified:
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java
    webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/util/WSDL4JWrapper.java

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java?view=diff&rev=505551&r1=505550&r2=505551
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java Fri Feb  9 15:31:29 2007
@@ -398,14 +398,48 @@
  *
  */
 class JAXWSThreadFactory implements ThreadFactory {
+	private static final Log log = LogFactory.getLog(JAXWSThreadFactory.class);
     private static int groupNumber = 0;
     private int threadNumber = 0;
     // We put the threads into a unique thread group only for ease of identifying them
-    private ThreadGroup threadGroup = new ThreadGroup("JAX-WS Default Executor Group " + groupNumber++);
-    public Thread newThread(Runnable r) {
+    private  ThreadGroup threadGroup = null;
+    public Thread newThread(final Runnable r) {
+    	if(threadGroup == null){
+    		try{
+    			threadGroup =(ThreadGroup) AccessController.doPrivileged(
+                        new PrivilegedExceptionAction() {
+                            public Object run() {
+                            	return new ThreadGroup("JAX-WS Default Executor Group " + groupNumber++);  
+                            }
+                        }
+            		);
+            }catch(PrivilegedActionException e){
+            	if (log.isDebugEnabled()) {
+                    log.debug("Exception thrown from AccessController: " + e);
+                }
+                throw ExceptionFactory.makeWebServiceException(e.getException());
+            }
+    	}
+    	
         threadNumber++;
-        Thread returnThread = new Thread(threadGroup, r);
-        returnThread.setDaemon(true);
+        Thread returnThread = null;
+        try{
+        	returnThread =(Thread) AccessController.doPrivileged(
+                    new PrivilegedExceptionAction() {
+                        public Object run() {
+                        	Thread newThread =  new Thread(threadGroup, r);
+                        	newThread.setDaemon(true);
+                        	return newThread;
+                        }
+                    }
+        		);        	
+        }catch(PrivilegedActionException e){
+        	if (log.isDebugEnabled()) {
+                log.debug("Exception thrown from AccessController: " + e);
+            }
+            throw ExceptionFactory.makeWebServiceException(e.getException());
+        }
+        
         return returnThread;
     }
     

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/util/WSDL4JWrapper.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/util/WSDL4JWrapper.java?view=diff&rev=505551&r1=505550&r2=505551
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/util/WSDL4JWrapper.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/util/WSDL4JWrapper.java Fri Feb  9 15:31:29 2007
@@ -44,9 +44,12 @@
 import javax.xml.namespace.QName;
 
 import org.apache.axis2.java.security.AccessController;
+import org.apache.axis2.jaxws.ExceptionFactory;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 public class WSDL4JWrapper implements WSDLWrapper {
-    
+	private static final Log log = LogFactory.getLog(WSDL4JWrapper.class);
 	private Definition wsdlDefinition = null;
 	private URL wsdlURL;
 	
@@ -55,15 +58,30 @@
 		super();
 		this.wsdlURL = wsdlURL;
 		
-        WSDLReader reader = getWSDLReader();
+		
 		
 		try {
 			URL url = new URL(wsdlURL.toString());
 			URLConnection urlCon = url.openConnection();
 			InputStream is = urlCon.getInputStream();
 			is.close();
-			String explicitWsdl = urlCon.getURL().toString();
-			wsdlDefinition = reader.readWSDL(explicitWsdl);
+			final String explicitWsdl = urlCon.getURL().toString();
+			try{
+			wsdlDefinition = (Definition)AccessController.doPrivileged(
+                    new PrivilegedExceptionAction() {
+                        public Object run() throws WSDLException {
+                        	WSDLReader reader = getWSDLReader();
+                        	return reader.readWSDL(explicitWsdl);
+                        }
+                    }
+        		);
+			}catch(PrivilegedActionException e){
+	        	if (log.isDebugEnabled()) {
+	                log.debug("Exception thrown from AccessController: " + e);
+	            }
+	            throw ExceptionFactory.makeWebServiceException(e.getException());
+	        }
+		
 		}
 		catch(FileNotFoundException ex) {
 			throw ex;



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