chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1799023 [1/2] - in /chemistry/portcmis/trunk: PortCMIS/binding/ PortCMIS/binding/atompub/ PortCMIS/binding/browser/ PortCMIS/binding/browser/json/ PortCMIS/client/ PortCMIS/const/ PortCMIS/data/ PortCMIS/enum/ PortCMIS/utils/ PortCMISTests...
Date Sat, 17 Jun 2017 21:43:34 GMT
Author: fmui
Date: Sat Jun 17 21:43:33 2017
New Revision: 1799023

URL: http://svn.apache.org/viewvc?rev=1799023&view=rev
Log:
PortCMIS: a bunch of small corrections and improvements

Modified:
    chemistry/portcmis/trunk/PortCMIS/binding/BindingCaches.cs
    chemistry/portcmis/trunk/PortCMIS/binding/BindingImpl.cs
    chemistry/portcmis/trunk/PortCMIS/binding/BindingIntf.cs
    chemistry/portcmis/trunk/PortCMIS/binding/BindingsConstants.cs
    chemistry/portcmis/trunk/PortCMIS/binding/DateTimeHelper.cs
    chemistry/portcmis/trunk/PortCMIS/binding/Http.cs
    chemistry/portcmis/trunk/PortCMIS/binding/HttpPortable.cs
    chemistry/portcmis/trunk/PortCMIS/binding/Url.cs
    chemistry/portcmis/trunk/PortCMIS/binding/atompub/AtomPubBinding.cs
    chemistry/portcmis/trunk/PortCMIS/binding/atompub/AtomPubUtils.cs
    chemistry/portcmis/trunk/PortCMIS/binding/atompub/XmlConstants.cs
    chemistry/portcmis/trunk/PortCMIS/binding/atompub/XmlConverter.cs
    chemistry/portcmis/trunk/PortCMIS/binding/atompub/XmlUtils.cs
    chemistry/portcmis/trunk/PortCMIS/binding/atompub/XmlWalker.cs
    chemistry/portcmis/trunk/PortCMIS/binding/browser/BrowserBinding.cs
    chemistry/portcmis/trunk/PortCMIS/binding/browser/BrowserConstants.cs
    chemistry/portcmis/trunk/PortCMIS/binding/browser/BrowserConverter.cs
    chemistry/portcmis/trunk/PortCMIS/binding/browser/BrowserUtils.cs
    chemistry/portcmis/trunk/PortCMIS/binding/browser/json/Json.cs
    chemistry/portcmis/trunk/PortCMIS/client/ClientCaches.cs
    chemistry/portcmis/trunk/PortCMIS/client/ClientImpl.cs
    chemistry/portcmis/trunk/PortCMIS/client/ClientIntf.cs
    chemistry/portcmis/trunk/PortCMIS/client/ClientObjectFactory.cs
    chemistry/portcmis/trunk/PortCMIS/client/ClientObjects.cs
    chemistry/portcmis/trunk/PortCMIS/client/ClientTypes.cs
    chemistry/portcmis/trunk/PortCMIS/client/ClientUtils.cs
    chemistry/portcmis/trunk/PortCMIS/const/ExtensionFeatures.cs
    chemistry/portcmis/trunk/PortCMIS/data/DataImpl.cs
    chemistry/portcmis/trunk/PortCMIS/data/Extensions.cs
    chemistry/portcmis/trunk/PortCMIS/enum/Enums.cs
    chemistry/portcmis/trunk/PortCMIS/utils/Cache.cs
    chemistry/portcmis/trunk/PortCMIS/utils/Logger.cs
    chemistry/portcmis/trunk/PortCMISTests/SimpleCmisTest.cs
    chemistry/portcmis/trunk/PortCMISTests/framework/DefaultTestValues.cs
    chemistry/portcmis/trunk/PortCMISTests/framework/TestFramework.cs
    chemistry/portcmis/trunk/PortCMISWin/binding/WindowsHttp.cs

Modified: chemistry/portcmis/trunk/PortCMIS/binding/BindingCaches.cs
URL: http://svn.apache.org/viewvc/chemistry/portcmis/trunk/PortCMIS/binding/BindingCaches.cs?rev=1799023&r1=1799022&r2=1799023&view=diff
==============================================================================
--- chemistry/portcmis/trunk/PortCMIS/binding/BindingCaches.cs (original)
+++ chemistry/portcmis/trunk/PortCMIS/binding/BindingCaches.cs Sat Jun 17 21:43:33 2017
@@ -22,11 +22,9 @@ using PortCMIS.Data;
 using PortCMIS.Utils;
 using System;
 using System.Collections.Generic;
-using System.Diagnostics;
 using System.Linq;
 using System.Text;
 using System.Threading;
-using System.Threading.Tasks;
 
 namespace PortCMIS.Binding
 {
@@ -79,7 +77,7 @@ namespace PortCMIS.Binding
 
                 if (cacheLevelConfig == null || cacheLevelConfig.Length == 0)
                 {
-                    throw new ArgumentException("Cache config must not be empty!", "cacheLevelConfig");
+                    throw new ArgumentException("Cache config must not be empty!", nameof(cacheLevelConfig));
                 }
                 cacheLevels = new List<Type>();
                 cacheLevelParameters = new List<IDictionary<string, string>>();
@@ -108,7 +106,7 @@ namespace PortCMIS.Binding
 
             if (keys.Length != cacheLevels.Count)
             {
-                throw new ArgumentException("Wrong number of keys!", "keys");
+                throw new ArgumentException("Wrong number of keys!", nameof(keys));
             }
 
             lock (cacheLock)
@@ -146,7 +144,7 @@ namespace PortCMIS.Binding
 
             if (keys.Length != cacheLevels.Count)
             {
-                throw new ArgumentException("Wrong number of keys!", "keys");
+                throw new ArgumentException("Wrong number of keys!", nameof(keys));
             }
 
             object result = null;
@@ -249,7 +247,7 @@ namespace PortCMIS.Binding
             }
             catch (Exception e)
             {
-                throw new ArgumentException("Class '" + typeName + "' not found!", "typeName", e);
+                throw new ArgumentException("Class '" + typeName + "' not found!", nameof(typeName), e);
             }
 
             cacheLevels.Add(levelType);
