Skip to content

Commit 4a319c3

Browse files
committed
Merge branch '6.0.x'
2 parents 52c77d8 + fdf1418 commit 4a319c3

File tree

6 files changed

+28
-26
lines changed

6 files changed

+28
-26
lines changed

spring-r2dbc/src/main/java/org/springframework/r2dbc/connection/init/DatabasePopulator.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2021 the original author or authors.
2+
* Copyright 2002-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -20,7 +20,6 @@
2020
import io.r2dbc.spi.ConnectionFactory;
2121
import reactor.core.publisher.Mono;
2222

23-
import org.springframework.dao.DataAccessException;
2423
import org.springframework.r2dbc.connection.ConnectionFactoryUtils;
2524
import org.springframework.util.Assert;
2625

@@ -44,17 +43,18 @@ public interface DatabasePopulator {
4443
* already configured and ready to use, must not be {@code null}
4544
* @return {@link Mono} that initiates script execution and is
4645
* notified upon completion
47-
* @throws ScriptException in all other error cases
46+
* @throws ScriptException in case of any errors
4847
*/
49-
Mono<Void> populate(Connection connection) throws ScriptException;
48+
Mono<Void> populate(Connection connection);
5049

5150
/**
5251
* Execute the given {@link DatabasePopulator} against the given {@link ConnectionFactory}.
5352
* @param connectionFactory the {@link ConnectionFactory} to execute against
5453
* @return {@link Mono} that initiates {@link DatabasePopulator#populate(Connection)}
5554
* and is notified upon completion
55+
* @throws ScriptException in case of any errors
5656
*/
57-
default Mono<Void> populate(ConnectionFactory connectionFactory) throws DataAccessException {
57+
default Mono<Void> populate(ConnectionFactory connectionFactory) {
5858
Assert.notNull(connectionFactory, "ConnectionFactory must not be null");
5959
return Mono.usingWhen(ConnectionFactoryUtils.getConnection(connectionFactory), //
6060
this::populate, //

spring-r2dbc/src/main/java/org/springframework/r2dbc/connection/init/ResourceDatabasePopulator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2020 the original author or authors.
2+
* Copyright 2002-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -260,7 +260,7 @@ public void setDataBufferFactory(DataBufferFactory dataBufferFactory) {
260260

261261

262262
@Override
263-
public Mono<Void> populate(Connection connection) throws ScriptException {
263+
public Mono<Void> populate(Connection connection) {
264264
Assert.notNull(connection, "Connection must not be null");
265265
return Flux.fromIterable(this.scripts).concatMap(resource -> {
266266
EncodedResource encodedScript = new EncodedResource(resource, this.sqlScriptEncoding);

spring-r2dbc/src/main/java/org/springframework/r2dbc/connection/init/ScriptUtils.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2021 the original author or authors.
2+
* Copyright 2002-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -125,7 +125,7 @@ public abstract class ScriptUtils {
125125
* @see org.springframework.r2dbc.connection.ConnectionFactoryUtils#getConnection
126126
* @see org.springframework.r2dbc.connection.ConnectionFactoryUtils#releaseConnection
127127
*/
128-
public static Mono<Void> executeSqlScript(Connection connection, Resource resource) throws ScriptException {
128+
public static Mono<Void> executeSqlScript(Connection connection, Resource resource) {
129129
return executeSqlScript(connection, new EncodedResource(resource));
130130
}
131131

@@ -149,7 +149,7 @@ public static Mono<Void> executeSqlScript(Connection connection, Resource resour
149149
* @see org.springframework.r2dbc.connection.ConnectionFactoryUtils#getConnection
150150
* @see org.springframework.r2dbc.connection.ConnectionFactoryUtils#releaseConnection
151151
*/
152-
public static Mono<Void> executeSqlScript(Connection connection, EncodedResource resource) throws ScriptException {
152+
public static Mono<Void> executeSqlScript(Connection connection, EncodedResource resource) {
153153
return executeSqlScript(connection, resource, DefaultDataBufferFactory.sharedInstance, false, false,
154154
DEFAULT_COMMENT_PREFIXES, DEFAULT_STATEMENT_SEPARATOR, DEFAULT_BLOCK_COMMENT_START_DELIMITER,
155155
DEFAULT_BLOCK_COMMENT_END_DELIMITER);
@@ -189,7 +189,7 @@ public static Mono<Void> executeSqlScript(Connection connection, EncodedResource
189189
public static Mono<Void> executeSqlScript(Connection connection, EncodedResource resource,
190190
DataBufferFactory dataBufferFactory, boolean continueOnError, boolean ignoreFailedDrops,
191191
String commentPrefix, @Nullable String separator, String blockCommentStartDelimiter,
192-
String blockCommentEndDelimiter) throws ScriptException {
192+
String blockCommentEndDelimiter) {
193193

194194
return executeSqlScript(connection, resource, dataBufferFactory, continueOnError,
195195
ignoreFailedDrops, new String[] { commentPrefix }, separator,
@@ -230,7 +230,7 @@ public static Mono<Void> executeSqlScript(Connection connection, EncodedResource
230230
public static Mono<Void> executeSqlScript(Connection connection, EncodedResource resource,
231231
DataBufferFactory dataBufferFactory, boolean continueOnError, boolean ignoreFailedDrops,
232232
String[] commentPrefixes, @Nullable String separator, String blockCommentStartDelimiter,
233-
String blockCommentEndDelimiter) throws ScriptException {
233+
String blockCommentEndDelimiter) {
234234

235235
if (logger.isDebugEnabled()) {
236236
logger.debug("Executing SQL script from " + resource);
@@ -365,7 +365,7 @@ private static void appendSeparatorToScriptIfNecessary(StringBuilder scriptBuild
365365
*/
366366
static boolean containsStatementSeparator(EncodedResource resource, String script,
367367
String separator, String[] commentPrefixes, String blockCommentStartDelimiter,
368-
String blockCommentEndDelimiter) throws ScriptException {
368+
String blockCommentEndDelimiter) {
369369

370370
boolean inSingleQuote = false;
371371
boolean inDoubleQuote = false;
@@ -448,7 +448,7 @@ else if (script.startsWith(blockCommentStartDelimiter, i)) {
448448
*/
449449
static List<String> splitSqlScript(EncodedResource resource, String script,
450450
String separator, String[] commentPrefixes, String blockCommentStartDelimiter,
451-
String blockCommentEndDelimiter) throws ScriptException {
451+
String blockCommentEndDelimiter) {
452452

453453
Assert.hasText(script, "'script' must not be null or empty");
454454
Assert.notNull(separator, "'separator' must not be null");

spring-r2dbc/src/main/java/org/springframework/r2dbc/core/ConnectionAccessor.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2020 the original author or authors.
2+
* Copyright 2002-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -22,22 +22,23 @@
2222
import reactor.core.publisher.Flux;
2323
import reactor.core.publisher.Mono;
2424

25-
import org.springframework.dao.DataAccessException;
26-
2725
/**
2826
* Interface declaring methods that accept callback {@link Function}
2927
* to operate within the scope of a {@link Connection}.
3028
* Callback functions operate on a provided connection and must not
3129
* close the connection as the connections may be pooled or be
3230
* subject to other kinds of resource management.
3331
*
34-
* <p> Callback functions are responsible for creating a
32+
* <p>Callback functions are responsible for creating a
3533
* {@link org.reactivestreams.Publisher} that defines the scope of how
3634
* long the allocated {@link Connection} is valid. Connections are
3735
* released after the publisher terminates.
3836
*
37+
* <p>This serves as a base interface for {@link DatabaseClient}.
38+
*
3939
* @author Mark Paluch
4040
* @since 5.3
41+
* @see DatabaseClient
4142
*/
4243
public interface ConnectionAccessor {
4344

@@ -49,8 +50,9 @@ public interface ConnectionAccessor {
4950
* {@link Function} closure, otherwise resources may get defunct.
5051
* @param action the callback object that specifies the connection action
5152
* @return the resulting {@link Mono}
53+
* @throws org.springframework.dao.DataAccessException in case of any errors
5254
*/
53-
<T> Mono<T> inConnection(Function<Connection, Mono<T>> action) throws DataAccessException;
55+
<T> Mono<T> inConnection(Function<Connection, Mono<T>> action);
5456

5557
/**
5658
* Execute a callback {@link Function} within a {@link Connection} scope.
@@ -60,7 +62,8 @@ public interface ConnectionAccessor {
6062
* {@link Function} closure, otherwise resources may get defunct.
6163
* @param action the callback object that specifies the connection action
6264
* @return the resulting {@link Flux}
65+
* @throws org.springframework.dao.DataAccessException in case of any errors
6366
*/
64-
<T> Flux<T> inConnectionMany(Function<Connection, Flux<T>> action) throws DataAccessException;
67+
<T> Flux<T> inConnectionMany(Function<Connection, Flux<T>> action);
6568

6669
}

spring-r2dbc/src/main/java/org/springframework/r2dbc/core/DatabaseClient.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@
3737
import org.springframework.util.Assert;
3838

3939
/**
40-
* A non-blocking, reactive client for performing database calls with
41-
* Reactive Streams back pressure. Provides a higher level, common API over
42-
* R2DBC client libraries.
40+
* A non-blocking, reactive client for performing database calls with Reactive Streams
41+
* back pressure. Provides a higher level, common API over R2DBC client libraries.
42+
* Propagates {@link org.springframework.dao.DataAccessException} variants for errors.
4343
*
4444
* <p>Use the static factory method {@link #create(ConnectionFactory)} or obtain
4545
* a {@linkplain DatabaseClient#builder() builder} to create an instance.

spring-r2dbc/src/main/java/org/springframework/r2dbc/core/DefaultDatabaseClient.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
import reactor.core.publisher.Flux;
4848
import reactor.core.publisher.Mono;
4949

50-
import org.springframework.dao.DataAccessException;
5150
import org.springframework.dao.InvalidDataAccessApiUsageException;
5251
import org.springframework.lang.Nullable;
5352
import org.springframework.r2dbc.connection.ConnectionFactoryUtils;
@@ -108,7 +107,7 @@ public GenericExecuteSpec sql(Supplier<String> sqlSupplier) {
108107
}
109108

110109
@Override
111-
public <T> Mono<T> inConnection(Function<Connection, Mono<T>> action) throws DataAccessException {
110+
public <T> Mono<T> inConnection(Function<Connection, Mono<T>> action) {
112111
Assert.notNull(action, "Callback object must not be null");
113112
Mono<ConnectionCloseHolder> connectionMono = getConnection().map(
114113
connection -> new ConnectionCloseHolder(connection, this::closeConnection));
@@ -130,7 +129,7 @@ public <T> Mono<T> inConnection(Function<Connection, Mono<T>> action) throws Dat
130129
}
131130

132131
@Override
133-
public <T> Flux<T> inConnectionMany(Function<Connection, Flux<T>> action) throws DataAccessException {
132+
public <T> Flux<T> inConnectionMany(Function<Connection, Flux<T>> action) {
134133
Assert.notNull(action, "Callback object must not be null");
135134
Mono<ConnectionCloseHolder> connectionMono = getConnection().map(
136135
connection -> new ConnectionCloseHolder(connection, this::closeConnection));

0 commit comments

Comments
 (0)