[jdom-interest] minor issue with Comment

Jason Hunter jhunter at collab.net
Mon Sep 25 23:19:09 PDT 2000


You're right.  Just checked in the fix.

-jh-

philip.nelson at omniresources.com wrote:
> 
> While writing some tests for the test suite I noticed this in Comment.java
> which seems a little inconsitent to me.  The constructor for a comment
> checks the data for valid data with Verifier but setText doesn't.  Shouldn't
> they both do the same thing?
> 
> Right now it's
> 
>     public Comment(String text) {
>         String reason;
>         if ((reason = Verifier.checkCommentData(text)) != null) {
>             throw new IllegalDataException(text, "comment", reason);
>         }
> 
>         this.text = text;
>     }
> 
>     /**
>      * <p>
>      * This will set the value of the <code>Comment</code>.
>      * </p>
>      *
>      * @param text <code>String</code> text for comment.
>      * @return <code>Comment</code> - this Comment modified.
>      */
>     public Comment setText(String text) {
>         this.text = text;
>         return this;
>     }
> 
> But maybe it should be something like ...
> 
>     public Comment(String text) {
>         setText(text);
>     }
> 
>     /**
>      * <p>
>      * This will set the value of the <code>Comment</code>.
>      * </p>
>      *
>      * @param text <code>String</code> text for comment.
>      * @return <code>Comment</code> - this Comment modified.
>      */
>     public Comment setText(String text) {
>         String reason;
>         if ((reason = Verifier.checkCommentData(text)) != null) {
>             throw new IllegalDataException(text, "comment", reason);
>         }
> 
>         this.text = text;
>         return this;
>     }
> 
> 
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com



More information about the jdom-interest mailing list