anon-iclr-submission/benchname-bug-localization huggingface dataset:
Repository: hibernate/hibernate-reactive
Issue: ReactiveSessionImpl#reactiveClose()

The implementation of `reactiveClose()` is first closing the connection, and then invoking close() on super.

I believe it needs to happen in the opposite order, for two reasons:

1. we need to flag the Session as closed ASAP to produce an error on illegal use
2. the super.close() method might need the connection to finalize pending operations

Changed files:
hibernate-reactive-core/src/main/java/org/hibernate/reactive/session/impl/ReactiveSessionImpl.java

diff --git a/hibernate-reactive-core/src/main/java/org/hibernate/reactive/session/impl/ReactiveSessionImpl.java b/hibernate-reactive-core/src/main/java/org/hibernate/reactive/session/impl/ReactiveSessionImpl.java
index a3e18857..0d4dca69 100644
--- a/hibernate-reactive-core/src/main/java/org/hibernate/reactive/session/impl/ReactiveSessionImpl.java
+++ b/hibernate-reactive-core/src/main/java/org/hibernate/reactive/session/impl/ReactiveSessionImpl.java
@@ -1485,10 +1485,10 @@ public void close() throws HibernateException {
 
 	@Override
 	public CompletionStage<Void> reactiveClose() {
-		CompletionStage<Void> closeStage = reactiveConnection != null
+		super.close();
+		return reactiveConnection != null
 				? reactiveConnection.close()
 				: voidFuture();
-		return closeStage.thenAccept( v -> super.close() );
 	}
 
 	@Override @SuppressWarnings("unchecked")