Skip to content

Commit 412e3fd

Browse files
committed
Remove effectively unused process attach callback
1 parent ca427b8 commit 412e3fd

File tree

6 files changed

+20
-57
lines changed

6 files changed

+20
-57
lines changed

src/docs/asciidoc/release_notes.adoc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,9 @@ If you are confronted with such a change, let us know on {firebird-java}[firebir
591591

592592
* `FbWireAsynchronousChannel`
593593
** `connect(String, int, int)` was replaced by `connect(String, int)`
594+
* `FbWireOperations`
595+
** The `ProcessAttachCallback` parameter of `authReceiveResponse` was removed, as all implementations did nothing, and since protocol 13, it wasn't only called for the attach response
596+
** Interface `ProcessAttachCallback` was removed
594597
595598
[#breaking-changes-unlikely]
596599
=== Unlikely breaking changes

src/main/org/firebirdsql/gds/ng/wire/FbWireOperations.java

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-FileCopyrightText: Copyright 2015-2023 Mark Rotteveel
1+
// SPDX-FileCopyrightText: Copyright 2015-2025 Mark Rotteveel
22
// SPDX-License-Identifier: LGPL-2.1-or-later OR BSD-3-Clause
33
package org.firebirdsql.gds.ng.wire;
44

@@ -212,26 +212,18 @@ default void processDeferredActions() { }
212212

213213
/**
214214
* Receive authentication response from the server.
215-
* <p>
216-
* This method is only relevant for protocol V13 or higher.
217-
* </p>
218215
*
219216
* @param acceptPacket
220-
* Packet with {@code op_cond_accept} data, or {@code null} when the data should be read from the
221-
* connection.
217+
* packet with {@code op_cond_accept} data, or {@code null} when the data should be read from the
218+
* connection
222219
* @param dbCryptCallback
223-
* Database encryption callback (ignored by protocols v12 and lower)
224-
* @param processAttachCallback
225-
* Callback for processing the final attach response
220+
* database encryption callback (ignored by protocols v12 and lower)
226221
* @throws IOException
227-
* For errors reading the response from the connection.
222+
* for errors reading the response from the connection
228223
* @throws SQLException
229-
* For errors returned from the server, or when attempting to
230-
* read.
224+
* for errors returned from the server, or when attempting to read
231225
*/
232-
void authReceiveResponse(FbWireAttachment.AcceptPacket acceptPacket,
233-
DbCryptCallback dbCryptCallback,
234-
ProcessAttachCallback processAttachCallback)
226+
void authReceiveResponse(FbWireAttachment.AcceptPacket acceptPacket, DbCryptCallback dbCryptCallback)
235227
throws IOException, SQLException;
236228

237229
/**
@@ -248,7 +240,4 @@ void authReceiveResponse(FbWireAttachment.AcceptPacket acceptPacket,
248240
*/
249241
void setNetworkTimeout(int milliseconds) throws SQLException;
250242

251-
interface ProcessAttachCallback {
252-
void processAttachResponse(GenericResponse response);
253-
}
254243
}

src/main/org/firebirdsql/gds/ng/wire/version10/V10Database.java

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import org.firebirdsql.gds.ng.FbTransaction;
1111
import org.firebirdsql.gds.ng.LockCloseable;
1212
import org.firebirdsql.gds.ng.TransactionState;
13-
import org.firebirdsql.gds.ng.dbcrypt.DbCryptCallback;
1413
import org.firebirdsql.gds.ng.fields.BlrCalculator;
1514
import org.firebirdsql.gds.ng.wire.*;
1615
import org.firebirdsql.jdbc.SQLStateConstants;
@@ -143,17 +142,6 @@ protected Encoding getFilenameEncoding(DatabaseParameterBuffer dpb) {
143142
return getEncoding();
144143
}
145144

146-
/**
147-
* Processes the response from the server to the attach or create operation.
148-
*
149-
* @param genericResponse
150-
* GenericResponse received from the server.
151-
*/
152-
@SuppressWarnings("unused")
153-
protected final void processAttachOrCreateResponse(GenericResponse genericResponse) {
154-
// nothing to do
155-
}
156-
157145
/**
158146
* Additional tasks to execute directly after attach operation.
159147
* <p>
@@ -422,7 +410,7 @@ private void sendExecuteImmediate(String statementText, FbTransaction transactio
422410
private void receiveExecuteImmediateResponse() throws SQLException {
423411
try {
424412
if (!isAttached()) {
425-
processAttachOrCreateResponse(readGenericResponse(null));
413+
readGenericResponse(null);
426414
}
427415
readGenericResponse(null);
428416
} catch (IOException e) {
@@ -517,7 +505,6 @@ public final BlrCalculator getBlrCalculator() {
517505

518506
@Override
519507
public final void authReceiveResponse(AcceptPacket acceptPacket) throws IOException, SQLException {
520-
final DbCryptCallback dbCryptCallback = connection.createDbCryptCallback();
521-
wireOperations.authReceiveResponse(acceptPacket, dbCryptCallback, this::processAttachOrCreateResponse);
508+
wireOperations.authReceiveResponse(acceptPacket, connection.createDbCryptCallback());
522509
}
523510
}

src/main/org/firebirdsql/gds/ng/wire/version10/V10Service.java

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-FileCopyrightText: Copyright 2015-2024 Mark Rotteveel
1+
// SPDX-FileCopyrightText: Copyright 2015-2025 Mark Rotteveel
22
// SPDX-License-Identifier: LGPL-2.1-or-later
33
package org.firebirdsql.gds.ng.wire.version10;
44

@@ -7,7 +7,6 @@
77
import org.firebirdsql.gds.impl.wire.XdrOutputStream;
88
import org.firebirdsql.gds.ng.FbExceptionBuilder;
99
import org.firebirdsql.gds.ng.LockCloseable;
10-
import org.firebirdsql.gds.ng.dbcrypt.DbCryptCallback;
1110
import org.firebirdsql.gds.ng.wire.*;
1211

1312
import java.io.IOException;
@@ -67,17 +66,6 @@ private void receiveAttachResponse() throws SQLException {
6766
}
6867
}
6968

70-
/**
71-
* Processes the response from the server to the attach or create operation.
72-
*
73-
* @param genericResponse
74-
* GenericResponse received from the server.
75-
*/
76-
@SuppressWarnings("unused")
77-
protected void processAttachResponse(GenericResponse genericResponse) {
78-
// nothing to do
79-
}
80-
8169
protected void afterAttachActions() throws SQLException {
8270
getServiceInfo(null, getDescribeServiceRequestBuffer(), 1024, getServiceInformationProcessor());
8371
// During connect and attach the socketTimeout might be set to the connectTimeout, now reset to 'normal' socketTimeout
@@ -226,7 +214,6 @@ private void receiveServiceStartResponse() throws SQLException {
226214

227215
@Override
228216
public final void authReceiveResponse(AcceptPacket acceptPacket) throws IOException, SQLException {
229-
final DbCryptCallback dbCryptCallback = connection.createDbCryptCallback();
230-
wireOperations.authReceiveResponse(acceptPacket, dbCryptCallback, V10Service.this::processAttachResponse);
217+
wireOperations.authReceiveResponse(acceptPacket, connection.createDbCryptCallback());
231218
}
232219
}

src/main/org/firebirdsql/gds/ng/wire/version10/V10WireOperations.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-FileCopyrightText: Copyright 2015-2024 Mark Rotteveel
1+
// SPDX-FileCopyrightText: Copyright 2015-2025 Mark Rotteveel
22
// SPDX-License-Identifier: LGPL-2.1-or-later
33
package org.firebirdsql.gds.ng.wire.version10;
44

@@ -25,12 +25,11 @@ public V10WireOperations(WireConnection<?, ?> connection, WarningMessageCallback
2525

2626
@Override
2727
@SuppressWarnings("java:S4274")
28-
public void authReceiveResponse(FbWireAttachment.AcceptPacket acceptPacket, DbCryptCallback dbCryptCallback,
29-
ProcessAttachCallback processAttachCallback) throws IOException, SQLException {
28+
public void authReceiveResponse(FbWireAttachment.AcceptPacket acceptPacket, DbCryptCallback dbCryptCallback)
29+
throws IOException, SQLException {
3030
assert acceptPacket == null : "Should not be called with non-null acceptPacket in V12 or earlier";
31-
GenericResponse response = readGenericResponse(null);
31+
readGenericResponse(null);
3232
getClientAuthBlock().setAuthComplete(true);
33-
processAttachCallback.processAttachResponse(response);
3433

3534
// fbclient also ignores REQUIRED when connecting to FB 2.5 or lower, apply same
3635
if (getAttachProperties().getWireCryptAsEnum() == WireCrypt.REQUIRED) {

src/main/org/firebirdsql/gds/ng/wire/version13/V13WireOperations.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import org.firebirdsql.gds.ng.dbcrypt.DbCryptCallback;
1414
import org.firebirdsql.gds.ng.dbcrypt.DbCryptData;
1515
import org.firebirdsql.gds.ng.wire.FbWireAttachment;
16-
import org.firebirdsql.gds.ng.wire.FbWireOperations;
1716
import org.firebirdsql.gds.ng.wire.GenericResponse;
1817
import org.firebirdsql.gds.ng.wire.WireConnection;
1918
import org.firebirdsql.gds.ng.wire.auth.ClientAuthBlock;
@@ -56,8 +55,8 @@ public V13WireOperations(WireConnection<?, ?> connection, WarningMessageCallback
5655
}
5756

5857
@Override
59-
public void authReceiveResponse(FbWireAttachment.AcceptPacket acceptPacket, DbCryptCallback dbCryptCallback,
60-
FbWireOperations.ProcessAttachCallback processAttachCallback) throws SQLException, IOException {
58+
public void authReceiveResponse(FbWireAttachment.AcceptPacket acceptPacket, DbCryptCallback dbCryptCallback)
59+
throws SQLException, IOException {
6160
assert acceptPacket == null || acceptPacket.operation == op_cond_accept
6261
: "Unexpected operation in AcceptPacket";
6362
final XdrInputStream xdrIn = getXdrIn();
@@ -103,7 +102,6 @@ public void authReceiveResponse(FbWireAttachment.AcceptPacket acceptPacket, DbCr
103102
GenericResponse response = (GenericResponse) readOperationResponse(operation, null);
104103
boolean wasAuthComplete = clientAuthBlock.isAuthComplete();
105104
clientAuthBlock.setAuthComplete(true);
106-
processAttachCallback.processAttachResponse(response);
107105
addServerKeys(response.data());
108106

109107
WireCrypt wireCrypt = getAttachProperties().getWireCryptAsEnum();

0 commit comments

Comments
 (0)