DotCMIS: a few quick fixes

git-svn-id: https://svn.apache.org/repos/asf/chemistry/dotcmis/trunk@1510195 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/DotCMIS/Properties/AssemblyInfo.cs b/DotCMIS/Properties/AssemblyInfo.cs
index 537a906..fe4c90a 100644
--- a/DotCMIS/Properties/AssemblyInfo.cs
+++ b/DotCMIS/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@
 // You can specify all the values or you can default the Build and Revision Numbers 

 // by using the '*' as shown below:

 // [assembly: AssemblyVersion("1.0.*")]

-[assembly: AssemblyVersion("0.5.0.0")]

-[assembly: AssemblyFileVersion("1.0.0.0")]

+[assembly: AssemblyVersion("0.6.0.0")]

+[assembly: AssemblyFileVersion("0.6.0.0")]

diff --git a/DotCMIS/binding/atompub/atompub-linkcache.cs b/DotCMIS/binding/atompub/atompub-linkcache.cs
index 477d039..b373c95 100644
--- a/DotCMIS/binding/atompub/atompub-linkcache.cs
+++ b/DotCMIS/binding/atompub/atompub-linkcache.cs
@@ -74,40 +74,44 @@
                 objCount = CacheSizeLinks;

             }

 

+            string dictionaryLevelName = typeof(DictionaryCacheLevel).FullName;

+            string lruLevelName = typeof(LruCacheLevel).FullName;

+            string contentTypeLevelName = typeof(DictionaryCacheLevel).FullName;

+

             linkCache = new Cache("Link Cache");

             linkCache.Initialize(new string[] {

-                typeof(DictionaryCacheLevel).FullName + " " + DictionaryCacheLevel.Capacity + "=" + repCount, // repository

-                typeof(LruCacheLevel).FullName + " " + LruCacheLevel.MaxEntries + "=" + objCount, // id

-                typeof(DictionaryCacheLevel).FullName + " " + DictionaryCacheLevel.Capacity + "=16", // rel

-                typeof(ContentTypeCacheLevel).FullName + " " + DictionaryCacheLevel.Capacity + "=3,"

+                dictionaryLevelName + " " + DictionaryCacheLevel.Capacity + "=" + repCount.ToString(), // repository

+                lruLevelName + " " + LruCacheLevel.MaxEntries + "=" + objCount.ToString(), // id

+                dictionaryLevelName + " " + DictionaryCacheLevel.Capacity + "=16", // rel

+                contentTypeLevelName + " " + DictionaryCacheLevel.Capacity + "=3,"

                         + DictionaryCacheLevel.SingleValue + "=true" // type

         });

 

             typeLinkCache = new Cache("Type Link Cache");

             typeLinkCache.Initialize(new string[] {

-                typeof(DictionaryCacheLevel).FullName + " " + DictionaryCacheLevel.Capacity + "=" + repCount, // repository

-                typeof(LruCacheLevel).FullName + " " + LruCacheLevel.MaxEntries + "=" + typeCount, // id

-                typeof(DictionaryCacheLevel).FullName + " " + DictionaryCacheLevel.Capacity + "=16", // rel

-                typeof(ContentTypeCacheLevel).FullName + " " + DictionaryCacheLevel.Capacity + "=3,"

+                dictionaryLevelName + " " + DictionaryCacheLevel.Capacity + "=" + repCount.ToString(), // repository

+                lruLevelName + " " + LruCacheLevel.MaxEntries + "=" + typeCount.ToString(), // id

+                dictionaryLevelName + " " + DictionaryCacheLevel.Capacity + "=16", // rel

+                contentTypeLevelName + " " + DictionaryCacheLevel.Capacity + "=3,"

                         + DictionaryCacheLevel.SingleValue + "=true"// type

         });

 

             collectionLinkCache = new Cache("Collection Link Cache");

             collectionLinkCache.Initialize(new string[] {

-                typeof(DictionaryCacheLevel).FullName + " " + DictionaryCacheLevel.Capacity + "=" + repCount, // repository

-                typeof(DictionaryCacheLevel).FullName + " " + DictionaryCacheLevel.Capacity + "=8" // collection

+                dictionaryLevelName + " " + DictionaryCacheLevel.Capacity + "=" + repCount.ToString(), // repository

+                dictionaryLevelName + " " + DictionaryCacheLevel.Capacity + "=8" // collection

         });

 

             templateCache = new Cache("URI Template Cache");

             templateCache.Initialize(new string[] {

-                typeof(DictionaryCacheLevel).FullName + " " + DictionaryCacheLevel.Capacity + "=" + repCount, // repository

-                typeof(DictionaryCacheLevel).FullName + " " + DictionaryCacheLevel.Capacity + "=6" // type

+                dictionaryLevelName + " " + DictionaryCacheLevel.Capacity + "=" + repCount.ToString(), // repository

+                dictionaryLevelName + " " + DictionaryCacheLevel.Capacity + "=6" // type

         });

 

             repositoryLinkCache = new Cache("Repository Link Cache");

             repositoryLinkCache.Initialize(new string[] {

-                typeof(DictionaryCacheLevel).FullName + " " + DictionaryCacheLevel.Capacity + "=" + repCount, // repository

-                typeof(DictionaryCacheLevel).FullName + " " + DictionaryCacheLevel.Capacity + "=6" // rel

+                dictionaryLevelName + " " + DictionaryCacheLevel.Capacity + "=" + repCount.ToString(), // repository

+                dictionaryLevelName + " " + DictionaryCacheLevel.Capacity + "=6" // rel

         });

         }

 

diff --git a/DotCMIS/binding/atompub/atompub.cs b/DotCMIS/binding/atompub/atompub.cs
index 7a96d5e..286166f 100644
--- a/DotCMIS/binding/atompub/atompub.cs
+++ b/DotCMIS/binding/atompub/atompub.cs
@@ -1789,11 +1789,11 @@
             // get the content

             if (offset != null && offset > Int32.MaxValue)

             {

-                throw new CmisInvalidArgumentException("Offset >" + Int32.MaxValue);

+                throw new CmisInvalidArgumentException("Offset >" + Int32.MaxValue.ToString());

             }

             if (length != null && length > Int32.MaxValue)

             {

-                throw new CmisInvalidArgumentException("Length >" + Int32.MaxValue);

+                throw new CmisInvalidArgumentException("Length >" + Int32.MaxValue.ToString());

             }

             HttpUtils.Response resp = HttpUtils.InvokeGET(url, Session, (int?)offset, (int?)length);

 

diff --git a/DotCMIS/binding/binding-impl.cs b/DotCMIS/binding/binding-impl.cs
index 3021a4b..1f68524 100644
--- a/DotCMIS/binding/binding-impl.cs
+++ b/DotCMIS/binding/binding-impl.cs
@@ -363,9 +363,9 @@
                         throw new CmisRuntimeException("SPI class is not set!");

                     }

                 }

-                catch (CmisBaseException ce)

+                catch (CmisBaseException)

                 {

-                    throw ce;

+                    throw;

                 }

                 catch (Exception e)

                 {

diff --git a/DotCMIS/binding/converter.cs b/DotCMIS/binding/converter.cs
index a9e6bef..8d886cc 100644
--- a/DotCMIS/binding/converter.cs
+++ b/DotCMIS/binding/converter.cs
@@ -126,7 +126,10 @@
                 }

             }

 

-            return (T)s.Deserialize(new XmlNodeReader(element));

+            using (XmlNodeReader reader = new XmlNodeReader(element))

+            {

+                return (T)s.Deserialize(reader);

+            }

         }

 

         /// <summary>

