commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <James.R...@ga.gov.au>
Subject RE: [PATCH][Jelly] new features : properties & VFS integration
Date Sun, 18 Dec 2005 22:40:32 GMT
Hi Benoit,

I'm new to the commons-dev list, forgive me if my comments are not
posted to the right place.

> -----Original Message-----
> From: Benoit Callebaut [mailto:benoit.callebaut@euphonynet.be] 
> Sent: Thursday, 15 December 2005 10:18 PM
> To: commons-dev@jakarta.apache.org
> Subject: [PATCH][Jelly] new features : properties & VFS integration
> 
> 
> Hello,
> This patch add 2 features :

> Index: src/java/org/apache/commons/jelly/tags/core/FileTag.java
> [ ... snip ... ]
> @@ -55,8 +72,42 @@
>     public void doTag(final XMLOutput output) throws JellyTagException {
>         try {
>             if ( name != null ) {
> +                OutputStream out = null;
>                 String encoding = (this.encoding != null) ? this.encoding :
"UTF-8";
> -                Writer writer = new OutputStreamWriter( new
FileOutputStream( name, doAppend ), encoding );
> +                Object obj = null;
> +                obj = getContext().getProperty("VFSManager");
> +                if ((obj == null) && (obj instanceof FileSystemManager)){
                        ^^^^^^^^^^^
Shouldn't this be obj != null ?

> +                    manager = (FileSystemManager)obj;
> +                }
> +                if (manager == null){
> +                    log.error("Manager not initialized. Falling back on
old functionality");
> +                    if ( name != null ) {
> +                        out = new FileOutputStream( name, doAppend );
> +                    }
> +                }else{

> Index: project.xml

Are there actually any changes to project.xml in your patch, or is it all
formatting? It would be a lot easier
if superfluous changes were removed from the patch.

> Index: parent-project.xml

Same again...

> Index: src/java/org/apache/commons/jelly/JellyContext.java
> @@ -262,6 +267,22 @@
>          return null;
>      }
>  
> +    public Hashtable getProperties(){
> +        return properties;
> +    }
> +    
> +    public Object setProperty(String name, Object value){
> +        return properties.put(name,value);
> +    }
> +    
> +    public Object getProperty(String name){
> +        try{
> +            return properties.get(name);
> +        }catch (Exception e){
> +            return null;
> +        }
> +    }
> +

I think 

	public Object getProperty(String name) {
		if (name == null)
			return null;
		return properties.get(name);
	}

is nicer than catching this exception.

> Benoit
> 

Thanks!

Regards,
James

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


Mime
View raw message