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/06/28 21:32:14 UTC

svn commit: r551676 - in /webservices/axis2/trunk/java/modules: jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/JAXBBlockImpl.java metadata/src/org/apache/axis2/jaxws/description/impl/URIResolverImpl.java

Author: nthaker
Date: Thu Jun 28 12:32:12 2007
New Revision: 551676

URL: http://svn.apache.org/viewvc?view=rev&rev=551676
Log:
JIRA = Axis2-2875
Also adding Indentation changes to JAXBBlockImpl

Modified:
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/JAXBBlockImpl.java
    webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/URIResolverImpl.java

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/JAXBBlockImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/JAXBBlockImpl.java?view=diff&rev=551676&r1=551675&r2=551676
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/JAXBBlockImpl.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/JAXBBlockImpl.java Thu Jun 28 12:32:12 2007
@@ -319,23 +319,23 @@
 			Object jbo = b;
                         
 			if (isList || (type!=null && type.isArray())) {
-                            if(log.isDebugEnabled()){
-                                log.debug("marshalling type which is a List or Array");
-                            }
-                            //We conver to xsdListString only if the type is not known
-                            // to the context. In case a jaxbcontext is created from package
-                            // the array types or list are not know to the context.
-                            if(ctype == JAXBUtils.CONSTRUCTION_TYPE.BY_CONTEXT_PATH){
-				QName qName = XMLRootElementUtil
-						.getXmlRootElementQNameFromObject(b);
-				String text = XSDListUtils
-						.toXSDListString(getTypeEnabledObject(b));
-				jbo = new JAXBElement(qName, String.class, text);
-                            }
-                            else if(ctype == JAXBUtils.CONSTRUCTION_TYPE.BY_CLASS_ARRAY){
-                                //do nothing common array types should be know to the jaxbcontext.
-                                //so do not use xsdListString conversion.
-                            }
+				if(log.isDebugEnabled()){
+					log.debug("marshalling type which is a List or Array");
+				}
+				//We conver to xsdListString only if the type is not known
+				// to the context. In case a jaxbcontext is created from package
+				// the array types or list are not know to the context.
+				if(ctype == JAXBUtils.CONSTRUCTION_TYPE.BY_CONTEXT_PATH){
+					QName qName = XMLRootElementUtil
+					.getXmlRootElementQNameFromObject(b);
+					String text = XSDListUtils
+					.toXSDListString(getTypeEnabledObject(b));
+					jbo = new JAXBElement(qName, String.class, text);
+				}
+				else if(ctype == JAXBUtils.CONSTRUCTION_TYPE.BY_CLASS_ARRAY){
+					//do nothing common array types should be know to the jaxbcontext.
+					//so do not use xsdListString conversion.
+				}
 			}
 			
 			// When JAXBContext is created using a context path, it will not include Enum classes

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/URIResolverImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/URIResolverImpl.java?view=diff&rev=551676&r1=551675&r2=551676
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/URIResolverImpl.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/URIResolverImpl.java Thu Jun 28 12:32:12 2007
@@ -29,6 +29,7 @@
 import java.io.InputStream;
 import java.net.MalformedURLException;
 import java.net.URI;
+import java.net.URISyntaxException;
 import java.net.URL;
 
 /** This class is used to locate xml schemas that are imported by wsdl documents. */
