From f9dccb7a6538cb9c4dd16cbdd2e426ccc767fcdc Mon Sep 17 00:00:00 2001 From: Tara Drwenski Date: Mon, 3 Jul 2023 15:20:13 -0600 Subject: [PATCH] Simplify code with ternary if --- .../src/main/java/ucar/nc2/internal/ncml/NcmlReader.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/cdm/core/src/main/java/ucar/nc2/internal/ncml/NcmlReader.java b/cdm/core/src/main/java/ucar/nc2/internal/ncml/NcmlReader.java index 53fca741b7..bc41bdcaaa 100644 --- a/cdm/core/src/main/java/ucar/nc2/internal/ncml/NcmlReader.java +++ b/cdm/core/src/main/java/ucar/nc2/internal/ncml/NcmlReader.java @@ -806,10 +806,7 @@ private void readDim(Group.Builder groupBuilder, @Nullable Group refGroup, Eleme return; } - String nameInFile = dimElem.getAttributeValue("orgName"); - if (nameInFile == null) { - nameInFile = name; - } + String nameInFile = dimElem.getAttributeValue("orgName") != null ? dimElem.getAttributeValue("orgName") : name; // LOOK this is wrong, groupBuilder may already have the dimension. // see if it already exists