[jdom-interest] Toward beta 9

Bradley S. Huffman hip at a.cs.okstate.edu
Wed Apr 9 16:17:54 PDT 2003


Elliotte Rusty Harold writes:

> >Verifier check for ProcessingInstruction's setData()? Elliotte can we borrow
> >the check out of XOM's Verifier?
> >
> 
> Sure. I officially grant the JDOM permission to republish that check 
> under the JDOM license rather than the LGPL.

And ProcessingInstruction.

*** ProcessingInstruction.java	Wed Apr  9 18:13:10 2003
--- ProcessingInstruction.new	Wed Apr  9 18:11:51 2003
***************
*** 256,263 ****
       * @return <code>ProcessingInstruction</code> - this PI modified.
       */
      public ProcessingInstruction setData(String data) {
!         // XXX Need to validate the data
!         // XXX Make sure the PI doesn't contain ?> internally, a la CDATA
          this.rawData = data;
          this.mapData = parseData(data);
          return this;
--- 256,266 ----
       * @return <code>ProcessingInstruction</code> - this PI modified.
       */
      public ProcessingInstruction setData(String data) {
!         String reason = Verifier.checkProcessingInstructionData(data);
!         if (reason != null) {
!             throw new IllegalDataException(data, reason);
!         }
! 
          this.rawData = data;
          this.mapData = parseData(data);
          return this;
***************
*** 272,279 ****
       * @return <code>ProcessingInstruction</code> - modified PI.
       */
      public ProcessingInstruction setData(Map data) {
!         // XXX Need to validate the data
!         this.rawData = toString(data);
          this.mapData = data;
          return this;
      }
--- 275,288 ----
       * @return <code>ProcessingInstruction</code> - modified PI.
       */
      public ProcessingInstruction setData(Map data) {
!         String temp = toString(data);
! 
!         String reason = Verifier.checkProcessingInstructionData(temp);
!         if (reason != null) {
!             throw new IllegalDataException(temp, reason);
!         }
! 
!         this.rawData = temp;
          this.mapData = data;
          return this;
      }
***************
*** 302,310 ****
       */
      public ProcessingInstruction setValue(String name,
                                            String value) {
!         // XXX Need to validate the data
!         mapData.put(name, value);
!         rawData = toString(mapData);
          return this;
      }
  
--- 311,328 ----
       */
      public ProcessingInstruction setValue(String name,
                                            String value) {
!         String reason = Verifier.checkProcessingInstructionData(name);
!         if (reason != null) {
!             throw new IllegalDataException(name, reason);
!         }
! 
!         reason = Verifier.checkProcessingInstructionData(value);
!         if (reason != null) {
!             throw new IllegalDataException(value, reason);
!         }
! 
!         this.mapData.put(name, value);
!         this.rawData = toString(mapData);
          return this;
      }
  



More information about the jdom-interest mailing list