Uploaded image for project: 'Apache Jena'
  1. Apache Jena
  2. JENA-1784

CacheSimple doesn't check keys for equality

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • Jena 3.14.0
    • None
    • None

    Description

      CacheSimple identifies keys solely by their hash codes, so that two keys with same hash code are treated as equal, and values stored with one key can be retrieved with another.

      A test that currently fails:

      @Test
      public void testSameHash() {
        Cache<String, Integer> cache = new CacheSimple<>(10);
        assertEquals("Aa".hashCode(), "BB".hashCode());
        cache.put("Aa", 1);
        assertFalse("Keys with same hash code should not be considered equal", cache.containsKey("BB"));
      }
      

      Attachments

        Issue Links

          Activity

            People

              andy Andy Seaborne
              strangepleasures Pavel Mikhailovskii
              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 - 1h 10m
                  1h 10m