You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by he...@apache.org on 2005/10/01 14:59:34 UTC

svn commit: r292978 - /jakarta/velocity/core/trunk/src/java/org/apache/velocity/util/introspection/UberspectImpl.java

Author: henning
Date: Sat Oct  1 05:59:31 2005
New Revision: 292978

URL: http://svn.apache.org/viewcvs?rev=292978&view=rev
Log:
static Introspector object? Now that scares me.

And makes me wonder if ever anyone has tried to run two different
VelocityEngine instances with different Introspectors in the same
VM. Make it a protected instance member. private and getters/setters
might even be better.

setLog() initialized the introspector object??? That can't be
right. The init code in the runtimeInstance makes sure that init() is
called last (after setLog() if the class implements UberspectLoggable)
so we can move this into init() where it belongs.

Do some javadoc fixup. 



Modified:
    jakarta/velocity/core/trunk/src/java/org/apache/velocity/util/introspection/UberspectImpl.java

Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/util/introspection/UberspectImpl.java
URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/util/introspection/UberspectImpl.java?rev=292978&r1=292977&r2=292978&view=diff
==============================================================================
--- jakarta/velocity/core/trunk/src/java/org/apache/velocity/util/introspection/UberspectImpl.java (original)
+++ jakarta/velocity/core/trunk/src/java/org/apache/velocity/util/introspection/UberspectImpl.java Sat Oct  1 05:59:31 2005
@@ -49,27 +49,27 @@
     /**
      *  the default Velocity introspector
      */
-    protected static Introspector introspector;
+    protected Introspector introspector;
 
     /**
-     *  init - does nothing - we need to have setRuntimeLogger
-     *  called before getting our introspector, as the default
-     *  vel introspector depends upon it.
+     *  init - generates the Introspector. As the setup code
+     *  makes sure that the log gets set before this is called,
+     *  we can initialize the Introspector using the log object.
      */
     public void init()
-        throws Exception
     {
+        introspector = new Introspector(log);
     }
 
     /**
      *  Sets the runtime logger - this must be called before anything
-     *  else besides init() as to get the logger.  Makes the pull
-     *  model appealing...
+     *  else.
+     *  
+     * @param log The logger instance to use.
      */
     public void setLog(Log log)
     {
         this.log = log;
-        introspector = new Introspector(log);
     }
 
     /**



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


Re: svn commit: r292978 - /jakarta/velocity/core/trunk/src/java/org/apache/velocity/util/introspection/UberspectImpl.java

Posted by Will Glass-Husain <wg...@forio.com>.
Good catch.

I'm really appreciating the open source approach here of multiple eyes on 
the same code.

WILL

----- Original Message ----- 
From: <he...@apache.org>
To: <ve...@jakarta.apache.org>
Sent: Saturday, October 01, 2005 5:59 AM
Subject: svn commit: r292978 - 
/jakarta/velocity/core/trunk/src/java/org/apache/velocity/util/introspection/UberspectImpl.java


> Author: henning
> Date: Sat Oct  1 05:59:31 2005
> New Revision: 292978
>
> URL: http://svn.apache.org/viewcvs?rev=292978&view=rev
> Log:
> static Introspector object? Now that scares me.
>
> And makes me wonder if ever anyone has tried to run two different
> VelocityEngine instances with different Introspectors in the same
> VM. Make it a protected instance member. private and getters/setters
> might even be better.
>
> setLog() initialized the introspector object??? That can't be
> right. The init code in the runtimeInstance makes sure that init() is
> called last (after setLog() if the class implements UberspectLoggable)
> so we can move this into init() where it belongs.
>
> Do some javadoc fixup.
>
>
>
> Modified:
> 
> jakarta/velocity/core/trunk/src/java/org/apache/velocity/util/introspection/UberspectImpl.java
>
> Modified: 
> jakarta/velocity/core/trunk/src/java/org/apache/velocity/util/introspection/UberspectImpl.java
> URL: 
> http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/util/introspection/UberspectImpl.java?rev=292978&r1=292977&r2=292978&view=diff
> ==============================================================================
> ---  
> jakarta/velocity/core/trunk/src/java/org/apache/velocity/util/introspection/UberspectImpl.java 
> (original)
> +++ 
> jakarta/velocity/core/trunk/src/java/org/apache/velocity/util/introspection/UberspectImpl.java 
> Sat Oct  1 05:59:31 2005
> @@ -49,27 +49,27 @@
>     /**
>      *  the default Velocity introspector
>      */
> -    protected static Introspector introspector;
> +    protected Introspector introspector;
>
>     /**
> -     *  init - does nothing - we need to have setRuntimeLogger
> -     *  called before getting our introspector, as the default
> -     *  vel introspector depends upon it.
> +     *  init - generates the Introspector. As the setup code
> +     *  makes sure that the log gets set before this is called,
> +     *  we can initialize the Introspector using the log object.
>      */
>     public void init()
> -        throws Exception
>     {
> +        introspector = new Introspector(log);
>     }
>
>     /**
>      *  Sets the runtime logger - this must be called before anything
> -     *  else besides init() as to get the logger.  Makes the pull
> -     *  model appealing...
> +     *  else.
> +     *
> +     * @param log The logger instance to use.
>      */
>     public void setLog(Log log)
>     {
>         this.log = log;
> -        introspector = new Introspector(log);
>     }
>
>     /**
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-dev-help@jakarta.apache.org
> 


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