You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by bu...@apache.org on 2003/04/27 07:18:06 UTC

DO NOT REPLY [Bug 19360] New: - Misleading tests for (form == null)

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=19360>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=19360

Misleading tests for (form == null)

           Summary: Misleading tests for (form == null)
           Product: Struts
           Version: Nightly Build
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Minor
          Priority: Other
         Component: Example
        AssignedTo: struts-dev@jakarta.apache.org
        ReportedBy: phil@steitz.com


The execute methods of EditRegistration and EditSubcription both include code
that tests for (form == null) and manually creates a form and puts it into the
request if the incoming form is null.  This may be misleading and confusing to
newbies, since unless someone has modified the config files, the form will never
be null.

Personally, I would trade off the "good defensive programming" example (avoid
the NPE at all costs) for clarity in the example and remove these blocks.  Given
that this has already been discussed and rejected, I am attaching patches that
add comments clarify why the code is there.

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org