[jsword-svn] common/java/core/org/crosswire/common/util s

jswordcvs at crosswire.org jswordcvs at crosswire.org
Sun Nov 28 14:36:33 MST 2004


Update of /cvs/jsword/common/java/core/org/crosswire/common/util
In directory www.crosswire.org:/tmp/cvs-serv11368/java/core/org/crosswire/common/util

Modified Files:
	IteratorEnumeration.java ReporterEvent.java Reporter.java 
	StringUtil.java EventListenerList.java IOUtil.java 
	ClassUtil.java ThreadUtil.java Convert.java CWClassLoader.java 
	MsgBase.java TabbedFileReader.java StackTrace.java 
Log Message:
intellij refactor - safe

Index: EventListenerList.java
===================================================================
RCS file: /cvs/jsword/common/java/core/org/crosswire/common/util/EventListenerList.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** EventListenerList.java	16 Aug 2004 22:07:35 -0000	1.5
--- EventListenerList.java	28 Nov 2004 21:36:31 -0000	1.6
***************
*** 12,16 ****
   * very useful in non GUI code which does not need the rest of sw*ng.
   * BORROWED: From javax.sw*ng.event.EventListnerList
!  * 
   * <p>If you inculde sw*ng code in non-gui code then you can end up not being
   * able to run your code in a headerless environment because X includes Y which
--- 12,16 ----
   * very useful in non GUI code which does not need the rest of sw*ng.
   * BORROWED: From javax.sw*ng.event.EventListnerList
!  *
   * <p>If you inculde sw*ng code in non-gui code then you can end up not being
   * able to run your code in a headerless environment because X includes Y which
***************
*** 117,129 ****
       * Add the listener as a listener of the specified type.
       * @param t the type of the listener to be added
!      * @param l the listener to be added
       */
!     public synchronized void add(Class t, EventListener l)
      {
!         assert l != null;
  
!         if (!t.isInstance(l))
          {
!             throw new IllegalArgumentException(Msg.WRONG_TYPE.toString(new Object[] { l, t }));
          }
  
--- 117,129 ----
       * Add the listener as a listener of the specified type.
       * @param t the type of the listener to be added
!      * @param li the listener to be added
       */
!     public synchronized void add(Class t, EventListener li)
      {
!         assert li != null;
  
!         if (!t.isInstance(li))
          {
!             throw new IllegalArgumentException(Msg.WRONG_TYPE.toString(new Object[] { li, t }));
          }
  
***************
*** 132,136 ****
              // if this is the first listener added,
              // initialize the lists
!             listenerList = new Object[] { t, l };
          }
          else
--- 132,136 ----
              // if this is the first listener added,
              // initialize the lists
!             listenerList = new Object[] { t, li };
          }
          else
***************
*** 142,146 ****
  
              tmp[i] = t;
!             tmp[i + 1] = l;
  
              listenerList = tmp;
--- 142,146 ----
  
              tmp[i] = t;
!             tmp[i + 1] = li;
  
              listenerList = tmp;
***************
*** 151,170 ****
       * Remove the listener as a listener of the specified type.
       * @param t the type of the listener to be removed
!      * @param l the listener to be removed
       */
!     public synchronized void remove(Class t, EventListener l)
      {
!         assert l != null;
  
!         if (!t.isInstance(l))
          {
!             throw new IllegalArgumentException(Msg.WRONG_TYPE.toString(new Object[] { l, t }));
          }
  
!         // Is l on the list?
          int index = -1;
          for (int i = listenerList.length - 2; i >= 0; i -= 2)
          {
!             if (listenerList[i] == t && listenerList[i + 1].equals(l))
              {
                  index = i;
--- 151,170 ----
       * Remove the listener as a listener of the specified type.
       * @param t the type of the listener to be removed
!      * @param li the listener to be removed
       */
!     public synchronized void remove(Class t, EventListener li)
      {
!         assert li != null;
  
!         if (!t.isInstance(li))
          {
!             throw new IllegalArgumentException(Msg.WRONG_TYPE.toString(new Object[] { li, t }));
          }
  
!         // Is li on the list?
          int index = -1;
          for (int i = listenerList.length - 2; i >= 0; i -= 2)
          {
!             if (listenerList[i] == t && listenerList[i + 1].equals(li))
              {
                  index = i;
***************
*** 197,204 ****
       * Serialization support
       */
!     private void writeObject(ObjectOutputStream s) throws IOException
      {
          Object[] lList = listenerList;
!         s.defaultWriteObject();
  
          // Save the non-null event listeners:
--- 197,204 ----
       * Serialization support
       */
!     private void writeObject(ObjectOutputStream oos) throws IOException
      {
          Object[] lList = listenerList;
!         oos.defaultWriteObject();
  
          // Save the non-null event listeners:
***************
*** 206,218 ****
          {
              Class t = (Class) lList[i];
!             EventListener l = (EventListener) lList[i + 1];
!             if ((l != null) && (l instanceof Serializable))
              {
!                 s.writeObject(t.getName());
!                 s.writeObject(l);
              }
          }
  
!         s.writeObject(null);
      }
  
--- 206,218 ----
          {
              Class t = (Class) lList[i];
!             EventListener li = (EventListener) lList[i + 1];
!             if ((li != null) && (li instanceof Serializable))
              {
!                 oos.writeObject(t.getName());
!                 oos.writeObject(li);
              }
          }
  
!         oos.writeObject(null);
      }
  
***************
*** 220,236 ****
       * Serialization support
       */
!     private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException
      {
          listenerList = NULL_ARRAY;
!         s.defaultReadObject();
  
          while (true)
          {
!             Object listenerTypeOrNull = s.readObject();
              if (listenerTypeOrNull == null)
                  break;
  
!             EventListener l = (EventListener) s.readObject();
!             add(Class.forName((String) listenerTypeOrNull), l);
          }
      }
--- 220,238 ----
       * Serialization support
       */
!     private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException
      {
          listenerList = NULL_ARRAY;
!         ois.defaultReadObject();
  
          while (true)
          {
!             Object listenerTypeOrNull = ois.readObject();
              if (listenerTypeOrNull == null)
+             {
                  break;
+             }
  
!             EventListener li = (EventListener) ois.readObject();
!             add(Class.forName((String) listenerTypeOrNull), li);
          }
      }

Index: CWClassLoader.java
===================================================================
RCS file: /cvs/jsword/common/java/core/org/crosswire/common/util/CWClassLoader.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** CWClassLoader.java	8 Sep 2004 19:54:24 -0000	1.5
--- CWClassLoader.java	28 Nov 2004 21:36:31 -0000	1.6
***************
*** 182,186 ****
  
      /**
!      * 
       */
      public ClassLoader getClassLoader()
--- 182,186 ----
  
      /**
!      *
       */
      public ClassLoader getClassLoader()
***************
*** 198,202 ****
       * primordial loader [i.e., everybody's parent].
       */
!     private static ClassLoader pickLoader(final ClassLoader loader1, final ClassLoader loader2)
      {
          ClassLoader loader = loader2;
--- 198,202 ----
       * primordial loader [i.e., everybody's parent].
       */
!     private static ClassLoader pickLoader(ClassLoader loader1, ClassLoader loader2)
      {
          ClassLoader loader = loader2;
***************
*** 273,278 ****
  
              // Make sure the file exists and can be read
!             File f = new File(override.getFile());
!             if (f.canRead())
              {
                  reply = override;
--- 273,278 ----
  
              // Make sure the file exists and can be read
!             File file = new File(override.getFile());
!             if (file.canRead())
              {
                  reply = override;
***************
*** 286,294 ****
       * The class to which the resources belong
       */
!     private Class owner;
  
      /**
       * Notion of a project's home from where additional resources can be found.
       */
!     private static URL home;
  }
--- 286,294 ----
       * The class to which the resources belong
       */
!     private Class owner = null;
  
      /**
       * Notion of a project's home from where additional resources can be found.
       */
!     private static URL home = null;
  }

Index: ReporterEvent.java
===================================================================
RCS file: /cvs/jsword/common/java/core/org/crosswire/common/util/ReporterEvent.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ReporterEvent.java	20 Apr 2004 21:16:06 -0000	1.1
--- ReporterEvent.java	28 Nov 2004 21:36:31 -0000	1.2
***************
*** 29,33 ****
  public class ReporterEvent extends EventObject
  {
!     /**
       * Constructs an CaptureEvent object.
       * @param source The event originator (typically <code>this</code>)
--- 29,33 ----
  public class ReporterEvent extends EventObject
  {
! 	/**
       * Constructs an CaptureEvent object.
       * @param source The event originator (typically <code>this</code>)
***************
*** 74,79 ****
  
          String full = clazz.getName();
!         int last_dot = full.lastIndexOf("."); //$NON-NLS-1$
!         if (last_dot == -1)
          {
              return full;
--- 74,79 ----
  
          String full = clazz.getName();
!         int lastDot = full.lastIndexOf("."); //$NON-NLS-1$
!         if (lastDot == -1)
          {
              return full;
***************
*** 81,85 ****
          else
          {
!             return full.substring(last_dot + 1);
          }
      }
--- 81,85 ----
          else
          {
!             return full.substring(lastDot + 1);
          }
      }
***************
*** 112,114 ****
--- 112,119 ----
       */
      private String message;
+ 
+     /**
+      * Serialization ID
+      */
+     private static final long serialVersionUID = 4121978048640988213L;
  }

Index: Convert.java
===================================================================
RCS file: /cvs/jsword/common/java/core/org/crosswire/common/util/Convert.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Convert.java	21 Sep 2004 17:45:47 -0000	1.3
--- Convert.java	28 Nov 2004 21:36:31 -0000	1.4
***************
*** 7,11 ****
  /**
   * Conversions between various types and Strings.
!  * 
   * <p><table border='1' cellPadding='3' cellSpacing='0'>
   * <tr><td bgColor='white' class='TableRowColor'><font size='-7'>
--- 7,11 ----
  /**
   * Conversions between various types and Strings.
!  *
   * <p><table border='1' cellPadding='3' cellSpacing='0'>
   * <tr><td bgColor='white' class='TableRowColor'><font size='-7'>
***************
*** 220,226 ****
  
                  retcode.append(key);
!                 retcode.append("="); //$NON-NLS-1$
                  retcode.append(value);
!                 retcode.append(" "); //$NON-NLS-1$
              }
              catch (ClassCastException ex)
--- 220,226 ----
  
                  retcode.append(key);
!                 retcode.append('=');
                  retcode.append(value);
!                 retcode.append(' ');
              }
              catch (ClassCastException ex)

Index: Reporter.java
===================================================================
RCS file: /cvs/jsword/common/java/core/org/crosswire/common/util/Reporter.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Reporter.java	16 Aug 2004 22:07:35 -0000	1.4
--- Reporter.java	28 Nov 2004 21:36:31 -0000	1.5
***************
*** 302,306 ****
           * Handle AWT exceptions
           */
!         public void handle(final Throwable ex)
          {
              Reporter.informUser(this, ex);
--- 302,306 ----
           * Handle AWT exceptions
           */
!         public void handle(Throwable ex)
          {
              Reporter.informUser(this, ex);

Index: ClassUtil.java
===================================================================
RCS file: /cvs/jsword/common/java/core/org/crosswire/common/util/ClassUtil.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** ClassUtil.java	21 Sep 2004 17:45:47 -0000	1.6
--- ClassUtil.java	28 Nov 2004 21:36:31 -0000	1.7
***************
*** 15,19 ****
  /**
   * Various Java Class Utilities.
!  * 
   * <p><table border='1' cellPadding='3' cellSpacing='0'>
   * <tr><td bgColor='white' class='TableRowColor'><font size='-7'>
--- 15,19 ----
  /**
   * Various Java Class Utilities.
!  *
   * <p><table border='1' cellPadding='3' cellSpacing='0'>
   * <tr><td bgColor='white' class='TableRowColor'><font size='-7'>
***************
*** 90,94 ****
                  if (!paths[i].endsWith(File.separator))
                  {
!                     paths[i] = paths[i] + File.separator;
                  }
  
--- 90,94 ----
                  if (!paths[i].endsWith(File.separator))
                  {
!                     paths[i] += File.separator;
                  }
  
***************
*** 232,236 ****
       * @see ClassUtil#getImplementors(Class)
       */
!     public static Class getImplementor(Class clazz) throws MalformedURLException, IOException, ClassNotFoundException, ClassCastException
      {
          Properties props = ResourceUtil.getProperties(clazz);
--- 232,236 ----
       * @see ClassUtil#getImplementors(Class)
       */
!     public static Class getImplementor(Class clazz) throws IOException, ClassNotFoundException, ClassCastException
      {
          Properties props = ResourceUtil.getProperties(clazz);
***************
*** 266,270 ****
      /**
       * <p>Gets the class name minus the package name for an <code>Object</code>.</p>
!      * 
       * @param object  the class to get the short name for, may be null
       * @param valueIfNull  the value to return if null
--- 266,270 ----
      /**
       * <p>Gets the class name minus the package name for an <code>Object</code>.</p>
!      *
       * @param object  the class to get the short name for, may be null
       * @param valueIfNull  the value to return if null
***************
*** 282,286 ****
      /**
       * <p>Gets the class name minus the package name from a <code>Class</code>.</p>
!      * 
       * @param cls  the class to get the short name for, must not be
       *  <code>null</code>
--- 282,286 ----
      /**
       * <p>Gets the class name minus the package name from a <code>Class</code>.</p>
!      *
       * @param cls  the class to get the short name for, must not be
       *  <code>null</code>
***************
*** 301,305 ****
       *
       * <p>The string passed in is assumed to be a class name - it is not checked.</p>
!      * 
       * @param className  the className to get the short name for,
       *  must not be empty or <code>null</code>
--- 301,305 ----
       *
       * <p>The string passed in is assumed to be a class name - it is not checked.</p>
!      *
       * @param className  the className to get the short name for,
       *  must not be empty or <code>null</code>

Index: IteratorEnumeration.java
===================================================================
RCS file: /cvs/jsword/common/java/core/org/crosswire/common/util/IteratorEnumeration.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** IteratorEnumeration.java	20 Apr 2004 21:16:06 -0000	1.1
--- IteratorEnumeration.java	28 Nov 2004 21:36:31 -0000	1.2
***************
*** 9,13 ****
   * <p>The only real difference between the 2 is the naming and
   * that Enumeration does not have the delete method.
!  * 
   * <p><table border='1' cellPadding='3' cellSpacing='0'>
   * <tr><td bgColor='white' class='TableRowColor'><font size='-7'>
--- 9,13 ----
   * <p>The only real difference between the 2 is the naming and
   * that Enumeration does not have the delete method.
!  *
   * <p><table border='1' cellPadding='3' cellSpacing='0'>
   * <tr><td bgColor='white' class='TableRowColor'><font size='-7'>
***************
*** 44,48 ****
       * Returns true if the iteration has more elements
       */
!     public final boolean hasMoreElements()
      {
          return it.hasNext();
--- 44,48 ----
       * Returns true if the iteration has more elements
       */
!     public boolean hasMoreElements()
      {
          return it.hasNext();
***************
*** 52,56 ****
       *  Returns the next element in the interation
       */
!     public final Object nextElement() throws NoSuchElementException
      {
          return it.next();
--- 52,56 ----
       *  Returns the next element in the interation
       */
!     public Object nextElement() throws NoSuchElementException
      {
          return it.next();

Index: StringUtil.java
===================================================================
RCS file: /cvs/jsword/common/java/core/org/crosswire/common/util/StringUtil.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** StringUtil.java	21 Sep 2004 17:45:47 -0000	1.4
--- StringUtil.java	28 Nov 2004 21:36:31 -0000	1.5
***************
*** 56,65 ****
      {
          StringBuffer retcode = new StringBuffer();
-         String line = ""; //$NON-NLS-1$
          BufferedReader din = new BufferedReader(in);
  
          while (true)
          {
!             line = din.readLine();
  
              if (line == null)
--- 56,64 ----
      {
          StringBuffer retcode = new StringBuffer();
          BufferedReader din = new BufferedReader(in);
  
          while (true)
          {
!             String line = din.readLine();
  
              if (line == null)
***************
*** 160,164 ****
       * <p>The separator is not included in the returned String array.
       * Adjacent separators are treated as one separator.</p>
!      * 
       * <p>A <code>null</code> input String returns <code>null</code>.</p>
       *
--- 159,163 ----
       * <p>The separator is not included in the returned String array.
       * Adjacent separators are treated as one separator.</p>
!      *
       * <p>A <code>null</code> input String returns <code>null</code>.</p>
       *
***************
*** 170,174 ****
       * StringUtils.split(" abc ")    = ["abc"]
       * </pre>
!      * 
       * @param str  the String to parse, may be null
       * @return an array of parsed Strings, <code>null</code> if null String input
--- 169,173 ----
       * StringUtils.split(" abc ")    = ["abc"]
       * </pre>
!      *
       * @param str  the String to parse, may be null
       * @return an array of parsed Strings, <code>null</code> if null String input
***************
*** 185,189 ****
       * <p>The separator is not included in the returned String array.
       * Adjacent separators are treated as one separator.</p>
!      * 
       * <p>A <code>null</code> input String returns <code>null</code>.</p>
       *
--- 184,188 ----
       * <p>The separator is not included in the returned String array.
       * Adjacent separators are treated as one separator.</p>
!      *
       * <p>A <code>null</code> input String returns <code>null</code>.</p>
       *
***************
*** 197,201 ****
       * StringUtils.split("a b c", ' ')    = ["a", "b", "c"]
       * </pre>
!      * 
       * @param str  the String to parse, may be null
       * @param separatorChar  the character used as the delimiter,
--- 196,200 ----
       * StringUtils.split("a b c", ' ')    = ["a", "b", "c"]
       * </pre>
!      *
       * @param str  the String to parse, may be null
       * @param separatorChar  the character used as the delimiter,
***************
*** 249,253 ****
       * <p>The separator is not included in the returned String array.
       * Adjacent separators are treated as one separator.</p>
!      * 
       * <p>A <code>null</code> input String returns <code>null</code>.
       * A <code>null</code> separatorChars splits on whitespace.</p>
--- 248,252 ----
       * <p>The separator is not included in the returned String array.
       * Adjacent separators are treated as one separator.</p>
!      *
       * <p>A <code>null</code> input String returns <code>null</code>.
       * A <code>null</code> separatorChars splits on whitespace.</p>
***************
*** 261,265 ****
       * StringUtils.split("ab:cd:ef", ":") = ["ab", "cd", "ef"]
       * </pre>
!      * 
       * @param str  the String to parse, may be null
       * @param separatorChars  the characters used as the delimiters,
--- 260,264 ----
       * StringUtils.split("ab:cd:ef", ":") = ["ab", "cd", "ef"]
       * </pre>
!      *
       * @param str  the String to parse, may be null
       * @param separatorChars  the characters used as the delimiters,
***************
*** 281,285 ****
       * <p>A <code>null</code> input String returns <code>null</code>.
       * A <code>null</code> separatorChars splits on whitespace.</p>
!      * 
       * <pre>
       * StringUtils.split(null, *, *)            = null
--- 280,284 ----
       * <p>A <code>null</code> input String returns <code>null</code>.
       * A <code>null</code> separatorChars splits on whitespace.</p>
!      *
       * <pre>
       * StringUtils.split(null, *, *)            = null
***************
*** 290,294 ****
       * StringUtils.split("ab:cd:ef", ":", 2)    = ["ab", "cdef"]
       * </pre>
!      * 
       * @param str  the String to parse, may be null
       * @param separatorChars  the characters used as the delimiters,
--- 289,293 ----
       * StringUtils.split("ab:cd:ef", ":", 2)    = ["ab", "cdef"]
       * </pre>
!      *
       * @param str  the String to parse, may be null
       * @param separatorChars  the characters used as the delimiters,
***************
*** 400,405 ****
       *
       * <p>No delimiter is added before or after the list.
!      * A <code>null</code> separator is the same as an empty String (""). 
!      * Null objects or empty strings within the array are represented by 
       * empty strings.</p>
       *
--- 399,404 ----
       *
       * <p>No delimiter is added before or after the list.
!      * A <code>null</code> separator is the same as an empty String ("").
!      * Null objects or empty strings within the array are represented by
       * empty strings.</p>
       *
***************
*** 434,438 ****
          //           (Assuming that all Strings are roughly equally long)
          int bufSize = arraySize == 0 ? 0 : arraySize
!                         * ((array[0] == null ? 16 : array[0].toString().length()) + (separator != null ? separator.length() : 0));
  
          StringBuffer buf = new StringBuffer(bufSize);
--- 433,437 ----
          //           (Assuming that all Strings are roughly equally long)
          int bufSize = arraySize == 0 ? 0 : arraySize
!                         * ((array[0] == null ? 16 : array[0].toString().length()) + separator.length());
  
          StringBuffer buf = new StringBuffer(bufSize);
***************
*** 440,444 ****
          for (int i = 0; i < arraySize; i++)
          {
!             if (separator != null && (i > 0))
              {
                  buf.append(separator);
--- 439,443 ----
          for (int i = 0; i < arraySize; i++)
          {
!             if (i > 0)
              {
                  buf.append(separator);

Index: StackTrace.java
===================================================================
RCS file: /cvs/jsword/common/java/core/org/crosswire/common/util/StackTrace.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** StackTrace.java	21 Sep 2004 17:45:47 -0000	1.4
--- StackTrace.java	28 Nov 2004 21:36:31 -0000	1.5
***************
*** 10,14 ****
   * makes use of the way exceptions print their stack straces, however
   * it is probably a safe enough assumption for the moment.
!  * 
   * <p><table border='1' cellPadding='3' cellSpacing='0'>
   * <tr><td bgColor='white' class='TableRowColor'><font size='-7'>
--- 10,14 ----
   * makes use of the way exceptions print their stack straces, however
   * it is probably a safe enough assumption for the moment.
!  *
   * <p><table border='1' cellPadding='3' cellSpacing='0'>
   * <tr><td bgColor='white' class='TableRowColor'><font size='-7'>
***************
*** 58,72 ****
      private void init(Throwable ex, int disgard)
      {
!         StringWriter str = new StringWriter();
!         ex.printStackTrace(new PrintWriter(str));
!         String msg = new String(str.getBuffer());
          String[] calls = StringUtil.split(msg, "\n\r"); //$NON-NLS-1$
  
!         class_names = new String[calls.length - disgard];
!         method_names = new String[calls.length - disgard];
!         file_names = new String[calls.length - disgard];
!         line_numbers = new int[calls.length - disgard];
  
!         for (int i = 0; i < class_names.length; i++)
          {
              String call = calls[i + disgard];
--- 58,72 ----
      private void init(Throwable ex, int disgard)
      {
!         StringWriter sout = new StringWriter();
!         ex.printStackTrace(new PrintWriter(sout));
!         String msg = new String(sout.getBuffer());
          String[] calls = StringUtil.split(msg, "\n\r"); //$NON-NLS-1$
  
!         classNames = new String[calls.length - disgard];
!         methodNames = new String[calls.length - disgard];
!         fileNames = new String[calls.length - disgard];
!         lineNumbers = new int[calls.length - disgard];
  
!         for (int i = 0; i < classNames.length; i++)
          {
              String call = calls[i + disgard];
***************
*** 74,105 ****
              try
              {
!                 int spc_index = call.indexOf(' ');
!                 int lhs_index = call.indexOf('(');
!                 int cln_index = call.indexOf(':');
!                 int rhs_index = call.indexOf(')');
  
!                 String full_fn = call.substring(spc_index + 1, lhs_index).trim();
!                 int last_dot = full_fn.lastIndexOf('.');
  
!                 class_names[i] = full_fn.substring(0, last_dot).replace('/', '.'); //$NON-NLS-1$ //$NON-NLS-2$
!                 method_names[i] = full_fn.substring(last_dot + 1);
  
!                 if (cln_index != -1)
                  {
!                     file_names[i] = call.substring(lhs_index + 1, cln_index);
!                     line_numbers[i] = Integer.parseInt(call.substring(cln_index + 1, rhs_index));
                  }
                  else
                  {
!                     file_names[i] = call.substring(lhs_index + 1, rhs_index);
!                     line_numbers[i] = 0;
                  }
              }
              catch (Exception ex2)
              {
!                 class_names[i] = "ParseError: "; //$NON-NLS-1$
!                 method_names[i] = call;
!                 file_names[i] = "Error"; //$NON-NLS-1$
!                 line_numbers[i] = 0;
              }
          }
--- 74,105 ----
              try
              {
!                 int spcIndex = call.indexOf(' ');
!                 int lhsIndex = call.indexOf('(');
!                 int clnIndex = call.indexOf(':');
!                 int rhsIndex = call.indexOf(')');
  
!                 String fullFn = call.substring(spcIndex + 1, lhsIndex).trim();
!                 int lastDot = fullFn.lastIndexOf('.');
  
!                 classNames[i] = fullFn.substring(0, lastDot).replace('/', '.');
!                 methodNames[i] = fullFn.substring(lastDot + 1);
  
!                 if (clnIndex != -1)
                  {
!                     fileNames[i] = call.substring(lhsIndex + 1, clnIndex);
!                     lineNumbers[i] = Integer.parseInt(call.substring(clnIndex + 1, rhsIndex));
                  }
                  else
                  {
!                     fileNames[i] = call.substring(lhsIndex + 1, rhsIndex);
!                     lineNumbers[i] = 0;
                  }
              }
              catch (Exception ex2)
              {
!                 classNames[i] = "ParseError: "; //$NON-NLS-1$
!                 methodNames[i] = call;
!                 fileNames[i] = "Error"; //$NON-NLS-1$
!                 lineNumbers[i] = 0;
              }
          }
***************
*** 109,115 ****
       * How many stack elements are there?
       */
!     public final int countStackElements()
      {
!         return method_names.length;
      }
  
--- 109,115 ----
       * How many stack elements are there?
       */
!     public int countStackElements()
      {
!         return methodNames.length;
      }
  
***************
*** 118,124 ****
       * @param level Number of calling function
       */
!     public final String getFunctionName(int level)
      {
!         return method_names[level];
      }
  
--- 118,124 ----
       * @param level Number of calling function
       */
!     public String getFunctionName(int level)
      {
!         return methodNames[level];
      }
  
***************
*** 127,133 ****
       * @param level Number of calling function
       */
!     public final String getFullFunctionName(int level)
      {
!         return class_names[level] + "." + method_names[level] + "()"; //$NON-NLS-1$ //$NON-NLS-2$
      }
  
--- 127,133 ----
       * @param level Number of calling function
       */
!     public String getFullFunctionName(int level)
      {
!         return classNames[level] + '.' + methodNames[level] + "()"; //$NON-NLS-1$
      }
  
***************
*** 136,142 ****
       * @param level Number of calling function
       */
!     public final String getClassName(int level)
      {
!         return class_names[level];
      }
  
--- 136,142 ----
       * @param level Number of calling function
       */
!     public String getClassName(int level)
      {
!         return classNames[level];
      }
  
***************
*** 145,151 ****
       * @param level Number of calling function
       */
!     public final String getFileName(int level)
      {
!         return file_names[level];
      }
  
--- 145,151 ----
       * @param level Number of calling function
       */
!     public String getFileName(int level)
      {
!         return fileNames[level];
      }
  
***************
*** 154,160 ****
       * @param level Number of calling function
       */
!     public final int getLineNumber(int level)
      {
!         return line_numbers[level];
      }
  
--- 154,160 ----
       * @param level Number of calling function
       */
!     public int getLineNumber(int level)
      {
!         return lineNumbers[level];
      }
  
***************
*** 163,171 ****
       * @param level Number of calling function
       */
!     public final Class getClass(int level)
      {
          try
          {
!             return Class.forName(class_names[level]);
          }
          catch (ClassNotFoundException ex)
--- 163,171 ----
       * @param level Number of calling function
       */
!     public Class getClass(int level)
      {
          try
          {
!             return Class.forName(classNames[level]);
          }
          catch (ClassNotFoundException ex)
***************
*** 186,190 ****
          public boolean hasMoreElements()
          {
!             return level < class_names.length;
          }
  
--- 186,190 ----
          public boolean hasMoreElements()
          {
!             return level < classNames.length;
          }
  
***************
*** 198,202 ****
       * To itterate over the class names
       */
!     public final Enumeration getClassNameElements()
      {
          return new AbstractStackEnumeration()
--- 198,202 ----
       * To itterate over the class names
       */
!     public Enumeration getClassNameElements()
      {
          return new AbstractStackEnumeration()
***************
*** 212,216 ****
       * To itterate over the function names
       */
!     public final Enumeration getFunctionNameElements()
      {
          return new AbstractStackEnumeration()
--- 212,216 ----
       * To itterate over the function names
       */
!     public Enumeration getFunctionNameElements()
      {
          return new AbstractStackEnumeration()
***************
*** 226,230 ****
       * To itterate over the full function names
       */
!     public final Enumeration getFullFunctionNameElements()
      {
          return new AbstractStackEnumeration()
--- 226,230 ----
       * To itterate over the full function names
       */
!     public Enumeration getFullFunctionNameElements()
      {
          return new AbstractStackEnumeration()
***************
*** 240,258 ****
       * Array containing the class names
       */
!     protected String[] class_names;
  
      /**
       * Array containing the method names
       */
!     private String[] method_names;
  
      /**
       * Array containing the file names
       */
!     private String[] file_names;
  
      /**
       * Array containing the line numbers
       */
!     private int[] line_numbers;
  }
--- 240,258 ----
       * Array containing the class names
       */
!     protected String[] classNames;
  
      /**
       * Array containing the method names
       */
!     private String[] methodNames;
  
      /**
       * Array containing the file names
       */
!     private String[] fileNames;
  
      /**
       * Array containing the line numbers
       */
!     private int[] lineNumbers;
  }

Index: ThreadUtil.java
===================================================================
RCS file: /cvs/jsword/common/java/core/org/crosswire/common/util/ThreadUtil.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** ThreadUtil.java	21 Sep 2004 17:45:47 -0000	1.3
--- ThreadUtil.java	28 Nov 2004 21:36:31 -0000	1.4
***************
*** 163,167 ****
          try
          {
!             addItem(vec, depth, thread.getName() + " (" + thread.getPriority() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
          }
          catch (SecurityException ex)
--- 163,167 ----
          try
          {
!             addItem(vec, depth, thread.getName() + " (" + thread.getPriority() + ')'); //$NON-NLS-1$
          }
          catch (SecurityException ex)

Index: MsgBase.java
===================================================================
RCS file: /cvs/jsword/common/java/core/org/crosswire/common/util/MsgBase.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** MsgBase.java	8 Sep 2004 19:54:24 -0000	1.5
--- MsgBase.java	28 Nov 2004 21:36:31 -0000	1.6
***************
*** 12,16 ****
   * easy for most cases. See {@link org.crosswire.common.util.Msg} for an
   * example of how to inherit from here.
!  * 
   * <p>Some Regex/Vi macros to convert from a half way house i18n scheme where
   * the strings are in Msg classes but not properties files:
--- 12,16 ----
   * easy for most cases. See {@link org.crosswire.common.util.Msg} for an
   * example of how to inherit from here.
!  *
   * <p>Some Regex/Vi macros to convert from a half way house i18n scheme where
   * the strings are in Msg classes but not properties files:
***************
*** 21,25 ****
   *   :%s/ = new Msg("/: /
   *   :%s/");\/\/\$NON-NLS-1\$$/
!  * 
   * <p><table border='1' cellPadding='3' cellSpacing='0'>
   * <tr><td bgColor='white' class='TableRowColor'><font size='-7'>
--- 21,25 ----
   *   :%s/ = new Msg("/: /
   *   :%s/");\/\/\$NON-NLS-1\$$/
!  *
   * <p><table border='1' cellPadding='3' cellSpacing='0'>
   * <tr><td bgColor='white' class='TableRowColor'><font size='-7'>
***************
*** 95,99 ****
       * Initialise any resource bundles
       */
!     protected void loadResources()
      {
          Class implementingClass = getClass();
--- 95,99 ----
       * Initialise any resource bundles
       */
!     protected final void loadResources()
      {
          Class implementingClass = getClass();

Index: TabbedFileReader.java
===================================================================
RCS file: /cvs/jsword/common/java/core/org/crosswire/common/util/TabbedFileReader.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** TabbedFileReader.java	21 Sep 2004 17:45:47 -0000	1.2
--- TabbedFileReader.java	28 Nov 2004 21:36:31 -0000	1.3
***************
*** 9,13 ****
   * A TabbedFileReader reads a file consisting of lines with
   * tab separated columns.
!  * 
   * <p><table border='1' cellPadding='3' cellSpacing='0'>
   * <tr><td bgColor='white' class='TableRowColor'><font size='-7'>
--- 9,13 ----
   * A TabbedFileReader reads a file consisting of lines with
   * tab separated columns.
!  *
   * <p><table border='1' cellPadding='3' cellSpacing='0'>
   * <tr><td bgColor='white' class='TableRowColor'><font size='-7'>
***************
*** 70,76 ****
          // read the file a line at a time and send it to the
          // processor for processing
!         String line = null;
!         while ((line = in.readLine()) != null)
          {
              // Split it on tabs
              int previousLoc = 0;
--- 70,81 ----
          // read the file a line at a time and send it to the
          // processor for processing
!         while (true)
          {
+             String line = in.readLine();
+             if (line == null)
+             {
+                 break;
+             }
+ 
              // Split it on tabs
              int previousLoc = 0;

Index: IOUtil.java
===================================================================
RCS file: /cvs/jsword/common/java/core/org/crosswire/common/util/IOUtil.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** IOUtil.java	10 Oct 2004 22:12:17 -0000	1.1
--- IOUtil.java	28 Nov 2004 21:36:31 -0000	1.2
***************
*** 12,16 ****
  /**
   * .
!  * 
   * <p><table border='1' cellPadding='3' cellSpacing='0'>
   * <tr><td bgColor='white' class='TableRowColor'><font size='-7'>
--- 12,16 ----
  /**
   * .
!  *
   * <p><table border='1' cellPadding='3' cellSpacing='0'>
   * <tr><td bgColor='white' class='TableRowColor'><font size='-7'>
***************
*** 45,57 ****
      /**
       * Unpack a zip file to a given directory
!      * @param f The zip file to download
       * @param destdir The directory to unpack up
       * @throws IOException If there is an file error
       */
!     public static void unpackZip(File f, URL destdir) throws IOException
      {
          // unpack the zip.
          byte[] dbuf = new byte[4096];
!         ZipFile zf = new ZipFile(f);
          Enumeration entries = zf.entries();
          while (entries.hasMoreElements())
--- 45,57 ----
      /**
       * Unpack a zip file to a given directory
!      * @param file The zip file to download
       * @param destdir The directory to unpack up
       * @throws IOException If there is an file error
       */
!     public static void unpackZip(File file, URL destdir) throws IOException
      {
          // unpack the zip.
          byte[] dbuf = new byte[4096];
!         ZipFile zf = new ZipFile(file);
          Enumeration entries = zf.entries();
          while (entries.hasMoreElements())
***************
*** 61,71 ****
              String filename = entrypath.substring(entrypath.lastIndexOf('/') + 1);
              URL child = NetUtil.lengthenURL(destdir, filename);
!     
              OutputStream dataOut = NetUtil.getOutputStream(child);
              InputStream dataIn = zf.getInputStream(entry);
!             for (int count = 0; -1 != (count = dataIn.read(dbuf)); )
              {
                  dataOut.write(dbuf, 0, count);
              }
              dataOut.close();
          }
--- 61,78 ----
              String filename = entrypath.substring(entrypath.lastIndexOf('/') + 1);
              URL child = NetUtil.lengthenURL(destdir, filename);
! 
              OutputStream dataOut = NetUtil.getOutputStream(child);
              InputStream dataIn = zf.getInputStream(entry);
! 
!             while (true)
              {
+                 int count = dataIn.read(dbuf);
+                 if (count == -1)
+                 {
+                     break;
+                 }
                  dataOut.write(dbuf, 0, count);
              }
+ 
              dataOut.close();
          }



More information about the jsword-svn mailing list