@@ -69,7 +70,9 @@
             try {
                 // if the location is an absolute path, build a URL directly
                 // from it
-
+            	if(log.isDebugEnabled()){
+            		log.debug("Base URI not null");
+            	}
                 if (isAbsolute(schemaLocation)) {
                     if(log.isDebugEnabled()) {
                         log.debug("Retrieving input stream for absolute schema location: "
@@ -79,7 +82,21 @@
                 }
 
                 else {
-                    pathURI = new URI(baseUri);
+                    if(log.isDebugEnabled()){
+                        log.debug("schemaLocation not in absolute path");
+                    }
+                    try{
+                        pathURI = new URI(baseUri);
+                    }catch(URISyntaxException e){
+                        // Got URISyntaxException, Creation of URI requires 
+                        // that we use special escape characters in path.
+                        // The URI constructor below does this for us, so lets use that.
+                        if(log.isDebugEnabled()){
+                            log.debug("Got URISyntaxException. Exception Message = "+e.getMessage());
+                            log.debug("Implementing alternate way to create URI");
+                        }
+                       pathURI = new URI(null, null, baseUri, null);
+                     }
                     pathURIStr = schemaLocation;
                     // If this is absolute we need to resolve the path without the 
                     // scheme information
@@ -90,7 +107,19 @@
                         }
                         URL url = new URL(baseUri);
                         if (url != null) {
-                            URI tempURI = new URI(url.getPath());
+                            URI tempURI;
+                            try{
+                                tempURI = new URI(url.getPath());
+                            }catch(URISyntaxException e){
+                                //Got URISyntaxException, Creation of URI requires 
+                                // that we use special escape characters in path.
+                                // The URI constructor below does this for us, so lets use that.
+                                if(log.isDebugEnabled()){
+                                    log.debug("Got URISyntaxException. Exception Message = "+e.getMessage());
+                                    log.debug("Implementing alternate way to create URI");
+                                }
+                                tempURI = new URI(null, null, url.getPath(), null);
+                            }
                             URI resolvedURI = tempURI.resolve(schemaLocation);
                             // Add back the scheme to the resolved path
                             pathURIStr = constructPath(url, resolvedURI);
@@ -128,6 +157,7 @@
                 }
             } catch (Exception e) {
                 if(log.isDebugEnabled()) {
+                	log.debug("Exception occured in resolveEntity, ignoring exception continuing processing "+e.getMessage());
                     log.debug(e);
                 }
             }
@@ -221,24 +251,40 @@
             // Allow for http or https
             if (baseURL.getProtocol() != null && (baseURL.getProtocol().equals(
                     HTTP_PROTOCOL) || baseURL.getProtocol().equals(HTTPS_PROTOCOL))) {
+            	if(log.isDebugEnabled()){
+            		log.debug("Constructing path with http/https protocol");
+            	}
                 url = new URL(baseURL.getProtocol(), baseURL.getHost(), baseURL.getPort(),
                               resolvedURI.toString());
-                importLocation = url.toString();
+                if (log.isDebugEnabled()) {
+					log.debug("URL = " + url);
+				}
+               
             }
             // Check for file
             else if (baseURL.getProtocol() != null && baseURL.getProtocol().equals(FILE_PROTOCOL)) {
+            	if(log.isDebugEnabled()){
+            		log.debug("Constructing path with file protocol");
+            	}
                 url = new URL(baseURL.getProtocol(), baseURL.getHost(), resolvedURI.toString());
-                importLocation = url.toString();
             }
-            // Check for jar
+            //Check for jar
             else if (baseURL.getProtocol() != null && baseURL.getProtocol().equals(JAR_PROTOCOL)) {
-                importLocation = resolvedURI.toString();  
-                if(importLocation.startsWith(":")){
-                  importLocation = "jar" + importLocation; 
-                } else {
-                  importLocation = "jar:" + importLocation; 
-                }
+            	if(log.isDebugEnabled()){
+            		log.debug("Constructing path with jar protocol");
+            	}
+            	url = new URL(baseURL.getProtocol(), baseURL.getHost(), resolvedURI.toString());
+            }
+            else{
+            	if(log.isDebugEnabled()){
+            		if(baseURL !=null){
+            			log.debug("unknown protocol in url "+ baseURL.getProtocol());
+            		}else{
+            			log.debug("baseURL is NULL");
+            		}
+            	}
             }
+                        
         }
         catch (MalformedURLException e) {
             throw ExceptionFactory.makeWebServiceException(Messages.getMessage("schemaImportError",
@@ -246,11 +292,12 @@
                                                                                baseURL.toString()),
                                                            e);
         }
-        if (importLocation == null) {
+        if (url == null) {
             throw ExceptionFactory.makeWebServiceException(Messages.getMessage("schemaImportError",
                                                                                resolvedURI.toString(),
                                                                                baseURL.toString()));
         }
+        importLocation = url.toString();
         return importLocation;
     }
 



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