]> source.dussan.org Git - sonarqube.git/commitdiff
Replace MessageException by IllegalStateException
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Wed, 18 Jun 2014 15:08:30 +0000 (17:08 +0200)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Wed, 18 Jun 2014 15:18:21 +0000 (17:18 +0200)
sonar-server/src/main/java/org/sonar/server/db/migrations/MassUpdater.java
sonar-server/src/test/java/org/sonar/server/db/migrations/MassUpdaterTest.java

index 494c5e7a4faed085126d563232d980bbc7fa61bd..49230376878b6f6cab8eeb8c6259dd7d65ea8139 100644 (file)
@@ -24,7 +24,6 @@ import com.google.common.annotations.VisibleForTesting;
 import org.apache.commons.dbutils.DbUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.sonar.api.utils.MessageException;
 import org.sonar.core.persistence.Database;
 import org.sonar.core.persistence.dialect.MySql;
 
@@ -153,10 +152,8 @@ public class MassUpdater {
     writeConnection.commit();
   }
 
-  private static MessageException processError(Exception e) {
-    String message = String.format("Fail to migrate data, error is : %s", e.getMessage());
-    LOGGER.error(message, e);
-    throw MessageException.of(message);
+  private static RuntimeException processError(Exception e) {
+    throw new IllegalStateException(e);
   }
 
   @VisibleForTesting
index 36a9085cf323b307002bc678ec74d193a419c42e..928424901017ec093585c64df0b6e0a4d60fcdbc 100644 (file)
@@ -24,7 +24,6 @@ import org.junit.ClassRule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.runners.MockitoJUnitRunner;
-import org.sonar.api.utils.MessageException;
 import org.sonar.core.persistence.Database;
 import org.sonar.core.persistence.TestDatabase;
 import org.sonar.core.persistence.dialect.Dialect;
@@ -115,7 +114,7 @@ public class MassUpdaterTest {
         );
       fail();
     } catch (Exception e) {
-      assertThat(e).isInstanceOf(MessageException.class);
+      assertThat(e).isInstanceOf(IllegalStateException.class);
     }
   }
 
@@ -152,7 +151,7 @@ public class MassUpdaterTest {
         );
       fail();
     } catch (Exception e) {
-      assertThat(e).isInstanceOf(MessageException.class);
+      assertThat(e).isInstanceOf(IllegalStateException.class);
     }
   }