On Tue, 27 Sep 2005, [EMAIL PROTECTED] wrote:

> Author: henning
> Date: Tue Sep 27 02:38:36 2005
> New Revision: 291876
> 
> URL: http://svn.apache.org/viewcvs?rev=291876&view=rev
> Log:
> Removed FindBugs report (Exception was too broad, replaced with
> IllegalAccessException), cleaned up error messages.
> 
> I was wondering if there should be a "standard" way to allow Velocity
> Tools access to the logging. Maybe something like we have with
> RuntimeServicesAware for Event handlers also for elements added to the
> Context.
 
That's a good idea, these println()'s are ... icky.  It would be especially
nice to preseve the stack trace.

Until then, shouldn't this error reporting go to stderr, rather than to
stdout?
 
> Modified:
>     
> jakarta/velocity/core/trunk/src/java/org/apache/velocity/app/FieldMethodizer.java
> 
> Modified: 
> jakarta/velocity/core/trunk/src/java/org/apache/velocity/app/FieldMethodizer.java
> URL: 
> http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/app/FieldMethodizer.java?rev=291876&r1=291875&r2=291876&view=diff
> ==============================================================================
> --- 
> jakarta/velocity/core/trunk/src/java/org/apache/velocity/app/FieldMethodizer.java
>  (original)
> +++ 
> jakarta/velocity/core/trunk/src/java/org/apache/velocity/app/FieldMethodizer.java
>  Tue Sep 27 02:38:36 2005
> @@ -86,7 +86,9 @@
>          }
>          catch( Exception e )
>          {
> -            System.out.println( e );
> +            System.out.println("Could not add " + s 
> +                    + " for field methodizing: " 
> +                    + e.getMessage());
>          }
>      }
>  
> @@ -106,7 +108,9 @@
>          }
>          catch( Exception e )
>          {
> -            System.out.println( e );
> +            System.out.println("Could not add " + o 
> +                    + " for field methodizing: " 
> +                    + e.getMessage());
>          }
>      }
>      
> @@ -137,16 +141,21 @@
>       */
>      public Object get( String fieldName )
>      {
> +        Object value = null;
>          try 
>          {
>              Field f = (Field) fieldHash.get( fieldName );
>              if (f != null)
> -                return f.get( (Class) classHash.get(fieldName) );
> +            {
> +                value = f.get( (Class) classHash.get(fieldName) );
> +            }
>          }
> -        catch( Exception e )
> +        catch( IllegalAccessException e )
>          {
> +            System.out.println("IllegalAccessException while trying to 
> access " + fieldName 
> +                    + ": " + e.getMessage());
>          }
> -        return null;
> +        return value;
>      }

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to