From af3a226b3d7437304371fa862b9655ac40f87f65 Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Mon, 2 Apr 2012 11:44:10 -0700 Subject: [PATCH] Issue 894:update to guava 12 --- core/pom.xml | 2 +- .../virtualbox/functions/MastersLoadingCache.java | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/core/pom.xml b/core/pom.xml index a6abf30d56..9f1b049474 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -99,7 +99,7 @@ com.google.guava guava - 11.0.2 + 12.0-rc1 diff --git a/labs/virtualbox/src/main/java/org/jclouds/virtualbox/functions/MastersLoadingCache.java b/labs/virtualbox/src/main/java/org/jclouds/virtualbox/functions/MastersLoadingCache.java index ecdc4b8bc3..5aa668205e 100644 --- a/labs/virtualbox/src/main/java/org/jclouds/virtualbox/functions/MastersLoadingCache.java +++ b/labs/virtualbox/src/main/java/org/jclouds/virtualbox/functions/MastersLoadingCache.java @@ -19,12 +19,14 @@ package org.jclouds.virtualbox.functions; +import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkState; -import static org.jclouds.virtualbox.config.VirtualBoxConstants.*; +import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_DEFAULT_DIR; import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_IMAGE_PREFIX; import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_INSTALLATION_KEY_SEQUENCE; import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_NODE_NAME_SEPARATOR; +import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_PRECONFIGURATION_URL; import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_WORKINGDIR; import static org.jclouds.virtualbox.util.MachineUtils.machineNotFoundException; @@ -215,9 +217,11 @@ public class MastersLoadingCache extends AbstractLoadingCache { } @Override - public synchronized Master getIfPresent(Image key) { - if (masters.containsKey(key.getId())) { - return masters.get(key.getId()); + public synchronized Master getIfPresent(Object key) { + checkArgument(key instanceof Image, "this cache is for entries who's keys are Images"); + Image image = Image.class.cast(key); + if (masters.containsKey(image.getId())) { + return masters.get(image.getId()); } return null; }