Running SonarQube 9.7.0.61563. Note that this does not have any great impact for us, just pointing out a possible side effect after some changes in case there might be others, of greater impact.
When sending a request to api/projects/create with name and project set to a key that already exists, the server returns a 5xx error (used to be 4xx in earlier versions). The traceback shows a failure:
Fail to process request <REDACTED>/api/projects/create
org.apache.ibatis.exceptions.TooManyResultsException: Expected one result (or null) to be returned by selectOne(), but found: 2
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:80)
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:87)
at org.apache.ibatis.binding.MapperProxy$PlainMethodInvoker.invoke(MapperProxy.java:145)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:86)
at com.sun.proxy.$Proxy81.selectByKeyCaseInsensitive(Unknown Source)
at org.sonar.db.component.ComponentDao.selectByKeyCaseInsensitive(ComponentDao.java:213)
at org.sonar.server.component.ComponentUpdater.checkKeyAlreadyExists(ComponentUpdater.java:129)
at org.sonar.server.component.ComponentUpdater.createWithoutCommit(ComponentUpdater.java:113)
at org.sonar.server.component.ComponentUpdater.createWithoutCommit(ComponentUpdater.java:102)
at org.sonar.server.component.ComponentUpdater.create(ComponentUpdater.java:86)
at org.sonar.server.project.ws.CreateAction.doHandle(CreateAction.java:111)
at org.sonar.server.project.ws.CreateAction.handle(CreateAction.java:102)
at org.sonar.server.ws.WebServiceEngine.execute(WebServiceEngine.java:111)
From our investigation, this might be connected to the changes made in [SONAR-17352] - Jira - since the existing project with the same name had two branches, two results are returned instead of one or none. This API used to return a 4xx exception instead of 5xx and this traceback.
Again, this does not impact us so no fix is needed, just wanted to point out a potential side-effect of the change (there may be others which are more disruptive).