[uima-uimaj] 01/01: [UIMA-6390] NPE when trying to access config names of fresh context

2021-10-22 Thread rec
This is an automated email from the ASF dual-hosted git repository.

rec pushed a commit to branch 
bugfix/UIMA-6390-NPE-when-trying-to-access-config-names-of-fresh-context
in repository https://gitbox.apache.org/repos/asf/uima-uimaj.git

commit 112c5d24c5a041526fed32164e5d74a6b09524cb
Author: Richard Eckart de Castilho 
AuthorDate: Fri Oct 22 11:22:11 2021 +0200

[UIMA-6390] NPE when trying to access config names of fresh context

- Fix NPE in both versions of the getConfigParameterNames() method
- Added test
---
 .../org/apache/uima/impl/UimaContext_ImplBase.java | 41 +-
 .../apache/uima/resource/ConfigurationManager.java |  2 +-
 .../org/apache/uima/impl/UimaContext_implTest.java | 10 ++
 3 files changed, 35 insertions(+), 18 deletions(-)

diff --git 
a/uimaj-core/src/main/java/org/apache/uima/impl/UimaContext_ImplBase.java 
b/uimaj-core/src/main/java/org/apache/uima/impl/UimaContext_ImplBase.java
index dd3be78..e8fdee8 100644
--- a/uimaj-core/src/main/java/org/apache/uima/impl/UimaContext_ImplBase.java
+++ b/uimaj-core/src/main/java/org/apache/uima/impl/UimaContext_ImplBase.java
@@ -572,17 +572,19 @@ public abstract class UimaContext_ImplBase implements 
UimaContextAdmin {
*/
   @Override
   public String[] getConfigParameterNames() {
-ConfigurationParameter[] params = 
getConfigurationManager().getConfigParameterDeclarations(
-getQualifiedContextName()).getConfigurationParameters();
-if (params == null) {
+ConfigurationParameterDeclarations paramDecls = getConfigurationManager()
+.getConfigParameterDeclarations(getQualifiedContextName());
+
+if (paramDecls == null) {
   return Constants.EMPTY_STRING_ARRAY;
-} else {
-  String[] names = new String[params.length];
-  for (int i = 0; i < params.length; i++) {
-names[i] = params[i].getName();
   }
-  return names;
+
+ConfigurationParameter[] params = paramDecls.getConfigurationParameters();
+if (params == null || params.length == 0) {
+  return Constants.EMPTY_STRING_ARRAY;
 }
+
+return 
Arrays.stream(params).map(ConfigurationParameter::getName).toArray(String[]::new);
   }
 
   /*
@@ -592,29 +594,34 @@ public abstract class UimaContext_ImplBase implements 
UimaContextAdmin {
*/
   @Override
   public String[] getConfigParameterNames(String aGroup) {
-ConfigurationGroup[] groups = 
getConfigurationManager().getConfigParameterDeclarations(
-
getQualifiedContextName()).getConfigurationGroupDeclarations(aGroup);
+ConfigurationParameterDeclarations paramDecls = getConfigurationManager()
+.getConfigParameterDeclarations(getQualifiedContextName());
+
+if (paramDecls == null) {
+  return Constants.EMPTY_STRING_ARRAY;
+}
+
+ConfigurationGroup[] groups = 
paramDecls.getConfigurationGroupDeclarations(aGroup);
 if (groups.length == 0) {
   return Constants.EMPTY_STRING_ARRAY;
-} else {
+}
+
   List names = new ArrayList<>();
-  ConfigurationParameter[] commonParams = getConfigurationManager()
-  
.getConfigParameterDeclarations(getQualifiedContextName()).getCommonParameters();
+ConfigurationParameter[] commonParams = paramDecls.getCommonParameters();
   if (commonParams != null) {
 for (int i = 0; i < commonParams.length; i++) {
   names.add(commonParams[i].getName());
 }
   }
+
   for (int i = 0; i < groups.length; i++) {
 ConfigurationParameter[] groupParams = 
groups[i].getConfigurationParameters();
 for (int j = 0; j < groupParams.length; j++) {
   names.add(groupParams[j].getName());
 }
   }
-  String[] nameArray = new String[names.size()];
-  names.toArray(nameArray);
-  return nameArray;
-}
+
+return names.toArray(new String[names.size()]);
   }
 
   /**
diff --git 
a/uimaj-core/src/main/java/org/apache/uima/resource/ConfigurationManager.java 
b/uimaj-core/src/main/java/org/apache/uima/resource/ConfigurationManager.java
index d9a5fbf..83eebf7 100644
--- 
a/uimaj-core/src/main/java/org/apache/uima/resource/ConfigurationManager.java
+++ 
b/uimaj-core/src/main/java/org/apache/uima/resource/ConfigurationManager.java
@@ -144,7 +144,7 @@ public interface ConfigurationManager {
* @param aContextName
*  the name for which to get the parameter declarations
* 
-   * @return parameter declarations for the context
+   * @return parameter declarations for the context or {@code null} if there 
are no declarations.
*/
   public ConfigurationParameterDeclarations 
getConfigParameterDeclarations(String aContextName);
 
diff --git 
a/uimaj-core/src/test/java/org/apache/uima/impl/UimaContext_implTest.java 
b/uimaj-core/src/test/java/org/apache/uima/impl/UimaContext_implTest.java
index 8824d40..a384983 100644
--- a/uimaj-core/src/test/java/org/apache/uima/impl/UimaContext_implTest.java
+++ 

[uima-uimaj] branch maintenance/3.2.x updated (adec365 -> b4de8d1)

2021-10-22 Thread rec
This is an automated email from the ASF dual-hosted git repository.

rec pushed a change to branch maintenance/3.2.x
in repository https://gitbox.apache.org/repos/asf/uima-uimaj.git.


from adec365  Merge pull request #150 from 
apache/bugfix/UIMA-6389-Logger_common_impl-swallows-exception
 add 112c5d2  [UIMA-6390] NPE when trying to access config names of fresh 
context
 add c1b1682  [UIMA-6390] NPE when trying to access config names of fresh 
context
 add 4aa843b  [UIMA-6390] NPE when trying to access config names of fresh 
context
 new b4de8d1  Merge pull request #152 from 
apache/bugfix/UIMA-6390-NPE-when-trying-to-access-config-names-of-fresh-context

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../org/apache/uima/impl/UimaContext_ImplBase.java | 86 --
 .../apache/uima/resource/ConfigurationManager.java |  2 +-
 .../org/apache/uima/impl/UimaContext_implTest.java | 19 -
 3 files changed, 67 insertions(+), 40 deletions(-)


[uima-uimaj] 01/01: Merge pull request #152 from apache/bugfix/UIMA-6390-NPE-when-trying-to-access-config-names-of-fresh-context

2021-10-22 Thread rec
This is an automated email from the ASF dual-hosted git repository.

rec pushed a commit to branch maintenance/3.2.x
in repository https://gitbox.apache.org/repos/asf/uima-uimaj.git

commit b4de8d1a580212960398aa9f49ded15cbf195770
Merge: adec365 4aa843b
Author: Richard Eckart de Castilho 
AuthorDate: Fri Oct 22 12:39:55 2021 +0200

Merge pull request #152 from 
apache/bugfix/UIMA-6390-NPE-when-trying-to-access-config-names-of-fresh-context

[UIMA-6390] NPE when trying to access config names of fresh context

 .../org/apache/uima/impl/UimaContext_ImplBase.java | 86 --
 .../apache/uima/resource/ConfigurationManager.java |  2 +-
 .../org/apache/uima/impl/UimaContext_implTest.java | 19 -
 3 files changed, 67 insertions(+), 40 deletions(-)


[uima-uimaj] branch bugfix/UIMA-6390-NPE-when-trying-to-access-config-names-of-fresh-context updated (c1b1682 -> 4aa843b)

2021-10-22 Thread rec
This is an automated email from the ASF dual-hosted git repository.

rec pushed a change to branch 
bugfix/UIMA-6390-NPE-when-trying-to-access-config-names-of-fresh-context
in repository https://gitbox.apache.org/repos/asf/uima-uimaj.git.


from c1b1682  [UIMA-6390] NPE when trying to access config names of fresh 
context
 add 4aa843b  [UIMA-6390] NPE when trying to access config names of fresh 
context

No new revisions were added by this update.

Summary of changes:
 .../org/apache/uima/impl/UimaContext_ImplBase.java | 50 +++---
 .../org/apache/uima/impl/UimaContext_implTest.java |  9 +++-
 2 files changed, 34 insertions(+), 25 deletions(-)


[uima-uimaj] branch bugfix/UIMA-6390-NPE-when-trying-to-access-config-names-of-fresh-context-main created (now 11f2861)

2021-10-22 Thread rec
This is an automated email from the ASF dual-hosted git repository.

rec pushed a change to branch 
bugfix/UIMA-6390-NPE-when-trying-to-access-config-names-of-fresh-context-main
in repository https://gitbox.apache.org/repos/asf/uima-uimaj.git.


  at 11f2861  Merge branch 
'bugfix/UIMA-6390-NPE-when-trying-to-access-config-names-of-fresh-context' into 
bugfix/UIMA-6390-NPE-when-trying-to-access-config-names-of-fresh-context-main

This branch includes the following new commits:

 new d1ff8b3  [UIMA-6390] NPE when trying to access config names of fresh 
context
 new 11f2861  Merge branch 
'bugfix/UIMA-6390-NPE-when-trying-to-access-config-names-of-fresh-context' into 
bugfix/UIMA-6390-NPE-when-trying-to-access-config-names-of-fresh-context-main

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[uima-uimaj] 01/02: [UIMA-6390] NPE when trying to access config names of fresh context

2021-10-22 Thread rec
This is an automated email from the ASF dual-hosted git repository.

rec pushed a commit to branch 
bugfix/UIMA-6390-NPE-when-trying-to-access-config-names-of-fresh-context-main
in repository https://gitbox.apache.org/repos/asf/uima-uimaj.git

commit d1ff8b3fa9a0671c50c19a0f77068dd412579487
Author: Richard Eckart de Castilho 
AuthorDate: Fri Oct 22 11:07:52 2021 +0200

[UIMA-6390] NPE when trying to access config names of fresh context

- Add test
- Fix NPE when no parameter declarations have been made for a context
---
 .../org/apache/uima/impl/UimaContext_ImplBase.java | 36 +-
 .../apache/uima/resource/ConfigurationManager.java |  2 +-
 .../org/apache/uima/impl/UimaContext_implTest.java |  9 ++
 3 files changed, 32 insertions(+), 15 deletions(-)

diff --git 
a/uimaj-core/src/main/java/org/apache/uima/impl/UimaContext_ImplBase.java 
b/uimaj-core/src/main/java/org/apache/uima/impl/UimaContext_ImplBase.java
index 8c9d74c..af2fdfc 100644
--- a/uimaj-core/src/main/java/org/apache/uima/impl/UimaContext_ImplBase.java
+++ b/uimaj-core/src/main/java/org/apache/uima/impl/UimaContext_ImplBase.java
@@ -56,6 +56,7 @@ import 
org.apache.uima.resource.ResourceConfigurationException;
 import org.apache.uima.resource.ResourceInitializationException;
 import org.apache.uima.resource.metadata.ConfigurationGroup;
 import org.apache.uima.resource.metadata.ConfigurationParameter;
+import org.apache.uima.resource.metadata.ConfigurationParameterDeclarations;
 import org.apache.uima.util.Level;
 import org.apache.uima.util.Logger;
 import org.apache.uima.util.Settings;
@@ -579,17 +580,19 @@ public abstract class UimaContext_ImplBase implements 
UimaContextAdmin {
*/
   @Override
   public String[] getConfigParameterNames() {
-ConfigurationParameter[] params = getConfigurationManager()
-
.getConfigParameterDeclarations(getQualifiedContextName()).getConfigurationParameters();
-if (params == null) {
+ConfigurationParameterDeclarations paramDecls = getConfigurationManager()
+.getConfigParameterDeclarations(getQualifiedContextName());
+
+if (paramDecls == null) {
   return Constants.EMPTY_STRING_ARRAY;
-} else {
-  String[] names = new String[params.length];
-  for (int i = 0; i < params.length; i++) {
-names[i] = params[i].getName();
-  }
-  return names;
 }
+
+ConfigurationParameter[] params = paramDecls.getConfigurationParameters();
+if (params == null || params.length == 0) {
+  return Constants.EMPTY_STRING_ARRAY;
+}
+
+return 
Arrays.stream(params).map(ConfigurationParameter::getName).toArray(String[]::new);
   }
 
   /*
@@ -658,15 +661,17 @@ public abstract class UimaContext_ImplBase implements 
UimaContextAdmin {
 String absoluteSofaName = null;
 if (index < 0) {
   absoluteSofaName = mSofaMappings.get(nameToMap);
-  if (absoluteSofaName == null)
+  if (absoluteSofaName == null) {
 absoluteSofaName = nameToMap;
+  }
 
 } else {
   nameToMap = aSofaName.substring(0, index);
   String rest = aSofaName.substring(index);
   String absoluteRoot = mSofaMappings.get(nameToMap);
-  if (absoluteRoot == null)
+  if (absoluteRoot == null) {
 absoluteRoot = nameToMap;
+  }
   absoluteSofaName = absoluteRoot + rest;
 }
 SofaID sofaid = new SofaID_impl();
@@ -684,8 +689,9 @@ public abstract class UimaContext_ImplBase implements 
UimaContextAdmin {
 String componentSofaName = aSofaID;
 SofaID[] sofaArr = getSofaMappings();
 for (int i = 0; i < sofaArr.length; i++) {
-  if (aSofaID.equals(sofaArr[i].getSofaID()))
+  if (aSofaID.equals(sofaArr[i].getSofaID())) {
 return sofaArr[i].getComponentSofaName();
+  }
 }
 return componentSofaName;
   }
@@ -852,14 +858,16 @@ public abstract class UimaContext_ImplBase implements 
UimaContextAdmin {
   String absoluteSofaName = null;
   if (index < 0) {
 absoluteSofaName = mSofaMappings.get(nameToMap);
-if (absoluteSofaName == null)
+if (absoluteSofaName == null) {
   absoluteSofaName = nameToMap;
+}
   } else {
 nameToMap = aSofaName.substring(0, index);
 String rest = aSofaName.substring(index);
 String absoluteRoot = mSofaMappings.get(nameToMap);
-if (absoluteRoot == null)
+if (absoluteRoot == null) {
   absoluteRoot = nameToMap;
+}
 absoluteSofaName = absoluteRoot + rest;
   }
   return absoluteSofaName;
diff --git 
a/uimaj-core/src/main/java/org/apache/uima/resource/ConfigurationManager.java 
b/uimaj-core/src/main/java/org/apache/uima/resource/ConfigurationManager.java
index 6e242e2..ad61d8a 100644
--- 
a/uimaj-core/src/main/java/org/apache/uima/resource/ConfigurationManager.java
+++ 
b/uimaj-core/src/main/java/org/apache/uima/resource/ConfigurationManager.java
@@ -146,7 +146,7 @@ public interface ConfigurationManager {
  

[uima-uimaj] 02/02: Merge branch 'bugfix/UIMA-6390-NPE-when-trying-to-access-config-names-of-fresh-context' into bugfix/UIMA-6390-NPE-when-trying-to-access-config-names-of-fresh-context-main

2021-10-22 Thread rec
This is an automated email from the ASF dual-hosted git repository.

rec pushed a commit to branch 
bugfix/UIMA-6390-NPE-when-trying-to-access-config-names-of-fresh-context-main
in repository https://gitbox.apache.org/repos/asf/uima-uimaj.git

commit 11f2861d956bd9378f66c3e56e21cef286fc443a
Merge: d1ff8b3 c1b1682
Author: Richard Eckart de Castilho 
AuthorDate: Fri Oct 22 11:36:16 2021 +0200

Merge branch 
'bugfix/UIMA-6390-NPE-when-trying-to-access-config-names-of-fresh-context' into 
bugfix/UIMA-6390-NPE-when-trying-to-access-config-names-of-fresh-context-main

* bugfix/UIMA-6390-NPE-when-trying-to-access-config-names-of-fresh-context:
  [UIMA-6390] NPE when trying to access config names of fresh context
  [UIMA-6390] NPE when trying to access config names of fresh context

% Conflicts:
%   uimaj-core/src/main/java/org/apache/uima/impl/UimaContext_ImplBase.java
%   uimaj-core/src/test/java/org/apache/uima/impl/UimaContext_implTest.java

 .../org/apache/uima/impl/UimaContext_ImplBase.java | 42 --
 .../org/apache/uima/impl/UimaContext_implTest.java |  1 +
 2 files changed, 24 insertions(+), 19 deletions(-)

diff --cc 
uimaj-core/src/main/java/org/apache/uima/impl/UimaContext_ImplBase.java
index af2fdfc,3f214ca..f1faadf
--- a/uimaj-core/src/main/java/org/apache/uima/impl/UimaContext_ImplBase.java
+++ b/uimaj-core/src/main/java/org/apache/uima/impl/UimaContext_ImplBase.java
@@@ -602,30 -595,34 +602,34 @@@ public abstract class UimaContext_ImplB
 */
@Override
public String[] getConfigParameterNames(String aGroup) {
- ConfigurationGroup[] groups = getConfigurationManager()
- .getConfigParameterDeclarations(getQualifiedContextName())
- .getConfigurationGroupDeclarations(aGroup);
+ ConfigurationParameterDeclarations paramDecls = getConfigurationManager()
+ .getConfigParameterDeclarations(getQualifiedContextName());
+ 
+ if (paramDecls == null) {
+   return Constants.EMPTY_STRING_ARRAY;
+ }
+ 
+ ConfigurationGroup[] groups = 
paramDecls.getConfigurationGroupDeclarations(aGroup);
  if (groups.length == 0) {
return Constants.EMPTY_STRING_ARRAY;
- } else {
-   List names = new ArrayList<>();
-   ConfigurationParameter[] commonParams = getConfigurationManager()
-   
.getConfigParameterDeclarations(getQualifiedContextName()).getCommonParameters();
-   if (commonParams != null) {
- for (int i = 0; i < commonParams.length; i++) {
-   names.add(commonParams[i].getName());
- }
+ }
+ 
 -  List names = new ArrayList<>();
++List names = new ArrayList<>();
+ ConfigurationParameter[] commonParams = paramDecls.getCommonParameters();
 -  if (commonParams != null) {
 -for (int i = 0; i < commonParams.length; i++) {
 -  names.add(commonParams[i].getName());
 -}
++if (commonParams != null) {
++  for (int i = 0; i < commonParams.length; i++) {
++names.add(commonParams[i].getName());
}
-   for (int i = 0; i < groups.length; i++) {
- ConfigurationParameter[] groupParams = 
groups[i].getConfigurationParameters();
- for (int j = 0; j < groupParams.length; j++) {
-   names.add(groupParams[j].getName());
- }
++}
+ 
 -  for (int i = 0; i < groups.length; i++) {
 -ConfigurationParameter[] groupParams = 
groups[i].getConfigurationParameters();
 -for (int j = 0; j < groupParams.length; j++) {
 -  names.add(groupParams[j].getName());
 -}
++for (int i = 0; i < groups.length; i++) {
++  ConfigurationParameter[] groupParams = 
groups[i].getConfigurationParameters();
++  for (int j = 0; j < groupParams.length; j++) {
++names.add(groupParams[j].getName());
}
-   String[] nameArray = new String[names.size()];
-   names.toArray(nameArray);
-   return nameArray;
 +}
+ 
+ return names.toArray(new String[names.size()]);
}
  
/**
diff --cc 
uimaj-core/src/test/java/org/apache/uima/impl/UimaContext_implTest.java
index b567cbd,a384983..a85c31b
--- a/uimaj-core/src/test/java/org/apache/uima/impl/UimaContext_implTest.java
+++ b/uimaj-core/src/test/java/org/apache/uima/impl/UimaContext_implTest.java
@@@ -301,9 -305,9 +301,10 @@@ public class UimaContext_implTest 
  UIMAFramework.newDefaultResourceManager(), 
UIMAFramework.newConfigurationManager());
  
  assertThat(emptyContext.getConfigParameterNames()).isEmpty();
+ assertThat(emptyContext.getConfigParameterNames("blah")).isEmpty();
}
  
 +  @Test
public void testGetConfigParameterNamesString() {
  String[] names = mContext2.getConfigParameterNames("en");
  Assert.assertEquals(4, names.length);


[uima-uimaj] branch bugfix/UIMA-6390-NPE-when-trying-to-access-config-names-of-fresh-context-main updated (11f2861 -> 2939f15)

2021-10-22 Thread rec
This is an automated email from the ASF dual-hosted git repository.

rec pushed a change to branch 
bugfix/UIMA-6390-NPE-when-trying-to-access-config-names-of-fresh-context-main
in repository https://gitbox.apache.org/repos/asf/uima-uimaj.git.


from 11f2861  Merge branch 
'bugfix/UIMA-6390-NPE-when-trying-to-access-config-names-of-fresh-context' into 
bugfix/UIMA-6390-NPE-when-trying-to-access-config-names-of-fresh-context-main
 add 4aa843b  [UIMA-6390] NPE when trying to access config names of fresh 
context
 add 2939f15  Merge branch 
'bugfix/UIMA-6390-NPE-when-trying-to-access-config-names-of-fresh-context' into 
bugfix/UIMA-6390-NPE-when-trying-to-access-config-names-of-fresh-context-main

No new revisions were added by this update.

Summary of changes:
 .../org/apache/uima/impl/UimaContext_ImplBase.java | 26 --
 .../org/apache/uima/impl/UimaContext_implTest.java |  9 
 2 files changed, 23 insertions(+), 12 deletions(-)


[uima-uimaj] branch bugfix/UIMA-6390-NPE-when-trying-to-access-config-names-of-fresh-context created (now d1ff8b3)

2021-10-22 Thread rec
This is an automated email from the ASF dual-hosted git repository.

rec pushed a change to branch 
bugfix/UIMA-6390-NPE-when-trying-to-access-config-names-of-fresh-context
in repository https://gitbox.apache.org/repos/asf/uima-uimaj.git.


  at d1ff8b3  [UIMA-6390] NPE when trying to access config names of fresh 
context

This branch includes the following new commits:

 new d1ff8b3  [UIMA-6390] NPE when trying to access config names of fresh 
context

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[uima-uimaj] 01/01: [UIMA-6390] NPE when trying to access config names of fresh context

2021-10-22 Thread rec
This is an automated email from the ASF dual-hosted git repository.

rec pushed a commit to branch 
bugfix/UIMA-6390-NPE-when-trying-to-access-config-names-of-fresh-context
in repository https://gitbox.apache.org/repos/asf/uima-uimaj.git

commit d1ff8b3fa9a0671c50c19a0f77068dd412579487
Author: Richard Eckart de Castilho 
AuthorDate: Fri Oct 22 11:07:52 2021 +0200

[UIMA-6390] NPE when trying to access config names of fresh context

- Add test
- Fix NPE when no parameter declarations have been made for a context
---
 .../org/apache/uima/impl/UimaContext_ImplBase.java | 36 +-
 .../apache/uima/resource/ConfigurationManager.java |  2 +-
 .../org/apache/uima/impl/UimaContext_implTest.java |  9 ++
 3 files changed, 32 insertions(+), 15 deletions(-)

diff --git 
a/uimaj-core/src/main/java/org/apache/uima/impl/UimaContext_ImplBase.java 
b/uimaj-core/src/main/java/org/apache/uima/impl/UimaContext_ImplBase.java
index 8c9d74c..af2fdfc 100644
--- a/uimaj-core/src/main/java/org/apache/uima/impl/UimaContext_ImplBase.java
+++ b/uimaj-core/src/main/java/org/apache/uima/impl/UimaContext_ImplBase.java
@@ -56,6 +56,7 @@ import 
org.apache.uima.resource.ResourceConfigurationException;
 import org.apache.uima.resource.ResourceInitializationException;
 import org.apache.uima.resource.metadata.ConfigurationGroup;
 import org.apache.uima.resource.metadata.ConfigurationParameter;
+import org.apache.uima.resource.metadata.ConfigurationParameterDeclarations;
 import org.apache.uima.util.Level;
 import org.apache.uima.util.Logger;
 import org.apache.uima.util.Settings;
@@ -579,17 +580,19 @@ public abstract class UimaContext_ImplBase implements 
UimaContextAdmin {
*/
   @Override
   public String[] getConfigParameterNames() {
-ConfigurationParameter[] params = getConfigurationManager()
-
.getConfigParameterDeclarations(getQualifiedContextName()).getConfigurationParameters();
-if (params == null) {
+ConfigurationParameterDeclarations paramDecls = getConfigurationManager()
+.getConfigParameterDeclarations(getQualifiedContextName());
+
+if (paramDecls == null) {
   return Constants.EMPTY_STRING_ARRAY;
-} else {
-  String[] names = new String[params.length];
-  for (int i = 0; i < params.length; i++) {
-names[i] = params[i].getName();
-  }
-  return names;
 }
+
+ConfigurationParameter[] params = paramDecls.getConfigurationParameters();
+if (params == null || params.length == 0) {
+  return Constants.EMPTY_STRING_ARRAY;
+}
+
+return 
Arrays.stream(params).map(ConfigurationParameter::getName).toArray(String[]::new);
   }
 
   /*
@@ -658,15 +661,17 @@ public abstract class UimaContext_ImplBase implements 
UimaContextAdmin {
 String absoluteSofaName = null;
 if (index < 0) {
   absoluteSofaName = mSofaMappings.get(nameToMap);
-  if (absoluteSofaName == null)
+  if (absoluteSofaName == null) {
 absoluteSofaName = nameToMap;
+  }
 
 } else {
   nameToMap = aSofaName.substring(0, index);
   String rest = aSofaName.substring(index);
   String absoluteRoot = mSofaMappings.get(nameToMap);
-  if (absoluteRoot == null)
+  if (absoluteRoot == null) {
 absoluteRoot = nameToMap;
+  }
   absoluteSofaName = absoluteRoot + rest;
 }
 SofaID sofaid = new SofaID_impl();
@@ -684,8 +689,9 @@ public abstract class UimaContext_ImplBase implements 
UimaContextAdmin {
 String componentSofaName = aSofaID;
 SofaID[] sofaArr = getSofaMappings();
 for (int i = 0; i < sofaArr.length; i++) {
-  if (aSofaID.equals(sofaArr[i].getSofaID()))
+  if (aSofaID.equals(sofaArr[i].getSofaID())) {
 return sofaArr[i].getComponentSofaName();
+  }
 }
 return componentSofaName;
   }
@@ -852,14 +858,16 @@ public abstract class UimaContext_ImplBase implements 
UimaContextAdmin {
   String absoluteSofaName = null;
   if (index < 0) {
 absoluteSofaName = mSofaMappings.get(nameToMap);
-if (absoluteSofaName == null)
+if (absoluteSofaName == null) {
   absoluteSofaName = nameToMap;
+}
   } else {
 nameToMap = aSofaName.substring(0, index);
 String rest = aSofaName.substring(index);
 String absoluteRoot = mSofaMappings.get(nameToMap);
-if (absoluteRoot == null)
+if (absoluteRoot == null) {
   absoluteRoot = nameToMap;
+}
 absoluteSofaName = absoluteRoot + rest;
   }
   return absoluteSofaName;
diff --git 
a/uimaj-core/src/main/java/org/apache/uima/resource/ConfigurationManager.java 
b/uimaj-core/src/main/java/org/apache/uima/resource/ConfigurationManager.java
index 6e242e2..ad61d8a 100644
--- 
a/uimaj-core/src/main/java/org/apache/uima/resource/ConfigurationManager.java
+++ 
b/uimaj-core/src/main/java/org/apache/uima/resource/ConfigurationManager.java
@@ -146,7 +146,7 @@ public interface ConfigurationManager {
* 

[uima-uimaj] branch bugfix/UIMA-6390-NPE-when-trying-to-access-config-names-of-fresh-context updated (112c5d2 -> c1b1682)

2021-10-22 Thread rec
This is an automated email from the ASF dual-hosted git repository.

rec pushed a change to branch 
bugfix/UIMA-6390-NPE-when-trying-to-access-config-names-of-fresh-context
in repository https://gitbox.apache.org/repos/asf/uima-uimaj.git.


from 112c5d2  [UIMA-6390] NPE when trying to access config names of fresh 
context
 add c1b1682  [UIMA-6390] NPE when trying to access config names of fresh 
context

No new revisions were added by this update.

Summary of changes:
 uimaj-core/src/main/java/org/apache/uima/impl/UimaContext_ImplBase.java | 1 +
 1 file changed, 1 insertion(+)


[uima-uimaj] 01/01: Merge pull request #153 from apache/bugfix/UIMA-6390-NPE-when-trying-to-access-config-names-of-fresh-context-main

2021-10-22 Thread rec
This is an automated email from the ASF dual-hosted git repository.

rec pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/uima-uimaj.git

commit 84b8dcf22ff02c0082d14fba4a31e438f6d5967a
Merge: 2e6aeb0 2939f15
Author: Richard Eckart de Castilho 
AuthorDate: Fri Oct 22 13:20:17 2021 +0200

Merge pull request #153 from 
apache/bugfix/UIMA-6390-NPE-when-trying-to-access-config-names-of-fresh-context-main

[UIMA-6390] NPE when trying to access config names of fresh context @ main

 .../org/apache/uima/impl/UimaContext_ImplBase.java | 100 -
 .../apache/uima/resource/ConfigurationManager.java |   2 +-
 .../org/apache/uima/impl/UimaContext_implTest.java |  19 
 3 files changed, 77 insertions(+), 44 deletions(-)


[uima-uimaj] branch main updated (2e6aeb0 -> 84b8dcf)

2021-10-22 Thread rec
This is an automated email from the ASF dual-hosted git repository.

rec pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/uima-uimaj.git.


from 2e6aeb0  Merge pull request #151 from 
apache/bugfix/UIMA-6389-Logger_common_impl-swallows-exception
 add d1ff8b3  [UIMA-6390] NPE when trying to access config names of fresh 
context
 add adec365  Merge pull request #150 from 
apache/bugfix/UIMA-6389-Logger_common_impl-swallows-exception
 add 112c5d2  [UIMA-6390] NPE when trying to access config names of fresh 
context
 add c1b1682  [UIMA-6390] NPE when trying to access config names of fresh 
context
 add 11f2861  Merge branch 
'bugfix/UIMA-6390-NPE-when-trying-to-access-config-names-of-fresh-context' into 
bugfix/UIMA-6390-NPE-when-trying-to-access-config-names-of-fresh-context-main
 add 4aa843b  [UIMA-6390] NPE when trying to access config names of fresh 
context
 add 2939f15  Merge branch 
'bugfix/UIMA-6390-NPE-when-trying-to-access-config-names-of-fresh-context' into 
bugfix/UIMA-6390-NPE-when-trying-to-access-config-names-of-fresh-context-main
 new 84b8dcf  Merge pull request #153 from 
apache/bugfix/UIMA-6390-NPE-when-trying-to-access-config-names-of-fresh-context-main

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../org/apache/uima/impl/UimaContext_ImplBase.java | 100 -
 .../apache/uima/resource/ConfigurationManager.java |   2 +-
 .../org/apache/uima/impl/UimaContext_implTest.java |  19 
 3 files changed, 77 insertions(+), 44 deletions(-)