diff --git a/compute/src/main/java/org/jclouds/compute/domain/internal/TemplateBuilderImpl.java b/compute/src/main/java/org/jclouds/compute/domain/internal/TemplateBuilderImpl.java index fe013d604f..6c3e0f3c3a 100644 --- a/compute/src/main/java/org/jclouds/compute/domain/internal/TemplateBuilderImpl.java +++ b/compute/src/main/java/org/jclouds/compute/domain/internal/TemplateBuilderImpl.java @@ -440,7 +440,8 @@ public class TemplateBuilderImpl implements TemplateBuilder { Ordering. natural().nullsLast()) .compare(left.getOperatingSystem().getDescription(), right.getOperatingSystem().getDescription(),// Ordering. natural().nullsLast()) - .compare(left.getOperatingSystem().getArch(), right.getOperatingSystem().getArch()).result(); + .compare(left.getOperatingSystem().getArch(), right.getOperatingSystem().getArch(),// + Ordering. natural().nullsLast()).result(); } }; diff --git a/compute/src/test/java/org/jclouds/compute/BaseTemplateBuilderLiveTest.java b/compute/src/test/java/org/jclouds/compute/BaseTemplateBuilderLiveTest.java index 160c6b4229..cfd5d3f852 100644 --- a/compute/src/test/java/org/jclouds/compute/BaseTemplateBuilderLiveTest.java +++ b/compute/src/test/java/org/jclouds/compute/BaseTemplateBuilderLiveTest.java @@ -281,12 +281,12 @@ public abstract class BaseTemplateBuilderLiveTest extends BaseVersionedServiceLi assertEquals(context.getComputeService().templateBuilder().build().getImage().getDefaultCredentials(), LoginCredentials.builder().user(user).password(pass).authenticateSudo(auth).build()); } finally { - if (context != null) + if (context != null){ + // Need to clear persisted credentials; otherwise next time a ComputeServiceContext is created + // then it will have these "foo" credentials! + context.credentialStore().clear(); context.close(); - - // Need to clear persisted credentials; otherwise next time a ComputeServiceContext is created - // then it will have these "foo" credentials! - context.credentialStore().clear(); + } } }