Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-13273

Make Result.EMPTY_RESULT read-only; currently it can be modified

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.98.0, 1.0.0
    • Fix Version/s: 1.0.1, 1.1.0, 0.98.12, 2.0.0
    • Component/s: None
    • Labels:
    • Release Note:
      The Result.EMPTY_RESULT object is now immutable. In previous releases, the object could be modified by a caller to no longer be empty. Code that relies on this behavior will now receive an UnsupportedOperationException.

      Description

      Again from Lars George

      Result result2 = Result.EMPTY_RESULT;
      System.out.println(result2);

      result2.copyFrom(result1);
      System.out.println(result2);

      "What do you think happens when result1 has cells? Yep, you just modified the shared public EMPTY_RESULT to be not empty anymore."

      Fix. Result should be non-modifiable post-construction.

        Attachments

        1. HBASE-13273-v5.patch
          6 kB
          Mikhail Antonov
        2. HBASE-13273-v5.patch
          6 kB
          Mikhail Antonov
        3. HBASE-13273.patch
          0.9 kB
          Mikhail Antonov
        4. HBASE-13273.patch
          2 kB
          Mikhail Antonov
        5. HBASE-13273.patch
          2 kB
          Mikhail Antonov
        6. HBASE-13273.patch
          5 kB
          Mikhail Antonov

          Activity

            People

            • Assignee:
              mantonov Mikhail Antonov
              Reporter:
              stack Michael Stack
            • Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: