commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject cvs commit: jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly JellyContext.java
Date Mon, 22 Jul 2002 14:05:29 GMT
jstrachan    2002/07/22 07:05:29

  Modified:    jelly/src/java/org/apache/commons/jelly JellyContext.java
  Log:
  temporary patch so that System properties are available by default in the global variable
scope.
  
  So you can do ${user.home} inside a Jelly script. We'll include a better patch shortly using
pluggable Scope objects that make it easier to configure this behaviour
  
  Revision  Changes    Path
  1.18      +11 -1     jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/JellyContext.java
  
  Index: JellyContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/JellyContext.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- JellyContext.java	22 Jul 2002 07:16:52 -0000	1.17
  +++ JellyContext.java	22 Jul 2002 14:05:29 -0000	1.18
  @@ -204,7 +204,17 @@
       public Object findVariable(String name) {
           Object answer = variables.get(name);
           if ( answer == null && parent != null ) {
  -            return parent.findVariable(name);
  +            answer = parent.findVariable(name);
  +            
  +            // ### this is a hack - remove this when we have support for pluggable Scopes
  +            if ( answer == null ) {
  +                try {
  +                    answer = System.getProperty(name);
  +                }
  +                catch (Throwable t) {
  +                    // ignore security exceptions
  +                }
  +            }
           }
           return answer;
       }
  
  
  

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


Mime
View raw message