Issue 894:update to guava 12

This commit is contained in:
Adrian Cole 2012-04-02 11:44:10 -07:00
parent 8a3712fb2f
commit af3a226b3d
2 changed files with 9 additions and 5 deletions

View File

@ -99,7 +99,7 @@
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>11.0.2</version>
<version>12.0-rc1</version>
</dependency>
</dependencies>

View File

@ -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<Image, Master> {
}
@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;
}