Update message about unsupported JIRA version

This commit is contained in:
Mikhail Golubev
2014-02-10 19:52:12 +04:00
parent fbae0107fc
commit f1ff831284
2 changed files with 5 additions and 5 deletions
@@ -152,7 +152,7 @@ public class JiraRepository extends BaseRepositoryImpl {
// may be used instead version string parsing
JiraRestApi version = JiraRestApi.fromJiraVersion(object.get("version").getAsString(), this);
if (version == null) {
throw new Exception("JIRA below 4.0.0 doesn't have REST API and is no longer supported.");
throw new Exception("JIRA below 4.2.0 doesn't have REST API and is no longer supported.");
}
return version;
}
@@ -178,7 +178,7 @@ public class JiraRepository extends BaseRepositoryImpl {
// may be null if 204 No Content received
final InputStream stream = method.getResponseBodyAsStream();
entityContent = stream == null ? "" : StreamUtil.readText(stream, CharsetToolkit.UTF8);
LOG.debug(entityContent);
TaskUtil.prettyFormatJsonToLog(LOG, entityContent);
}
finally {
method.releaseConnection();
@@ -224,4 +224,4 @@ public class JiraRepository extends BaseRepositoryImpl {
public String getRestUrl(String... parts) {
return getUrl() + REST_API_PATH + "/" + StringUtil.join(parts, "/");
}
}
}
@@ -28,14 +28,14 @@ public abstract class JiraRestApi {
public static JiraRestApi fromJiraVersion(@NotNull JiraVersion jiraVersion, @NotNull JiraRepository repository) {
LOG.debug("JIRA version is " + jiraVersion);
if (jiraVersion.getMajorNumber() == 4) {
if (jiraVersion.getMajorNumber() == 4 && jiraVersion.getMinorNumber() >= 2) {
return new JiraRestApi20Alpha1(repository);
}
else if (jiraVersion.getMajorNumber() >= 5) {
return new JiraRestApi2(repository);
}
else {
LOG.warn("JIRA below 4.0.0 doesn't support REST API (" + jiraVersion + " used)");
LOG.warn("JIRA below 4.2.0 doesn't support REST API (" + jiraVersion + " used)");
return null;
}
}