import org.apache.catalina.LifecycleException;
import java.io.IOException;
-import java.net.URISyntaxException;
public final class StartServer {
tomcat.stop();
}
- public static void main(String[] args) throws URISyntaxException, IOException, LifecycleException {
+ public static void main(String[] args) throws Exception {
new StartServer(new Env()).start();
}
}
this.target = target;
this.pom = pom;
- // TODO See http://jira.codehaus.org/browse/SONAR-2126
// previously MavenProjectBuilder was responsible for creation of ProjectFileSystem
project.setFileSystem(this);
}
}
+ @Override
@CheckForNull
public Rule findByKey(RuleKey key) {
return findByKey(key.repository(), key.rule());
}
-
- @CheckForNull
- protected final Rule doFindByKey(String repositoryKey, String key) {
- DatabaseSession session = sessionFactory.getSession();
- return session.getSingleResult(
- session.createQuery("FROM " + Rule.class.getSimpleName() + " r WHERE r.key=:key and r.pluginName=:pluginName and r.status<>:status")
- .setParameter("key", key)
- .setParameter("pluginName", repositoryKey)
- .setParameter("status", Rule.STATUS_REMOVED
- ),
- null);
- }
-
+ @Override
public final Rule find(RuleQuery query) {
DatabaseSession session = sessionFactory.getSession();
return session.getSingleResult(createHqlQuery(session, query), null);
}
+ @Override
public final Collection<Rule> findAll(RuleQuery query) {
DatabaseSession session = sessionFactory.getSession();
return createHqlQuery(session, query).getResultList();
import java.io.File;
import java.io.IOException;
-import java.lang.reflect.Method;
import static org.fest.assertions.Assertions.assertThat;
import static org.fest.assertions.Fail.fail;
File file = temp.newFile();
String path = PathUtils.canonicalPath(file);
assertThat(path).isEqualTo(FilenameUtils.separatorsToUnix(file.getCanonicalPath()));
+ assertThat(PathUtils.canonicalPath(null)).isNull();
}
@Test
* Never return null, but an empty list if the issue does not exist.
* No security check is done since it should already have been done to get the issue
*/
- // TODO remove userSession parameter ?
public List<Transition> listTransitions(@Nullable Issue issue, UserSession userSession) {
if (issue == null) {
return Collections.emptyList();
@CheckForNull
public org.sonar.api.rules.Rule findById(int ruleId) {
Rule rule = index.getById(ruleId);
- if (rule.status() != RuleStatus.REMOVED) {
+ if (rule != null && rule.status() != RuleStatus.REMOVED) {
return toRule(rule);
- } else {
- return null;
}
+ return null;
}
@CheckForNull