Skip to content

Commit 67783a5

Browse files
committed
[BUG FIX] check that key is not already in attribute dictionary's
1 parent 392d840 commit 67783a5

File tree

6 files changed

+21
-23
lines changed

6 files changed

+21
-23
lines changed

rls/log4net.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<threshold value="ERROR" />
2323
</evaluator>
2424
<!-- List of comma separated emails for the recipients -->
25-
<to value="" />
25+
<to value="" />
2626
<!-- Email of the sender -->
2727
<from value="" />
2828
<!-- Email's subject -->

rls/packages/API.Library.7.0.1.nupkg

66.5 KB
Binary file not shown.

src/API.Library/API.Library.csproj

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,12 @@
1212
<PackageId>API.Library</PackageId>
1313
<Product>API Library</Product>
1414
<Copyright>Central Statistics Office, Ireland</Copyright>
15-
<Version>7.0.0</Version>
15+
<Version>7.0.1</Version>
1616
<Authors>Central Statistics Office, Ireland</Authors>
1717
<SignAssembly>False</SignAssembly>
1818
<RepositoryUrl>https://github.com/CSOIreland/Server-API-Library</RepositoryUrl>
1919
<PackageReleaseNotes>
20-
- [ENHANCEMENT] removed references to classes that are not required for the API. They are now moved to different projects
21-
- [BUG FIX] parse error function in restful had a default of " " instead of ""
22-
- [BUG FIX] changed accessibility level of MemcachedClient to be internal
23-
- [ENHANCEMENT] added logging of networkusername when AD connectivity issue
24-
- [ENHANCEMENT] use method handle and static dictionary to speed up reflection lookup
25-
- [BUG FIX] handle custom sql datatypes on non query procedure
26-
- [BUG FIX] Dispose of database connection if it can't be opened
27-
- [ENHANCEMENT] memcache CAS locking for casrepositoryflush implemented
28-
- [ENHANCEMENT] updated libraries -- sqlclient, enyim and log4net
29-
- [ENHANCEMENT] move interfaces to interfaces directory
30-
- [ENHANCEMENT] remove CustomPropertyAttributes.cs as now in CSOSanitiser
31-
- [BUG FIX] removed internal set bug -- public int API_ADO_BULKCOPY_TIMEOUT { get; internal set; }
32-
- [ENHANCEMENT] change activity declaration type in Middleware/API.Middleware.
33-
- [BUG FIX] parse error function in restful had a default of " " instead of ""
34-
- [BUG FIX] changed accessibility level of MemcachedClient to be internal
35-
- [ENHANCEMENT] added logging of networkusername when AD connectivity issue
20+
- [BUG FIX] check that key is not already in attribute dictionarys
3621
</PackageReleaseNotes>
3722
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
3823
<RestoreLockedMode>true</RestoreLockedMode>

src/API.Library/Config/ApiConfiguration.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ private void ReadAppSettings()
152152
else if (ApiServicesHelper.APIConfig.Settings_Type == "DB")
153153
{
154154
apiConfiguration = ReadDBAppSettings(new ADO());
155-
155+
156156
if (version == null)
157157
{
158158
//update memcache

src/API.Library/Entities/API.Common.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,7 @@ internal void GatherTraceInformation(dynamic apiRequest, Trace trace)
502502
/// </summary>
503503
internal static MethodInfo CheckAPICallsAllowed(string methodName, string methodPath, dynamic typeOfClassType)
504504
{
505+
505506
//create key for the dictionary
506507
dynamic jsonObj = new ExpandoObject();
507508
jsonObj.methodName = methodName;
@@ -543,7 +544,10 @@ internal static MethodInfo CheckAPICallsAllowed(string methodName, string method
543544
RuntimeMethodHandle handle = methodInfo.MethodHandle;
544545

545546
//add handle to dictionary for future lookup
546-
AttributeDictionary.AllowedAPIDictionary.Add(serializedAPIInfo, handle);
547+
if (!AttributeDictionary.AllowedAPIDictionary.TryAdd(serializedAPIInfo, handle))
548+
{
549+
Log.Instance.Debug("Adding : " + serializedAPIInfo + " to dictionary 'CheckAPICallsAllowed' failed");
550+
}
547551
return methodInfo;
548552
}
549553
}

src/API.Library/Entities/MethodReader.cs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,14 @@ public static CustomAttributeData MethodAttributeValue(string method, string att
8989

9090
//get the methods handle
9191
RuntimeMethodHandle handle = methodInfo.MethodHandle;
92-
92+
9393
//add handle to dictionary for future lookup
94-
AttributeDictionary.DictMethodAttributeValue.Add(serializedAPIInfo, handle);
94+
95+
if (!AttributeDictionary.DictMethodAttributeValue.TryAdd(serializedAPIInfo, handle))
96+
{
97+
Log.Instance.Debug("Adding : " + serializedAPIInfo + " to dictionary 'DictMethodAttributeValue' failed");
98+
}
99+
95100

96101
//Return true or false depending on whether the attribute was found
97102
return searchedAttribute;
@@ -186,7 +191,11 @@ public static bool MethodHasAttribute(string method, string attributeName, Type[
186191
RuntimeMethodHandle handle = methodInfo.MethodHandle;
187192

188193
//add handle to dictionary for future lookup
189-
AttributeDictionary.DictMethodHasAttribute.Add(serializedAPIInfo, handle);
194+
if (!AttributeDictionary.DictMethodHasAttribute.TryAdd(serializedAPIInfo, handle))
195+
{
196+
Log.Instance.Debug("Adding : " + serializedAPIInfo + " to dictionary 'DictMethodHasAttribute' failed");
197+
}
198+
190199

191200
//Return true or false depending on whether the attribute was found
192201
return searchedAttribute != null;

0 commit comments

Comments
 (0)