@@ -283,7 +281,7 @@ namespace PortCMIS.Binding
         {
             if ((level < 0) || (level >= cacheLevels.Count))
             {
-                throw new ArgumentException("Cache level doesn't fit the configuration!", "level");
+                throw new ArgumentException("Cache level doesn't fit the configuration!", nameof(level));
             }
 
             // get the class and create an instance
@@ -334,7 +332,7 @@ namespace PortCMIS.Binding
         {
             get
             {
-                object value = GetValue(key == null ? NullKey : key);
+                object value = GetValue(key ?? NullKey);
                 if (value != null)
                 {
                     return value;
@@ -364,7 +362,7 @@ namespace PortCMIS.Binding
             {
                 if (value != null)
                 {
-                    AddValue(key == null ? NullKey : key, value);
+                    AddValue(key ?? NullKey, value);
                 }
             }
         }
@@ -588,7 +586,7 @@ namespace PortCMIS.Binding
         private const int CacheSizeRepositories = 10;
         private const int CacheSizeTypes = 100;
 
-        private IBindingCache cache;
+        private readonly IBindingCache cache;
 
         public TypeDefinitionCache(IBindingSession session)
         {

Modified: chemistry/portcmis/trunk/PortCMIS/binding/BindingImpl.cs
URL: http://svn.apache.org/viewvc/chemistry/portcmis/trunk/PortCMIS/binding/BindingImpl.cs?rev=1799023&r1=1799022&r2=1799023&view=diff
==============================================================================
--- chemistry/portcmis/trunk/PortCMIS/binding/BindingImpl.cs (original)
+++ chemistry/portcmis/trunk/PortCMIS/binding/BindingImpl.cs Sat Jun 17 21:43:33 2017
@@ -25,10 +25,7 @@ using PortCMIS.Data.Extensions;
 using PortCMIS.Exceptions;
 using System;
 using System.Collections.Generic;
-using System.Linq;
 using System.Numerics;
-using System.Text;
-using System.Threading.Tasks;
 
 namespace PortCMIS.Binding.Impl
 {
@@ -51,7 +48,7 @@ namespace PortCMIS.Binding.Impl
         {
             if (sessionParameters == null)
             {
-                throw new ArgumentNullException("sessionParameters");
+                throw new ArgumentNullException(nameof(sessionParameters));
             }
 
             if (!sessionParameters.ContainsKey(SessionParameter.BindingSpiClass))
@@ -258,7 +255,7 @@ namespace PortCMIS.Binding.Impl
         public const string SpiObject = "org.apache.chemistry.portcmis.bindings.spi.object";
         public const string HttpInvokerObject = "org.apache.chemistry.portcmis.binding.httpinvoker.object";
 
-        private Dictionary<string, object> data;
+        private readonly Dictionary<string, object> data;
         private object sessionLock = new object();
 
         public BindingSession()
@@ -303,7 +300,7 @@ namespace PortCMIS.Binding.Impl
                     return (int)value;
                 }
             }
-            catch (Exception)
+            catch
             {
             }
 
@@ -325,7 +322,7 @@ namespace PortCMIS.Binding.Impl
                     return (bool)value;
                 }
             }
-            catch (Exception)
+            catch
             {
             }
 
@@ -471,7 +468,7 @@ namespace PortCMIS.Binding.Impl
     /// </summary>
     internal class BindingRepositoryService : IRepositoryService
     {
-        private BindingSession session;
+        private readonly BindingSession session;
 
         public BindingRepositoryService(BindingSession session)
         {

Modified: chemistry/portcmis/trunk/PortCMIS/binding/BindingIntf.cs
URL: http://svn.apache.org/viewvc/chemistry/portcmis/trunk/PortCMIS/binding/BindingIntf.cs?rev=1799023&r1=1799022&r2=1799023&view=diff
==============================================================================
--- chemistry/portcmis/trunk/PortCMIS/binding/BindingIntf.cs (original)
+++ chemistry/portcmis/trunk/PortCMIS/binding/BindingIntf.cs Sat Jun 17 21:43:33 2017
@@ -633,7 +633,7 @@ namespace PortCMIS.Binding
             // don't accept null
             if (sessionParameters == null)
             {
-                throw new ArgumentNullException("sessionParameters");
+                throw new ArgumentNullException(nameof(sessionParameters));
             }
 
             // check binding entry
@@ -653,7 +653,7 @@ namespace PortCMIS.Binding
             }
         }
 
-        private void Check(IDictionary<string, string> sessionParameters, String parameter)
+        private void Check(IDictionary<string, string> sessionParameters, string parameter)
         {
             if (!sessionParameters.ContainsKey(parameter))
             {

Modified: chemistry/portcmis/trunk/PortCMIS/binding/BindingsConstants.cs
URL: http://svn.apache.org/viewvc/chemistry/portcmis/trunk/PortCMIS/binding/BindingsConstants.cs?rev=1799023&r1=1799022&r2=1799023&view=diff
==============================================================================
--- chemistry/portcmis/trunk/PortCMIS/binding/BindingsConstants.cs (original)
+++ chemistry/portcmis/trunk/PortCMIS/binding/BindingsConstants.cs Sat Jun 17 21:43:33 2017
@@ -17,15 +17,10 @@
 * under the License.
 */
 
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
 
 namespace PortCMIS.Binding
 {
-    internal class BindingConstants
+    internal static class BindingConstants
     {
         // media types
         public const string MediaTypeService = "application/atomsvc+xml";

Modified: chemistry/portcmis/trunk/PortCMIS/binding/DateTimeHelper.cs
URL: http://svn.apache.org/viewvc/chemistry/portcmis/trunk/PortCMIS/binding/DateTimeHelper.cs?rev=1799023&r1=1799022&r2=1799023&view=diff
==============================================================================
--- chemistry/portcmis/trunk/PortCMIS/binding/DateTimeHelper.cs (original)
+++ chemistry/portcmis/trunk/PortCMIS/binding/DateTimeHelper.cs Sat Jun 17 21:43:33 2017
@@ -18,16 +18,11 @@
 */
 
 using System;
-using System.Collections.Generic;
 using System.Globalization;
-using System.Linq;
-using System.Numerics;
-using System.Text;
-using System.Threading.Tasks;
 
 namespace PortCMIS.Binding
 {
-    internal class DateTimeHelper
+    internal static class DateTimeHelper
     {
         private static readonly DateTime Jan1st1970 = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
 
@@ -41,8 +36,9 @@ namespace PortCMIS.Binding
             return (datetime.Ticks - Jan1st1970.Ticks) / TimeSpan.TicksPerMillisecond;
         }
 
-        public static DateTime ParseISO8601(string s) {
-           return DateTime.Parse(s, null, DateTimeStyles.RoundtripKind);
+        public static DateTime ParseISO8601(string s)
+        {
+            return DateTime.Parse(s, null, DateTimeStyles.RoundtripKind);
         }
 
         public static string FormatISO8601(DateTime dt)

Modified: chemistry/portcmis/trunk/PortCMIS/binding/Http.cs
URL: http://svn.apache.org/viewvc/chemistry/portcmis/trunk/PortCMIS/binding/Http.cs?rev=1799023&r1=1799022&r2=1799023&view=diff
==============================================================================
--- chemistry/portcmis/trunk/PortCMIS/binding/Http.cs (original)
+++ chemistry/portcmis/trunk/PortCMIS/binding/Http.cs Sat Jun 17 21:43:33 2017
@@ -17,17 +17,9 @@
 * under the License.
 */
 
-using PortCMIS.Client;
-using PortCMIS.Exceptions;
-using PortCMIS.Utils;
-using System;
 using System.Collections.Generic;
 using System.IO;
-using System.Linq;
-using System.Net;
 using System.Net.Http;
-using System.Net.Http.Headers;
-using System.Threading.Tasks;
 
 namespace PortCMIS.Binding.Http
 {

Modified: chemistry/portcmis/trunk/PortCMIS/binding/HttpPortable.cs
URL: http://svn.apache.org/viewvc/chemistry/portcmis/trunk/PortCMIS/binding/HttpPortable.cs?rev=1799023&r1=1799022&r2=1799023&view=diff
==============================================================================
--- chemistry/portcmis/trunk/PortCMIS/binding/HttpPortable.cs (original)
+++ chemistry/portcmis/trunk/PortCMIS/binding/HttpPortable.cs Sat Jun 17 21:43:33 2017
@@ -281,10 +281,10 @@ namespace PortCMIS.Binding.Http
                 if (httpResponse.StatusCode != HttpStatusCode.NoContent)
                 {
                     if (ContentType != null &&
-                        (ContentType.ToLowerInvariant().StartsWith("text/") ||
-                        ContentType.ToLowerInvariant().EndsWith("+xml") ||
-                        ContentType.ToLowerInvariant().StartsWith("application/xml") ||
-                        ContentType.ToLowerInvariant().StartsWith("application/json")))
+                        (ContentType.ToLowerInvariant().StartsWith("text/", StringComparison.Ordinal) ||
+                        ContentType.ToLowerInvariant().EndsWith("+xml", StringComparison.Ordinal) ||
+                        ContentType.ToLowerInvariant().StartsWith("application/xml", StringComparison.Ordinal) ||
+                        ContentType.ToLowerInvariant().StartsWith("application/json", StringComparison.Ordinal)))
                     {
                         ErrorContent = GetContentString().Result;
                     }
@@ -295,7 +295,7 @@ namespace PortCMIS.Binding.Http
                     response.Dispose();
                     response = null;
                 }
-                catch (Exception) { }
+                catch { }
             }
         }
 
@@ -314,7 +314,7 @@ namespace PortCMIS.Binding.Http
                     response.Dispose();
                     response = null;
                 }
-                catch (Exception) { }
+                catch { }
             }
         }
 

Modified: chemistry/portcmis/trunk/PortCMIS/binding/Url.cs
URL: http://svn.apache.org/viewvc/chemistry/portcmis/trunk/PortCMIS/binding/Url.cs?rev=1799023&r1=1799022&r2=1799023&view=diff
==============================================================================
--- chemistry/portcmis/trunk/PortCMIS/binding/Url.cs (original)
+++ chemistry/portcmis/trunk/PortCMIS/binding/Url.cs Sat Jun 17 21:43:33 2017
@@ -48,7 +48,7 @@ namespace PortCMIS.Binding
         {
             if (url == null)
             {
-                throw new ArgumentNullException("url");
+                throw new ArgumentNullException(nameof(url));
             }
 
             uri = new UriBuilder(url);
@@ -186,7 +186,7 @@ namespace PortCMIS.Binding
 
         private const string MIMESpecials = "()<>@,;:\\\"/[]?=" + "\t ";
         private const string RFC2231Specials = "*'%" + MIMESpecials;
-        private static char[] HexDigits = new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
+        private static readonly char[] HexDigits = new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
 
         public static string EncodeContentDisposition(string disposition, string filename)
         {
@@ -218,7 +218,7 @@ namespace PortCMIS.Binding
             byte[] bytes;
             try
             {
-                bytes = UTF8Encoding.UTF8.GetBytes(value);
+                bytes = Encoding.UTF8.GetBytes(value);
             }
             catch (Exception)
             {

Modified: chemistry/portcmis/trunk/PortCMIS/binding/atompub/AtomPubBinding.cs
URL: http://svn.apache.org/viewvc/chemistry/portcmis/trunk/PortCMIS/binding/atompub/AtomPubBinding.cs?rev=1799023&r1=1799022&r2=1799023&view=diff
==============================================================================
--- chemistry/portcmis/trunk/PortCMIS/binding/atompub/AtomPubBinding.cs (original)
+++ chemistry/portcmis/trunk/PortCMIS/binding/atompub/AtomPubBinding.cs Sat Jun 17 21:43:33 2017
@@ -17,12 +17,10 @@
 * under the License.
 */
 
-using PortCMIS.Binding;
 using PortCMIS.Binding.Http;
 using PortCMIS.Binding.Impl;
 using PortCMIS.Binding.Services;
 using PortCMIS.Client;
-using PortCMIS.Client.Impl;
 using PortCMIS.Data;
 using PortCMIS.Data.Extensions;
 using PortCMIS.Enums;
@@ -2462,7 +2460,7 @@ namespace PortCMIS.Binding.AtomPub
             IExtensionsData extension)
         {
             // we need an object id
-            if (objectId == null || objectId.Length == 0)
+            if (string.IsNullOrEmpty(objectId))
             {
                 throw new CmisInvalidArgumentException("Object ID must be set!");
             }
@@ -2615,12 +2613,12 @@ namespace PortCMIS.Binding.AtomPub
         public void MoveObject(string repositoryId, ref string objectId, string targetFolderId, string sourceFolderId,
             IExtensionsData extension)
         {
-            if (objectId == null || objectId.Length == 0)
+            if (string.IsNullOrEmpty(objectId))
             {
                 throw new CmisInvalidArgumentException("Object ID must be set!");
             }
 
-            if (targetFolderId == null || targetFolderId.Length == 0 || sourceFolderId == null || sourceFolderId.Length == 0)
+            if (string.IsNullOrEmpty(targetFolderId) || string.IsNullOrEmpty(sourceFolderId))
             {
                 throw new CmisInvalidArgumentException("Source and target folder must be set!");
             }
@@ -2907,7 +2905,7 @@ namespace PortCMIS.Binding.AtomPub
 
         public void CheckOut(string repositoryId, ref string objectId, IExtensionsData extension, out bool? contentCopied)
         {
-            if (objectId == null || objectId.Length == 0)
+            if (string.IsNullOrEmpty(objectId))
             {
                 throw new CmisInvalidArgumentException("Object ID must be set!");
             }
@@ -2991,7 +2989,7 @@ namespace PortCMIS.Binding.AtomPub
             IExtensionsData extension)
         {
             // we need an object id
-            if (objectId == null || objectId.Length == 0)
+            if (string.IsNullOrEmpty(objectId))
             {
                 throw new CmisInvalidArgumentException("Object ID must be set!");
             }

Modified: chemistry/portcmis/trunk/PortCMIS/binding/atompub/AtomPubUtils.cs
URL: http://svn.apache.org/viewvc/chemistry/portcmis/trunk/PortCMIS/binding/atompub/AtomPubUtils.cs?rev=1799023&r1=1799022&r2=1799023&view=diff
==============================================================================
--- chemistry/portcmis/trunk/PortCMIS/binding/atompub/AtomPubUtils.cs (original)
+++ chemistry/portcmis/trunk/PortCMIS/binding/atompub/AtomPubUtils.cs Sat Jun 17 21:43:33 2017
@@ -17,7 +17,6 @@
 * under the License.
 */
 
-using PortCMIS.Binding;
 using PortCMIS.Binding.Impl;
 using PortCMIS.Client;
 using PortCMIS.Data;
@@ -31,7 +30,6 @@ using System.Net;
 using System.Net.Http;
 using System.Net.Http.Headers;
 using System.Numerics;
-using System.Runtime.InteropServices;
 using System.Text;
 using System.Threading.Tasks;
 using System.Xml;
@@ -50,7 +48,7 @@ namespace PortCMIS.Binding.AtomPub
         {
             if (stream == null)
             {
-                throw new ArgumentNullException("stream");
+                throw new ArgumentNullException(nameof(stream));
             }
 
             this.stream = stream;
@@ -512,9 +510,10 @@ namespace PortCMIS.Binding.AtomPub
         {
             string uri = parser.NamespaceURI;
             string local = parser.LocalName;
-            Dictionary<string, string> result = new Dictionary<string, string>();
-
-            result["href"] = parser.GetAttribute("href");
+            Dictionary<string, string> result = new Dictionary<string, string>()
+            {
+                ["href"] = parser.GetAttribute("href")
+            };
 
             XmlUtils.Next(parser);
 
@@ -657,8 +656,10 @@ namespace PortCMIS.Binding.AtomPub
             string uri = parser.NamespaceURI;
             string local = parser.LocalName;
 
-            AtomLink result = new AtomLink();
-            result.Rel = LinkRelContent;
+            AtomLink result = new AtomLink()
+            {
+                Rel = LinkRelContent
+            };
 
             // save attributes
             if (parser.HasAttributes)
@@ -719,7 +720,7 @@ namespace PortCMIS.Binding.AtomPub
 
     internal abstract class AtomBase
     {
-        private IList<AtomElement> elements = new List<AtomElement>();
+        private readonly IList<AtomElement> elements = new List<AtomElement>();
 
         public abstract string Type { get; }
 
@@ -747,7 +748,7 @@ namespace PortCMIS.Binding.AtomPub
 
     internal class ServiceDoc : AtomBase
     {
-        private IList<RepositoryWorkspace> workspaces = new List<RepositoryWorkspace>();
+        private readonly IList<RepositoryWorkspace> workspaces = new List<RepositoryWorkspace>();
 
         public override string Type { get { return "Service Document"; } }
         public IList<RepositoryWorkspace> Workspaces { get { return workspaces; } }
@@ -824,29 +825,31 @@ namespace PortCMIS.Binding.AtomPub
 
     internal class LinkCache
     {
-        private static readonly HashSet<string> KnownLinks = new HashSet<string>();
+        private static readonly HashSet<string> KnownLinks = new HashSet<string>()
+        {
+            BindingConstants.RelAcl,
+            BindingConstants.RelDown,
+            BindingConstants.RelUp,
+            BindingConstants.RelFolderTree,
+            BindingConstants.RelRelationships,
+            BindingConstants.RelSelf,
+            BindingConstants.RelAllowableActions,
+            BindingConstants.RelEditMedia,
+            BindingConstants.RelPolicies,
+            BindingConstants.RelVersionHistory,
+            BindingConstants.RelWorkingCopy,
+            AtomPubParser.LinkRelContent
+        };
 
         static LinkCache()
         {
-            KnownLinks.Add(BindingConstants.RelAcl);
-            KnownLinks.Add(BindingConstants.RelDown);
-            KnownLinks.Add(BindingConstants.RelUp);
-            KnownLinks.Add(BindingConstants.RelFolderTree);
-            KnownLinks.Add(BindingConstants.RelRelationships);
-            KnownLinks.Add(BindingConstants.RelSelf);
-            KnownLinks.Add(BindingConstants.RelAllowableActions);
-            KnownLinks.Add(BindingConstants.RelEditMedia);
-            KnownLinks.Add(BindingConstants.RelPolicies);
-            KnownLinks.Add(BindingConstants.RelVersionHistory);
-            KnownLinks.Add(BindingConstants.RelWorkingCopy);
-            KnownLinks.Add(AtomPubParser.LinkRelContent);
-        }
-
-        private IBindingCache linkCache;
-        private IBindingCache typeLinkCache;
-        private IBindingCache collectionLinkCache;
-        private IBindingCache templateCache;
-        private IBindingCache repositoryLinkCache;
+        }
+
+        private readonly IBindingCache linkCache;
+        private readonly IBindingCache typeLinkCache;
+        private readonly IBindingCache collectionLinkCache;
+        private readonly IBindingCache templateCache;
+        private readonly IBindingCache repositoryLinkCache;
 
         /// <summary>
         /// Constructor.
@@ -1175,7 +1178,7 @@ namespace PortCMIS.Binding.AtomPub
         private CmisVersion cmisVersion;
         private IObjectData objectData;
         private IContentStream contentStream;
-        private Stream stream;
+        private readonly Stream stream;
         private ITypeDefinition typeDef;
         private BulkUpdate bulkUpdate;
 

Modified: chemistry/portcmis/trunk/PortCMIS/binding/atompub/XmlConstants.cs
URL: http://svn.apache.org/viewvc/chemistry/portcmis/trunk/PortCMIS/binding/atompub/XmlConstants.cs?rev=1799023&r1=1799022&r2=1799023&view=diff
==============================================================================
--- chemistry/portcmis/trunk/PortCMIS/binding/atompub/XmlConstants.cs (original)
+++ chemistry/portcmis/trunk/PortCMIS/binding/atompub/XmlConstants.cs Sat Jun 17 21:43:33 2017
@@ -17,15 +17,10 @@
 * under the License.
 */
 
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
 
 namespace PortCMIS.Binding.AtomPub
 {
-    class XmlConstants
+    internal static class XmlConstants
     {
         // namespaces
         public const string NamespaceCmis = "http://docs.oasis-open.org/ns/cmis/core/200908/";

Modified: chemistry/portcmis/trunk/PortCMIS/binding/atompub/XmlConverter.cs
URL: http://svn.apache.org/viewvc/chemistry/portcmis/trunk/PortCMIS/binding/atompub/XmlConverter.cs?rev=1799023&r1=1799022&r2=1799023&view=diff
==============================================================================
--- chemistry/portcmis/trunk/PortCMIS/binding/atompub/XmlConverter.cs (original)
+++ chemistry/portcmis/trunk/PortCMIS/binding/atompub/XmlConverter.cs Sat Jun 17 21:43:33 2017
@@ -17,8 +17,6 @@
 * under the License.
 */
 
-using PortCMIS.Binding.AtomPub;
-using PortCMIS.Client.Impl;
 using PortCMIS.Data;
 using PortCMIS.Data.Extensions;
 using PortCMIS.Enums;
@@ -28,8 +26,6 @@ using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Numerics;
-using System.Text;
-using System.Threading.Tasks;
 using System.Xml;
 
 namespace PortCMIS.Binding.AtomPub
@@ -358,19 +354,19 @@ namespace PortCMIS.Binding.AtomPub
                 }
             }
 
-            if (source is DocumentTypeDefinition)
+            if (source is IDocumentTypeDefinition)
             {
-                DocumentTypeDefinition docDef = (DocumentTypeDefinition)source;
+                IDocumentTypeDefinition docDef = (IDocumentTypeDefinition)source;
                 XmlUtils.Write(writer, XmlConstants.PrefixCmis, XmlConstants.NamespaceCmis, XmlConstants.TAG_TYPE_VERSIONABLE, docDef.IsVersionable);
                 XmlUtils.Write(writer, XmlConstants.PrefixCmis, XmlConstants.NamespaceCmis, XmlConstants.TAG_TYPE_CONTENTSTREAM_ALLOWED, docDef.ContentStreamAllowed);
             }
 
-            if (source is RelationshipTypeDefinition)
+            if (source is IRelationshipTypeDefinition)
             {
-                RelationshipTypeDefinition relDef = (RelationshipTypeDefinition)source;
+                IRelationshipTypeDefinition relDef = (IRelationshipTypeDefinition)source;
                 if (relDef.AllowedSourceTypeIds != null)
                 {
-                    foreach (String id in relDef.AllowedSourceTypeIds)
+                    foreach (string id in relDef.AllowedSourceTypeIds)
                     {
                         if (id != null)
                         {
@@ -380,7 +376,7 @@ namespace PortCMIS.Binding.AtomPub
                 }
                 if (relDef.AllowedTargetTypeIds != null)
                 {
-                    foreach (String id in relDef.AllowedTargetTypeIds)
+                    foreach (string id in relDef.AllowedTargetTypeIds)
                     {
                         if (id != null)
                         {
@@ -544,7 +540,7 @@ namespace PortCMIS.Binding.AtomPub
                     }
                 }
             }
-            else if (source is PropertyDateTimeDefinition)
+            else if (source is IPropertyDateTimeDefinition)
             {
                 IPropertyDateTimeDefinition def = (IPropertyDateTimeDefinition)source;
 
@@ -1080,7 +1076,7 @@ namespace PortCMIS.Binding.AtomPub
         // --- bulk update ---
         // -------------------
 
-        public static void WriteBulkUpdate(XmlWriter writer, String ns, BulkUpdate bulkUpdate)
+        public static void WriteBulkUpdate(XmlWriter writer, string ns, BulkUpdate bulkUpdate)
         {
             if (bulkUpdate == null || bulkUpdate.ObjectIdAndChangeToken == null)
             {
@@ -1852,29 +1848,29 @@ namespace PortCMIS.Binding.AtomPub
                 string typeAttr = parser.GetAttribute("type", XmlConstants.NamespaceXsi);
                 if (typeAttr != null)
                 {
-                    if (typeAttr.EndsWith(XmlConstants.ATTR_DOCUMENT_TYPE))
+                    if (typeAttr.EndsWith(XmlConstants.ATTR_DOCUMENT_TYPE, StringComparison.Ordinal))
                     {
                         result = new DocumentTypeDefinition();
                     }
-                    else if (typeAttr.EndsWith(XmlConstants.ATTR_FOLDER_TYPE))
+                    else if (typeAttr.EndsWith(XmlConstants.ATTR_FOLDER_TYPE, StringComparison.Ordinal))
                     {
                         result = new FolderTypeDefinition();
                     }
-                    else if (typeAttr.EndsWith(XmlConstants.ATTR_RELATIONSHIP_TYPE))
+                    else if (typeAttr.EndsWith(XmlConstants.ATTR_RELATIONSHIP_TYPE, StringComparison.Ordinal))
                     {
                         result = new RelationshipTypeDefinition();
                         ((RelationshipTypeDefinition)result).AllowedSourceTypeIds = new List<string>();
                         ((RelationshipTypeDefinition)result).AllowedTargetTypeIds = new List<string>();
                     }
-                    else if (typeAttr.EndsWith(XmlConstants.ATTR_POLICY_TYPE))
+                    else if (typeAttr.EndsWith(XmlConstants.ATTR_POLICY_TYPE, StringComparison.Ordinal))
                     {
                         result = new PolicyTypeDefinition();
                     }
-                    else if (typeAttr.EndsWith(XmlConstants.ATTR_ITEM_TYPE))
+                    else if (typeAttr.EndsWith(XmlConstants.ATTR_ITEM_TYPE, StringComparison.Ordinal))
                     {
                         result = new ItemTypeDefinition();
                     }
-                    else if (typeAttr.EndsWith(XmlConstants.ATTR_SECONDARY_TYPE))
+                    else if (typeAttr.EndsWith(XmlConstants.ATTR_SECONDARY_TYPE, StringComparison.Ordinal))
                     {
                         result = new SecondaryTypeDefinition();
                     }
@@ -2425,7 +2421,7 @@ namespace PortCMIS.Binding.AtomPub
         private static readonly ChoiceStringParser CHOICE_STRING_PARSER = new ChoiceStringParser();
         private class ChoiceStringParser : ChoiceXmlWalker<string>
         {
-            protected override Choice<string> createTarget(XmlReader parser, string localname, string ns)
+            protected override Choice<string> CreateTarget(XmlReader parser, string localname, string ns)
             {
                 return new Choice<string>();
             }
@@ -2468,7 +2464,7 @@ namespace PortCMIS.Binding.AtomPub
         private static readonly ChoiceBooleanParser CHOICE_BOOLEAN_PARSER = new ChoiceBooleanParser();
         private class ChoiceBooleanParser : ChoiceXmlWalker<bool?>
         {
-            protected override Choice<bool?> createTarget(XmlReader parser, string localname, string ns)
+            protected override Choice<bool?> CreateTarget(XmlReader parser, string localname, string ns)
             {
                 return new Choice<bool?>();
             }
@@ -2492,7 +2488,7 @@ namespace PortCMIS.Binding.AtomPub
         private static readonly ChoiceIntegerParser CHOICE_INTEGER_PARSER = new ChoiceIntegerParser();
         private class ChoiceIntegerParser : ChoiceXmlWalker<BigInteger?>
         {
-            protected override Choice<BigInteger?> createTarget(XmlReader parser, string localname, string ns)
+            protected override Choice<BigInteger?> CreateTarget(XmlReader parser, string localname, string ns)
             {
                 return new Choice<BigInteger?>();
             }
@@ -2516,7 +2512,7 @@ namespace PortCMIS.Binding.AtomPub
         private static readonly ChoiceDateTimeParser CHOICE_DATETIME_PARSER = new ChoiceDateTimeParser();
         private class ChoiceDateTimeParser : ChoiceXmlWalker<DateTime?>
         {
-            protected override Choice<DateTime?> createTarget(XmlReader parser, string localname, string ns)
+            protected override Choice<DateTime?> CreateTarget(XmlReader parser, string localname, string ns)
             {
                 return new Choice<DateTime?>();
             }
@@ -2540,7 +2536,7 @@ namespace PortCMIS.Binding.AtomPub
         private static readonly ChoiceDecimalParser CHOICE_DECIMAL_PARSER = new ChoiceDecimalParser();
         private class ChoiceDecimalParser : ChoiceXmlWalker<decimal?>
         {
-            protected override Choice<decimal?> createTarget(XmlReader parser, string localname, string ns)
+            protected override Choice<decimal?> CreateTarget(XmlReader parser, string localname, string ns)
             {
                 return new Choice<decimal?>();
             }
@@ -2563,11 +2559,11 @@ namespace PortCMIS.Binding.AtomPub
 
         private abstract class ChoiceXmlWalker<T> : XmlWalker<Choice<T>>
         {
-            protected abstract Choice<T> createTarget(XmlReader parser, string localname, string ns);
+            protected abstract Choice<T> CreateTarget(XmlReader parser, string localname, string ns);
 
             protected override Choice<T> PrepareTarget(XmlReader parser, string localname, string ns)
             {
-                Choice<T> result = createTarget(parser, localname, ns);
+                Choice<T> result = CreateTarget(parser, localname, ns);
 
                 if (parser.HasAttributes)
                 {

Modified: chemistry/portcmis/trunk/PortCMIS/binding/atompub/XmlUtils.cs
URL: http://svn.apache.org/viewvc/chemistry/portcmis/trunk/PortCMIS/binding/atompub/XmlUtils.cs?rev=1799023&r1=1799022&r2=1799023&view=diff
==============================================================================
--- chemistry/portcmis/trunk/PortCMIS/binding/atompub/XmlUtils.cs (original)
+++ chemistry/portcmis/trunk/PortCMIS/binding/atompub/XmlUtils.cs Sat Jun 17 21:43:33 2017
@@ -31,7 +31,7 @@ using PortCMIS.Exceptions;
 
 namespace PortCMIS.Binding.AtomPub
 {
-    internal class XmlUtils
+    internal static class XmlUtils
     {
 
         // --------------
@@ -43,8 +43,11 @@ namespace PortCMIS.Binding.AtomPub
         /// </summary>
         public static XmlWriter CreateWriter(Stream stream)
         {
-            XmlWriterSettings settings = new XmlWriterSettings();
-            settings.Encoding = Encoding.UTF8;
+            XmlWriterSettings settings = new XmlWriterSettings()
+            {
+                Encoding = Encoding.UTF8
+            };
+
             return XmlWriter.Create(stream, settings);
         }
 
@@ -184,9 +187,12 @@ namespace PortCMIS.Binding.AtomPub
         /// </summary>
         public static XmlReader CreateParser(Stream stream)
         {
-            XmlReaderSettings settings = new XmlReaderSettings();
-            settings.MaxCharactersInDocument = 0;
-            settings.CloseInput = true;
+            XmlReaderSettings settings = new XmlReaderSettings()
+            {
+                MaxCharactersInDocument = 0,
+                CloseInput = true
+            };
+
             return XmlReader.Create(stream, settings);
         }
 

Modified: chemistry/portcmis/trunk/PortCMIS/binding/atompub/XmlWalker.cs
URL: http://svn.apache.org/viewvc/chemistry/portcmis/trunk/PortCMIS/binding/atompub/XmlWalker.cs?rev=1799023&r1=1799022&r2=1799023&view=diff
==============================================================================
--- chemistry/portcmis/trunk/PortCMIS/binding/atompub/XmlWalker.cs (original)
+++ chemistry/portcmis/trunk/PortCMIS/binding/atompub/XmlWalker.cs Sat Jun 17 21:43:33 2017
@@ -17,18 +17,15 @@
 * under the License.
 */
 
-using PortCMIS.Binding.AtomPub;
 using PortCMIS.Data.Extensions;
+using PortCMIS.Enums;
 using PortCMIS.Exceptions;
 using System;
 using System.Collections.Generic;
-using System.Linq;
+using System.Globalization;
 using System.Numerics;
 using System.Text;
-using System.Threading.Tasks;
 using System.Xml;
-using PortCMIS.Enums;
-using System.Globalization;
 
 namespace PortCMIS.Binding.AtomPub
 {
@@ -272,13 +269,14 @@ namespace PortCMIS.Binding.AtomPub
         {
             string value = ReadText(parser);
 
-            DateTime result = DateTimeHelper.ParseISO8601(value);
-            if (result == null)
+            try
             {
-                throw new CmisInvalidArgumentException("Invalid datetime value!");
+                return DateTimeHelper.ParseISO8601(value);
+            }
+            catch (Exception e)
+            {
+                throw new CmisInvalidArgumentException("Invalid datetime value!", e);
             }
-
-            return result;
         }
 
         protected E ReadEnum<E>(XmlReader parser)
@@ -292,7 +290,7 @@ namespace PortCMIS.Binding.AtomPub
 
     }
 
-    internal class XmlConstraints
+    internal static class XmlConstraints
     {
         public const int MaxStringLength = 100 * 1024;
 

Modified: chemistry/portcmis/trunk/PortCMIS/binding/browser/BrowserBinding.cs
URL: http://svn.apache.org/viewvc/chemistry/portcmis/trunk/PortCMIS/binding/browser/BrowserBinding.cs?rev=1799023&r1=1799022&r2=1799023&view=diff
==============================================================================
--- chemistry/portcmis/trunk/PortCMIS/binding/browser/BrowserBinding.cs (original)
+++ chemistry/portcmis/trunk/PortCMIS/binding/browser/BrowserBinding.cs Sat Jun 17 21:43:33 2017
@@ -17,7 +17,6 @@
 * under the License.
 */
 
-using PortCMIS.Binding;
 using PortCMIS.Binding.Browser.Json;
 using PortCMIS.Binding.Http;
 using PortCMIS.Binding.Impl;
@@ -31,13 +30,10 @@ using System;
 using System.Collections.Generic;
 using System.Globalization;
 using System.IO;
-using System.Linq;
-using System.Net;
 using System.Net.Http;
 using System.Net.Http.Headers;
 using System.Numerics;
 using System.Text;
-using System.Threading.Tasks;
 
 namespace PortCMIS.Binding.Browser
 {
@@ -459,7 +455,7 @@ namespace PortCMIS.Binding.Browser
             int idx = 0;
             foreach (string typeId in secondaryTypeIds)
             {
-                if (typeId == null || typeId.Length == 0)
+                if (string.IsNullOrEmpty(typeId))
                 {
                     continue;
                 }
@@ -1654,7 +1650,7 @@ namespace PortCMIS.Binding.Browser
             IExtensionsData extension)
         {
             // we need an object ID
-            if (objectId == null || objectId.Length == 0)
+            if (string.IsNullOrEmpty(objectId))
             {
                 throw new CmisInvalidArgumentException("Object ID must be set!");
             }
@@ -1718,7 +1714,7 @@ namespace PortCMIS.Binding.Browser
             IExtensionsData extension)
         {
             // we need an object id
-            if (objectId == null || objectId.Length == 0)
+            if (string.IsNullOrEmpty(objectId))
             {
                 throw new CmisInvalidArgumentException("Object ID must be set!");
             }
@@ -1793,7 +1789,7 @@ namespace PortCMIS.Binding.Browser
             IContentStream contentStream, IExtensionsData extension)
         {
             // we need an object id
-            if (objectId == null || objectId.Length == 0)
+            if (string.IsNullOrEmpty(objectId))
             {
                 throw new CmisInvalidArgumentException("Object ID must be set!");
             }
@@ -1828,7 +1824,7 @@ namespace PortCMIS.Binding.Browser
             IContentStream contentStream, IExtensionsData extension)
         {
             // we need an object id
-            if (objectId == null || objectId.Length == 0)
+            if (string.IsNullOrEmpty(objectId))
             {
                 throw new CmisInvalidArgumentException("Object ID must be set!");
             }
@@ -1861,7 +1857,7 @@ namespace PortCMIS.Binding.Browser
         public void DeleteContentStream(string repositoryId, ref string objectId, ref string changeToken, IExtensionsData extension)
         {
             // we need an object id
-            if (objectId == null || objectId.Length == 0)
+            if (string.IsNullOrEmpty(objectId))
             {
                 throw new CmisInvalidArgumentException("Object ID must be set!");
             }
@@ -1900,7 +1896,7 @@ namespace PortCMIS.Binding.Browser
         public void CheckOut(string repositoryId, ref string objectId, IExtensionsData extension, out bool? contentCopied)
         {
             // we need an object id
-            if (objectId == null || objectId.Length == 0)
+            if (string.IsNullOrEmpty(objectId))
             {
                 throw new CmisInvalidArgumentException("Object ID must be set!");
             }
@@ -1943,7 +1939,7 @@ namespace PortCMIS.Binding.Browser
             IExtensionsData extension)
         {
             // we need an object id
-            if (objectId == null || objectId.Length == 0)
+            if (string.IsNullOrEmpty(objectId))
             {
                 throw new CmisInvalidArgumentException("Object ID must be set!");
             }

Modified: chemistry/portcmis/trunk/PortCMIS/binding/browser/BrowserConstants.cs
URL: http://svn.apache.org/viewvc/chemistry/portcmis/trunk/PortCMIS/binding/browser/BrowserConstants.cs?rev=1799023&r1=1799022&r2=1799023&view=diff
==============================================================================
--- chemistry/portcmis/trunk/PortCMIS/binding/browser/BrowserConstants.cs (original)
+++ chemistry/portcmis/trunk/PortCMIS/binding/browser/BrowserConstants.cs Sat Jun 17 21:43:33 2017
@@ -17,12 +17,9 @@
 * under the License.
 */
 
+using PortCMIS.Enums;
 using System;
 using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using PortCMIS.Enums;
 
 namespace PortCMIS.Binding.Browser
 {

Modified: chemistry/portcmis/trunk/PortCMIS/binding/browser/BrowserConverter.cs
URL: http://svn.apache.org/viewvc/chemistry/portcmis/trunk/PortCMIS/binding/browser/BrowserConverter.cs?rev=1799023&r1=1799022&r2=1799023&view=diff
==============================================================================
--- chemistry/portcmis/trunk/PortCMIS/binding/browser/BrowserConverter.cs (original)
+++ chemistry/portcmis/trunk/PortCMIS/binding/browser/BrowserConverter.cs Sat Jun 17 21:43:33 2017
@@ -17,19 +17,15 @@
 * under the License.
 */
 
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
 using PortCMIS.Binding.Browser.Json;
+using PortCMIS.Const;
 using PortCMIS.Data;
+using PortCMIS.Data.Extensions;
 using PortCMIS.Enums;
 using PortCMIS.Exceptions;
-using PortCMIS.Data.Extensions;
-using System.Collections;
+using System;
+using System.Collections.Generic;
 using System.Numerics;
-using PortCMIS.Const;
 
 namespace PortCMIS.Binding.Browser
 {
@@ -3443,7 +3439,14 @@ namespace PortCMIS.Binding.Browser
                 }
                 else if (value is string)
                 {
-                    return DateTimeHelper.ParseISO8601((string)value);
+                    try
+                    {
+                        return DateTimeHelper.ParseISO8601((string)value);
+                    }
+                    catch
+                    {
+                        return null;
+                    }
                 }
             }
 

Modified: chemistry/portcmis/trunk/PortCMIS/binding/browser/BrowserUtils.cs
URL: http://svn.apache.org/viewvc/chemistry/portcmis/trunk/PortCMIS/binding/browser/BrowserUtils.cs?rev=1799023&r1=1799022&r2=1799023&view=diff
==============================================================================
--- chemistry/portcmis/trunk/PortCMIS/binding/browser/BrowserUtils.cs (original)
+++ chemistry/portcmis/trunk/PortCMIS/binding/browser/BrowserUtils.cs Sat Jun 17 21:43:33 2017
@@ -20,9 +20,6 @@
 using PortCMIS.Data;
 using System;
 using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
 
 namespace PortCMIS.Binding.Browser
 {

Modified: chemistry/portcmis/trunk/PortCMIS/binding/browser/json/Json.cs
URL: http://svn.apache.org/viewvc/chemistry/portcmis/trunk/PortCMIS/binding/browser/json/Json.cs?rev=1799023&r1=1799022&r2=1799023&view=diff
==============================================================================
--- chemistry/portcmis/trunk/PortCMIS/binding/browser/json/Json.cs (original)
+++ chemistry/portcmis/trunk/PortCMIS/binding/browser/json/Json.cs Sat Jun 17 21:43:33 2017
@@ -27,10 +27,8 @@ using System.Collections;
 using System.Collections.Generic;
 using System.Globalization;
 using System.IO;
-using System.Linq;
 using System.Numerics;
 using System.Text;
-using System.Threading.Tasks;
 
 
 namespace PortCMIS.Binding.Browser.Json
@@ -202,7 +200,7 @@ namespace PortCMIS.Binding.Browser.Json
             {
                 if (key == null)
                 {
-                    throw new ArgumentNullException("key");
+                    throw new ArgumentNullException(nameof(key));
                 }
 
                 return dict[key].Value;
@@ -212,7 +210,7 @@ namespace PortCMIS.Binding.Browser.Json
             {
                 if (key == null)
                 {
-                    throw new ArgumentNullException("key");
+                    throw new ArgumentNullException(nameof(key));
                 }
 
                 KeyValuePair<string, object> kv = new KeyValuePair<string, object>(key, value);
@@ -270,12 +268,12 @@ namespace PortCMIS.Binding.Browser.Json
         {
             if (key == null)
             {
-                throw new ArgumentNullException("key");
+                throw new ArgumentNullException(nameof(key));
             }
 
             if (dict.ContainsKey(key))
             {
-                throw new ArgumentException("Key already exists!", key);
+                throw new ArgumentException("Key already exists!", nameof(key));
             }
 
             this[key] = value;
@@ -285,7 +283,7 @@ namespace PortCMIS.Binding.Browser.Json
         {
             if (key == null)
             {
-                throw new ArgumentNullException("key");
+                throw new ArgumentNullException(nameof(key));
             }
 
             if (dict.Remove(key))

Modified: chemistry/portcmis/trunk/PortCMIS/client/ClientCaches.cs
URL: http://svn.apache.org/viewvc/chemistry/portcmis/trunk/PortCMIS/client/ClientCaches.cs?rev=1799023&r1=1799022&r2=1799023&view=diff
==============================================================================
--- chemistry/portcmis/trunk/PortCMIS/client/ClientCaches.cs (original)
+++ chemistry/portcmis/trunk/PortCMIS/client/ClientCaches.cs Sat Jun 17 21:43:33 2017
@@ -193,7 +193,7 @@ namespace PortCMIS.Client
                         }
                     }
                 }
-                catch (Exception) { }
+                catch { }
 
                 // cache time-to-live
                 cacheTtl = 2 * 60 * 60 * 1000;
@@ -209,7 +209,7 @@ namespace PortCMIS.Client
                         }
                     }
                 }
-                catch (Exception) { }
+                catch { }
 
                 // path-to-id size
                 pathToIdSize = 1000;

Modified: chemistry/portcmis/trunk/PortCMIS/client/ClientImpl.cs
URL: http://svn.apache.org/viewvc/chemistry/portcmis/trunk/PortCMIS/client/ClientImpl.cs?rev=1799023&r1=1799022&r2=1799023&view=diff
==============================================================================
--- chemistry/portcmis/trunk/PortCMIS/client/ClientImpl.cs (original)
+++ chemistry/portcmis/trunk/PortCMIS/client/ClientImpl.cs Sat Jun 17 21:43:33 2017
@@ -111,7 +111,7 @@ namespace PortCMIS.Client.Impl
         {
             if (parameters == null)
             {
-                throw new ArgumentNullException("parameters");
+                throw new ArgumentNullException(nameof(parameters));
             }
 
             if (!parameters.ContainsKey(SessionParameter.BindingType))
@@ -283,7 +283,7 @@ namespace PortCMIS.Client.Impl
             {
                 lock (sessionLock)
                 {
-                    context = (value == null ? FallbackContext : value);
+                    context = value ?? FallbackContext;
                 }
             }
         }
@@ -299,14 +299,14 @@ namespace PortCMIS.Client.Impl
         {
             if (parameters == null)
             {
-                throw new ArgumentNullException("parameters");
+                throw new ArgumentNullException(nameof(parameters));
             }
 
             this.parameters = parameters;
 
-            ObjectFactory = (objectFactory == null ? CreateObjectFactory() : objectFactory);
+            ObjectFactory = objectFactory ?? CreateObjectFactory();
             AuthenticationProvider = authenticationProvider;
-            Cache = (cache == null ? CreateCache() : cache);
+            Cache = cache ?? CreateCache();
 
             string cachePathOmitStr;
             if (parameters.TryGetValue(SessionParameter.CachePathOmit, out cachePathOmitStr))
@@ -457,7 +457,7 @@ namespace PortCMIS.Client.Impl
         {
             IRepositoryService service = Binding.GetRepositoryService();
 
-            PageFetcher<IObjectType>.FetchPage fetchPageDelegate = delegate(BigInteger maxNumItems, BigInteger skipCount)
+            PageFetcher<IObjectType>.FetchPage fetchPageDelegate = delegate (BigInteger maxNumItems, BigInteger skipCount)
             {
                 // fetch the data
                 ITypeDefinitionList tdl = service.GetTypeChildren(RepositoryId, typeId, includePropertyDefinitions, maxNumItems, skipCount, null);
@@ -499,9 +499,11 @@ namespace PortCMIS.Client.Impl
 
             foreach (ITypeDefinitionContainer container in descendantsList)
             {
-                Tree<IObjectType> tree = new Tree<IObjectType>();
-                tree.Item = ObjectFactory.ConvertTypeDefinition(container.TypeDefinition);
-                tree.Children = ConvertTypeDescendants(container.Children);
+                Tree<IObjectType> tree = new Tree<IObjectType>()
+                {
+                    Item = ObjectFactory.ConvertTypeDefinition(container.TypeDefinition),
+                    Children = ConvertTypeDescendants(container.Children)
+                };
 
                 result.Add(tree);
             }
@@ -568,7 +570,7 @@ namespace PortCMIS.Client.Impl
             INavigationService service = Binding.GetNavigationService();
             IOperationContext ctxt = new OperationContext(context);
 
-            PageFetcher<IDocument>.FetchPage fetchPageDelegate = delegate(BigInteger maxNumItems, BigInteger skipCount)
+            PageFetcher<IDocument>.FetchPage fetchPageDelegate = delegate (BigInteger maxNumItems, BigInteger skipCount)
             {
                 // get all checked out documents
                 IObjectList checkedOutDocs = service.GetCheckedOutDocs(RepositoryId, null, ctxt.FilterString, ctxt.OrderBy,
@@ -608,7 +610,7 @@ namespace PortCMIS.Client.Impl
         {
             if (objectId == null || objectId.Id == null)
             {
-                throw new ArgumentException("Object Id must be set!", "objectId");
+                throw new ArgumentException("Object Id must be set!", nameof(objectId));
             }
 
             return GetObject(objectId.Id, context);
@@ -625,11 +627,11 @@ namespace PortCMIS.Client.Impl
         {
             if (objectId == null)
             {
-                throw new ArgumentException("Object Id must be set!", "objectId");
+                throw new ArgumentException("Object Id must be set!", nameof(objectId));
             }
             if (context == null)
             {
-                throw new ArgumentException("Operation context must be set!", "context");
+                throw new ArgumentException("Operation context must be set!", nameof(context));
             }
 
             ICmisObject result = null;
@@ -673,7 +675,7 @@ namespace PortCMIS.Client.Impl
 
             if (context == null)
             {
-                throw new ArgumentNullException("context");
+                throw new ArgumentNullException(nameof(context));
             }
 
             ICmisObject result = null;
@@ -713,22 +715,22 @@ namespace PortCMIS.Client.Impl
         /// <inheritdoc/>
         public ICmisObject GetObjectByPath(string parentPath, string name, IOperationContext context)
         {
-            if (parentPath == null || parentPath.Length < 1)
+            if (string.IsNullOrEmpty(parentPath))
             {
-                throw new ArgumentException("Parent path must be set!", "parentPath");
+                throw new ArgumentException("Parent path must be set!", nameof(parentPath));
             }
             if (parentPath[0] != '/')
             {
-                throw new ArgumentException("Parent path must start with a '/'!", "parentPath");
+                throw new ArgumentException("Parent path must start with a '/'!", nameof(parentPath));
             }
-            if (name == null || name.Length < 1)
+            if (string.IsNullOrEmpty(name))
             {
-                throw new ArgumentException("Name must be set!", "name");
+                throw new ArgumentException("Name must be set!", nameof(name));
             }
 
             StringBuilder path = new StringBuilder();
             path.Append(parentPath);
-            if (!parentPath.EndsWith("/"))
+            if (!parentPath.EndsWith("/", StringComparison.Ordinal))
             {
                 path.Append('/');
             }
@@ -748,7 +750,7 @@ namespace PortCMIS.Client.Impl
         {
             if (objectId == null)
             {
-                throw new ArgumentNullException("objectId");
+                throw new ArgumentNullException(nameof(objectId));
             }
 
             return GetLatestDocumentVersion(CreateObjectId(objectId), false, context);
@@ -771,12 +773,12 @@ namespace PortCMIS.Client.Impl
         {
             if (objectId == null || objectId.Id == null)
             {
-                throw new ArgumentNullException("objectId");
+                throw new ArgumentNullException(nameof(objectId));
             }
 
             if (context == null)
             {
-                throw new ArgumentNullException("context");
+                throw new ArgumentNullException(nameof(context));
             }
 
             ICmisObject result = null;
@@ -864,7 +866,7 @@ namespace PortCMIS.Client.Impl
         {
             if (objectId == null)
             {
-                throw new ArgumentNullException("objectId");
+                throw new ArgumentNullException(nameof(objectId));
             }
             return Exists(objectId.Id);
         }
@@ -874,7 +876,7 @@ namespace PortCMIS.Client.Impl
         {
             if (objectId == null)
             {
-                throw new ArgumentNullException(objectId);
+                throw new ArgumentNullException(nameof(objectId));
             }
 
             try
@@ -918,22 +920,22 @@ namespace PortCMIS.Client.Impl
         /// <inheritdoc/>
         public bool ExistsPath(string parentPath, string name)
         {
-            if (parentPath == null || parentPath.Length < 1)
+            if (string.IsNullOrEmpty(parentPath))
             {
-                throw new ArgumentException("Parent path must be set!", "parentPath");
+                throw new ArgumentException("Parent path must be set!", nameof(parentPath));
             }
             if (parentPath[0] != '/')
             {
-                throw new ArgumentException("Parent path must start with a '/'!", "parentPath");
+                throw new ArgumentException("Parent path must start with a '/'!", nameof(parentPath));
             }
-            if (name == null || name.Length < 1)
+            if (string.IsNullOrEmpty(name))
             {
-                throw new ArgumentException("Name must be set!", "name");
+                throw new ArgumentException("Name must be set!", nameof(name));
             }
 
             StringBuilder path = new StringBuilder(parentPath.Length + name.Length + 2);
             path.Append(parentPath);
-            if (!parentPath.EndsWith("/"))
+            if (!parentPath.EndsWith("/", StringComparison.Ordinal))
             {
                 path.Append('/');
             }
@@ -973,7 +975,7 @@ namespace PortCMIS.Client.Impl
             IDiscoveryService service = Binding.GetDiscoveryService();
             IOperationContext ctxt = new OperationContext(context);
 
-            PageFetcher<IQueryResult>.FetchPage fetchPageDelegate = delegate(BigInteger maxNumItems, BigInteger skipCount)
+            PageFetcher<IQueryResult>.FetchPage fetchPageDelegate = delegate (BigInteger maxNumItems, BigInteger skipCount)
             {
                 // fetch the data
                 IObjectList resultList = service.Query(RepositoryId, statement, searchAllVersions, ctxt.IncludeAllowableActions,
@@ -1005,12 +1007,12 @@ namespace PortCMIS.Client.Impl
         {
             if (typeId == null || typeId.Trim().Length == 0)
             {
-                throw new ArgumentException("Type ID must be set!", "typeId");
+                throw new ArgumentException("Type ID must be set!", nameof(typeId));
             }
 
             if (context == null)
             {
-                throw new ArgumentException("Operation context must be set!", "context");
+                throw new ArgumentException("Operation context must be set!", nameof(context));
             }
 
             IDiscoveryService discoveryService = Binding.GetDiscoveryService();
@@ -1045,7 +1047,7 @@ namespace PortCMIS.Client.Impl
                 statement.Append(orderBy);
             }
 
-            PageFetcher<ICmisObject>.FetchPage fetchPageDelegate = delegate(BigInteger maxNumItems, BigInteger skipCount)
+            PageFetcher<ICmisObject>.FetchPage fetchPageDelegate = delegate (BigInteger maxNumItems, BigInteger skipCount)
             {
                 // fetch the data
                 IObjectList resultList = discoveryService.Query(RepositoryId, statement.ToString(),
@@ -1266,7 +1268,7 @@ namespace PortCMIS.Client.Impl
             IRelationshipService service = Binding.GetRelationshipService();
             IOperationContext ctxt = new OperationContext(context);
 
-            PageFetcher<IRelationship>.FetchPage fetchPageDelegate = delegate(BigInteger maxNumItems, BigInteger skipCount)
+            PageFetcher<IRelationship>.FetchPage fetchPageDelegate = delegate (BigInteger maxNumItems, BigInteger skipCount)
             {
                 // fetch the relationships
                 IObjectList relList = service.GetObjectRelationships(RepositoryId, id, includeSubRelationshipTypes, relationshipDirection,
@@ -1314,7 +1316,7 @@ namespace PortCMIS.Client.Impl
                     if (!(secondaryType is ISecondaryType))
                     {
                         throw new ArgumentException("Secondary types contains a type that is not a secondary type: "
-                                + secondaryType.Id, "addSecondaryTypeIds");
+                                + secondaryType.Id, nameof(addSecondaryTypeIds));
                     }
 
                     secondaryTypes[secondaryType.Id] = (ISecondaryType)secondaryType;
@@ -1367,7 +1369,7 @@ namespace PortCMIS.Client.Impl
         {
             if (objectId == null || objectId.Id == null)
             {
-                throw new ArgumentException("Invalid object ID!", "objectId");
+                throw new ArgumentException("Invalid object ID!", nameof(objectId));
             }
 
             Binding.GetObjectService().DeleteObject(RepositoryId, objectId.Id, allVersions, null);
@@ -1379,7 +1381,7 @@ namespace PortCMIS.Client.Impl
         {
             if (folderId == null || folderId.Id == null)
             {
-                throw new ArgumentException("Invalid object ID!", "folderId");
+                throw new ArgumentException("Invalid object ID!", nameof(folderId));
             }
 
             IFailedToDeleteData failed = Binding.GetObjectService().DeleteTree(RepositoryId, folderId.Id, allVersions, unfile, continueOnFailure, null);
@@ -1405,7 +1407,7 @@ namespace PortCMIS.Client.Impl
         {
             if (docId == null || docId.Id == null)
             {
-                throw new ArgumentException("Invalid document ID!", "objectId");
+                throw new ArgumentException("Invalid document ID!", nameof(docId));
             }
 
             // get the content stream
@@ -1430,7 +1432,7 @@ namespace PortCMIS.Client.Impl
         {
             if (objectId == null || objectId.Id == null)
             {
-                throw new ArgumentException("Invalid object ID!", "objectId");
+                throw new ArgumentException("Invalid object ID!", nameof(objectId));
             }
 
             return Binding.GetAclService().GetAcl(RepositoryId, objectId.Id, onlyBasicPermissions, null);
@@ -1441,7 +1443,7 @@ namespace PortCMIS.Client.Impl
         {
             if (objectId == null || objectId.Id == null)
             {
-                throw new ArgumentException("Invalid object ID!", "objectId");
+                throw new ArgumentException("Invalid object ID!", nameof(objectId));
             }
 
             return Binding.GetAclService().ApplyAcl(RepositoryId, objectId.Id, ObjectFactory.ConvertAces(addAces),
@@ -1453,9 +1455,9 @@ namespace PortCMIS.Client.Impl
         {
             if (objectId == null || objectId.Id == null)
             {
-                throw new ArgumentException("Invalid object ID!", "objectId");
+                throw new ArgumentException("Invalid object ID!", nameof(objectId));
             }
-            if (policyIds == null || (policyIds.Length == 0))
+            if (policyIds == null || policyIds.Length == 0)
             {
                 throw new ArgumentException("No Policies provided!");
             }
@@ -1465,7 +1467,7 @@ namespace PortCMIS.Client.Impl
             {
                 if (policyIds[i] == null || policyIds[i].Id == null)
                 {
-                    throw new ArgumentException("A Policy ID is not set!", "policyIds");
+                    throw new ArgumentException("A Policy ID is not set!", nameof(policyIds));
                 }
 
                 ids[i] = policyIds[i].Id;
@@ -1482,11 +1484,11 @@ namespace PortCMIS.Client.Impl
         {
             if (objectId == null || objectId.Id == null)
             {
-                throw new ArgumentException("Invalid object ID!", "objectId");
+                throw new ArgumentException("Invalid object ID!", nameof(objectId));
             }
             if (policyIds == null || policyIds.Length == 0)
             {
-                throw new ArgumentException("No Policies provided!", "policyIds");
+                throw new ArgumentException("No Policies provided!", nameof(policyIds));
             }
 
             string[] ids = new string[policyIds.Length];
@@ -1511,7 +1513,7 @@ namespace PortCMIS.Client.Impl
         /// </summary>
         protected void CheckPath(string path)
         {
-            if (path == null || path.Length < 1)
+            if (string.IsNullOrEmpty(path))
             {
                 throw new ArgumentException("Invalid path!");
             }
@@ -1554,12 +1556,12 @@ namespace PortCMIS.Client.Impl
         {
             if (session == null)
             {
-                throw new ArgumentNullException("session");
+                throw new ArgumentNullException(nameof(session));
             }
 
             if (statement == null)
             {
-                throw new ArgumentNullException("statement");
+                throw new ArgumentNullException(nameof(statement));
             }
 
             this.session = session;
@@ -1577,7 +1579,7 @@ namespace PortCMIS.Client.Impl
         {
             if (type == null)
             {
-                throw new ArgumentException("Type must be set!");
+                throw new ArgumentNullException(nameof(type));
             }
 
             if (type.QueryName == null)
@@ -1703,7 +1705,7 @@ namespace PortCMIS.Client.Impl
         }
 
         /// <inheritdoc/>
-        public void SetId(int parameterIndex, params  IObjectId[] id)
+        public void SetId(int parameterIndex, params IObjectId[] id)
         {
             if (id == null || id.Length == 0)
             {

Modified: chemistry/portcmis/trunk/PortCMIS/client/ClientIntf.cs
URL: http://svn.apache.org/viewvc/chemistry/portcmis/trunk/PortCMIS/client/ClientIntf.cs?rev=1799023&r1=1799022&r2=1799023&view=diff
==============================================================================
--- chemistry/portcmis/trunk/PortCMIS/client/ClientIntf.cs (original)
+++ chemistry/portcmis/trunk/PortCMIS/client/ClientIntf.cs Sat Jun 17 21:43:33 2017
@@ -2290,14 +2290,14 @@ namespace PortCMIS.Client
     /// <summary>
     /// Item properties.
     /// </summary>
-    public interface ItemProperties
+    public interface IItemProperties
     {
     }
 
     /// <summary>
     /// Item interface.
     /// </summary>
-    public interface IItem : IFileableCmisObject, ItemProperties
+    public interface IItem : IFileableCmisObject, IItemProperties
     {
         /// <summary>
         /// Returns the object type as an item type.

Modified: chemistry/portcmis/trunk/PortCMIS/client/ClientObjectFactory.cs
URL: http://svn.apache.org/viewvc/chemistry/portcmis/trunk/PortCMIS/client/ClientObjectFactory.cs?rev=1799023&r1=1799022&r2=1799023&view=diff
==============================================================================
--- chemistry/portcmis/trunk/PortCMIS/client/ClientObjectFactory.cs (original)
+++ chemistry/portcmis/trunk/PortCMIS/client/ClientObjectFactory.cs Sat Jun 17 21:43:33 2017
@@ -47,8 +47,10 @@ namespace PortCMIS.Client.Impl
         {
             if (aces == null) { return null; }
 
-            Acl result = new Acl();
-            result.Aces = new List<IAce>();
+            Acl result = new Acl()
+            {
+                Aces = new List<IAce>()
+            };
 
             foreach (IAce ace in aces)
             {
@@ -61,8 +63,10 @@ namespace PortCMIS.Client.Impl
         /// <inheritdoc/>
         public virtual IAcl CreateAcl(IList<IAce> aces)
         {
-            Acl acl = new Acl();
-            acl.Aces = aces;
+            Acl acl = new Acl()
+            {
+                Aces = aces
+            };
 
             return acl;
         }
@@ -106,7 +110,7 @@ namespace PortCMIS.Client.Impl
         {
             if (rendition == null)
             {
-                throw new ArgumentException("rendition");
+                throw new ArgumentNullException(nameof(rendition));
             }
 
             return new Rendition(this.session, objectId, rendition.StreamId, rendition.MimeType, rendition.Length, rendition.Kind,
@@ -118,11 +122,13 @@ namespace PortCMIS.Client.Impl
         /// <inheritdoc/>
         public virtual IContentStream CreateContentStream(string filename, long length, string mimetype, Stream stream)
         {
-            ContentStream result = new ContentStream();
-            result.FileName = filename;
-            result.Length = length;
-            result.MimeType = mimetype;
-            result.Stream = stream;
+            ContentStream result = new ContentStream()
+            {
+                FileName = filename,
+                Length = length,
+                MimeType = mimetype,
+                Stream = stream
+            };
 
             return result;
         }
@@ -219,7 +225,7 @@ namespace PortCMIS.Client.Impl
         {
             if (objectType == null)
             {
-                throw new ArgumentNullException("objectType");
+                throw new ArgumentNullException(nameof(objectType));
             }
 
             if (objectType.PropertyDefinitions == null)
@@ -418,7 +424,7 @@ namespace PortCMIS.Client.Impl
         {
             if (objectData == null)
             {
-                throw new ArgumentNullException("objectData");
+                throw new ArgumentNullException(nameof(objectData));
             }
 
             if (objectData.Id == null)
@@ -455,7 +461,7 @@ namespace PortCMIS.Client.Impl
         {
             if (objectData == null)
             {
-                throw new ArgumentException("Object data is null!");
+                throw new ArgumentNullException(nameof(objectData));
             }
 
             return new QueryResult(session, objectData);

Modified: chemistry/portcmis/trunk/PortCMIS/client/ClientObjects.cs
URL: http://svn.apache.org/viewvc/chemistry/portcmis/trunk/PortCMIS/client/ClientObjects.cs?rev=1799023&r1=1799022&r2=1799023&view=diff
==============================================================================
--- chemistry/portcmis/trunk/PortCMIS/client/ClientObjects.cs (original)
+++ chemistry/portcmis/trunk/PortCMIS/client/ClientObjects.cs Sat Jun 17 21:43:33 2017
@@ -123,12 +123,12 @@ namespace PortCMIS.Client.Impl
         {
             if (session == null)
             {
-                throw new ArgumentNullException("session");
+                throw new ArgumentNullException(nameof(session));
             }
 
             if (objectType == null)
             {
-                throw new ArgumentNullException("objectType");
+                throw new ArgumentNullException(nameof(objectType));
             }
 
             if (objectType.PropertyDefinitions == null || objectType.PropertyDefinitions.Count < 9)
@@ -139,7 +139,7 @@ namespace PortCMIS.Client.Impl
 
             if (objectData == null)
             {
-                throw new ArgumentNullException("objectData");
+                throw new ArgumentNullException(nameof(objectData));
             }
 
             if (objectData.Properties == null)
@@ -340,8 +340,10 @@ namespace PortCMIS.Client.Impl
                 string objectId = ObjectId;
                 string changeToken = ChangeToken;
 
-                HashSet<Updatability> updatebility = new HashSet<Updatability>();
-                updatebility.Add(Updatability.ReadWrite);
+                HashSet<Updatability> updatebility = new HashSet<Updatability>()
+                {
+                    Updatability.ReadWrite
+                };
 
                 // check if checked out
                 bool? isCheckedOut = GetPropertyValue(PropertyIds.IsVersionSeriesCheckedOut) as bool?;
@@ -373,9 +375,9 @@ namespace PortCMIS.Client.Impl
         /// <inheritdoc/>
         public virtual ICmisObject Rename(string newName)
         {
-            if (newName == null || newName.Length == 0)
+            if (string.IsNullOrEmpty(newName))
             {
-                throw new ArgumentException("New name must not be empty!", "newName");
+                throw new ArgumentException("New name must not be empty!", nameof(newName));
             }
 
             IDictionary<string, object> prop = new Dictionary<string, object>();
@@ -450,7 +452,7 @@ namespace PortCMIS.Client.Impl
             {
                 if (propertyId == null)
                 {
-                    throw new ArgumentNullException("propertyId");
+                    throw new ArgumentNullException(nameof(propertyId));
                 }
 
                 lock (objectLock)
@@ -774,12 +776,12 @@ namespace PortCMIS.Client.Impl
 
             if (sourceFolderId == null || sourceFolderId.Id == null)
             {
-                throw new ArgumentException("Source folder ID must be set!", "sourceFolderId");
+                throw new ArgumentException("Source folder ID must be set!", nameof(sourceFolderId));
             }
 
             if (targetFolderId == null || targetFolderId.Id == null)
             {
-                throw new ArgumentException("Target folder ID must be set!", "targetFolderId");
+                throw new ArgumentException("Target folder ID must be set!", nameof(targetFolderId));
             }
 
             Binding.GetObjectService().MoveObject(RepositoryId, ref objectId, targetFolderId.Id, sourceFolderId.Id, null);
@@ -881,7 +883,7 @@ namespace PortCMIS.Client.Impl
                         // the repository sent a folder without a valid path...
                         throw new CmisInvalidServerData("Repository sent invalid data! No path property value!");
                     }
-                    paths.Add(folderPath + (folderPath.EndsWith("/") ? "" : "/") + p.RelativePathSegment);
+                    paths.Add(folderPath + (folderPath.EndsWith("/", StringComparison.Ordinal) ? "" : "/") + p.RelativePathSegment);
                 }
 
                 return paths;
@@ -934,7 +936,7 @@ namespace PortCMIS.Client.Impl
                 }
                 else
                 {
-                    throw new InvalidCastException("Object type is not a document type.");
+                    throw new CmisInvalidServerData("Object type is not a document type.");
                 }
             }
         }
@@ -1192,9 +1194,11 @@ namespace PortCMIS.Client.Impl
 
                 IObjectFactory of = Session.ObjectFactory;
 
-                HashSet<Updatability> updatebility = new HashSet<Updatability>();
-                updatebility.Add(Updatability.ReadWrite);
-                updatebility.Add(Updatability.WhenCheckedOut);
+                HashSet<Updatability> updatebility = new HashSet<Updatability>()
+                {
+                    Updatability.ReadWrite,
+                    Updatability.WhenCheckedOut
+                };
 
                 Binding.GetVersioningService().CheckIn(RepositoryId, ref objectId, major, of.ConvertProperties(properties, ObjectType, SecondaryTypes, updatebility),
                     contentStream, checkinComment, of.ConvertPolicies(policies), of.ConvertAces(addAces), of.ConvertAces(removeAces), null);
@@ -1292,12 +1296,14 @@ namespace PortCMIS.Client.Impl
             // -> get the file name from properties, if present
             if (contentStream.FileName == null && ContentStreamFileName != null)
             {
-                ContentStream newContentStream = new ContentStream();
-                newContentStream.FileName = ContentStreamFileName;
-                newContentStream.Length = contentStream.Length;
-                newContentStream.MimeType = contentStream.MimeType;
-                newContentStream.Stream = contentStream.Stream;
-                newContentStream.Extensions = contentStream.Extensions;
+                ContentStream newContentStream = new ContentStream()
+                {
+                    FileName = ContentStreamFileName,
+                    Length = contentStream.Length,
+                    MimeType = contentStream.MimeType,
+                    Stream = contentStream.Stream,
+                    Extensions = contentStream.Extensions
+                };
 
                 contentStream = newContentStream;
             }
@@ -1475,7 +1481,7 @@ namespace PortCMIS.Client.Impl
                 }
                 else
                 {
-                    throw new InvalidCastException("Object type is not a folder type.");
+                    throw new CmisInvalidServerData("Object type is not a folder type.");
                 }
             }
         }
@@ -1907,7 +1913,7 @@ namespace PortCMIS.Client.Impl
                 }
                 else
                 {
-                    throw new InvalidCastException("Object type is not a policy type.");
+                    throw new CmisInvalidServerData("Object type is not a policy type.");
                 }
             }
         }
@@ -1944,7 +1950,7 @@ namespace PortCMIS.Client.Impl
                 }
                 else
                 {
-                    throw new InvalidCastException("Object type is not a relationship type.");
+                    throw new CmisInvalidServerData("Object type is not a relationship type.");
                 }
             }
         }
@@ -1976,7 +1982,7 @@ namespace PortCMIS.Client.Impl
             get
             {
                 string sourceId = GetPropertyAsStringValue(PropertyIds.SourceId);
-                if (sourceId == null || sourceId.Length == 0)
+                if (string.IsNullOrEmpty(sourceId))
                 {
                     return null;
                 }
@@ -2012,7 +2018,7 @@ namespace PortCMIS.Client.Impl
             get
             {
                 string targetId = GetPropertyAsStringValue(PropertyIds.TargetId);
-                if (targetId == null || targetId.Length == 0)
+                if (string.IsNullOrEmpty(targetId))
                 {
                     return null;
                 }
@@ -2050,7 +2056,7 @@ namespace PortCMIS.Client.Impl
                 }
                 else
                 {
-                    throw new InvalidCastException("Object type is not an item type.");
+                    throw new CmisInvalidServerData("Object type is not an item type.");
                 }
             }
         }
@@ -2169,8 +2175,8 @@ namespace PortCMIS.Client.Impl
     /// </summary>
     public class Rendition : RenditionData, IRendition
     {
-        private ISession session;
-        private string objectId;
+        private readonly ISession session;
+        private readonly string objectId;
 
         /// <summary>
         /// Constructor.
@@ -2298,12 +2304,12 @@ namespace PortCMIS.Client.Impl
         {
             if (algorithm == null || algorithm.Trim().Length == 0)
             {
-                throw new ArgumentException("Algorithm must be set!", "algorithm");
+                throw new ArgumentException("Algorithm must be set!", nameof(algorithm));
             }
 
             if (hashStr == null || hashStr.Trim().Length == 0)
             {
-                throw new ArgumentException("Hash must be set!", "hashStr");
+                throw new ArgumentException("Hash must be set!", nameof(hashStr));
             }
 
             Algorithm = algorithm.ToLowerInvariant();

Modified: chemistry/portcmis/trunk/PortCMIS/client/ClientTypes.cs
URL: http://svn.apache.org/viewvc/chemistry/portcmis/trunk/PortCMIS/client/ClientTypes.cs?rev=1799023&r1=1799022&r2=1799023&view=diff
==============================================================================
--- chemistry/portcmis/trunk/PortCMIS/client/ClientTypes.cs (original)
+++ chemistry/portcmis/trunk/PortCMIS/client/ClientTypes.cs Sat Jun 17 21:43:33 2017
@@ -29,8 +29,8 @@ namespace PortCMIS.Client.Impl
     /// </summary>
     internal class ObjectTypeHelper
     {
-        private ISession session;
-        private IObjectType objectType;
+        private readonly ISession session;
+        private readonly IObjectType objectType;
         private IObjectType baseType;
         private IObjectType parentType;
 
@@ -86,7 +86,7 @@ namespace PortCMIS.Client.Impl
     /// </summary>
     public class DocumentType : DocumentTypeDefinition, IDocumentType
     {
-        private ObjectTypeHelper helper;
+        private readonly ObjectTypeHelper helper;
 
         /// <summary>
         /// Constructor.
@@ -122,7 +122,7 @@ namespace PortCMIS.Client.Impl
     /// </summary>
     public class FolderType : FolderTypeDefinition, IFolderType
     {
-        private ObjectTypeHelper helper;
+        private readonly ObjectTypeHelper helper;
 
         /// <summary>
         /// Constructor.
@@ -156,7 +156,7 @@ namespace PortCMIS.Client.Impl
     /// </summary>
     public class RelationshipType : RelationshipTypeDefinition, IRelationshipType
     {
-        private ObjectTypeHelper helper;
+        private readonly ObjectTypeHelper helper;
         private IList<IObjectType> allowedSourceTypes;
         private IList<IObjectType> allowedTargetTypes;
 
@@ -219,7 +219,7 @@ namespace PortCMIS.Client.Impl
                     IList<IObjectType> types = new List<IObjectType>(ids == null ? 0 : ids.Count);
                     if (ids != null)
                     {
-                        foreach (String id in ids)
+                        foreach (string id in ids)
                         {
                             types.Add(helper.Session.GetTypeDefinition(id));
                         }
@@ -236,7 +236,7 @@ namespace PortCMIS.Client.Impl
     /// </summary>
     public class PolicyType : PolicyTypeDefinition, IPolicyType
     {
-        private ObjectTypeHelper helper;
+        private readonly ObjectTypeHelper helper;
 
         /// <summary>
         /// Constructor.
@@ -270,7 +270,7 @@ namespace PortCMIS.Client.Impl
     /// </summary>
     public class ItemType : ItemTypeDefinition, IItemType
     {
-        private ObjectTypeHelper helper;
+        private readonly ObjectTypeHelper helper;
 
         /// <summary>
         /// Constructor.
@@ -304,7 +304,7 @@ namespace PortCMIS.Client.Impl
     /// </summary>
     public class SecondaryType : SecondaryTypeDefinition, ISecondaryType
     {
-        private ObjectTypeHelper helper;
+        private readonly ObjectTypeHelper helper;
 
         /// <summary>
         /// Constructor.



Mime
View raw message