[JAVA-5213] Invalid automatic module name for mongo-scala-bson and mongo-scala-driver Created: 20/Oct/23  Updated: 10/Jan/24  Resolved: 27/Oct/23

Status: Closed
Project: Java Driver
Component/s: Build
Affects Version/s: None
Fix Version/s: 4.11.1

Type: Bug Priority: Major - P3
Reporter: Fernando Correia Assignee: Slav Babanin
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Documentation Changes: Not Needed
Documentation Changes Summary:

1. What would you like to communicate to the user about this feature?
2. Would you like the user to see examples of the syntax and/or executable code and its output?
3. Which versions of the driver/connector does this apply to?


 Description   

Summary

mongo-scala-bson and mongo-scala-driver have invalid characters in the "Automatic-Module-Name" field of their META-INF/MANIFEST.MF files.

This causes some builds to fail with the error "cannot determine module name" . This happens on a Bazel project using JDK 17.

This is present in the latest version of these two libraries, i.e. version 4.11.0.

How to Reproduce

  1. Download the jar file for mongo-scala-driver or mongo-scala-bson.
  2. Extract the jar file e.g.:
    unzip ./mongo-scala-bson_2.13-4.11.0.jar
  3. View MANIFEST.MF:
    cat META-INF/MANIFEST.MF
  4. Look at the content of the Automatic-Module-Name field e.g.
    Automatic-Module-Name: org.mongodb.scala.mongo-scala-bson
    and
    Automatic-Module-Name: org.mongodb.scala.mongo-scala-driver
  5. Notice the invalid "-" character in the module name.

Additional Background

The character "-" is not valid. For a description of the valid characters see:

_Similar issue: https://jira.mongodb.org/browse/JAVA-5202_ 

Suggested fix: replace "-" with a dot: ".".



 Comments   
Comment by Slav Babanin [ 27/Oct/23 ]

Thank you fernandoacorreia@gmail.com for reporting this issue. The fix will be included in the 4.11.1 patch release.

Comment by Githook User [ 26/Oct/23 ]

Author:

{'name': 'Viacheslav Babanin', 'email': 'frest0512@gmail.com', 'username': 'vbabanin'}

Message: Add explicit automatic module name configuration. (#1232)

JAVA-5213
JAVA-5202
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/aa4c0f1344ad1e003555d4d4dea7ad1a94460aee

Comment by Fernando Correia [ 23/Oct/23 ]

I found an additional reference about what valid module names are:

>  A module name consists of one or more Java identifiers (§3.8) separated by "." tokens.

https://docs.oracle.com/javase/specs/jls/se17/html/jls-7.html#jls-7.7

 

Comment by PM Bot [ 20/Oct/23 ]

Hi fernandoacorreia@gmail.com, thank you for reporting this issue! The team will look into it and get back to you soon.

Generated at Thu Feb 08 09:04:01 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.