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 23
23
import org .apache .commons .logging .LogFactory ;
24
24
import org .jooq .ExecuteContext ;
25
25
import org .jooq .SQLDialect ;
26
+ import org .jspecify .annotations .Nullable ;
26
27
27
28
import org .springframework .dao .DataAccessException ;
28
29
import org .springframework .jdbc .support .SQLErrorCodeSQLExceptionTranslator ;
@@ -117,7 +118,7 @@ private SQLExceptionTranslator apply(SQLDialect dialect) {
117
118
: new SQLExceptionSubclassTranslator ();
118
119
}
119
120
120
- private String getSpringDbName (SQLDialect dialect ) {
121
+ private @ Nullable String getSpringDbName (@ Nullable SQLDialect dialect ) {
121
122
return (dialect != null && dialect .thirdParty () != null ) ? dialect .thirdParty ().springDbName () : null ;
122
123
}
123
124
Original file line number Diff line number Diff line change @@ -133,6 +133,7 @@ Settings settings(JooqProperties properties) throws IOException {
133
133
throw new JaxbNotAvailableException ();
134
134
}
135
135
Resource resource = properties .getConfig ();
136
+ Assert .state (resource != null , "'resource' must not be null" );
136
137
Assert .state (resource .exists (),
137
138
() -> "Resource %s set in spring.jooq.config does not exist" .formatted (resource ));
138
139
try (InputStream stream = resource .getInputStream ()) {
Original file line number Diff line number Diff line change 19
19
import javax .sql .DataSource ;
20
20
21
21
import org .jooq .SQLDialect ;
22
+ import org .jspecify .annotations .Nullable ;
22
23
23
24
import org .springframework .boot .context .properties .ConfigurationProperties ;
24
25
import org .springframework .core .io .Resource ;
@@ -37,26 +38,26 @@ public class JooqProperties {
37
38
/**
38
39
* SQL dialect to use. Auto-detected by default.
39
40
*/
40
- private SQLDialect sqlDialect ;
41
+ private @ Nullable SQLDialect sqlDialect ;
41
42
42
43
/**
43
44
* Location of the jOOQ config file.
44
45
*/
45
- private Resource config ;
46
+ private @ Nullable Resource config ;
46
47
47
- public SQLDialect getSqlDialect () {
48
+ public @ Nullable SQLDialect getSqlDialect () {
48
49
return this .sqlDialect ;
49
50
}
50
51
51
- public void setSqlDialect (SQLDialect sqlDialect ) {
52
+ public void setSqlDialect (@ Nullable SQLDialect sqlDialect ) {
52
53
this .sqlDialect = sqlDialect ;
53
54
}
54
55
55
- public Resource getConfig () {
56
+ public @ Nullable Resource getConfig () {
56
57
return this .config ;
57
58
}
58
59
59
- public void setConfig (Resource config ) {
60
+ public void setConfig (@ Nullable Resource config ) {
60
61
this .config = config ;
61
62
}
62
63
Original file line number Diff line number Diff line change 17
17
package org .springframework .boot .jooq .autoconfigure ;
18
18
19
19
import org .jooq .DSLContext ;
20
+ import org .jspecify .annotations .Nullable ;
20
21
21
22
import org .springframework .beans .factory .BeanFactory ;
22
23
import org .springframework .beans .factory .NoSuchBeanDefinitionException ;
@@ -35,7 +36,7 @@ class NoDslContextBeanFailureAnalyzer extends AbstractFailureAnalyzer<NoSuchBean
35
36
}
36
37
37
38
@ Override
38
- protected FailureAnalysis analyze (Throwable rootFailure , NoSuchBeanDefinitionException cause ) {
39
+ protected @ Nullable FailureAnalysis analyze (Throwable rootFailure , NoSuchBeanDefinitionException cause ) {
39
40
if (DSLContext .class .equals (cause .getBeanType ()) && hasR2dbcAutoConfiguration ()) {
40
41
return new FailureAnalysis (
41
42
"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 23
23
import org .springframework .transaction .TransactionDefinition ;
24
24
import org .springframework .transaction .TransactionStatus ;
25
25
import org .springframework .transaction .support .DefaultTransactionDefinition ;
26
+ import org .springframework .util .Assert ;
26
27
27
28
/**
28
29
* Allows Spring Transaction to be used with jOOQ.
@@ -61,6 +62,7 @@ public void rollback(TransactionContext ctx) {
61
62
62
63
private TransactionStatus getTransactionStatus (TransactionContext ctx ) {
63
64
SpringTransaction transaction = (SpringTransaction ) ctx .transaction ();
65
+ Assert .state (transaction != null , "'transaction' must not be null" );
64
66
return transaction .getTxStatus ();
65
67
}
66
68
Original file line number Diff line number Diff line change 25
25
import org .apache .commons .logging .LogFactory ;
26
26
import org .jooq .SQLDialect ;
27
27
import org .jooq .tools .jdbc .JDBCUtils ;
28
+ import org .jspecify .annotations .Nullable ;
28
29
29
30
/**
30
31
* Utility to lookup well known {@link SQLDialect SQLDialects} from a {@link DataSource}.
@@ -45,7 +46,7 @@ private SqlDialectLookup() {
45
46
* @param dataSource the source {@link DataSource}
46
47
* @return the most suitable {@link SQLDialect}
47
48
*/
48
- static SQLDialect getDialect (DataSource dataSource ) {
49
+ static SQLDialect getDialect (@ Nullable DataSource dataSource ) {
49
50
try (Connection connection = (dataSource != null ) ? dataSource .getConnection () : null ) {
50
51
return JDBCUtils .dialect (connection );
51
52
}
Original file line number Diff line number Diff line change 17
17
/**
18
18
* Auto-configuration for jOOQ.
19
19
*/
20
+ @ NullMarked
20
21
package org .springframework .boot .jooq .autoconfigure ;
22
+
23
+ import org .jspecify .annotations .NullMarked ;
Original file line number Diff line number Diff line change 19
19
*
20
20
* @see org.springframework.boot.json.JsonParser
21
21
*/
22
+ @ NullMarked
22
23
package org .springframework .boot .jooq ;
24
+
25
+ import org .jspecify .annotations .NullMarked ;
You can’t perform that action at this time.
0 commit comments