commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From MORITA Hajime <...@dodgson.org>
Subject [jelly] JellyContext.newJellyContext side-effect
Date Tue, 13 Jan 2004 01:15:15 GMT

Hello.

I've tried jelly in my in-house tool. It works well.

While Embedding jelly into my tool, 
I noticed that JellyContext.newJellyContext() puts a value to its parameter. 

    public JellyContext newJellyContext(Map newVariables) {
        // XXXX: should allow this new context to
        // XXXX: inherit parent contexts? 
        // XXXX: Or at least publish the parent scope
        // XXXX: as a Map in this new variable scope?
        newVariables.put("parentScope", variables); /*** here ***/
        JellyContext answer = createChildContext();
        answer.setVariables(newVariables);
        return answer;
    }

I prefer keep it remain instead of effect it
like :

    public JellyContext newJellyContext(Map newVariables) {
        JellyContext answer = createChildContext();
		answer.setVariable("parentScope", variables);
        answer.setVariables(newVariables);
        return answer;
    }

Because I often pass the unmodifieable map to the method, 
then cause an exception :

	    /* throws UnsupportedOperationException. */
        jellyCtx.newJellyContext( Collections.EMPTY_MAP ); 


I can't find problems that the modification might cause.
Do you have any ideas?

Thank you in advance.

--
MORITA Hajime <omo@dodgson.org>


---------------------------------------------------------------------
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