[jdom-interest] Patch for JDK1.1

Bradley S. Huffman hip at a.cs.okstate.edu
Thu Mar 14 12:14:58 PST 2002


Sigh, had to give up StringBuffer.substring :(  This patch compiles under
JDK1.1 and 1.2, and runs under 1.2.  If someone could test that it also
runs under 1.1 that would be great.

Brad

==================== Cut Here ====================
Common subdirectories: jdom/src and jdom-new/src
Common subdirectories: jdom/src/java and jdom-new/src/java
Common subdirectories: jdom/src/java/META-INF and jdom-new/src/java/META-INF
Common subdirectories: jdom/src/java/org and jdom-new/src/java/org
Common subdirectories: jdom/src/java/org/jdom and jdom-new/src/java/org/jdom
diff -c -r jdom/src/java/org/jdom/ContentList.java jdom-new/src/java/org/jdom/ContentList.java
*** jdom/src/java/org/jdom/ContentList.java	Tue Mar 12 21:57:41 2002
--- jdom-new/src/java/org/jdom/ContentList.java	Thu Mar 14 13:33:00 2002
***************
*** 87,92 ****
--- 87,106 ----
  
      private static final int INITIAL_ARRAY_SIZE = 5;
  
+     /**
+      * Used inner class FilterListIterator to help hasNext and
+      * hasPrevious the next index of our cursor (must be here
+      * for JDK1.1).
+      */
+     private static final int CREATE  = 0;
+     private static final int HASPREV = 1;
+     private static final int HASNEXT = 2;
+     private static final int PREV    = 3;
+     private static final int NEXT    = 4;
+     private static final int ADD     = 5;
+     private static final int REMOVE  = 6;
+     private static final int SET     = 7;
+ 
      /** Our backing list */
      protected ArrayList list;
  
***************
*** 890,908 ****
  
      class FilterListIterator implements ListIterator {
  
-         /**
-          * Used to help hasNext and hasPrevious the next
-          * index of our cursor
-          */
-         static final int CREATE  = 0;
-         static final int HASPREV = 1;
-         static final int HASNEXT = 2;
-         static final int PREV    = 3;
-         static final int NEXT    = 4;
-         static final int ADD     = 5;
-         static final int REMOVE  = 6;
-         static final int SET     = 7;
- 
          /** The Filter that applies */
          Filter filter;
  
--- 904,909 ----
Common subdirectories: jdom/src/java/org/jdom/adapters and jdom-new/src/java/org/jdom/adapters
Common subdirectories: jdom/src/java/org/jdom/filter and jdom-new/src/java/org/jdom/filter
Common subdirectories: jdom/src/java/org/jdom/input and jdom-new/src/java/org/jdom/input
Common subdirectories: jdom/src/java/org/jdom/output and jdom-new/src/java/org/jdom/output
Common subdirectories: jdom/src/java/org/jdom/test and jdom-new/src/java/org/jdom/test
Common subdirectories: jdom/src/java/org/jdom/transform and jdom-new/src/java/org/jdom/transform
diff -c -r jdom/src/java/org/jdom/input/SAXHandler.java jdom-new/src/java/org/jdom/input/SAXHandler.java
*** jdom/src/java/org/jdom/input/SAXHandler.java	Thu Mar  7 12:48:47 2002
--- jdom-new/src/java/org/jdom/input/SAXHandler.java	Thu Mar 14 13:46:34 2002
***************
*** 714,720 ****
--- 714,724 ----
              return;
          }
  
+         /*
+          * Note: When we stop supporting JDK1.1, use substring instead
          String data = textBuffer.substring(0);
+          */
+         String data = textBuffer.toString();
          textBuffer.setLength(0);
  
  /**
diff -c -r jdom/src/java/org/jdom/output/XMLOutputter.java jdom-new/src/java/org/jdom/output/XMLOutputter.java
*** jdom/src/java/org/jdom/output/XMLOutputter.java	Tue Feb 19 00:46:03 2002
--- jdom-new/src/java/org/jdom/output/XMLOutputter.java	Thu Mar 14 13:37:36 2002
***************
*** 214,226 ****
        * - default is <code>false</code> */
      private boolean omitEncoding = false;
  
!     class Format implements Cloneable {
!         /** standard value to indent by, if we are indenting */
!         static final String STANDARD_INDENT = "  ";
  
!         /** standard string with which to end a line */
!         static final String STANDARD_LINE_SEPARATOR = "\r\n";
  
          /** The default indent is no spaces (as original document) */
          String indent = null;
  
--- 214,227 ----
        * - default is <code>false</code> */
      private boolean omitEncoding = false;
  
!     /** standard value to indent by, if we are indenting */
!     private static final String STANDARD_INDENT = "  ";
  
!     /** standard string with which to end a line */
!     private static final String STANDARD_LINE_SEPARATOR = "\r\n";
  
+     class Format implements Cloneable {
+ 
          /** The default indent is no spaces (as original document) */
          String indent = null;
  
***************
*** 527,533 ****
       */
      public void setIndent(boolean doIndent) {
          if (doIndent) {
!             defaultFormat.indent = Format.STANDARD_INDENT;
          }
          else {
              defaultFormat.indent = null;
--- 528,534 ----
       */
      public void setIndent(boolean doIndent) {
          if (doIndent) {
!             defaultFormat.indent = STANDARD_INDENT;
          }
          else {
              defaultFormat.indent = null;



More information about the jdom-interest mailing list