runner.stop();
exit.exit(Exit.SUCCESS);
}
-
+
private void checkSkip(Properties properties) {
if ("true".equalsIgnoreCase(properties.getProperty(ScanProperties.SKIP))) {
logger.info("SonarQube Scanner analysis skipped");
logger.error(message, e);
} else {
logger.error(message);
- if (e != null) {
- logger.error(e.getMessage());
- String previousMsg = "";
- for (Throwable cause = e.getCause(); cause != null
- && cause.getMessage() != null
- && !cause.getMessage().equals(previousMsg); cause = cause.getCause()) {
- logger.error("Caused by: " + cause.getMessage());
- previousMsg = cause.getMessage();
- }
+ logger.error(e.getMessage());
+ String previousMsg = "";
+ for (Throwable cause = e.getCause(); cause != null
+ && cause.getMessage() != null
+ && !cause.getMessage().equals(previousMsg); cause = cause.getCause()) {
+ logger.error("Caused by: " + cause.getMessage());
+ previousMsg = cause.getMessage();
}
}
-
+
if (!cli.isDebugEnabled()) {
logger.error("");
suggestDebugMode();
}
}
-
+
private static boolean showStackTrace(Throwable e, boolean debug) {
// class not available at compile time (loaded by isolated classloader)
- return debug || "org.sonar.api.utils.MessageException".equals(e.getClass().getName());
+ return debug || !"org.sonar.api.utils.MessageException".equals(e.getClass().getName());
}
private void suggestDebugMode() {
--- /dev/null
+/*
+ * SonarQube Scanner
+ * Copyright (C) 2011-2016 SonarSource SA
+ * mailto:contact AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.sonar.api.utils;
+
+public class MessageException extends RuntimeException {
+ public MessageException(String msg) {
+ super(msg);
+ }
+}
+++ /dev/null
-/*
- * SonarQube Scanner
- * Copyright (C) 2011-2016 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.api.utils.MessageException;
-
-public class MessageException extends RuntimeException {
- public MessageException(String msg) {
- super(msg);
- }
-}
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
-import org.sonar.api.utils.MessageException.MessageException;
+import org.sonar.api.utils.MessageException;
import org.sonarsource.scanner.api.EmbeddedScanner;
import org.sonarsource.scanner.api.ScanProperties;
verify(runner).stop();
verify(exit).exit(Exit.ERROR);
- verify(logs).error("Caused by: NPE");
+ verify(logs).error("Error during SonarQube Scanner execution", e);
}
@Test
Exception e = createException(false);
testException(e, false);
- verify(logs).error("Error during SonarQube Scanner execution");
+ verify(logs).error("Error during SonarQube Scanner execution", e);
verify(logs).error("Re-run SonarQube Scanner using the -X switch to enable full debug logging.");
}