You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Sebb (JIRA)" <ji...@apache.org> on 2011/03/29 03:49:05 UTC

[jira] [Created] (NET-396) POP3.setState() should not be public

POP3.setState() should not be public
------------------------------------

                 Key: NET-396
                 URL: https://issues.apache.org/jira/browse/NET-396
             Project: Commons Net
          Issue Type: Bug
          Components: POP3
    Affects Versions: 2.2
            Reporter: Sebb


The POP3 method setState() is public. However, the state should only be settable by library methods, not by client code, otherwise the state checks won't work correctly.

Changing the visibility would break binary compatibility.

To maintain compatibility there could be a new method (package-private, which would give test cases access) which is allowed to set the state. Also change the public method to either do nothing or throw an UnsupportedOperationException.

The getState() method can remain public.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Resolved] (NET-396) POP3.setState() should not be public

Posted by "Sebb (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/NET-396?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebb resolved NET-396.
----------------------

       Resolution: Fixed
    Fix Version/s: 3.0

Changed public method to do nothing, deprecated, and added package method for use by POP3 classes

> POP3.setState() should not be public
> ------------------------------------
>
>                 Key: NET-396
>                 URL: https://issues.apache.org/jira/browse/NET-396
>             Project: Commons Net
>          Issue Type: Bug
>          Components: POP3
>    Affects Versions: 2.2
>            Reporter: Sebb
>             Fix For: 3.0
>
>
> The POP3 method setState() is public. However, the state should only be settable by library methods, not by client code, otherwise the state checks won't work correctly.
> Changing the visibility would break binary compatibility.
> To maintain compatibility there could be a new method (package-private, which would give test cases access) which is allowed to set the state. Also change the public method to either do nothing or throw an UnsupportedOperationException.
> The getState() method can remain public.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Closed] (NET-396) POP3.setState() should not be public

Posted by "Sebb (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/NET-396?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebb closed NET-396.
--------------------


> POP3.setState() should not be public
> ------------------------------------
>
>                 Key: NET-396
>                 URL: https://issues.apache.org/jira/browse/NET-396
>             Project: Commons Net
>          Issue Type: Bug
>          Components: POP3
>    Affects Versions: 2.2
>            Reporter: Sebb
>
> The POP3 method setState() is public. However, the state should only be settable by library methods, not by client code, otherwise the state checks won't work correctly.
> Changing the visibility would break binary compatibility.
> To maintain compatibility there could be a new method (package-private, which would give test cases access) which is allowed to set the state. Also change the public method to either do nothing or throw an UnsupportedOperationException.
> The getState() method can remain public.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Reopened] (NET-396) POP3.setState() should not be public

Posted by "Daniel Savarese (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/NET-396?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Savarese reopened NET-396:
---------------------------------

      Assignee: Daniel Savarese

setState is supposed to be public.  As I originally documented over a decade ago:
  "The POP3 class ... is provided only so that you may easily implement your own POP3 client ..."

That is no longer possible with this change.  The function must be public so the class can be used via aggregation as well as derivation by third-party code.  Classes like POP3 (better thought of as instantiable namespaces instead of conventional objects) were intended to provide raw protocol access and maximum flexibility, not to protect the programmer from shooting himself in the foot.  Otherwise, there would be no base protocol classes and only FooClient classes.  It was always intended for it to be possible for adventurous programmers to use the base protocol classes outside of their packages.

I'm not defending the outdated design--Commons Net has been in need of a rewrite for many years, but the incremental patching approach was the path of least resistance.  Nonetheless, I'd like to revert the change before the 3.0 release.

> POP3.setState() should not be public
> ------------------------------------
>
>                 Key: NET-396
>                 URL: https://issues.apache.org/jira/browse/NET-396
>             Project: Commons Net
>          Issue Type: Bug
>          Components: POP3
>    Affects Versions: 2.2
>            Reporter: Sebb
>            Assignee: Daniel Savarese
>             Fix For: 3.0
>
>
> The POP3 method setState() is public. However, the state should only be settable by library methods, not by client code, otherwise the state checks won't work correctly.
> Changing the visibility would break binary compatibility.
> To maintain compatibility there could be a new method (package-private, which would give test cases access) which is allowed to set the state. Also change the public method to either do nothing or throw an UnsupportedOperationException.
> The getState() method can remain public.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Resolved] (NET-396) POP3.setState() should not be public

Posted by "Sebb (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/NET-396?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebb resolved NET-396.
----------------------

       Resolution: Not A Problem
    Fix Version/s:     (was: 3.0)
         Assignee:     (was: Daniel Savarese)

Method needs to remain public.

> POP3.setState() should not be public
> ------------------------------------
>
>                 Key: NET-396
>                 URL: https://issues.apache.org/jira/browse/NET-396
>             Project: Commons Net
>          Issue Type: Bug
>          Components: POP3
>    Affects Versions: 2.2
>            Reporter: Sebb
>
> The POP3 method setState() is public. However, the state should only be settable by library methods, not by client code, otherwise the state checks won't work correctly.
> Changing the visibility would break binary compatibility.
> To maintain compatibility there could be a new method (package-private, which would give test cases access) which is allowed to set the state. Also change the public method to either do nothing or throw an UnsupportedOperationException.
> The getState() method can remain public.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira