Here you go, as per request.  You will have to fiddle a bit to get what is 
going on, but not much.  The methods return the object so you can debug as 
follows:  new Debugger().add(blah1).add(blah2).add(blah3).log("Testing the 
Back Forty", true); which will do what is specified.  Set up the paths 
however is best for you.  I give this to students.  When I use it, I name 
it REMOVE_ME.java.  Good luck!

Micael

At 09:59 AM 8/19/2002 -0700, you wrote:
>It is always nice to have an extra debugger handy :) I
>am testing JTest but am not sure it is really what I
>need. I would appreciate your help if you can send me
>yours.
>
>Thank you in advance.
>
>--- micael <[EMAIL PROTECTED]> wrote:
> > If you have a debugger, all you have to do is to
> > follow the bouncing ball
> > and find the null reference.  That will be the
> > fastest way to find this
> > problem.  It should not take long.  If you don't
> > have a debugger, I will
> > send you one I made to use, and I like better than
> > the standard debuggers.
> >
> > At 08:49 AM 8/19/2002 -0700, you wrote:
> > >I am sorry, but I did not get what you mean with
> > >connection limit to be a hard limit, which one is
> > >that?
> > >
> > >I am including a copy of my pool.xml if you care do
> > >point out what should be changed.
> > >
> > >Thank you in advance.
> > >
> > >==================== Pool.xml =====================
> > ><?xml version="1.0" encoding="UTF-8"?>
> > >
> > ><poolman>
> > >
> > >   <management-mode>local</management-mode>
> > >
> > >   <datasource>
> > >
> > >     <!-- ============================== -->
> > >     <!-- Physical Connection Attributes -->
> > >     <!-- ============================== -->
> > >
> > >     <!-- Standard JDBC Driver info -->
> > >
> > >     <dbname>webdev</dbname>
> > >     <jndiName>webdev</jndiName>
> > >     <driver>org.postgresql.Driver</driver>
> > >
> > <url>jdbc:postgresql://localhost:6093/webdev</url>
> > >
> > >     <username>JustAUserName</username>
> > >     <password>JustAUserNamePassword</password>
> > >
> > >     <!-- Oracle needs this to be set to true -->
> > >     <nativeResults>true</nativeResults>
> > >
> > >     <minimumSize>1</minimumSize>
> > >     <maximumSize>10</maximumSize>
> > >     <connectionTimeout>600</connectionTimeout>
> > >     <userTimeout>12</userTimeout>
> > >     <shrinkBy>10</shrinkBy>
> > >
> > >
> >
> ><logFile>/usr/local/tomcat/logs/poolman.log</logFile>
> > >     <debugging>false</debugging>
> > >
> > >     <!-- Query Cache Attributes-->
> > >
> > >     <cacheEnabled>false</cacheEnabled>
> > >     <cacheSize>20</cacheSize>
> > >
> > <cacheRefreshInterval>120</cacheRefreshInterval>
> > >
> > >   </datasource>
> > >
> > ></poolman>
> > >
> > >==================== End Pool.xml =================
> > >--- Mike Jackson <[EMAIL PROTECTED]> wrote:
> > > > Actually now that I think about it more that
> > might
> > > > be the cause of the null
> > > > pointer (but
> > > > probably not).  In your poolman.xml file have
> > you
> > > > set the connection limit
> > > > to be a hard
> > > > limit?  If you timeout on connections (user
> > timeout)
> > > > is fairly high you
> > > > could run out of
> > > > connections, and it might return a "null"
> > instead of
> > > > a connection.
> > > >
> > > > But that's just a guess.  Also, you might was to
> > > > also turn on logging (debug
> > > > level) in
> > > > poolman as well so that you can watch the
> > > > connections getting checked out
> > > > and in.
> > > >
> > > > --mikej
> > > > -=-----
> > > > mike jackson
> > > > [EMAIL PROTECTED]
> > > >
> > > > > -----Original Message-----
> > > > > From: Luminous Heart
> > > > [mailto:[EMAIL PROTECTED]]
> > > > > Sent: Monday, August 19, 2002 8:36 AM
> > > > > To: Tomcat Users List
> > > > > Subject: Re: It would be great IF somebody
> > > > answered me, ONCE, for change
> > > > > :(
> > > > >
> > > > >
> > > > > Hi Graig,
> > > > > Here is my jsp file. I am not sure what might
> > be
> > > > > wrong. Although the same error happens in a
> > bigger
> > > > > application in a tc cluster of 3 tomcats. Two
> > of
> > > > these
> > > > > tcs fail while one does not get any forwards
> > after
> > > > > that.
> > > > >
> > > > > Please take a look at my code, if you do not
> > mind.
> > > > >
> > > > > Best regards.
> > > > >
> > > > > ===================== JSP
> > =====================
> > > > > <%@ page import="java.io.*" %>
> > > > > <%@ page import="java.util.*" %>
> > > > > <%@ page import="java.text.*" %>
> > > > >
> > > > > <%@ page import="java.util.Properties" %>
> > > > > <%@ page import="java.util.Date" %>
> > > > >
> > > > > <%@ page contentType="text/html"%>
> > > > >
> > > > > <%@ page import="com.codestudio.util.*"%>
> > > > > <%@ page import="java.sql.*"%>
> > > > >
> > > > > <!-- %@ include file="no-cache.jsp" % -->
> > > > >
> > > > > <form action="UserAccount.jsp" method=post
> > > > > name="access_form">
> > > > >   <table width="90%" align="center">
> > > > >   <tr>
> > > > >               <th bgcolor="#CCCCFF" colspan=3>
> > > > <font
> > > > > size=5>User Access</font></th>
> > > > >
> > > > >     <td>&nbsp;</td>
> > > > >     <td>&nbsp;</td>
> > > > >     <td>&nbsp;</td>
> > > > >   </tr>
> > > > >   <tr>
> > > > >     <td>
> > > > >         <center>
> > > > >           <table cellpadding=4 cellspacing=2
> > > > border=0>
> > > > >             <th bgcolor="#CCCCFF" colspan=2>
> > <font
> > > > > size=5>User Access by userid</font></th>
> > > > >             <tr bgcolor="#c8d8f8">
> > > > >               <td valign=top colspan=2>
> > <b>User
> > > > > Name</b><br>
> > > > >                 <input type="text"
> > > > name="byusername"
> > > > > size=25 value=""  maxlength=25>
> > > > >               </td>
> > > > >             </tr>
> > > > >           </table>
> > > > > </center>
> > > > > </td>
> > > > >     <td>
> > > > >         <center>
> > > > >           <table cellpadding=4 cellspacing=2
> > > > border=0>
> > > > >             <th bgcolor="#CCCCFF" colspan=2>
> > <font
> > > > > size=5>User Access by Date</font><font
> > > > size=1></font>
> > > > >             </th>
> > > > >             <tr bgcolor="#c8d8f8">
> > > > >               <td valign=top> <b>Date</b><br>
> > > > >                 <input type="text"
> > name="bydate"
> > > > > value="" size=25  maxlength=125>
> > > > >                 <br>
> > > > >               </td>
> > > > >             </tr>
> > > > >           </table>
> > > > > </center>
> > > > > </td>
> > > > >     <td>
> > > > >         <center>
> > > > >           <table cellpadding=4 cellspacing=2
> > > > border=0>
> > > > >             <th bgcolor="#CCCCFF" colspan=2>
> > <font
> > > > > size=5>USER Access by IP Address</font>
> > > > >             </th>
> > > > >             <tr bgcolor="#c8d8f8">
> >
>=== message truncated ===
>
>
>__________________________________________________
>Do You Yahoo!?
>HotJobs - Search Thousands of New Jobs
>http://www.hotjobs.com
>
>--
>To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
/* tccjava December 31, 2001
 *
 * Copyright 2001 Swords and Ploughshares, Ltd. All Rights Reserved.
 *
 * This software is the proprietary information of Swords and Ploughshares, Ltd.
 * Use is subject to license terms. */
package tccjava;

/**     This class holds the version of the JDK presently being
  * used for the tccjava testing application.   The class is final
  * so that it cannot be subclassed and has a private constructor
  * so that no instance can be created.
  * @author Micael Padraig Og mac Grene
  * @version 1.1 January 4, 2002 Made the class uninstantiable and final.
  * @since Version 1.0 December 31, 2001 */
public final class JavaPlatform {

        /** A private default constructor */
        private JavaPlatform() {
        }

        /** The name of the directory holding the JDK used by this application. */
        //public static final String version = "j2sdk1.4.0-beta3";
        public static final String version = "j2se14";
}
/* tccjava.toolbox.debugger.Debugger: December 9, 2001
 *
 * Copyright 2001 Swords and Ploughshares, Ltd. All Rights Reserved.
 *
 * This software is the proprietary information of Swords and Ploughshares, Ltd.
 * Use is subject to license terms. */
package tccjava.toolbox.debugger;

import java.io.IOException;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.PrintWriter;
import java.util.Date;
import java.util.StringTokenizer;

import tccjava.JavaPlatform;

/**  This class is for debugging and logging values
  *      in Java classes and applications -- The class
  *      will log any values without difficulty -- Further,
  *  having a log which is time stamped will allow
  *  the user to make decisions based on looking at
  *  the history of an application and will allow a
  *  look at whatever length of values may occur,
  *  unlike with a DOS window: the application
  *  overloads add([Whatever]) methods for all data
  *  types.
  *  @author    Micael Padraig Og mac Grene
  *  @version   1.2: 21 April 2001
  *  @since     Version 1.2 */
public class Debugger {
        private FileWriter    writer;
        private PrintWriter  printer;
        private StringBuffer  strbuf = new StringBuffer();
        private String          path;
        private boolean     showtype;

        /**  The default constructor, which sets the default path of the debugger 
logs. */
        public Debugger() {
                setPath("C", new String [] { JavaPlatform.version, "jre", "classes", 
"tccjava", "bugs" }, "defaultlog", "bug");
        }

        /**  Constructor that informs the application to show the type of variables
          *  tested dureing debugging.
          *  @param showtype If set to true, shows the type of variables, e.g. int,
          *  class, short, etc. The default of the debugger logs is also set. */
        public Debugger(boolean showtype) {
                this.showtype = showtype;
                setPath("C", new String [] { JavaPlatform.version, "jre", "classes", 
"tccjava", "bugs" }, "defaultlog", "bug");
        }

        /**  Allows the user to set the path for the debugger logs.
          *  @param root The root of the path, usually "C" for a PC and ""
          *  for Linux, Unix.
          *  @param directories The directories along the path to the file, not
          *  including the file.
          *  @param logFileName The name of the log file.
          *  @param ext The name of the extension of the log file, the default
          *  is "bug".
          *  @return The Debugger value. */
        public Debugger setPath(String root, String [] directories, String 
logFileName, String ext) {
                /*  Make a buffer to hold values temporarily. */
                StringBuffer strbuf = new StringBuffer();

                /*  Add ":" if the root is a PC root. */
                if(root.length() > 0 && Character.isLetter(root.charAt(0))) {
                        strbuf.append(root + ":");
                }

                /*  Use platform independent File.separator values. */
                for (int i = 0; i < directories.length; i++) {
                        strbuf.append(File.separator + directories[i]);
                }

                /*  Create the directories for the file. */
                new File(strbuf.toString()).mkdirs();

                /*  Add the file name to the directories. */
                strbuf.append(File.separator + logFileName);

                /*  Add the extension to the file name. */
                strbuf.append("." + ext);

                /*  Create the file. */
                try {
                        new File(strbuf.toString()).createNewFile();
                } catch (IOException ioe) {
                        ioe.printStackTrace();
                }

                /*  Set the Debugger class path name of the file. */
                path = strbuf.toString();

                /*  Return the debugger value. */
                return this;
        }

        /**  This method logs the values added to the Debugger value.
          *  @param value If set to true, keeps prior values, else
          *  overwrites prior results.
          *  @return The Debugger value. */
        public synchronized Debugger log(boolean append) {
                try {
                        /*  Create a file writer with the right path and the proper 
overwriting
                         *  instructions. */
                        writer = new FileWriter(path, append);

                        /*  Uses a print writer for the file writer and flushes the 
line output. */
                        printer = new PrintWriter(writer, true);

                        /*  Gives a header to the output, dates the output, then 
publishes the
                         *  output. */
                        printer.println("\n\n\n\nApplication Values: " + new 
Date().toString() + "\n\n" + strbuf.toString() + "\n\n");

                        /*  Close the resources. */
                        printer.close();
                } catch (IOException ioe) {
                        ioe.printStackTrace();
                }

                /*  Reset the buffer. */
                strbuf = new StringBuffer();

                /*  Return the debugger value. */
                return this;
        }

        /**  This method logs the values added to the Debugger value.
          *  @param info Provides whatever information the user wants to
          *  the debugger log.
          *  @param value If set to true, keeps prior values, else
          *  overwrites prior results.
          *  @return The Debugger value. */
        public synchronized Debugger log(String info, boolean append) {
                try {
                        /*  Create a file writer with the right path and the proper 
overwriting
                         *  instructions. */
                        writer = new FileWriter(path, append);

                        /*  Uses a print writer for the file writer and flushes the 
line output. */
                        printer = new PrintWriter(writer, true);

                        /*  Gives a header to the output, dates the output, then 
publishes the
                         *  output. */
                        printer.println("\n\n\n\nApplication Values: " + new 
Date().toString() + "\n\n" + info + ":\n\n" + strbuf.toString() + "\n\n");

                        /*  Close the resources. */
                        printer.close();
                } catch (IOException ioe) {
                        ioe.printStackTrace();
                }

                /*  Reset the buffer. */
                strbuf = new StringBuffer();

                /*  Return the Debugger value. */
                return this;
        }

        /**  A method to see what a variable has as an value and what
          *  the type (if showType is set) and value of the variable is:
          *  the method is overloaded for all data types.
          *  @param value The value being tested.
          *  @return The <code>Debugger</code> value. */
        public synchronized Debugger add(Object value) {
                if(value == null) {
                        strbuf.append("The value value is null\n");
                        return this;
                }
                if(showtype) {
                        strbuf.append("Object, " + value.getClass().getName() + " 
value is: " + value.toString() + "\n");
                        return this;
                } else {
                        strbuf.append(value.getClass().getName() + " value is: " + 
value.toString() + "\n");
                        return this;
                }
        }

        /**  A method to see what a variable has as an value and what
          *  the type (if showType is set) and value of the variable is:
          *  the method is overloaded for all data types.
          *  @param info Whatever information the user wants to include in the
          *  log, usually the name of the variable would be included for reference
          *  purposes.
          *  @param value The value being tested.
          *  @return The <code>Debugger</code> value. */
        public synchronized Debugger add(String info, Object value) {
                if(value == null && showtype) {
                        strbuf.append("String value is null" + " (Info: " + info + ") 
\n");
                        return this;
                } else if(value == null) {
                        strbuf.append("The String value is null \n");
                        return this;
                } else if(showtype) {
                        strbuf.append("Object: " + value.getClass().getName() + " 
value is: " + value.toString() + " (Info: " + info + ") \n");
                        return this;
                } else {
                        strbuf.append(value.getClass().getName() + " value is: " + 
value.toString() + " \n");
                        return this;
                }
        }

        /**  A method to see what a variable has as an value and what
          *  the type (if showType is set) and value of the variable is:
          *  the method is overloaded for all data types.
          *  @param value The value being tested.
          *  @return The <code>Debugger</code> value. */
        public synchronized Debugger add(String value) {
                if(value == null) {
                        strbuf.append("The String value is null \n");
                        return this;
                } else if(showtype) {
                        strbuf.append("String value is: " + value + " \n");
                        return this;
                } else {
                        strbuf.append(value + "\n");
                        return this;
                }
        }

        /**  This method logs the values added to the Debugger value.
          *  @param info Provides whatever information the user wants to
          *  the debugger log.
          *  @param value If set to true, keeps prior values, else
          *  overwrites prior results.
          *  @return The Debugger value. */
        public synchronized Debugger add(String info, String value) {
                if(value == null && showtype) {
                        strbuf.append("String value is null" + " (Info: " + info + ") 
\n");
                        return this;
                } else if(value == null) {
                        strbuf.append("The String value is null\n");
                        return this;
                } else if(showtype) {
                        strbuf.append("String value is: " + value + " (Info: " + info 
+ ") \n");
                        return this;
                } else {
                        strbuf.append(info + " value is: " + value + "\n");
                        return this;
                }
        }

        /**  A method to see what a variable has as an value and what
          *  the type (if showType is set) and value of the variable is:
          *  the method is overloaded for all data types.
          *  @param value The value being tested.
          *  @return The <code>Debugger</code> value. */
        public synchronized Debugger add(char value) {
                if(showtype) {
                        strbuf.append("char value is: " + new 
Character(value).toString() + "\n");
                        return this;
                } else {
                        strbuf.append(new Character(value).toString() + "\n");
                        return this;
                }
        }

        /**  This method logs the values added to the Debugger value.
          *  @param info Provides whatever information the user wants to
          *  the debugger log.
          *  @param value If set to true, keeps prior values, else
          *  overwrites prior results.
          *  @return The Debugger value. */
        public synchronized Debugger add(String info, char value) {
                if(showtype) {
                        strbuf.append("char value is: " + new 
Character(value).toString() + " [Info: " + info + "]\n");
                        return this;
                } else {
                        strbuf.append(info + " value is: " + new 
Character(value).toString() + "\n");
                        return this;
                }
        }

        /**  A method to see what a variable has as an value and what
          *  the type (if showType is set) and value of the variable is:
          *  the method is overloaded for all data types.
          *  @param value The value being tested.
          *  @return The <code>Debugger</code> value. */
        public synchronized Debugger add(byte value) {
                if(showtype) {
                        strbuf.append("byte value is: " + Byte.toString(value) + "\n");
                        return this;
                } else {
                        strbuf.append(Byte.toString(value) + "\n");
                        return this;
                }
        }

        /**  This method logs the values added to the Debugger value.
          *  @param info Provides whatever information the user wants to
          *  the debugger log.
          *  @param value If set to true, keeps prior values, else
          *  overwrites prior results.
          *  @return The Debugger value. */
        public synchronized Debugger add(String info, byte value) {
                if(showtype) {
                        strbuf.append("byte value is: " + Byte.toString(value) + " 
[Info: " + info + "]\n");
                        return this;
                } else {
                        strbuf.append(info + " value is: " + Byte.toString(value) + 
"\n");
                        return this;
                }
        }

        /**  A method to see what a variable has as an value and what
          *  the type (if showType is set) and value of the variable is:
          *  the method is overloaded for all data types.
          *  @param value The value being tested.
          *  @return The <code>Debugger</code> value. */
        public synchronized Debugger add(short value) {
                if(showtype) {
                        strbuf.append("short value is: " + Short.toString(value) + 
"\n");
                        return this;
                } else {
                        strbuf.append(Short.toString(value) + "\n");
                        return this;
                }
        }

        /**  This method logs the values added to the Debugger value.
          *  @param info Provides whatever information the user wants to
          *  the debugger log.
          *  @param value If set to true, keeps prior values, else
          *  overwrites prior results.
          *  @return The Debugger value. */
        public synchronized Debugger add(String info, short value) {
                if(showtype) {
                        strbuf.append("short value is: " + Short.toString(value) + " 
[Info: " + info + "]\n");
                        return this;
                } else {
                        strbuf.append(info + " value is: " + Short.toString(value) + 
"\n");
                        return this;
                }
        }

        /**  A method to see what a variable has as an value and what
          *  the type (if showType is set) and value of the variable is:
          *  the method is overloaded for all data types.
          *  @param value The value being tested.
          *  @return The <code>Debugger</code> value. */
        public synchronized Debugger add(int value) {
                if(showtype) {
                        strbuf.append("int value is: " + Integer.toString(value) + 
"\n");
                        return this;
                } else {
                        strbuf.append(Integer.toString(value) + "\n");
                        return this;
                }
        }

        /**  This method logs the values added to the Debugger value.
          *  @param info Provides whatever information the user wants to
          *  the debugger log.
          *  @param value If set to true, keeps prior values, else
          *  overwrites prior results.
          *  @return The Debugger value. */
        public synchronized Debugger add(String info, int value) {
                if(showtype) {
                        strbuf.append("int value is: " + Integer.toString(value) + " 
[Info: " + info + "]\n");
                        return this;
                } else {
                        strbuf.append(info + " value is: " + Integer.toString(value) + 
"\n");
                        return this;
                }
        }

        /**  A method to see what a variable has as an value and what
          *  the type (if showType is set) and value of the variable is:
          *  the method is overloaded for all data types.
          *  @param value The value being tested.
          *  @return The <code>Debugger</code> value. */
        public synchronized Debugger add(long value) {
                if(showtype) {
                        strbuf.append("long value is: " + Long.toString(value) + "\n");
                        return this;
                } else {
                        strbuf.append(Long.toString(value) + "\n");
                        return this;
                }
        }

        /**  This method logs the values added to the Debugger value.
          *  @param info Provides whatever information the user wants to
          *  the debugger log.
          *  @param value If set to true, keeps prior values, else
          *  overwrites prior results.
          *  @return The Debugger value. */
        public synchronized Debugger add(String info, long value) {
                if(showtype) {
                        strbuf.append("long value is: " + Long.toString(value) + " 
[Info: " + info + "]\n");
                        return this;
                } else {
                        strbuf.append(info + " value is: " + Long.toString(value) + 
"\n");
                        return this;
                }
        }

        /**  A method to see what a variable has as an value and what
          *  the type (if showType is set) and value of the variable is:
          *  the method is overloaded for all data types.
          *  @param value The value being tested.
          *  @return The <code>Debugger</code> value. */
        public synchronized Debugger add(float value) {
                if(showtype) {
                        strbuf.append("float value is: " + Float.toString(value) + 
"\n");
                        return this;
                } else {
                        strbuf.append(Float.toString(value) + "\n");
                        return this;
                }
        }

        /**  This method logs the values added to the Debugger value.
          *  @param info Provides whatever information the user wants to
          *  the debugger log.
          *  @param value If set to true, keeps prior values, else
          *  overwrites prior results.
          *  @return The Debugger value. */
        public synchronized Debugger add(String info, float value) {
                if(showtype) {
                        strbuf.append("float value is: " + Float.toString(value) + " 
[Info: " + info + "]\n");
                        return this;
                } else {
                        strbuf.append(info + " value is: " + Float.toString(value) + 
"\n");
                        return this;
                }
        }

        /**  A method to see what a variable has as an value and what
          *  the type (if showType is set) and value of the variable is:
          *  the method is overloaded for all data types.
          *  @param value The value being tested.
          *  @return The <code>Debugger</code> value. */
        public synchronized Debugger add(double value) {
                if(showtype) {
                        strbuf.append("double value is: " + Double.toString(value) + 
"\n");
                        return this;
                } else {
                        strbuf.append(Double.toString(value) + "\n");
                        return this;
                }
        }

        /**  This method logs the values added to the Debugger value.
          *  @param info Provides whatever information the user wants to
          *  the debugger log.
          *  @param value If set to true, keeps prior values, else
          *  overwrites prior results.
          *  @return The Debugger value. */
        public synchronized Debugger add(String info, double value) {
                if(showtype) {
                        strbuf.append("double value is: " + Double.toString(value) + " 
[Info: " + info + "]\n");
                        return this;
                } else {
                        strbuf.append(info + " value is: " + Double.toString(value) + 
"\n");
                        return this;
                }
        }

        /**  A method to see what a variable has as an value and what
          *  the type (if showType is set) and value of the variable is:
          *  the method is overloaded for all data types.
          *  @param value The value being tested.
          *  @return The <code>Debugger</code> value. */
        public synchronized Debugger add(boolean value) {
                if(showtype) {
                        strbuf.append("boolean value is: " + new 
Boolean(value).toString() + "\n");
                        return this;
                } else {
                        strbuf.append(new Boolean(value).toString() + "\n");
                        return this;
                }
        }

        /**  This method logs the values added to the Debugger value.
          *  @param info Provides whatever information the user wants to
          *  the debugger log.
          *  @param value If set to true, keeps prior values, else
          *  overwrites prior results.
          *  @return The Debugger value. */
        public synchronized Debugger add(String info, boolean value) {
                if(showtype) {
                        strbuf.append("boolean value is: " + new 
Boolean(value).toString() + " [Info: " + info + "]\n");
                        return this;
                } else {
                        strbuf.append(info + " value is: " + new 
Boolean(value).toString() + "\n");
                        return this;
                }
        }
} ///;-)
java tccjava.toolbox.debugger.DebuggerExampleTest
javac *.java
/* tccjava.toolbox.debugger.DebuggerExampleTest: December 9, 2001
 *
 * Copyright 2001 Swords and Ploughshares, Ltd. All Rights Reserved.
 *
 * This software is the proprietary information of Swords and Ploughshares, Ltd.
 * Use is subject to license terms. */
package tccjava.toolbox.debugger;

import tccjava.JavaPlatform;
import tccjava.toolbox.debugger.Debugger;

/**  This class simply provides both a test and an example of the use of
  *  the Debugger class.*/
public class DebuggerExampleTest {

        /**  This method show the results of three different debugging objects:
          *  (1) <code>Debugger</code> object "debugger" which is spread throughout
          *  the method, and (2) one anonymous <code>Debugger</code> object which
          *  cannot per force be spread out, because it has no variable to refer
          *  to it, and (3) a <code>Debugger</code> object "bugger" that is initialized
          *  after some initial use of methods.  This is an unusual but helpful 
alternative
          *  that should be noted.  Note that we never have to use the 
<code>Debugger</code> object's
          *  variable unless there is intervening code, because the methods always 
return
          *  the <code>Debugger</code> object. */
        public static void main(String [] params) {
                byte      byteNumber = 4;
                short    shortNumber = 5;
                int        intNumber = 6;
                long      longNumber = 7L;
                float    floatNumber = 8.0f;
                double  doubleNumber = 9.0d;
                char       charValue = 'c';
                boolean booleanValue = true;
                String   stringValue = "stringy";
                Object   objectValue = new DebuggerExampleTest();

                /*  The Debugger debugger. */
                Debugger debugger = new Debugger();
                debugger.setPath("C", new String [] { JavaPlatform.version, "jre", 
"classes", "tccjava", "bugs", "testlogs" }, "debuggerOneTestlog", "bug")
                    /*  The Debugger object is returned, so no need to use the 
variable. */
                    .add(byteNumber)
                    .add(shortNumber)
                    .add(intNumber)
                    /*  There is intervening code coming, so we must end the statement 
with ";" */
                    .add(longNumber);

                /*  An anonymous Debugger object. */
                new Debugger().setPath("C", new String [] { JavaPlatform.version, 
"jre", "classes", "tccjava", "bugs", "testlogs" }, "debuggerTwoTestlog", "bug")
                           /*  Need not (and cannot because the Debugger object is 
anonymous) use a
                            *  variable, but must complete the add([whatever) and 
log([whatever]) methods
                            *  without intervening code. */
                           .add(byteNumber)
                           .add(shortNumber)
                           .add(intNumber)
                           .add(longNumber)
                           .add(floatNumber)
                           .add(doubleNumber)
                           .add(charValue)
                           .add(booleanValue)
                           .add(stringValue)
                           .add(objectValue)
                           .log(false)
                           .add("The variable name is byteNumber", byteNumber)
                           .add("The variable name is shortNumber", shortNumber)
                           .add("The variable name is intNumber", intNumber)
                           .add("The variable name is longNumber", longNumber)
                           .add("The variable name is floatNumber", floatNumber)
                           .add("The variable name is doubleNumber", doubleNumber)
                           .add("The variable name is charValue", charValue)
                           .add("The variable name is booleanValue", booleanValue)
                           .add("The variable name is stringValue", stringValue)
                           .add("The variable name is objectValue", objectValue)
                           .log(true);

                debugger.add(floatNumber)
                            .add(doubleNumber)
                            .add(charValue)
                            .add(booleanValue);
                /*  Note that we can set the value of the Debugger bugger with the 
last .log(false) method. */
                Debugger bugger = new Debugger(true).setPath("C", new String [] { 
JavaPlatform.version, "jre", "classes", "tccjava", "bugs", "testlogs" }, 
"debuggerThreeTestlog", "bug")
                           .add(byteNumber)
                           .add(shortNumber)
                           .add(intNumber)
                           .add(longNumber)
                           .add(floatNumber)
                           .add(doubleNumber)
                           .add(charValue)
                           .add(booleanValue)
                           .add(stringValue)
                           .add(objectValue)
                           .log(false);

                debugger.add(stringValue)
                            .add(objectValue)
                            .log(false)
                            .add("The variable name is byteNumber", byteNumber)
                            .add("The variable name is shortNumber", shortNumber)
                            .add("The variable name is intNumber", intNumber)
                            .add("The variable name is longNumber", longNumber)
                            .add("The variable name is floatNumber", floatNumber)
                            .add("The variable name is doubleNumber", doubleNumber)
                            .add("The variable name is charValue", charValue);

                debugger.add("The variable name is charValue", charValue)
                            .add("The variable name is booleanValue", booleanValue)
                            .add("The variable name is stringValue", stringValue)
                            .add("The variable name is objectValue", objectValue)
                            .log("Test of the Debugger class", true);


                bugger.add("The variable name is byteNumber", byteNumber)
                          .add("The variable name is shortNumber", shortNumber)
                          .add("The variable name is intNumber", intNumber)
                          .add("The variable name is longNumber", longNumber)
                          .add("The variable name is floatNumber", floatNumber)
                          .add("The variable name is doubleNumber", doubleNumber)
                          .add("The variable name is charValue", charValue)
                          .add("The variable name is booleanValue", booleanValue)
                          .add("The variable name is stringValue", stringValue)
                          .add("The variable name is objectValue", objectValue)
                          .log("Test of the Debugger class", true);

                System.out.println("\n\n\tCHECK FOR THE RESULTS AT tccjava\\bugs\\ 
UNDER testlogs.");

                System.exit(0);
        }
} ///;-)
--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to