From 219424b647c7d44bc61dcfc042755453b0a7aac1 Mon Sep 17 00:00:00 2001 From: dtnaughton <77862637+dtnaughton@users.noreply.github.com> Date: Thu, 30 Mar 2023 14:21:31 -0400 Subject: [PATCH 1/2] fix(gsa): prevent gsa memb2d from gwa parse exception --- ConnectorGSA/GSAProxy/GwaParsers/GsaMembParser.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ConnectorGSA/GSAProxy/GwaParsers/GsaMembParser.cs b/ConnectorGSA/GSAProxy/GwaParsers/GsaMembParser.cs index ebaad293b1..a86aba7ed0 100644 --- a/ConnectorGSA/GSAProxy/GwaParsers/GsaMembParser.cs +++ b/ConnectorGSA/GSAProxy/GwaParsers/GsaMembParser.cs @@ -267,7 +267,7 @@ protected bool AddName(string v) } private bool AddTopology(string v) { - var bracketPieces = v.Split(new[] { '(', ')' }).Select(s => s.Trim()).ToList(); + var bracketPieces = v.Split(new[] { '(', ')' }, StringSplitOptions.RemoveEmptyEntries).Select(s => s.Trim()).ToList(); if (bracketPieces.Count() > 1) { var listTypes = bracketPieces.Take(bracketPieces.Count() - 1).Select(bp => bp.Last()).ToList(); From 4a2adf8331ee5663bb60019a0fdeef32a71f545e Mon Sep 17 00:00:00 2001 From: dtnaughton <77862637+dtnaughton@users.noreply.github.com> Date: Thu, 30 Mar 2023 14:22:10 -0400 Subject: [PATCH 2/2] test(gsa): gsa memb2d from gwa with empty point node indices --- ConnectorGSA/ConnectorGSATests/SchemaTests.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ConnectorGSA/ConnectorGSATests/SchemaTests.cs b/ConnectorGSA/ConnectorGSATests/SchemaTests.cs index 004781e7c0..46826d3930 100644 --- a/ConnectorGSA/ConnectorGSATests/SchemaTests.cs +++ b/ConnectorGSA/ConnectorGSATests/SchemaTests.cs @@ -1238,6 +1238,16 @@ public void GsaMemb1dSimple() //Assert.True(ModelValidation(gwaToTest, GsaRecord.GetKeyword(), 3, out var mismatch)); } + [Fact] + public void GsaMemb2dFromGwa_WithEmptyPointNodeIndices_ReturnsTrue() + { + var gsaMemb2d = "MEMB.8\t5730\t\tNO_RGB\t2D_GENERIC\tALL\t3\t0\t21759 4928 4927 21762 21759 P()\t0\t0\t0\tYES\tLINEAR\t0\t0\t0\t0\t0\t0\tACTIVE\t0\tNO\tREBAR_2D.1\t0.03\t0.03\t0"; + + var memParser = new GsaMembParser(); + + Assert.True(memParser.FromGwa(gsaMemb2d)); + } + [Fact (Skip = "WIP")] public void GsaMemb2dSimple() {