File tree Expand file tree Collapse file tree 8 files changed +22
-9
lines changed
module/spring-boot-jooq/src/main/java/org/springframework/boot/jooq Expand file tree Collapse file tree 8 files changed +22
-9
lines changed Original file line number Diff line number Diff line change 2323import org .apache .commons .logging .LogFactory ;
2424import org .jooq .ExecuteContext ;
2525import org .jooq .SQLDialect ;
26+ import org .jspecify .annotations .Nullable ;
2627
2728import org .springframework .dao .DataAccessException ;
2829import org .springframework .jdbc .support .SQLErrorCodeSQLExceptionTranslator ;
@@ -117,7 +118,7 @@ private SQLExceptionTranslator apply(SQLDialect dialect) {
117118 : new SQLExceptionSubclassTranslator ();
118119 }
119120
120- private String getSpringDbName (SQLDialect dialect ) {
121+ private @ Nullable String getSpringDbName (@ Nullable SQLDialect dialect ) {
121122 return (dialect != null && dialect .thirdParty () != null ) ? dialect .thirdParty ().springDbName () : null ;
122123 }
123124
Original file line number Diff line number Diff line change @@ -133,6 +133,7 @@ Settings settings(JooqProperties properties) throws IOException {
133133 throw new JaxbNotAvailableException ();
134134 }
135135 Resource resource = properties .getConfig ();
136+ Assert .state (resource != null , "'resource' must not be null" );
136137 Assert .state (resource .exists (),
137138 () -> "Resource %s set in spring.jooq.config does not exist" .formatted (resource ));
138139 try (InputStream stream = resource .getInputStream ()) {
Original file line number Diff line number Diff line change 1919import javax .sql .DataSource ;
2020
2121import org .jooq .SQLDialect ;
22+ import org .jspecify .annotations .Nullable ;
2223
2324import org .springframework .boot .context .properties .ConfigurationProperties ;
2425import org .springframework .core .io .Resource ;
@@ -37,26 +38,26 @@ public class JooqProperties {
3738 /**
3839 * SQL dialect to use. Auto-detected by default.
3940 */
40- private SQLDialect sqlDialect ;
41+ private @ Nullable SQLDialect sqlDialect ;
4142
4243 /**
4344 * Location of the jOOQ config file.
4445 */
45- private Resource config ;
46+ private @ Nullable Resource config ;
4647
47- public SQLDialect getSqlDialect () {
48+ public @ Nullable SQLDialect getSqlDialect () {
4849 return this .sqlDialect ;
4950 }
5051
51- public void setSqlDialect (SQLDialect sqlDialect ) {
52+ public void setSqlDialect (@ Nullable SQLDialect sqlDialect ) {
5253 this .sqlDialect = sqlDialect ;
5354 }
5455
55- public Resource getConfig () {
56+ public @ Nullable Resource getConfig () {
5657 return this .config ;
5758 }
5859
59- public void setConfig (Resource config ) {
60+ public void setConfig (@ Nullable Resource config ) {
6061 this .config = config ;
6162 }
6263
Original file line number Diff line number Diff line change 1717package org .springframework .boot .jooq .autoconfigure ;
1818
1919import org .jooq .DSLContext ;
20+ import org .jspecify .annotations .Nullable ;
2021
2122import org .springframework .beans .factory .BeanFactory ;
2223import org .springframework .beans .factory .NoSuchBeanDefinitionException ;
@@ -35,7 +36,7 @@ class NoDslContextBeanFailureAnalyzer extends AbstractFailureAnalyzer<NoSuchBean
3536 }
3637
3738 @ Override
38- protected FailureAnalysis analyze (Throwable rootFailure , NoSuchBeanDefinitionException cause ) {
39+ protected @ Nullable FailureAnalysis analyze (Throwable rootFailure , NoSuchBeanDefinitionException cause ) {
3940 if (DSLContext .class .equals (cause .getBeanType ()) && hasR2dbcAutoConfiguration ()) {
4041 return new FailureAnalysis (
4142 "jOOQ has not been auto-configured as R2DBC has been auto-configured in favor of JDBC and jOOQ "
Original file line number Diff line number Diff line change 2323import org .springframework .transaction .TransactionDefinition ;
2424import org .springframework .transaction .TransactionStatus ;
2525import org .springframework .transaction .support .DefaultTransactionDefinition ;
26+ import org .springframework .util .Assert ;
2627
2728/**
2829 * Allows Spring Transaction to be used with jOOQ.
@@ -61,6 +62,7 @@ public void rollback(TransactionContext ctx) {
6162
6263 private TransactionStatus getTransactionStatus (TransactionContext ctx ) {
6364 SpringTransaction transaction = (SpringTransaction ) ctx .transaction ();
65+ Assert .state (transaction != null , "'transaction' must not be null" );
6466 return transaction .getTxStatus ();
6567 }
6668
Original file line number Diff line number Diff line change 2525import org .apache .commons .logging .LogFactory ;
2626import org .jooq .SQLDialect ;
2727import org .jooq .tools .jdbc .JDBCUtils ;
28+ import org .jspecify .annotations .Nullable ;
2829
2930/**
3031 * Utility to lookup well known {@link SQLDialect SQLDialects} from a {@link DataSource}.
@@ -45,7 +46,7 @@ private SqlDialectLookup() {
4546 * @param dataSource the source {@link DataSource}
4647 * @return the most suitable {@link SQLDialect}
4748 */
48- static SQLDialect getDialect (DataSource dataSource ) {
49+ static SQLDialect getDialect (@ Nullable DataSource dataSource ) {
4950 try (Connection connection = (dataSource != null ) ? dataSource .getConnection () : null ) {
5051 return JDBCUtils .dialect (connection );
5152 }
Original file line number Diff line number Diff line change 1717/**
1818 * Auto-configuration for jOOQ.
1919 */
20+ @ NullMarked
2021package org .springframework .boot .jooq .autoconfigure ;
22+
23+ import org .jspecify .annotations .NullMarked ;
Original file line number Diff line number Diff line change 1919 *
2020 * @see org.springframework.boot.json.JsonParser
2121 */
22+ @ NullMarked
2223package org .springframework .boot .jooq ;
24+
25+ import org .jspecify .annotations .NullMarked ;
You can’t perform that action at this time.
0 commit comments