Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-2449

NullPointerException in ClientMetadataHelper.getDriverVersion

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 3.4.0
    • Fix Version/s: 3.4.3, 3.5.0
    • Component/s: Monitoring
    • Labels:
      None
    • Environment:
      java version "1.8.0_111"
      Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
      Java HotSpot(TM) Client VM (build 25.111-b14, mixed mode, sharing)
    • Sprint:
      JVM Sprint 38

      Description

      Java Driver throws NPE in:

      at com.mongodb.connection.ClientMetadataHelper.getDriverVersion(ClientMetadataHelper.java:113)
      at com.mongodb.connection.ClientMetadataHelper.getDriverInformation(ClientMetadataHelper.java:201)
      at com.mongodb.connection.ClientMetadataHelper.addDriverInformation(ClientMetadataHelper.java:182)
      at com.mongodb.connection.ClientMetadataHelper.<clinit>(ClientMetadataHelper.java:64)
      

      We are running the driver in environment where

      InternalStreamConnectionInitializer.class.getProtectionDomain().getCodeSource().getLocation()
      

      returns null (some strange classloader)
      and it throws in NPE here:

      String path = codeSource.getLocation().getPath();
      

      It would be better to check it for nullness and for example set driverVersion = "unknown" (as it is being done in case of other errors).

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: