Report unsupported DBMS instead of throwing NPE - #5555
Merged
Conversation
makssent
marked this pull request as ready for review
July 30, 2026 08:18
makssent
force-pushed
the
unsupported-dbms-error
branch
from
July 30, 2026 08:22
053747f to
a1154f5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When
jmix.data.dbms-typeis set to a value that has no DbmsFeatures implementation on the classpath, the application fails with a bare NPE:The message mentions neither the DBMS type nor the property that produced it, so the
actual cause is not discoverable from the log. This is easy to hit with a typo in a supported DBMS name -postgres instead of
postgresql, mssqlserver instead of mssql.
Cause and fix
DbmsSpecifics.get(Class, String, String) behaves differently depending on the requested interface: for DbmsFeatures and DbTypeConverter it silently returns null, while for the rest it delegates to applicationContext.getBean(name) and gets a NoSuchBeanDefinitionException with a meaningful message. On top of that, the internal findDbmsFeatures is annotated @nullable, but the public getDbmsFeatures() wrapping it is not, and JmixBaseEntityManagerFactoryBean dereferences the result without a check.
Now all three lookups throw an IllegalStateException naming the DBMS type and the missing interface:
This matches the neighbouring DbmsType.getType(), which already throws the same exception when the DBMS cannot be determined.