This is an automated email from the ASF dual-hosted git repository.
garydgregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-text.git
The following commit(s) were added to refs/heads/master by this push:
new 225f7468 Bump github/codeql-action from 4.36.0 to 4.36.2
225f7468 is described below
commit 225f74680554b1e36008312a18aaa3bdb0b5ae07
Author: Gary Gregory <[email protected]>
AuthorDate: Fri Jun 5 07:29:00 2026 -0400
Bump github/codeql-action from 4.36.0 to 4.36.2
---
.github/workflows/codeql-analysis.yml | 6 ++--
.github/workflows/scorecards-analysis.yml | 2 +-
.../commons/text/lookup/FunctionStringLookup.java | 4 +--
.../text/lookup/FunctionStringLookupTest.java | 36 ++++++++++++++++++++++
4 files changed, 42 insertions(+), 6 deletions(-)
diff --git a/.github/workflows/codeql-analysis.yml
b/.github/workflows/codeql-analysis.yml
index a8afcbfb..4e69d194 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -58,7 +58,7 @@ jobs:
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
- uses: github/codeql-action/init@7211b7c8077ea37d8641b6271f6a365a22a5fbfa
# v4.36.0
+ uses: github/codeql-action/init@8aad20d150bbac5944a9f9d289da16a4b0d87c1e
# v4.36.2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a
config file.
@@ -69,7 +69,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually
(see below)
- name: Autobuild
- uses:
github/codeql-action/autobuild@7211b7c8077ea37d8641b6271f6a365a22a5fbfa #
v4.36.0
+ uses:
github/codeql-action/autobuild@8aad20d150bbac5944a9f9d289da16a4b0d87c1e #
v4.36.2
# âšī¸ Command-line programs to run using the OS shell.
# đ https://git.io/JvXDl
@@ -83,4 +83,4 @@ jobs:
# make release
- name: Perform CodeQL Analysis
- uses:
github/codeql-action/analyze@7211b7c8077ea37d8641b6271f6a365a22a5fbfa # v4.36.0
+ uses:
github/codeql-action/analyze@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4.36.2
diff --git a/.github/workflows/scorecards-analysis.yml
b/.github/workflows/scorecards-analysis.yml
index c756d386..d540a9f0 100644
--- a/.github/workflows/scorecards-analysis.yml
+++ b/.github/workflows/scorecards-analysis.yml
@@ -64,6 +64,6 @@ jobs:
retention-days: 5
- name: "Upload to code-scanning"
- uses:
github/codeql-action/upload-sarif@7211b7c8077ea37d8641b6271f6a365a22a5fbfa #
v4.36.0
+ uses:
github/codeql-action/upload-sarif@8aad20d150bbac5944a9f9d289da16a4b0d87c1e #
v4.36.2
with:
sarif_file: results.sarif
diff --git
a/src/main/java/org/apache/commons/text/lookup/FunctionStringLookup.java
b/src/main/java/org/apache/commons/text/lookup/FunctionStringLookup.java
index 07df1489..daee9bca 100644
--- a/src/main/java/org/apache/commons/text/lookup/FunctionStringLookup.java
+++ b/src/main/java/org/apache/commons/text/lookup/FunctionStringLookup.java
@@ -87,8 +87,8 @@ final class FunctionStringLookup<V> extends
AbstractStringLookup {
try {
obj = function.apply(key);
} catch (final SecurityException | NullPointerException |
IllegalArgumentException e) {
- // Squelched. All lookup(String) will return null.
- // Could be a ConcurrentHashMap and a null key request
+ // All lookup(String) will return null.
+ // NullPointerException: Could be a ConcurrentHashMap and a null
key request.
return null;
}
return Objects.toString(obj, null);
diff --git
a/src/test/java/org/apache/commons/text/lookup/FunctionStringLookupTest.java
b/src/test/java/org/apache/commons/text/lookup/FunctionStringLookupTest.java
index 92ff7ac3..acfd2f20 100644
--- a/src/test/java/org/apache/commons/text/lookup/FunctionStringLookupTest.java
+++ b/src/test/java/org/apache/commons/text/lookup/FunctionStringLookupTest.java
@@ -20,11 +20,13 @@ package org.apache.commons.text.lookup;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;
+import java.util.function.Supplier;
import org.junit.jupiter.api.Test;
@@ -57,10 +59,44 @@ class FunctionStringLookupTest {
assertEquals(value, FunctionStringLookup.on(map).apply(key));
}
+ @Test
+ void testThrowsError() {
+ assertThrows(Error.class, () -> FunctionStringLookup.on(k ->
throwError(Error::new)).apply("key"));
+ }
+
+ @Test
+ void testThrowsIllegalStateException() {
+ assertThrows(IllegalStateException.class, () ->
FunctionStringLookup.on(k ->
throwRuntimeException(IllegalStateException::new)).apply("key"));
+ }
+
+ @Test
+ void testThrowsNullPointerException() {
+ assertNull(FunctionStringLookup.on(k ->
throwRuntimeException(NullPointerException::new)).apply("key"));
+ }
+
+ @Test
+ void testThrowsRuntimeException() {
+ assertThrows(RuntimeException.class, () -> FunctionStringLookup.on(k
-> throwRuntimeException(RuntimeException::new)).apply("key"));
+ }
+
+ @Test
+ void testThrowsSecurityException() {
+ assertNull(FunctionStringLookup.on(k -> {
+ throw new SecurityException("test");
+ }).apply("key"));
+ }
+
@Test
void testToString() {
// does not blow up and gives some kind of string.
assertFalse(FunctionStringLookup.on(new
HashMap<>()).toString().isEmpty());
}
+ <T extends Error> Object throwError(final Supplier<T> t) throws T {
+ throw t.get();
+ }
+
+ <T extends RuntimeException> Object throwRuntimeException(final
Supplier<T> t) throws T {
+ throw t.get();
+ }
}