@@ -1885,7 +1888,6 @@
             }

             else if (element.Children != null)

             {

-                List<XmlElement> children = new List<XmlElement>();

                 foreach (ICmisExtensionElement child in element.Children)

                 {

                     XmlElement xml = CreateXmlElement(doc, child);

diff --git a/DotCMIS/binding/http.cs b/DotCMIS/binding/http.cs
index 0e0c13f..0e3fc2f 100644
--- a/DotCMIS/binding/http.cs
+++ b/DotCMIS/binding/http.cs
@@ -136,6 +136,19 @@
                     writer(requestStream);

                     requestStream.Close();

                 }

+                else

+                {

+#if __MonoCS__

+                    //around for MONO HTTP DELETE issue

+                    //http://stackoverflow.com/questions/11785597/monotouch-iphone-call-to-httpwebrequest-getrequeststream-connects-to-server

+                    if (method == "DELETE")

+                    {

+                        conn.ContentLength = 0;

+                        Stream requestStream = conn.GetRequestStream();

+                        requestStream.Close();

+                    }

+#endif

+                }

 

                 // connect

                 try

@@ -191,7 +204,7 @@
                         Stream = new BufferedStream(new CryptoStream(httpResponse.GetResponseStream(), new FromBase64Transform(), CryptoStreamMode.Read), 64 * 1024);

                     }

                     else

-                    {  

+                    {

                         Stream = new BufferedStream(httpResponse.GetResponseStream(), 64 * 1024);

                     }

                 }

diff --git a/DotCMIS/client/client-intf.cs b/DotCMIS/client/client-intf.cs
index 7e56dda..b5a2126 100644
--- a/DotCMIS/client/client-intf.cs
+++ b/DotCMIS/client/client-intf.cs
@@ -1152,7 +1152,7 @@
         /// <remarks>

         /// Since repositories are not obligated to add property ids to their

         /// query result properties, this method might not always work as expected with

-        /// some repositories. Use <see cref="this[string]"/> instead.

+        /// some repositories. Use <see cref="P:this[string]"/> instead.

         /// </remarks>

         IPropertyData GetPropertyById(string propertyId);

 

diff --git a/DotCMIS/client/client-objectfactory.cs b/DotCMIS/client/client-objectfactory.cs
index 9bcb92c..3ccfa80 100644
--- a/DotCMIS/client/client-objectfactory.cs
+++ b/DotCMIS/client/client-objectfactory.cs
@@ -335,7 +335,7 @@
                 case BaseTypeId.CmisRelationship:

                     return new Relationship(session, type, objectData, context);

                 default:

-                    throw new CmisRuntimeException("Unsupported type: " + objectData.BaseTypeId);

+                    throw new CmisRuntimeException("Unsupported type: " + objectData.BaseTypeId.ToString());

             }

         }

 

diff --git a/DotCMIS/client/client-objects.cs b/DotCMIS/client/client-objects.cs
index bc1e468..e0bce61 100644
--- a/DotCMIS/client/client-objects.cs
+++ b/DotCMIS/client/client-objects.cs
@@ -690,12 +690,7 @@
 

         public void RemoveFromFolder(IObjectId folderId)

         {

-            if (folderId == null || folderId.Id == null)

-            {

-                throw new ArgumentException("Folder Id must be set!");

-            }

-

-            Binding.GetMultiFilingService().RemoveObjectFromFolder(RepositoryId, ObjectId, folderId.Id, null);

+            Binding.GetMultiFilingService().RemoveObjectFromFolder(RepositoryId, ObjectId, folderId == null ? null : folderId.Id, null);

         }

     }

 

diff --git a/README b/README
index 4bb9b49..7055542 100644
--- a/README
+++ b/README
@@ -16,21 +16,26 @@
 Change log 

 ----------

 

+DotCMIS 0.6:

+

+- Bug fixes.

+

+

 DotCMIS 0.5:

 

-- Interoptability improvements.

+- Interoperability improvements.

 - Added NTLM authentication.

 

 

 DotCMIS 0.4:

 

-- Several bug and interoptability fixes.

+- Several bug and interoperability fixes.

 

 

 DotCMIS 0.3:

 

 - DotCMIS only requires the .NET Client Profile.

-- Several bug and interoptability fixes.

+- Several bug and interoperability fixes.

 

 

 DotCMIS 0.2:

@@ -55,7 +60,7 @@
   

 - Content is buffered in main memory when the Web Services binding is used. 

   That can cause problems with huge documents. 

-  The maxium document size can be controlled with the SessionParameter.MessageSize 

+  The maximum document size can be controlled with the SessionParameter.MessageSize 

   parameter. The default is 4 MB. The absolute maximum is 2 GB.

 

 => Use the AtomPub binding whenever possible!