[jdom-interest] Anything else for beta 9?

Bradley S. Huffman hip at a.cs.okstate.edu
Tue Apr 8 20:59:00 PDT 2003


Jason Hunter writes:

> That's definitely a bug, although I don't think it's worth holding up b9
> over.  Do you have a fix?  If so, I'll include it.  It's pretty low
> risk.

*** Element.java	Tue Apr  8 22:54:13 2003
--- Element.new	Tue Apr  8 22:33:50 2003
***************
*** 1483,1488 ****
--- 1483,1498 ----
              }
          }
  
+         // Cloning additional namespaces
+         if (additionalNamespaces != null) {
+             int additionalSize = additionalNamespaces.size();
+             element.additionalNamespaces = new ArrayList(additionalSize);
+             for (int i = 0; i < additionalSize; i++) {
+                 Object additional = additionalNamespaces.get(i);
+                 element.additionalNamespaces.add(additional);
+             }
+         }
+ 
          // Cloning content
          if (content != null) {
              for (int i = 0; i < content.size(); i++) {
***************
*** 1530,1535 ****
--- 1540,1558 ----
          // This allows for writing pointers to already written strings
          out.writeObject(namespace.getPrefix());
          out.writeObject(namespace.getURI());
+ 
+         if (additionalNamespaces == null) {
+             out.write(0);
+         }
+         else {
+             int size = additionalNamespaces.size();
+             out.write(size);
+             for (int i = 0; i < size; i++) {
+                 Namespace additional = (Namespace) additionalNamespaces.get(i);
+                 out.writeObject(additional.getPrefix());
+                 out.writeObject(additional.getURI());
+             }
+         }
      }
  
      private void readObject(ObjectInputStream in)
***************
*** 1539,1544 ****
--- 1562,1578 ----
  
          namespace = Namespace.getNamespace(
              (String)in.readObject(), (String)in.readObject());
+ 
+         int size = in.read();
+ 
+         if (size != 0) { 
+             additionalNamespaces = new ArrayList(size);
+             for (int i = 0; i < size; i++) {
+                 Namespace additional = Namespace.getNamespace(
+                     (String)in.readObject(), (String)in.readObject());
+                 additionalNamespaces.add(additional);
+             }
+         }
      }
  
      /**



More information about the jdom-interest mailing list