You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by wo...@apache.org on 2008/04/21 23:29:21 UTC

svn commit: r650276 - /webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/util/WSDL4JWrapper.java

Author: woodroy
Date: Mon Apr 21 14:29:20 2008
New Revision: 650276

URL: http://svn.apache.org/viewvc?rev=650276&view=rev
Log:
Add necessary doPrivs for getURLFromjar and getURLConnection

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

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?rev=650276&r1=650275&r2=650276&view=diff
==============================================================================
--- 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 Mon Apr 21 14:29:20 2008
@@ -178,9 +178,13 @@
                 });
         this.wsdlURL = wsdlURL;
        
-        try {
-            URLConnection urlCon = getURLConnection(this.wsdlURL);
-            InputStream is = null;
+        URLConnection urlCon;
+        try {        
+        	
+        	urlCon = getPrivilegedURLConnection(this.wsdlURL);
+
+        	InputStream is = null;
+            
             try {
                 is = getInputStream(urlCon);
             }
@@ -280,6 +284,20 @@
         return connection;
     }
     
+    private URLConnection getPrivilegedURLConnection(final URL url) throws IOException {
+        try {
+
+        	return (URLConnection) AccessController.doPrivileged( new PrivilegedExceptionAction() {
+                public Object run() throws IOException {
+                    return (getURLConnection(url));
+                }
+            });
+        
+        } catch (PrivilegedActionException e) {
+            throw (IOException) e.getException();
+        }
+    }
+
     private URLConnection openConnection(final URL url) throws IOException {
         try {
             return (URLConnection) AccessController.doPrivileged(new PrivilegedExceptionAction() {
@@ -313,13 +331,23 @@
                 log.debug("Could not get URL from classloader. Looking in a jar.");
             }
             if(classLoader instanceof URLClassLoader){
-                URLClassLoader urlLoader = (URLClassLoader)classLoader;
-                url = getURLFromJAR(urlLoader, wsdlURL);
+                final URLClassLoader urlLoader = (URLClassLoader)classLoader;
+                
+                url = (URL) AccessController.doPrivileged( new PrivilegedAction() {
+                    public Object run()  {
+                        return (getURLFromJAR(urlLoader, wsdlURL));
+                    }
+                });
+
             }
             else {
-                URLClassLoader nestedLoader = (URLClassLoader) getNestedClassLoader(URLClassLoader.class, classLoader);
+                final URLClassLoader nestedLoader = (URLClassLoader) getNestedClassLoader(URLClassLoader.class, classLoader);
                 if (nestedLoader != null) {
-                    url = getURLFromJAR(nestedLoader, wsdlURL);
+                    url = (URL) AccessController.doPrivileged( new PrivilegedAction() {
+                        public Object run()  {
+                            return (getURLFromJAR(nestedLoader, wsdlURL));
+                        }
+                    });
                 }
             }
         }
@@ -662,7 +690,8 @@
 
         if (wsdlExplicitURL != null) {
             try {
-                URLConnection urlConn = getURLConnection(wsdlURL);
+
+                URLConnection urlConn = getPrivilegedURLConnection(this.wsdlURL);
                 if(urlConn != null) {
                     try {
                         InputStream is = getInputStream(urlConn);



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