You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by dl...@apache.org on 2001/12/07 02:55:57 UTC

cvs commit: jakarta-turbine-torque/src/templates/om Peer.vm

dlr         01/12/06 17:55:57

  Modified:    src/templates/om Peer.vm
  Log:
  Consolidated all Class member initializations methods into a single
  method, and improved the error handling and reporting of that method.
  
  Revision  Changes    Path
  1.11      +17 -32    jakarta-turbine-torque/src/templates/om/Peer.vm
  
  Index: Peer.vm
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-torque/src/templates/om/Peer.vm,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -u -r1.10 -r1.11
  --- Peer.vm	2001/11/11 19:43:14	1.10
  +++ Peer.vm	2001/12/07 01:55:57	1.11
  @@ -67,22 +67,29 @@
           "${package}.$table.JavaName";
   
       /** A class that can be returned by this peer. */
  -    protected static final Class CLASS_DEFAULT = initClass();
  +    protected static final Class CLASS_DEFAULT = initClass(CLASSNAME_DEFAULT);
   
  -    /** Initialization method for static CLASS_DEFAULT attribute */
  -    private static Class initClass()
  +    /** Class object initialization method. */
  +    private static Class initClass(String className)
       {
           Class c = null;
           try
           { 
  -            c = Class.forName(CLASSNAME_DEFAULT);
  +            c = Class.forName(className);
           }
  -        catch (Exception e)
  +        catch (Throwable t)
           {
  -            category.error("A FATAL ERROR has occurred which should not" +
  -                "have happened under any circumstance.  Please notify" +
  -                "Turbine and give as many details as possible including the " +
  -                "error stacktrace.", e);
  +            category.error("A FATAL ERROR has occurred which should not " +
  +                "have happened under any circumstance.  Please notify " +
  +                "the Turbine developers <tu...@jakarta.apache.org> " +
  +                "and give as many details as possible (including the error " +
  +                "stack trace).", t);
  +
  +            // Error objects should always be propogated.
  +            if (t instanceof Error)
  +            {
  +                throw (Error) t.fillInStackTrace();
  +            }
           }
           return c;
       }
  @@ -140,29 +147,7 @@
   
       /** A class that can be returned by this peer. */
       public static final Class CLASS_$child.Key.toUpperCase() = 
  -        init${child.Key.toUpperCase()}Class();
  -
  -    /**
  -     * Initialization method for static 
  -     * CLASS_$child.Key.toUpperCase() attribute
  -     */
  -    private static Class init${child.Key.toUpperCase()}Class()
  -    {
  -        Class c = null;
  -        try
  -        { 
  -            c = Class.forName(CLASSNAME_$child.Key.toUpperCase());
  -        }
  -        catch (Exception e)
  -        {
  -            category.error("A FATAL ERROR has occurred which should not" +
  -                "have happened under any circumstance.  Please notify " +
  -                "the Turbine developers <tu...@jakarta.apache.org> " +
  -                "and give as many details as possible (including the error " +
  -                "stack trace).", e);
  -        }
  -        return c;
  -    }
  +        initClass(CLASSNAME_$child.Key.toUpperCase());
           #end
       #end
   #end
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>