Uploaded image for project: 'jclouds'
  1. jclouds
  2. JCLOUDS-1146

BlobStoreContext and BlobStore break reflexive propety of object equals

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.9.2
    • None
    • jclouds-blobstore
    • None

    Description

      Create a BlobStoreContext, call the equals method on it and pass in itself, the result should be true but it is false.

      Get the BlobStore from a context and call the equals method on it and pass in itself, the result should be true but is false with certain providers e.g. "transient", "azureBlob".

      From the javadoc

      Indicates whether some other object is "equal to" this one.

      The equals method implements an equivalence relation on non-null object references:

      It is reflexive: for any non-null reference value x, x.equals(x) should return true.

      ReflexiveTest.java
      import org.jclouds.ContextBuilder;
      import org.jclouds.blobstore.BlobStore;
      import org.jclouds.blobstore.BlobStoreContext;
      //Test for equals behavior
      public class ReflexiveTest {
      	public static void main(String[] args) {
      		BlobStoreContext context = ContextBuilder.newBuilder("azureblob")
      				.credentials("someId", "someKey")
      				.build(BlobStoreContext.class);
      		System.out.println("Context should equal itself " + context.equals(context));
      		BlobStore store = context.getBlobStore();
      		System.out.println("Store should equal itself " + store.equals(store));
      	}
      }
      

      From my tests azureBlob and transient never equals itself, yet somehow aws-s3 BlobStores equal themselves, but not BlobStoreContext.

      Attachments

        1. ReflexiveTest.java
          0.6 kB
          Ryan MacDowell

        Activity

          People

            Unassigned Unassigned
            ryanmacdowell@gmail.com Ryan MacDowell
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: