Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-10440

HarFsInputStream of HarFileSystem, when reading data, computing the position has bug

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.3.0
    • Fix Version/s: 2.4.0
    • Component/s: fs
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      In the HarFsInputStream of HarFileSystem, when reading data by interface "int read(byte[] b)", "int read(byte[] b, int offset, int len)" wille be called and position wille be update, so position need not be update in interface "int read(byte[] b)"

      //HarFileSystem.HarFsInputStream
            public synchronized int read(byte[] b) throws IOException {
              int ret = read(b, 0, b.length);
              if (ret != -1) {
                position += ret;
              }
              return ret;
            }
      
            /**
             *
             */
            public synchronized int read(byte[] b, int offset, int len)
              throws IOException {
              int newlen = len;
              int ret = -1;
              if (position + len > end) {
                newlen = (int) (end - position);
              }
              // end case
              if (newlen == 0)
                return ret;
              ret = underLyingStream.read(b, offset, newlen);
              position += ret;
              return ret;
            }
      

        Attachments

        1. HADOOP-10440-patch
          0.6 kB
          guodongdong

          Issue Links

            Activity

              People

              • Assignee:
                guodongdong guodongdong
                Reporter:
                guodongdong guodongdong
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: