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

How about inputstream close statement from catch block to finally block in FileContext#copy() ?

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.5.1
    • 2.6.0
    • None
    • None

    Description

      If IOException is happended, can be catched exception block..
      But another excpetion is happended, can't be catched exception block.. also Stream object can't be closed..

              try {
                in = open(qSrc);
                EnumSet<CreateFlag> createFlag = overwrite ? EnumSet.of(
                    CreateFlag.CREATE, CreateFlag.OVERWRITE) : 
                      EnumSet.of(CreateFlag.CREATE);
                out = create(qDst, createFlag);
                IOUtils.copyBytes(in, out, conf, true);
              } catch (IOException e) {
                IOUtils.closeStream(out);
                IOUtils.closeStream(in);
                throw e;
              }
      

      Attachments

        1. HADOOP-11101_001.patch
          0.8 kB
          skrho
        2. HADOOP-11101_002.patch
          0.8 kB
          skrho
        3. HADOOP-11101_003.patch
          0.8 kB
          Vinayakumar B

        Activity

          People

            rsk13th skrho
            rsk13th skrho
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: