maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From denn...@apache.org
Subject svn commit: r1428394 - in /maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira: AdaptiveJiraDownloader.java RestJiraDownloader.java
Date Thu, 03 Jan 2013 15:13:00 GMT
Author: dennisl
Date: Thu Jan  3 15:13:00 2013
New Revision: 1428394

URL: http://svn.apache.org/viewvc?rev=1428394&view=rev
Log:
[MCHANGES-302] The REST API is always used when JIRA authentication is configured

Modified:
    maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/AdaptiveJiraDownloader.java
    maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/RestJiraDownloader.java

Modified: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/AdaptiveJiraDownloader.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/AdaptiveJiraDownloader.java?rev=1428394&r1=1428393&r2=1428394&view=diff
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/AdaptiveJiraDownloader.java
(original)
+++ maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/AdaptiveJiraDownloader.java
Thu Jan  3 15:13:00 2013
@@ -48,7 +48,7 @@ public class AdaptiveJiraDownloader exte
         }
         catch( RestJiraDownloader.NoRest nre )
         {
-            getLog().info( "Falling back to RSS for issue download." );
+            getLog().info( "Falling back to RSS for issue download: " + nre.getMessage()
);
             effectiveDownloader = new ClassicJiraDownloader();
             copySettings( effectiveDownloader );
             effectiveDownloader.doExecute();

Modified: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/RestJiraDownloader.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/RestJiraDownloader.java?rev=1428394&r1=1428393&r2=1428394&view=diff
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/RestJiraDownloader.java
(original)
+++ maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/RestJiraDownloader.java
Thu Jan  3 15:13:00 2013
@@ -77,6 +77,10 @@ public class RestJiraDownloader extends 
         {
             // blank on purpose.
         }
+        public NoRest( String message )
+        {
+            super( message );
+        }
     }
 
     public RestJiraDownloader() {
@@ -98,19 +102,19 @@ public class RestJiraDownloader extends 
         String jiraUrl = urlMap.get( "url" );
         jiraProject = urlMap.get( "project" );
         WebClient client = setupWebClient( jiraUrl );
-        /*
-         If there is no session auth, explicitly probe to see if there is any REST.
-         */
-        if ( jiraUser == null)
-        {
-            client.replacePath( "/rest/api/2/serverInfo" );
-            client.accept( MediaType.APPLICATION_JSON );
-            Response siResponse = client.get();
-            if ( siResponse.getStatus() != Response.Status.OK.getStatusCode() )
-            {
-                throw new NoRest();
-            }
+
+        // We use version 2 of the REST API, that first appeared in JIRA 5
+        // Check if version 2 of the REST API is supported
+        // http://docs.atlassian.com/jira/REST/5.0/
+        // Note that serverInfo can always be accessed without authentication
+        client.replacePath( "/rest/api/2/serverInfo" );
+        client.accept( MediaType.APPLICATION_JSON );
+        Response siResponse = client.get();
+        if ( siResponse.getStatus() != Response.Status.OK.getStatusCode() )
+        {
+            throw new NoRest( "This JIRA server does not support version 2 of the REST API,
which maven-changes-plugin requires." );
         }
+
         doSessionAuth( client );
 
         resolveIds( client, jiraProject );



Mime
View raw message