You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2025/08/29 14:03:46 UTC
(commons-lang) branch master updated (230611601 -> 8dc245796)
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git
from 230611601 Add MethodUtilsTest tests
new f6817da36 Better comment
new 7de27aa9a Merge branch 'master' of https://garydgregory@github.com/apache/commons-lang.git
new 9edbeb438 Better test fixtures
new 8dc245796 Bump org.apache.commons:commons-parent from 85 to 87
The 4 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:
pom.xml | 2 +-
src/changes/changes.xml | 1 +
src/conf/spotbugs-exclude-filter.xml | 11 ++++--
.../apache/commons/lang3/time/DateUtilsTest.java | 44 +++++++++++-----------
4 files changed, 33 insertions(+), 25 deletions(-)
(commons-lang) 04/04: Bump org.apache.commons:commons-parent from 85 to 87
Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git
commit 8dc2457962d12ad978539ab3938e3a5883807bc4
Author: Gary D. Gregory <ga...@gmail.com>
AuthorDate: Fri Aug 29 10:03:41 2025 -0400
Bump org.apache.commons:commons-parent from 85 to 87
---
pom.xml | 2 +-
src/changes/changes.xml | 1 +
src/conf/spotbugs-exclude-filter.xml | 7 ++++++-
3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index d3b782b41..aa5363766 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.commons</groupId>
<artifactId>commons-parent</artifactId>
- <version>85</version>
+ <version>87</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>commons-lang3</artifactId>
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 62ae8631f..ea332d6d3 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -73,6 +73,7 @@ The <action> type attribute can be add,update,fix,remove.
<action type="add" dev="ggregory" due-to="Gary Gregory">Add org.apache.commons.lang3.time.DateUtils.toZonedDateTime(Date[, TimeZone]).</action>
<!-- UPDATE -->
<action type="update" dev="ggregory" due-to="Gary Gregory">[test] Bump org.apache.commons:commons-text from 1.13.1 to 1.14.0.</action>
+ <action type="update" dev="ggregory" due-to="Gary Gregory">Bump org.apache.commons:commons-parent from 85 to 87.</action>
</release>
<release version="3.18.0" date="2025-07-06" description="This is a feature and maintenance release. Java 8 or later is required.">
<!-- FIX -->
diff --git a/src/conf/spotbugs-exclude-filter.xml b/src/conf/spotbugs-exclude-filter.xml
index ecad3e0e3..3017d6308 100644
--- a/src/conf/spotbugs-exclude-filter.xml
+++ b/src/conf/spotbugs-exclude-filter.xml
@@ -130,13 +130,18 @@
<Method name="createNumber"/>
<Bug pattern="SF_SWITCH_FALLTHROUGH" />
</Match>
-
<!-- Reason: Intended -->
<Match>
<Class name="org.apache.commons.lang3.time.DateUtils" />
<Method name="getFragment"/>
<Bug pattern="SF_SWITCH_FALLTHROUGH" />
</Match>
+ <!-- Reason: False positive -->
+ <Match>
+ <Class name="org.apache.commons.lang3.text.ExtendedMessageFormat" />
+ <Method name="applyPattern"/>
+ <Bug pattern="SF_SWITCH_FALLTHROUGH" />
+ </Match>
<!-- Reason: toProperString is lazily loaded -->
<Match>
(commons-lang) 01/04: Better comment
Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git
commit f6817da36af6cf114b4cb5648af2c299301e3644
Author: Gary D. Gregory <ga...@gmail.com>
AuthorDate: Thu Aug 28 08:54:44 2025 -0400
Better comment
---
src/conf/spotbugs-exclude-filter.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/conf/spotbugs-exclude-filter.xml b/src/conf/spotbugs-exclude-filter.xml
index f6fea2c74..ecad3e0e3 100644
--- a/src/conf/spotbugs-exclude-filter.xml
+++ b/src/conf/spotbugs-exclude-filter.xml
@@ -124,14 +124,14 @@
<Bug pattern="ES_COMPARING_PARAMETER_STRING_WITH_EQ" />
</Match>
- <!-- Reason: Very much intended to do a fall through on the switch -->
+ <!-- Reason: Intended -->
<Match>
<Class name="org.apache.commons.lang3.math.NumberUtils" />
<Method name="createNumber"/>
<Bug pattern="SF_SWITCH_FALLTHROUGH" />
</Match>
- <!-- Reason: Very much intended to do a fall through on the switch -->
+ <!-- Reason: Intended -->
<Match>
<Class name="org.apache.commons.lang3.time.DateUtils" />
<Method name="getFragment"/>
(commons-lang) 02/04: Merge branch 'master' of https://garydgregory@github.com/apache/commons-lang.git
Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git
commit 7de27aa9ab457b5f1c2c6a5bb695e268d95c6a64
Merge: f6817da36 230611601
Author: Gary D. Gregory <ga...@gmail.com>
AuthorDate: Fri Aug 29 07:56:41 2025 -0400
Merge branch 'master' of https://garydgregory@github.com/apache/commons-lang.git
.../commons/lang3/reflect/MethodUtilsTest.java | 345 ++++++++++++---------
1 file changed, 192 insertions(+), 153 deletions(-)
(commons-lang) 03/04: Better test fixtures
Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git
commit 9edbeb438afa918510f8949bdec66aa75bef8296
Author: Gary D. Gregory <ga...@gmail.com>
AuthorDate: Fri Aug 29 10:02:35 2025 -0400
Better test fixtures
Seems failing locally, sometimes, and on GH CI, sometimes
---
.../apache/commons/lang3/time/DateUtilsTest.java | 44 +++++++++++-----------
1 file changed, 23 insertions(+), 21 deletions(-)
diff --git a/src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java b/src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java
index 379f4918b..5dac35777 100644
--- a/src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java
@@ -66,6 +66,7 @@
@WritesDefaultLocale
class DateUtilsTest extends AbstractLangTest {
+ private static final TimeZone TIME_ZONE_NY = TimeZone.getTimeZone("America/New_York");
private static final TimeZone TIME_ZONE_DEFAULT = TimeZone.getDefault();
private static final TimeZone TIME_ZONE_MET = TimeZone.getTimeZone("MET");
private static Date BASE_DATE;
@@ -139,44 +140,51 @@ public static void classSetup() {
private static Stream<Arguments> testToLocalDateTimeTimeZone() {
// @formatter:off
return Stream.of(
+ // [1]
Arguments.of(
// -292275055-05-16T16:47:04.192
LocalDateTime.of(-292275055, 5, 16, 16, 47, 04, 192_000_000),
new Date(Long.MIN_VALUE),
TimeZones.GMT
),
+ // [2]
Arguments.of(
// +292278994-08-17T07:12:55.807
LocalDateTime.of(292278994, 8, 17, 7, 12, 55, 807_000_000),
new Date(Long.MAX_VALUE),
TimeZones.GMT
),
+ // [3]
Arguments.of(
LocalDateTime.ofInstant(Instant.EPOCH, TimeZones.GMT.toZoneId()),
- java.sql.Timestamp.valueOf("1970-01-01 00:00:00"),
+ Date.from(LocalDateTime.of(1970, 1, 1, 0, 0).atOffset(ZoneOffset.UTC).toInstant()),
TimeZones.GMT
),
+ // [4]
Arguments.of(
LocalDateTime.ofInstant(Instant.EPOCH.minus(1, ChronoUnit.DAYS), TimeZones.GMT.toZoneId()),
- java.sql.Timestamp.valueOf("1969-12-31 00:00:00"),
+ Date.from(LocalDateTime.of(1969, 12, 31, 0, 0).atOffset(ZoneOffset.UTC).toInstant()),
TimeZones.GMT
),
+ // [5]
Arguments.of(
LocalDateTime.ofInstant(
java.sql.Timestamp.valueOf("2000-01-01 12:30:45").toInstant(),
- TimeZone.getTimeZone("America/New_York").toZoneId()
+ TIME_ZONE_NY.toZoneId()
),
java.sql.Timestamp.valueOf("2000-01-01 12:30:45"),
- TimeZone.getTimeZone("America/New_York")
+ TIME_ZONE_NY
),
+ // [6]
Arguments.of(
LocalDateTime.ofInstant(
java.sql.Timestamp.valueOf("2023-03-12 02:30:00").toInstant(),
- TimeZone.getTimeZone("America/New_York").toZoneId()
+ TIME_ZONE_NY.toZoneId()
),
java.sql.Timestamp.valueOf("2023-03-12 02:30:00"),
- TimeZone.getTimeZone("America/New_York")
+ TIME_ZONE_NY
),
+ // [7]
Arguments.of(
LocalDateTime.ofInstant(
java.sql.Timestamp.valueOf("2023-03-12 02:30:00").toInstant(),
@@ -185,25 +193,22 @@ private static Stream<Arguments> testToLocalDateTimeTimeZone() {
java.sql.Timestamp.valueOf("2023-03-12 02:30:00"),
null
),
+ // [8]
Arguments.of(
LocalDateTime.of(2022, 12, 31, 19, 0),
- Date.from(LocalDateTime.of(2023, 1, 1, 0, 0)
- .atOffset(ZoneOffset.UTC)
- .toInstant()),
- TimeZone.getTimeZone("America/New_York")
+ Date.from(LocalDateTime.of(2023, 1, 1, 0, 0).atOffset(ZoneOffset.UTC).toInstant()),
+ TIME_ZONE_NY
),
+ // [9]
Arguments.of(
LocalDateTime.of(2023, 3, 12, 3, 0),
- Date.from(LocalDateTime.of(2023, 3, 12, 7, 0)
- .atOffset(ZoneOffset.UTC)
- .toInstant()),
- TimeZone.getTimeZone("America/New_York")
+ Date.from(LocalDateTime.of(2023, 3, 12, 7, 0).atOffset(ZoneOffset.UTC).toInstant()),
+ TIME_ZONE_NY
),
+ // [10]
Arguments.of(
LocalDateTime.of(2023, 1, 1, 14, 0),
- Date.from(LocalDateTime.of(2023, 1, 1, 0, 0)
- .atOffset(ZoneOffset.UTC)
- .toInstant()),
+ Date.from(LocalDateTime.of(2023, 1, 1, 0, 0).atOffset(ZoneOffset.UTC).toInstant()),
TimeZone.getTimeZone("Pacific/Kiritimati")
)
);
@@ -211,11 +216,8 @@ private static Stream<Arguments> testToLocalDateTimeTimeZone() {
}
private DateFormat dateParser;
-
private DateFormat dateTimeParser;
-
private Date dateAmPm1;
-
private Date dateAmPm2;
private Date dateAmPm3;
private Date dateAmPm4;
@@ -240,6 +242,7 @@ private static Stream<Arguments> testToLocalDateTimeTimeZone() {
private Calendar cal6;
private Calendar cal7;
private Calendar cal8;
+
@AfterEach
public void afterEachResetTimeZones() {
TimeZone.setDefault(TIME_ZONE_DEFAULT);
@@ -260,7 +263,6 @@ private void assertDate(final Date date, final int year, final int month, final
public void setUp() throws Exception {
dateParser = new SimpleDateFormat("MMM dd, yyyy", Locale.ENGLISH);
dateTimeParser = new SimpleDateFormat("MMM dd, yyyy H:mm:ss.SSS", Locale.ENGLISH);
-
dateAmPm1 = dateTimeParser.parse("February 3, 2002 01:10:00.000");
dateAmPm2 = dateTimeParser.parse("February 3, 2002 11:10:00.000");
dateAmPm3 = dateTimeParser.parse("February 3, 2002 13:10:00.000");