Coder Social home page Coder Social logo

csharp-swift's People

Contributors

jmeridth avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

csharp-swift's Issues

System.ArgumentException: An item with the same key has already been added

Hi,

Please see https://github.com/rackspace/csharp-cloudfiles/issues/51, the last comment by 'horacioj'
The exception does happens in fact in this library (which I wish I could be able to understand and fix myself, but unfortunately I'm not that smart...)

   var query = new Dictionary<ObjectQuery, string>();
   query.Add(ObjectQuery.Prefix, "folder1/");
   query.Add(ObjectQuery.Delimiter, "/");
   list = container.GetObjectList(query);
Exception:
System.ArgumentException: An item with the same key has already been added.
   at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
   at OpenStack.Swift.SwiftClient.GetContainer(String url, String token, String container, Dictionary`2 headers, Dictionary`2 query, Boolean full_listing) in C:\Cloudfiles\rackspace-csharp-cloudfiles\cweidenkeller-csharp-swift-eedd837\src\OpenStack.Swift\Client.cs:line 312
   at Cloudfiles.CF_Container.GetObjectList(Boolean full_listing, Dictionary`2 query) in C:\Cloudfiles\rackspace-csharp-cloudfiles\Rackspace.Cloudfiles\CF_Container.cs:line 632
   at Cloudfiles.CF_Container.GetObjectList(Dictionary`2 query) in C:\Cloudfiles\rackspace-csharp-cloudfiles\Rackspace.Cloudfiles\CF_Container.cs:line 588

in '_client' ("public override ContainerResponse GetContainer(string url, string token, string container, Dictionary<string, string> headers, Dictionary<string, string> query, bool full_listing)") what happens is:

...
...
while (reader.Read())
            {
                switch (reader.NodeType)
                {
                    case XmlNodeType.Element:
                        if (reader.Name != "xml" && 
                            reader.Name != "container" && 
                            reader.Name != "object")
                        { 
                            var key = reader.Name;
                            reader.Read();
                            info.Add(key, reader.Value);    ////===== EXCEPTION HERE. NOTE: key = "subdir"
                        }
                        break;

Thanks

Response.close on ObjectResponse GetObject

In Client.cs:
method
public ObjectResponse GetObject(string url, string token, string container, string name, Dictionary<string, string> headers, Dictionary<string, string> query):
looks like responsec.close() is missing before return??

Check for key exists before add to info dictionary

Dictionary is a Set and complains about a duplicate items.
so in methods:
public ContainerResponse GetContainer(string url, string token, string container, Dictionary<string, string> headers, Dictionary<string, string> query, bool full_listing)

and
public AccountResponse GetAccount(string url, string token, Dictionary<string, string> headers, Dictionary<string, string> query, bool full_listing)

it will throw exception if info.ContainsKey(key) not checked before info.add ...

Enhancement. AbstractClient to interface

Looks like Client is inheriting from AbstractClient, but at this point there are only method signatures.. may be interface serves the purpose? No one can instiate an AbstractClient anyway, so ripple effect be minimal?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.