You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@synapse.apache.org by Andreas Veithen <an...@skynet.be> on 2008/05/01 13:49:11 UTC

Re: svn commit: r652335 - in /synapse/trunk/java/modules/core/src/main/java/org/apache/synapse: config/SynapseConfigUtils.java core/axis2/CustomURIResolver.java core/axis2/CustomWSDLLocator.java

Asankha,

Your modification changes the behavior of  
CustomURIResolver#resolveEntity in the case where resourceMap != null  
and ResourceMap#resolve returns null: instead of resolving the URI  
using SynapseConfigUtils.resolveRelativeURI, it now returns null. Is  
this intentional or a mistake?

Andreas

On 30 Apr 2008, at 13:25, asankha@apache.org wrote:

> Author: asankha
> Date: Wed Apr 30 04:25:31 2008
> New Revision: 652335
>
> URL: http://svn.apache.org/viewvc?rev=652335&view=rev
> Log:
> fix SYNAPSE-274
>
> Modified:
>    synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/ 
> config/SynapseConfigUtils.java
>    synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/ 
> core/axis2/CustomURIResolver.java
>    synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/ 
> core/axis2/CustomWSDLLocator.java
>
> Modified: synapse/trunk/java/modules/core/src/main/java/org/apache/ 
> synapse/config/SynapseConfigUtils.java
> URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/SynapseConfigUtils.java?rev=652335&r1=652334&r2=652335&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/ 
> config/SynapseConfigUtils.java (original)
> +++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/ 
> config/SynapseConfigUtils.java Wed Apr 30 04:25:31 2008
> @@ -402,7 +402,7 @@
>         return url;
>     }
>
> -    public static InputSource resolveRelativeURI(String  
> parentLocation, String relativeLocation) {
> +    public static String resolveRelativeURI(String parentLocation,  
> String relativeLocation) {
>
>         if (relativeLocation == null) {
>             throw new IllegalArgumentException("Import URI cannot be  
> null");
> @@ -416,21 +416,21 @@
>         try {
>             importUri = new URI(relativeLocation);
>             if (importUri.isAbsolute()) {
> -                return getInputSourceFormURI(importUri);
> +                return importUri.toString();
>             }
>         } catch (URISyntaxException e) {
> -            handleException("Invalid URI", e);
> +            handleException("Invalid URI : " + relativeLocation, e);
>         }
>
>         if (parentLocation == null) {
> -            return getInputSourceFormURI(importUri);
> +            return importUri.toString();
>         } else {
>             // if the importuri is absolute
>             if (relativeLocation.startsWith("/") ||  
> relativeLocation.startsWith("\\")) {
>                 if (importUri != null && !importUri.isAbsolute()) {
>                     try {
>                         importUri = new URI("file:" +  
> relativeLocation);
> -                        return getInputSourceFormURI(importUri);
> +                        return importUri.toString();
>                     } catch (URISyntaxException e) {
>                         handleException("Invalid URI ' " +  
> importUri.getPath() + " '", e);
>                     }
> @@ -448,12 +448,12 @@
>                         if (!resolvedUri.isAbsolute()) {
>                             resolvedUri = new URI("file:" +  
> resolvedPath);
>                         }
> -                        return getInputSourceFormURI(resolvedUri);
> +                        return resolvedUri.toString();
>                     } catch (URISyntaxException e) {
>                         handleException("Invalid URI ' " +  
> resolvedPath + " '", e);
>                     }
>                 } else {
> -                    return getInputSourceFormURI(importUri);
> +                    return importUri.toString();
>                 }
>             }
>         }
>
> Modified: synapse/trunk/java/modules/core/src/main/java/org/apache/ 
> synapse/core/axis2/CustomURIResolver.java
> URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/CustomURIResolver.java?rev=652335&r1=652334&r2=652335&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/ 
> core/axis2/CustomURIResolver.java (original)
> +++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/ 
> core/axis2/CustomURIResolver.java Wed Apr 30 04:25:31 2008
> @@ -42,13 +42,10 @@
>     }
>
>     public InputSource resolveEntity(String targetNamespace, String  
> schemaLocation, String baseUri) {
> -        InputSource result = null;
>         if (resourceMap != null) {
> -            result = resourceMap.resolve(synCfg, schemaLocation);
> +            return resourceMap.resolve(synCfg, schemaLocation);
> +        } else {
> +            return new  
> InputSource(SynapseConfigUtils.resolveRelativeURI(baseUri,  
> schemaLocation));
>         }
> -        if (result == null) {
> -            result = SynapseConfigUtils.resolveRelativeURI(baseUri,  
> schemaLocation);
> -        }
> -        return result;
>     }
> }
>
> Modified: synapse/trunk/java/modules/core/src/main/java/org/apache/ 
> synapse/core/axis2/CustomWSDLLocator.java
> URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/CustomWSDLLocator.java?rev=652335&r1=652334&r2=652335&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/ 
> core/axis2/CustomWSDLLocator.java (original)
> +++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/ 
> core/axis2/CustomWSDLLocator.java Wed Apr 30 04:25:31 2008
> @@ -65,7 +65,7 @@
>             result = resourceMap.resolve(synCfg, relativeLocation);
>         }
>         if (result == null) {
> -            result =  
> SynapseConfigUtils.resolveRelativeURI(parentLocation,  
> relativeLocation);
> +            result = new  
> InputSource(SynapseConfigUtils.resolveRelativeURI(parentLocation,  
> relativeLocation));
>         }
>         this.latestImportURI = relativeLocation;
>         return result;
>
>


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


Re: svn commit: r652335 - in /synapse/trunk/java/modules/core/src/main/java/org/apache/synapse: config/SynapseConfigUtils.java core/axis2/CustomURIResolver.java core/axis2/CustomWSDLLocator.java

Posted by "Asankha C. Perera" <as...@wso2.com>.
Andreas
> Your modification changes the behavior of 
> CustomURIResolver#resolveEntity in the case where resourceMap != null 
> and ResourceMap#resolve returns null: instead of resolving the URI 
> using SynapseConfigUtils.resolveRelativeURI, it now returns null. Is 
> this intentional or a mistake?
Thank you for noticing this, and it was my mistake! Your code review and 
feedback is something I really value and enjoy

regards
asankha

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