DBCollection.isCapped() method throws ClassCastException with mongodb-2.2.0

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Major - P3
    • 2.9.1
    • Affects Version/s: 2.7.3, 2.9.0
    • Component/s: API
    • None
    • Environment:
      Any.
      (tested with 3.5.2-3.fc17.x86_64/jdk1.7.0_06(x64))
    • None
    • Major Change
    • None
    • None
    • None
    • None
    • None
    • None

      Apparently mongodb 2.2.0 changed the type of "capped" property returned by getStats() method for collections from integer to boolean.
      As a result an attempt to invoke DBCollection.isCapped() on capped collection when working with mongodb version 2.2.0 leads to ClassCastException.

      I have attached the test that demonstrates the problem. The test will happily run with mongodb versions 2.0.x and below but fail with 2.2.0.
      The source also provides an alternative implementation of isCapped() that fixes the problem.

        1. IsCappedTest.java
          1 kB
          Alexei Krainiouk

            Assignee:
            Bryan Reinero (Inactive)
            Reporter:
            Alexei Krainiouk
            None
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: