Uploaded image for project: 'Commons Net'
  1. Commons Net
  2. NET-359

CopyStreamAdapter unconditionally resets the CopyStreamEvent source and is inefficient

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 3.0
    • None
    • None

    Description

      The CopyStreamAdapter.bytesTransferred(CopyStreamEvent event) method unpacks the event in order to pass the parameters to bytesTransferred(long, int, long) method which creates a new event and propagates it to the listeners.

      This means that the original event source is lost, and there is an unnecessary event creation.

      It seems wrong for the bytesTransferred(long, int, long) method to create a CopyStreamEvent - the interface Javadoc specifically says that the bytesTransferred(long, int, long) method was added to avoid the need to create the event.

      It would make more sense if the adapter handled the methods independently, i.e. if the caller provides an event, pass that on, otherwise pass on the individual parameters to the listeners.

      Attachments

        Activity

          People

            Unassigned Unassigned
            sebb Sebb
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: