Skip to content

Commit 7a00370

Browse files
Merge remote-tracking branch 'origin/master' into do_not_throw_general_exceptions_from_generated_data_types
2 parents 4cdb60e + dc41648 commit 7a00370

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+3534
-699
lines changed

.github/workflows/build-status.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ on:
33
push:
44
branches:
55
- master
6-
env:
7-
DOTNET_VERSION: '6.0.x'
6+
87
jobs:
98
build-and-test:
109
name: Build And Test ${{matrix.os}}
@@ -18,7 +17,7 @@ jobs:
1817
- name: Setup .NET Core
1918
uses: actions/setup-dotnet@v3
2019
with:
21-
dotnet-version: ${{ env.DOTNET_VERSION }}
20+
global-json-file: global.json
2221

2322
- name: Restore nHapi (Windows)
2423
if: matrix.os == 'windows-latest'

.github/workflows/codeql-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,4 @@ jobs:
8383
- name: Perform CodeQL Analysis
8484
uses: github/codeql-action/analyze@v2
8585
with:
86-
category: "/language:${{matrix.language}}"
86+
category: "/language:${{matrix.language}}"

.github/workflows/receive-pr.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
name: Receive Pull Request
22

33
on: [pull_request]
4-
env:
5-
DOTNET_VERSION: '6.0.x'
4+
65
jobs:
76
build-and-test:
87
name: Build And Test ${{matrix.os}}
@@ -16,7 +15,7 @@ jobs:
1615
- name: Setup .NET Core
1716
uses: actions/setup-dotnet@v3
1817
with:
19-
dotnet-version: ${{ env.DOTNET_VERSION }}
18+
global-json-file: global.json
2019

2120
- name: Restore nHapi (Windows)
2221
if: matrix.os == 'windows-latest'

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"sdk": {
3-
"version": "6.0.101",
3+
"version": "6.0.404",
44
"rollForward": "latestFeature"
55
},
66
"projects": []

src/NHapi.Base/Model/AbstractGroup.cs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,11 @@ namespace NHapi.Base.Model
4242
/// </author>
4343
public abstract class AbstractGroup : IGroup
4444
{
45-
private static readonly IHapiLog Log;
45+
private static readonly IHapiLog Log = HapiLogFactory.GetHapiLog(typeof(AbstractGroup));
4646

4747
private readonly IModelClassFactory myFactory;
4848
private List<AbstractGroupItem> items;
4949

50-
static AbstractGroup()
51-
{
52-
Log = HapiLogFactory.GetHapiLog(typeof(AbstractGroup));
53-
}
54-
5550
/// <summary> This constructor should be used by implementing classes that do not
5651
/// also implement Message.
5752
///
@@ -527,7 +522,7 @@ private IStructure TryToInstantiateStructure(Type c, string name)
527522
var argClasses = new[] { typeof(IGroup), typeof(IModelClassFactory) };
528523
var argObjects = new object[] { this, myFactory };
529524
var con = c.GetConstructor(argClasses);
530-
o = con.Invoke(argObjects);
525+
o = con!.Invoke(argObjects);
531526
}
532527
catch (MethodAccessException)
533528
{

src/NHapi.Base/Model/AbstractPrimitive.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ public AbstractPrimitive(IMessage message, string description)
5656
{
5757
}
5858

59-
/// <summary> Sets the value of this Primitive, first performing validation as specified
60-
/// by. <code>getMessage().getValidationContext()</code>. No validation is performed
61-
/// if getMessage() returns null.
62-
///
59+
/// <summary>
60+
/// Sets the value of this Primitive, first performing validation as specified
61+
/// by. <see cref="AbstractMessage.ValidationContext">Message.ValidationContext</see>
62+
/// No validation is performed if <see cref="AbstractType.Message"/> returns null.
6363
/// </summary>
6464
public virtual string Value
6565
{

src/NHapi.Base/Model/GenericComposite.cs

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
namespace NHapi.Base.Model
22
{
33
using System.Collections;
4+
using System.Collections.Generic;
45

56
/// <summary>
67
/// An unspecified Composite datatype that has an undefined number of components, each
@@ -11,7 +12,7 @@ namespace NHapi.Base.Model
1112
/// <author>Bryan Tripp.</author>
1213
public class GenericComposite : AbstractType, IComposite
1314
{
14-
private readonly ArrayList components;
15+
private readonly List<IType> components;
1516

1617
/// <summary>
1718
/// Creates a new instance of GenericComposite.
@@ -30,25 +31,13 @@ public GenericComposite(IMessage theMessage)
3031
public GenericComposite(IMessage theMessage, string description)
3132
: base(theMessage, description)
3233
{
33-
components = new ArrayList(20);
34+
components = new List<IType>(20);
3435
}
3536

3637
/// <summary>
3738
/// Returns an array containing the components of this field.
3839
/// </summary>
39-
public virtual IType[] Components
40-
{
41-
get
42-
{
43-
var ret = new IType[components.Count];
44-
for (var i = 0; i < ret.Length; i++)
45-
{
46-
ret[i] = (IType)components[i];
47-
}
48-
49-
return ret;
50-
}
51-
}
40+
public virtual IType[] Components => components.ToArray();
5241

5342
/// <summary>
5443
/// Returns the name of the type (used in XML encoding and profile checking).
@@ -68,7 +57,7 @@ public virtual IType this[int index]
6857
components.Add(new Varies(Message));
6958
}
7059

71-
return (IType)components[index];
60+
return components[index];
7261
}
7362
}
7463
}

src/NHapi.Base/Model/Primitive/CommonTM.cs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -151,15 +151,11 @@ public virtual string Value
151151
{
152152
// check to see if any of the following characters exist: "." or "+/-"
153153
// this will help us determine the acceptable lengths
154-
var d = value.IndexOf(".");
155-
var sp = value.IndexOf("+");
156-
var sm = value.IndexOf("-");
154+
var d = value.IndexOf(".", StringComparison.Ordinal);
155+
var sp = value.IndexOf("+", StringComparison.Ordinal);
156+
var sm = value.IndexOf("-", StringComparison.Ordinal);
157157
var indexOfSign = -1;
158-
var offsetExists = false;
159-
if ((sp != -1) || (sm != -1))
160-
{
161-
offsetExists = true;
162-
}
158+
var offsetExists = (sp != -1) || (sm != -1);
163159

164160
if (sp != -1)
165161
{
@@ -189,7 +185,7 @@ public virtual string Value
189185
{
190186
// The length of the GMT offset must be 5 characters (including the sign)
191187
var msg = "The length of the TM datatype value does not conform to an allowable" +
192-
" format. Format should conform to HH[MM[SS[.S[S[S[S]]]]]][+/-ZZZZ]";
188+
" format. Format should conform to HH[MM[SS[.S[S[S[S]]]]]][+/-ZZZZ]";
193189
var e = new DataTypeException(msg);
194190
throw e;
195191
}
@@ -201,7 +197,7 @@ public virtual string Value
201197
if ((timeVal.Length < 8) || (timeVal.Length > 11))
202198
{
203199
var msg = "The length of the TM datatype value does not conform to an allowable" +
204-
" format. Format should conform to HH[MM[SS[.S[S[S[S]]]]]][+/-ZZZZ]";
200+
" format. Format should conform to HH[MM[SS[.S[S[S[S]]]]]][+/-ZZZZ]";
205201
var e = new DataTypeException(msg);
206202
throw e;
207203
}
@@ -214,7 +210,7 @@ public virtual string Value
214210
if ((timeVal.Length != 2) && (timeVal.Length != 4) && (timeVal.Length != 6))
215211
{
216212
var msg = "The length of the TM datatype value does not conform to an allowable" +
217-
" format. Format should conform to HH[MM[SS[.S[S[S[S]]]]]][+/-ZZZZ]";
213+
" format. Format should conform to HH[MM[SS[.S[S[S[S]]]]]][+/-ZZZZ]";
218214
var e = new DataTypeException(msg);
219215
throw e;
220216
}

src/NHapi.Base/Model/Primitive/CommonTS.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,8 @@ public virtual string Value
206206
string dateVal = null;
207207
string timeVal = null;
208208
string timeValLessOffset = null;
209-
var sp = value.IndexOf("+");
210-
var sm = value.IndexOf("-");
209+
var sp = value.IndexOf("+", StringComparison.Ordinal);
210+
var sm = value.IndexOf("-", StringComparison.Ordinal);
211211
var indexOfSign = -1;
212212
var offsetExists = false;
213213
var timeValIsOffsetOnly = false;
@@ -310,7 +310,7 @@ public virtual string Value
310310
tm = new CommonTM();
311311

312312
// first extract the + sign from the offset value string if it exists
313-
if (timeVal.IndexOf("+") == 0)
313+
if (timeVal.IndexOf("+", StringComparison.Ordinal) == 0)
314314
{
315315
timeVal = timeVal.Substring(1);
316316
} // end if

src/NHapi.Base/NHapi.Base.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
<ItemGroup>
1616
<InternalsVisibleTo Include="$(AssemblyName).NUnit" />
17+
<InternalsVisibleTo Include="NHapi.NUnit" />
1718
<InternalsVisibleTo Include="NHapi.SourceGeneration" />
1819
</ItemGroup>
1920

@@ -43,4 +44,4 @@
4344
</PackageReference>
4445
</ItemGroup>
4546

46-
</Project>
47+
</Project>

0 commit comments

Comments
 (0)