mirror of https://github.com/apache/jclouds.git
fix issue #607: NPE in compareTo method of ResourceMetadataImpl
This commit is contained in:
parent
881bca7de2
commit
fd65cbf203
|
@ -20,6 +20,8 @@ package org.jclouds.domain.internal;
|
||||||
|
|
||||||
import static com.google.common.base.Objects.equal;
|
import static com.google.common.base.Objects.equal;
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
import static com.google.common.collect.ComparisonChain.start;
|
||||||
|
import static com.google.common.collect.Ordering.natural;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
@ -66,10 +68,10 @@ public abstract class ResourceMetadataImpl<T extends Enum<T>> implements Resourc
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(ResourceMetadata<T> o) {
|
public int compareTo(ResourceMetadata<T> that) {
|
||||||
if (getName() == null)
|
return start()
|
||||||
return -1;
|
.compare(this.getName(), that.getName(), natural().nullsLast())
|
||||||
return (this == o) ? 0 : getName().compareTo(o.getName());
|
.result();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue