4949import com .google .api .client .util .Key ;
5050import com .google .gson .Gson ;
5151import com .google .gson .GsonBuilder ;
52+ import com .google .gson .JsonSyntaxException ;
5253
5354import io .apigee .buildTools .enterprise4g .utils .PrintUtil ;
5455import io .apigee .buildTools .enterprise4g .utils .ServerProfile ;
@@ -679,7 +680,7 @@ public static String activateBundleRevision(ServerProfile profile, String revisi
679680 throws IOException {
680681
681682 BundleActivationConfig deployment2 = new BundleActivationConfig ();
682-
683+ HttpResponse response = null ;
683684 try {
684685
685686 UrlEncodedContent urlEncodedContent = null ;
@@ -716,12 +717,20 @@ public static String activateBundleRevision(ServerProfile profile, String revisi
716717 deployRestRequest .setReadTimeout (0 );
717718 deployRestRequest .setHeaders (headers );
718719
719-
720- HttpResponse response = null ;
721720 response = executeAPI (profile , deployRestRequest );
722-
721+ String responseString = response .parseAsString ();
722+ SeamLessDeploymentStatus deployment3 = null ;
723+ try {
724+ deployment3 = new Gson ().fromJson (responseString , SeamLessDeploymentStatus .class );
725+ }catch (JsonSyntaxException e ){
726+ // https://github.com/apigee/apigee-deploy-maven-plugin/issues/92
727+ // Whenever an existing API is deployed with option as override and in the new revision, the proxy basepath is changed,
728+ // the Mgmt API response is different. It does not return the usual response if the proxy has no changes to the basepath
729+ // So catching the exception from above and setting the override flag to false so that it doesnt go that section of code below
730+ Options .override = false ;
731+ }
723732 if (Options .override ) {
724- SeamLessDeploymentStatus deployment3 = response .parseAs (SeamLessDeploymentStatus .class );
733+ // SeamLessDeploymentStatus deployment3 = response.parseAs(SeamLessDeploymentStatus.class);
725734 Iterator <BundleActivationConfig > iter = deployment3 .environment .iterator ();
726735 while (iter .hasNext ()){
727736 BundleActivationConfig config = iter .next ();
@@ -746,8 +755,8 @@ public static String activateBundleRevision(ServerProfile profile, String revisi
746755 }
747756
748757 }
749-
750- deployment2 = response . parseAs ( BundleActivationConfig .class );
758+ //deployment2 = response.parseAs(BundleActivationConfig.class);
759+ deployment2 = new Gson (). fromJson ( responseString , BundleActivationConfig .class );
751760 logger .info (PrintUtil .formatResponse (response , gson .toJson (deployment2 ).toString ()));
752761 logger .info ("\n Deployed revision is: " +deployment2 .revision );
753762
0 commit comments