Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-5022

TIOStreamTransport.isOpen is false for InputStream or Outpstream only use.

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Task
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.13.0
    • 0.14.0
    • Java - Library
    • None

    Description

      This follows from THRIFT-2530.

      TIOStreamTransaport.isOpen changed to be
       

        public boolean isOpen() {
          return inputStream_ != null && outputStream_ != null;
        }
      

      but constructors TIOStreamTransaport(InputStream) and TIOStreamTransaport(OutputStream) leave one of inputStream_ or outputStream_ null.

      This makes isOpen false immediately, no close() called. open() does not change the state of object.

       Example:

      TIOStreamTransport x1 = new TIOStreamTransport(new ByteArrayInputStream(new byte[1]));
       System.out.println(x1.isOpen());
       TIOStreamTransport x2 = new TIOStreamTransport(new ByteArrayOutputStream());
       System.out.println(x2.isOpen());
      

      is prints false both times.
       
      It should be:

        public boolean isOpen() {
          return inputStream_ != null || outputStream_ != null;
        }
      

      or an explicit flag for the open/close state but inputStream_ != null || outputStream_ != null; is enough given the current close implementation.

       

       

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            andy Andy Seaborne
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 20m
                20m

                Issue deployment