|
There are some errors in the code of this class.
They are the same kind of errors that I found in org.apache.ecs.Document. The problem is mainly in the
setXXX methods (setBody for example), which forgets to update the
local reference AND the reference in the Hashtable.
And
now, some corrections to the code of org.apache.ecs.FrameSetDocument
in green:
added - in red:
removed
/** @serial doctype doctype
*/
private Doctype doctype = null;
{
html = new Html(); head = new Head(); title = new Title(); frameset = new FrameSet(); noframes = new NoFrames(); body = new Body(); head.addElement("title",title); html.addElement("head",head); html.addElement("frameset",frameset); html.addElement("noframes",noframes); noframes.addElement("body",body); }
/**
Get the doctype element for this document container. */ public Doctype getDoctype() { return(doctype); } /** Set the doctype element for this document container. */ public FrameSetDocument setDoctype(Doctype set_doctype) { this.doctype = set_doctype; return(this); } public FrameSetDocument setHead(Head
set_head)
{ html.addElement("head",set_head); this.head = set_head; return(this); } public FrameSetDocument
setHead(FrameSet set_frameset)
public FrameSetDocument setFrameSet(FrameSet set_frameset) { html.addElement("frameset",set_frameset); this.frameset = set_frameset; return(this); } public FrameSetDocument setBody(Body
set_body)
{ noframes.addElement("body",set_body); this.body = set_body; return(this); } public FrameSetDocument setTitle(Title
set_title)
{ head.addElement("title",set_title); this.title = set_title; return(this); } public void output(OutputStream
out)
{ if (doctype != null) { doctype.output(out); try { out.write('\n'); } catch ( Exception e) {} } // FrameSetDocument is just a convient wrapper for Html call Html.output html.output(out); } public void output(PrintWriter
out)
{ if (doctype != null) { doctype.output(out); try { out.write('\n'); } catch ( Exception e) {} } // FrameSetDocument is just a convient wrapper for Html call Html.output html.output(out); }
/**
Override the toString() method so that it prints something meaningful. */ public final String toString() { // previous
implementation removed
StringBuffer sb = new StringBuffer(); if ( getCodeset() != null ) { if (doctype != null) sb.append (doctype.toString(getCodeset())); sb.append (html.toString(getCodeset())); return (sb.toString()); } else { if (doctype != null) sb.append (doctype.toString()); sb.append (html.toString()); return(sb.toString()); } }
/**
Override the toString() method so that it prints something meaningful. */ public final String toString(String codeset) { // previous implementation removed StringBuffer sb = new StringBuffer(); if (doctype != null) sb.append (doctype.toString(getCodeset())); sb.append (html.toString(getCodeset())); return(sb.toString()); }
__________________________________________________
Joan Roch - programmeur k-otique
[EMAIL PROTECTED]
K-OS Multim=E9dia (www.k-os.com)
5505, boul. St-Laurent, Suite 4210
Montr=E9al (Qu=E9bec) H2T 1S6
T:514.495.1122 | F:514.495.1342
__________________________________________________
"Si vous me cherchez,
je suis dans ma combinaison spatiale."
- Capitaine Star -
|
