Description of the problem
When updating the key of a project, if for some reason the process is stopped at the middle, only some component keys will be updated, which will result in a project in a bad situation.
Indeed, trying to update again the project key could fail with
java.lang.StringIndexOutOfBoundsException: String index out of range: -7 at java.lang.String.substring(String.java:1967) at org.sonar.db.component.ComponentKeyUpdaterDao.runBatchUpdateForAllResources(ComponentKeyUpdaterDao.java:172) at org.sonar.db.component.ComponentKeyUpdaterDao.updateKey(ComponentKeyUpdaterDao.java:78) at org.sonar.server.component.ComponentService.updateKey(ComponentService.java:65) at org.sonar.server.project.ws.UpdateKeyAction.handle(UpdateKeyAction.java:110) at org.sonar.server.ws.WebServiceEngine.execute(WebServiceEngine.java:110)
Solution
In order for this situation to not happen again, we should made this feature transactional by using the "B columns" strategy (introduced with SONAR-7700).