]> source.dussan.org Git - sonarqube.git/commitdiff
Return WS response only after changes are commited
authorJulien HENRY <julien.henry@sonarsource.com>
Wed, 27 Sep 2017 10:59:05 +0000 (12:59 +0200)
committerJulien HENRY <julien.henry@sonarsource.com>
Wed, 27 Sep 2017 12:50:52 +0000 (14:50 +0200)
server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/CreateAction.java

index ee8beb022c92153780e3c795ec994fbba769a7ad..532361c33fce2bd458a7a3da50859fa6d4bdf12c 100644 (file)
@@ -24,9 +24,9 @@ import org.sonar.api.server.ws.Response;
 import org.sonar.api.server.ws.WebService;
 import org.sonar.db.DbClient;
 import org.sonar.db.DbSession;
+import org.sonar.db.permission.OrganizationPermission;
 import org.sonar.db.qualitygate.QualityGateDto;
 import org.sonar.server.organization.DefaultOrganizationProvider;
-import org.sonar.db.permission.OrganizationPermission;
 import org.sonar.server.qualitygate.QualityGateUpdater;
 import org.sonar.server.user.UserSession;
 import org.sonarqube.ws.WsQualityGates.CreateWsResponse;
@@ -73,8 +73,8 @@ public class CreateAction implements QualityGatesWsAction {
       CreateWsResponse.Builder createWsResponse = CreateWsResponse.newBuilder()
         .setId(newQualityGate.getId())
         .setName(newQualityGate.getName());
-      writeProtobuf(createWsResponse.build(), request, response);
       dbSession.commit();
+      writeProtobuf(createWsResponse.build(), request, response);
     }
   }